Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // G4ParticleWithCuts << 27 // 23 // 28 // Dummy class for G4ParticleDefinition << 24 // $Id: G4ParticleWithCuts.hh,v 1.14 2001/10/30 20:08:46 kurasige Exp $ >> 25 // GEANT4 tag $Name: geant4-04-00 $ >> 26 // >> 27 // >> 28 // ------------------------------------------------------------ >> 29 // GEANT 4 class header file >> 30 // >> 31 // History: >> 32 // first implementation, based on object model of Hisaya Kurashige, >> 33 // 21 Oct 1996 >> 34 // calculation of Range Table is based on implementeation for Muon >> 35 // by L.Urban, 10 May 1996 >> 36 // added RestoreCuts H.Kurashige 09 Mar. 2001 >> 37 // introduced material dependent range cuts 08 Sep. 2001 >> 38 // ---------------------------------------------------------------- >> 39 // Class Description >> 40 // "theCutInMaxInteractionLength", for charged particles, is >> 41 // coincident with a cut in stopping range; for neutral >> 42 // particles it corresponds to the distance allowed by >> 43 // the total cross section. >> 44 // "theKineticEnergyCuts" is the vector of cuts in kinetic >> 45 // energy (a value per material); it is allocated/computed >> 46 // in the specific SetCuts method. >> 47 // void SetCuts(G4double aCut): >> 48 // Sets the cuts values relative to this particle type in stopping >> 49 // range (or absorption length) and converts those cuts into energy cuts >> 50 // for all the materials defined in the Material table. >> 51 // It also triggers the recomputation of the physics tables of the >> 52 // void SetRangeCut(G4double aCut, const G4Material*): >> 53 // Set a cut value in range for the specified material and converts >> 54 // it into an energy cut. >> 55 // void ReCalcCuts(): >> 56 // Re calculate energy cut values with the previous cut value in range >> 57 // void ResetCuts(): >> 58 // Reset alll cut values in energy, though theCutInMaxInteractionLength >> 59 // remains unchanged >> 60 // const G4double* GetLengthCuts(): >> 61 // Returns an array of cuts in range (ordered per material) >> 62 // G4double GetRangeThreshold(const G4Material* ) const: >> 63 // Returns a range cut for a material >> 64 // const G4double* GetEnergyCuts(): >> 65 // Returns an array of energy cuts (ordered per material) >> 66 // G4double GetEnergyThreshold(const G4Material* ) const: >> 67 // Returns a energy cut for a material >> 68 // 29 69 30 // Author: H.Kurashige, 9 March 2001 << 31 // ------------------------------------------- << 32 #ifndef G4ParticleWithCuts_h 70 #ifndef G4ParticleWithCuts_h 33 #define G4ParticleWithCuts_h 1 71 #define G4ParticleWithCuts_h 1 34 72 >> 73 #include "globals.hh" >> 74 #include "g4std/vector" >> 75 #include "G4ios.hh" 35 #include "G4ParticleDefinition.hh" 76 #include "G4ParticleDefinition.hh" 36 77 37 using G4ParticleWithCuts = G4ParticleDefinitio << 78 #include "G4PhysicsTable.hh" >> 79 #include "G4Element.hh" >> 80 #include "G4Material.hh" >> 81 class G4PhysicsLogVector; >> 82 >> 83 >> 84 class G4ParticleWithCuts : public G4ParticleDefinition >> 85 { >> 86 public: >> 87 G4ParticleWithCuts(const G4String& aName, >> 88 G4double mass, >> 89 G4double width, >> 90 G4double charge, >> 91 G4int iSpin, >> 92 G4int iParity, >> 93 G4int iConjugation, >> 94 G4int iIsospin, >> 95 G4int iIsospinZ, >> 96 G4int gParity, >> 97 const G4String& pType, >> 98 G4int lepton, >> 99 G4int baryon, >> 100 G4int encoding, >> 101 G4bool stable, >> 102 G4double lifetime, >> 103 G4DecayTable *decaytable, >> 104 G4bool resonance = false); >> 105 virtual ~G4ParticleWithCuts(); >> 106 >> 107 //--------------for SetCuts------------------------------------------- >> 108 protected: >> 109 G4double* theCutInMaxInteractionLength; >> 110 G4double* theKineticEnergyCuts; >> 111 >> 112 public: // With Description >> 113 // G4ParticleWithCuts >> 114 // virtual methods derived from G4ParticleDefinition >> 115 >> 116 // Set Cuts methods >> 117 virtual void SetCuts(G4double aCut); >> 118 // Set the range of aCut for all materials >> 119 virtual void SetRangeCut(G4double aCut, const G4Material*); >> 120 // Set the cut range of aCut for a material >> 121 virtual void SetRangeCutVector(G4std::vector<G4double>&); >> 122 // Set the vector of range cuts for all material >> 123 >> 124 // Get cuts methods >> 125 virtual G4double* GetLengthCuts() const; >> 126 // Get an array of range cuts for all materials >> 127 virtual G4double GetRangeThreshold(const G4Material* ) const; >> 128 // Get a range cut for a material >> 129 virtual G4double* GetEnergyCuts() const; >> 130 // Get an array of energy cuts for all materials >> 131 virtual G4double GetEnergyThreshold(const G4Material* ) const; >> 132 // Get a energy cut for a material >> 133 >> 134 // Other methods related with cuts >> 135 virtual void ResetCuts(); >> 136 // Reset alll cut values in energy >> 137 // but theCutInMaxInteractionLength remain unchanged >> 138 virtual void ReCalcCuts(); >> 139 // Set cut values in energy derived from theCutInMaxInteractionLength >> 140 >> 141 // set energy range >> 142 static void SetEnergyRange(G4double lowedge, G4double highedge) ; >> 143 >> 144 public: // With Description >> 145 // This method concerning cut values is supposed to be used by >> 146 // G4VUserPhysicsList to restore cutvalues witout calculation >> 147 >> 148 virtual void RestoreCuts(const G4double* cutInLength, >> 149 const G4double* cutInEnergy ); >> 150 >> 151 protected: >> 152 void SetCutInMaxInteractionLength(G4double aCut); >> 153 // Set a value of theCutInMaxInteractionLength for all materials >> 154 void SetCutInMaxInteractionLength(G4double aCut , G4int matrialIndex); >> 155 // Set a value of theCutInMaxInteractionLength for a material >> 156 void SetCutInMaxInteractionLength(G4double aCut , >> 157 const G4Material* aMaterial); >> 158 // Set a value of theCutInMaxInteractionLength for a material >> 159 void SetEnergyCutValues(G4double energyCuts); >> 160 // Set a energy cut value for all materials >> 161 >> 162 virtual void CalcEnergyCuts(const G4Material* material=0); >> 163 // Calculate energy cut values by using range cuts >> 164 >> 165 // BuildPhysicsTable is defined as a dummy routine >> 166 void BuildPhysicsTable() {}; >> 167 >> 168 protected: >> 169 // cut values for proton is used for all heavy charged particles >> 170 static G4ParticleDefinition* theProton; >> 171 G4bool UseProtonCut(); >> 172 >> 173 G4bool CheckEnergyBinSetting() const; >> 174 >> 175 //-------------- Loss Table ------------------------------------------ >> 176 // theLossTable is a collection of loss vectors for all elements. >> 177 // Each loss vector has energy loss values (cross section values >> 178 // for neutral particles) which are calculated by >> 179 // ComputeLoss(G4double AtomicNumber,G4double KineticEnergy). >> 180 >> 181 protected: >> 182 typedef G4PhysicsTable G4LossTable; >> 183 G4LossTable* theLossTable; >> 184 G4int NumberOfElements; >> 185 >> 186 typedef G4PhysicsLogVector G4LossVector; >> 187 static G4double LowestEnergy, HighestEnergy; >> 188 G4int TotBin; >> 189 >> 190 protected: >> 191 virtual void BuildLossTable(); >> 192 virtual G4double ComputeLoss(G4double AtomicNumber, >> 193 G4double KineticEnergy >> 194 ) const; >> 195 >> 196 //-------------- Range Table ------------------------------------------ >> 197 protected: >> 198 typedef G4PhysicsLogVector G4RangeVector; >> 199 virtual void BuildRangeVector(const G4Material* aMaterial, >> 200 const G4LossTable* aLossTable, >> 201 G4double maxEnergy, >> 202 G4double aMass, >> 203 G4RangeVector* rangeVector); >> 204 >> 205 protected: >> 206 G4double ConvertCutToKineticEnergy( >> 207 G4RangeVector* theRangeVector, >> 208 size_t materialIndex >> 209 ) const; >> 210 >> 211 static G4double RangeLinSimpson( >> 212 const G4ElementVector* elementVector, >> 213 const G4double* atomicNumDensityVector, >> 214 const G4LossTable* aLossTable, >> 215 G4double aMass, >> 216 G4double taulow, G4double tauhigh, >> 217 G4int nbin, G4int NumEl >> 218 ); >> 219 static G4double RangeLogSimpson( >> 220 const G4ElementVector* elementVector, >> 221 const G4double* atomicNumDensityVector, >> 222 const G4LossTable* aLossTable, >> 223 G4double aMass, >> 224 G4double ltaulow, G4double ltauhigh, >> 225 G4int nbin, G4int NumEl >> 226 ); >> 227 >> 228 }; >> 229 >> 230 inline G4double* G4ParticleWithCuts::GetLengthCuts() const >> 231 { >> 232 return theCutInMaxInteractionLength; >> 233 } >> 234 >> 235 inline G4double* G4ParticleWithCuts::GetEnergyCuts() const >> 236 { >> 237 return theKineticEnergyCuts; >> 238 } >> 239 >> 240 inline void G4ParticleWithCuts::ResetCuts() >> 241 { >> 242 if(theKineticEnergyCuts) delete [] theKineticEnergyCuts; >> 243 theKineticEnergyCuts = 0; >> 244 } >> 245 >> 246 inline void G4ParticleWithCuts::ReCalcCuts() >> 247 { >> 248 if (theCutInMaxInteractionLength != 0) { >> 249 CalcEnergyCuts(); >> 250 } else { >> 251 if (GetVerboseLevel()>0) { >> 252 G4cout << "G4ParticleWithCuts::ReCalcCuts() :"; >> 253 G4cout << "theCutInMaxInteractionLength is not defined " << G4endl; >> 254 } >> 255 } >> 256 } >> 257 >> 258 #include "G4Material.hh" >> 259 >> 260 inline >> 261 G4double G4ParticleWithCuts::GetEnergyThreshold(const G4Material* aMaterial) const >> 262 { >> 263 return theKineticEnergyCuts[aMaterial->GetIndex()]; >> 264 } >> 265 >> 266 inline >> 267 G4double G4ParticleWithCuts::GetRangeThreshold(const G4Material* aMaterial) const >> 268 { >> 269 return theCutInMaxInteractionLength[aMaterial->GetIndex()]; >> 270 } >> 271 38 272 39 #endif 273 #endif >> 274 >> 275 >> 276 >> 277 >> 278 >> 279 >> 280 >> 281 >> 282 40 283