00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // 00030 // ------------------------------------------------------------ 00031 // GEANT 4 class header file 00032 // 00033 // 00034 // Class Description 00035 // This class is base class for Range to Energy Converters. 00036 // Cut in energy corresponding to given cut value in range 00037 // is calculated for a material by using Convert method 00038 // 00039 // ------------------------------------------------------------ 00040 // First Implementation 5 Oct. 2002 H.Kurahige 00041 // ------------------------------------------------------------ 00042 00043 #ifndef G4VRangeToEnergyConverter_h 00044 #define G4VRangeToEnergyConverter_h 1 00045 00046 #include "globals.hh" 00047 #include <cmath> 00048 #include "G4ios.hh" 00049 #include <vector> 00050 00051 #include "G4ParticleDefinition.hh" 00052 00053 #include "G4PhysicsTable.hh" 00054 #include "G4Element.hh" 00055 #include "G4Material.hh" 00056 class G4PhysicsLogVector; 00057 00058 class G4VRangeToEnergyConverter 00059 { 00060 public: // with description 00061 // constructor 00062 G4VRangeToEnergyConverter(); 00063 00064 // copy constructor 00065 G4VRangeToEnergyConverter(const G4VRangeToEnergyConverter &right); 00066 00067 G4VRangeToEnergyConverter & operator=(const G4VRangeToEnergyConverter &right); 00068 00069 public: 00070 // destructor 00071 virtual ~G4VRangeToEnergyConverter(); 00072 00073 // equal opperators 00074 G4int operator==(const G4VRangeToEnergyConverter &right) const; 00075 G4int operator!=(const G4VRangeToEnergyConverter &right) const; 00076 00077 public: // with description 00078 // calculate energy cut from given range cut for the material 00079 virtual G4double Convert(G4double rangeCut, const G4Material* material); 00080 00081 // set energy range for all particle type 00082 static void SetEnergyRange(G4double lowedge, G4double highedge); 00083 00084 // get energy range for all particle type 00085 static G4double GetLowEdgeEnergy(); 00086 static G4double GetHighEdgeEnergy(); 00087 00088 // get/set max cut energy for all particle type 00089 static G4double GetMaxEnergyCut(); 00090 static void SetMaxEnergyCut(G4double value); 00091 00092 // return pointer to the particle type which this converter takes care 00093 const G4ParticleDefinition* GetParticleType() const; 00094 00095 // return the Loss Table 00096 const G4PhysicsTable* GetLossTable() const; 00097 //-------------- Loss Table ------------------------------------------ 00098 // theLossTable is a collection of loss vectors for all elements. 00099 // Each loss vector has energy loss values (cross section values 00100 // for neutral particles) which are calculated by 00101 // ComputeLoss(G4double AtomicNumber,G4double KineticEnergy). 00102 // ComputeLoss method is pure virtual and should be provided for each 00103 // particle type 00104 00105 // reset Loss Table and Range Vectors 00106 virtual void Reset(); 00107 00108 protected: 00109 static G4double LowestEnergy, HighestEnergy; 00110 static G4double MaxEnergyCut; 00111 G4double fMaxEnergyCut; 00112 00113 const G4ParticleDefinition* theParticle; 00114 typedef G4PhysicsTable G4LossTable; 00115 G4LossTable* theLossTable; 00116 G4int NumberOfElements; 00117 00118 typedef G4PhysicsLogVector G4LossVector; 00119 const G4int TotBin; 00120 00121 protected:// with description 00122 virtual void BuildLossTable(); 00123 00124 virtual G4double ComputeLoss(G4double AtomicNumber, 00125 G4double KineticEnergy 00126 ) const = 0; 00127 00128 //-------------- Range Table ------------------------------------------ 00129 protected: 00130 typedef G4PhysicsLogVector G4RangeVector; 00131 00132 virtual void BuildRangeVector(const G4Material* aMaterial, 00133 G4RangeVector* rangeVector); 00134 00135 std::vector< G4RangeVector* > fRangeVectorStore; 00136 00137 protected: 00138 G4double ConvertCutToKineticEnergy( 00139 G4RangeVector* theRangeVector, 00140 G4double theCutInLength, 00141 size_t materialIndex 00142 ) const; 00143 00144 public: // with description 00145 void SetVerboseLevel(G4int value); 00146 G4int GetVerboseLevel() const; 00147 // controle flag for output message 00148 // 0: Silent 00149 // 1: Warning message 00150 // 2: More 00151 00152 private: 00153 G4int verboseLevel; 00154 00155 }; 00156 00157 inline 00158 void G4VRangeToEnergyConverter::SetVerboseLevel(G4int value) 00159 { 00160 verboseLevel = value; 00161 } 00162 00163 inline 00164 G4int G4VRangeToEnergyConverter::GetVerboseLevel() const 00165 { 00166 return verboseLevel; 00167 } 00168 00169 00170 inline 00171 const G4ParticleDefinition* G4VRangeToEnergyConverter::GetParticleType() const 00172 { 00173 return theParticle; 00174 } 00175 #endif 00176 00177 00178 00179 00180 00181 00182 00183