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 // >> 23 // $Id: G4EnergyLossForExtrapolator.hh,v 1.2 2005/12/13 08:44:04 gunter Exp $ >> 24 // GEANT4 tag $Name: geant4-08-00-patch-01 $ 26 // 25 // 27 //-------------------------------------------- 26 //--------------------------------------------------------------------------- 28 // 27 // 29 // ClassName: G4EnergyLossForExtrapolator 28 // ClassName: G4EnergyLossForExtrapolator 30 // 29 // 31 // Description: This class provide calculatio 30 // Description: This class provide calculation of energy loss, fluctuation, 32 // and msc angle 31 // and msc angle 33 // 32 // 34 // Author: 09.12.04 V.Ivanchenko 33 // Author: 09.12.04 V.Ivanchenko 35 // 34 // 36 // Modification: 35 // Modification: 37 // 08-04-05 Rename Propogator -> Extrapolator 36 // 08-04-05 Rename Propogator -> Extrapolator 38 // 16-03-06 Add muon tables << 39 // 21-03-06 Add verbosity defined in the const << 40 // start only when first public metho << 41 // 03-05-06 Remove unused pointer G4Material* << 42 // 28-07-07 Add maxEnergyTransfer for computat << 43 // 37 // 44 //-------------------------------------------- 38 //---------------------------------------------------------------------------- 45 // 39 // 46 40 47 //....oooOO0OOooo........oooOO0OOooo........oo 41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 48 42 49 #ifndef G4EnergyLossForExtrapolator_h 43 #ifndef G4EnergyLossForExtrapolator_h 50 #define G4EnergyLossForExtrapolator_h 1 44 #define G4EnergyLossForExtrapolator_h 1 51 45 52 #include <vector> << 53 #include <CLHEP/Units/PhysicalConstants.h> << 54 46 55 #include "globals.hh" 47 #include "globals.hh" 56 #include "G4PhysicsTable.hh" << 48 #include <vector> 57 #include "G4TablesForExtrapolator.hh" << 58 #include "G4Log.hh" << 59 #include "G4Threading.hh" << 60 49 >> 50 class G4PhysicsTable; 61 class G4ParticleDefinition; 51 class G4ParticleDefinition; 62 class G4Material; 52 class G4Material; 63 class G4MaterialCutsCouple; 53 class G4MaterialCutsCouple; >> 54 class G4ProductionCuts; 64 55 65 //....oooOO0OOooo........oooOO0OOooo........oo 56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 66 57 67 class G4EnergyLossForExtrapolator 58 class G4EnergyLossForExtrapolator 68 { 59 { 69 public: 60 public: 70 << 61 G4EnergyLossForExtrapolator(); 71 explicit G4EnergyLossForExtrapolator(G4int v << 72 << 73 ~G4EnergyLossForExtrapolator(); 62 ~G4EnergyLossForExtrapolator(); 74 63 75 void Initialisation(); << 64 G4double EnergyAfterStep(G4double kinEnergy, G4double step, 76 << 65 const G4Material*, const G4ParticleDefinition* part); 77 G4double ComputeDEDX(G4double kinEnergy, con << 78 const G4Material*); << 79 << 80 G4double ComputeRange(G4double kinEnergy, co << 81 const G4Material*); << 82 << 83 G4double ComputeEnergy(G4double range, const << 84 const G4Material*); << 85 66 86 G4double EnergyAfterStep(G4double kinEnergy, 67 G4double EnergyAfterStep(G4double kinEnergy, G4double step, 87 const G4Material*, const G4ParticleDe << 68 const G4Material*, const G4String& particleName); 88 69 89 G4double EnergyBeforeStep(G4double kinEnergy 70 G4double EnergyBeforeStep(G4double kinEnergy, G4double step, 90 const G4Material*, const G4Par << 71 const G4Material*, const G4ParticleDefinition* part); 91 << 92 G4double TrueStepLength(G4double kinEnergy, << 93 const G4Material*, const G4ParticleDef << 94 72 95 inline G4double EnergyAfterStep(G4double kin << 73 G4double EnergyBeforeStep(G4double kinEnergy, G4double step, 96 const G4Material*, << 74 const G4Material*, const G4String& particleName); 97 const G4Stri << 98 << 99 inline G4double EnergyBeforeStep(G4double ki << 100 const G4Material*, << 101 const G4Str << 102 75 103 G4double AverageScatteringAngle(G4double kin 76 G4double AverageScatteringAngle(G4double kinEnergy, G4double step, 104 const G4Material*, << 77 const G4Material*, const G4ParticleDefinition* part); 105 const G4ParticleDefinition* part); << 106 78 107 inline G4double AverageScatteringAngle(G4dou << 79 G4double AverageScatteringAngle(G4double kinEnergy, G4double step, 108 const G4Material*, << 80 const G4Material*, const G4String& particleName); 109 const G4String& particleName); << 110 << 111 inline G4double ComputeTrueStep(const G4Mate << 112 const G4ParticleDefinition* part, << 113 G4double kinEnergy, G4double stepLen << 114 81 115 G4double EnergyDispersion(G4double kinEnergy 82 G4double EnergyDispersion(G4double kinEnergy, G4double step, 116 const G4Material*, << 83 const G4Material*, const G4ParticleDefinition* part); 117 const G4ParticleDefinition*); << 118 << 119 inline G4double EnergyDispersion(G4double ki << 120 const G4Material*, << 121 const G4Str << 122 84 123 inline void SetVerbose(G4int val); << 85 G4double EnergyDispertion(G4double kinEnergy, G4double step, >> 86 const G4Material*, const G4String& particleName); 124 87 125 inline void SetMinKinEnergy(G4double); << 88 G4double ComputeDEDX(G4double kinEnergy, const G4Material*, const G4ParticleDefinition* part); 126 89 127 inline void SetMaxKinEnergy(G4double); << 90 G4double ComputeRange(G4double kinEnergy, const G4Material*, const G4ParticleDefinition* part); 128 91 129 inline void SetMaxEnergyTransfer(G4double); << 92 G4double ComputeEnergy(G4double range, const G4Material*, const G4ParticleDefinition* part); 130 93 131 // hide assignment operator << 94 void SetVerbose(G4int val) {verbose = val;}; 132 G4EnergyLossForExtrapolator & operator= << 133 (const G4EnergyLossForExtrapolator &right) = << 134 G4EnergyLossForExtrapolator(const G4EnergyLo << 135 95 136 private: 96 private: 137 97 138 G4bool SetupKinematics(const G4ParticleDefin << 98 void Initialisation(); 139 G4double kinEnergy); << 99 >> 100 G4PhysicsTable* PrepareTable(); 140 101 141 const G4ParticleDefinition* FindParticle(con 102 const G4ParticleDefinition* FindParticle(const G4String& name); 142 103 143 inline G4double ComputeValue(G4double x, con << 104 G4double ComputeValue(G4double x, const G4Material* mat, const G4PhysicsTable* table); 144 size_t idxMat); << 145 105 146 inline const G4PhysicsTable* GetPhysicsTable << 106 void ComputeElectronDEDX(const G4ParticleDefinition* part, G4PhysicsTable* table); 147 107 148 #ifdef G4MULTITHREADED << 108 void ComputeProtonDEDX(const G4ParticleDefinition* part, G4PhysicsTable* table); 149 static G4Mutex extrMutex; << 150 #endif << 151 static G4TablesForExtrapolator* tables; << 152 << 153 const G4ParticleDefinition* currentParticle << 154 const G4ParticleDefinition* electron = nullp << 155 const G4ParticleDefinition* positron = nullp << 156 const G4ParticleDefinition* muonPlus = nullp << 157 const G4ParticleDefinition* muonMinus= nullp << 158 const G4ParticleDefinition* proton = nullptr << 159 const G4Material* currentMaterial = nullptr; << 160 << 161 G4double electronDensity = 0.0; << 162 G4double radLength = 0.0; << 163 G4double charge2 = 0.0; << 164 G4double kineticEnergy = 0.0; << 165 G4double gam = 1.0; << 166 G4double bg2 = 0.0; << 167 G4double beta2 = 0.0; << 168 G4double tmax = 0.0; << 169 << 170 G4double linLossLimit = 0.01; << 171 G4double emin = 0.0; << 172 G4double emax = 0.0; << 173 G4double maxEnergyTransfer = 0.0; << 174 << 175 size_t index = 0; << 176 size_t nmat = 0; << 177 G4int nbins = 80; << 178 G4int verbose = 0; << 179 109 180 G4bool isMaster = false; << 110 const G4ParticleDefinition* currentParticle; >> 111 const G4ParticleDefinition* electron; >> 112 const G4ParticleDefinition* positron; >> 113 const G4ParticleDefinition* proton; >> 114 >> 115 G4ProductionCuts* cuts; >> 116 std::vector<const G4MaterialCutsCouple*> couples; >> 117 >> 118 G4String currentParticleName; >> 119 >> 120 G4PhysicsTable* dedxElectron; >> 121 G4PhysicsTable* dedxPositron; >> 122 G4PhysicsTable* dedxProton; >> 123 G4PhysicsTable* rangeElectron; >> 124 G4PhysicsTable* rangePositron; >> 125 G4PhysicsTable* rangeProton; >> 126 G4PhysicsTable* invRangeElectron; >> 127 G4PhysicsTable* invRangePositron; >> 128 G4PhysicsTable* invRangeProton; >> 129 >> 130 G4double linLossLimit; >> 131 G4double emin; >> 132 G4double emax; >> 133 G4int nbins; >> 134 G4int nmat; >> 135 G4int verbose; 181 }; 136 }; 182 137 183 //....oooOO0OOooo........oooOO0OOooo........oo 138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 184 139 185 inline const G4PhysicsTable* << 140 inline G4double G4EnergyLossForExtrapolator::EnergyAfterStep(G4double kinEnergy, 186 G4EnergyLossForExtrapolator::GetPhysicsTable(E << 141 G4double step, 187 { << 142 const G4Material* mat, 188 return tables->GetPhysicsTable(type); << 143 const G4String& name) 189 } << 190 << 191 //....oooOO0OOooo........oooOO0OOooo........oo << 192 << 193 inline G4double << 194 G4EnergyLossForExtrapolator::EnergyAfterStep(G << 195 G4double step, << 196 const G4Material* mat, << 197 const G4String& name) << 198 { 144 { 199 return EnergyAfterStep(kinEnergy,step,mat,Fi 145 return EnergyAfterStep(kinEnergy,step,mat,FindParticle(name)); 200 } 146 } 201 147 202 //....oooOO0OOooo........oooOO0OOooo........oo 148 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 203 149 204 inline G4double << 150 inline G4double G4EnergyLossForExtrapolator::EnergyBeforeStep(G4double kinEnergy, 205 G4EnergyLossForExtrapolator::EnergyBeforeStep( << 151 G4double step, 206 G4double step, << 152 const G4Material* mat, 207 const G4Material* mat, << 153 const G4String& name) 208 const G4String& name) << 209 { 154 { 210 return EnergyBeforeStep(kinEnergy,step,mat,F 155 return EnergyBeforeStep(kinEnergy,step,mat,FindParticle(name)); 211 } 156 } 212 157 213 //....oooOO0OOooo........oooOO0OOooo........oo 158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 214 159 215 inline G4double << 160 inline G4double G4EnergyLossForExtrapolator::AverageScatteringAngle(G4double kinEnergy, 216 G4EnergyLossForExtrapolator::AverageScattering << 161 G4double step, 217 G4double step, << 162 const G4Material* mat, 218 const G4Material* mat, << 163 const G4String& name) 219 const G4String& name) << 220 { 164 { 221 return AverageScatteringAngle(kinEnergy,step 165 return AverageScatteringAngle(kinEnergy,step,mat,FindParticle(name)); 222 } 166 } 223 167 224 //....oooOO0OOooo........oooOO0OOooo........oo 168 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 225 169 226 inline G4double << 170 inline G4double G4EnergyLossForExtrapolator::EnergyDispertion(G4double kinEnergy, 227 G4EnergyLossForExtrapolator::EnergyDispersion( << 171 G4double step, 228 G4double step, << 172 const G4Material* mat, 229 const G4Material* mat, << 173 const G4String& name) 230 const G4String& name) << 231 { 174 { 232 return EnergyDispersion(kinEnergy,step,mat,F 175 return EnergyDispersion(kinEnergy,step,mat,FindParticle(name)); 233 } << 234 << 235 //....oooOO0OOooo........oooOO0OOooo........oo << 236 << 237 inline G4double << 238 G4EnergyLossForExtrapolator::ComputeTrueStep(c << 239 const G4ParticleDefinition* par << 240 G4double kinEnergy, << 241 G4double stepLength) << 242 { << 243 G4double theta = AverageScatteringAngle(kinE << 244 return stepLength*std::sqrt(1.0 + 0.625*thet << 245 } << 246 << 247 //....oooOO0OOooo........oooOO0OOooo........oo << 248 << 249 inline G4double << 250 G4EnergyLossForExtrapolator::ComputeValue(G4do << 251 const G4PhysicsTable* table, << 252 size_t idxMat) << 253 { << 254 return (nullptr != table) ? ((*table)[idxMat << 255 } << 256 << 257 //....oooOO0OOooo........oooOO0OOooo........oo << 258 << 259 inline void G4EnergyLossForExtrapolator::SetVe << 260 { << 261 verbose = val; << 262 } << 263 << 264 //....oooOO0OOooo........oooOO0OOooo........oo << 265 << 266 inline void G4EnergyLossForExtrapolator::SetMi << 267 { << 268 emin = val; << 269 } << 270 << 271 //....oooOO0OOooo........oooOO0OOooo........oo << 272 << 273 inline void G4EnergyLossForExtrapolator::SetMa << 274 { << 275 emax = val; << 276 } << 277 << 278 //....oooOO0OOooo........oooOO0OOooo........oo << 279 << 280 inline void G4EnergyLossForExtrapolator::SetMa << 281 { << 282 maxEnergyTransfer = val; << 283 } 176 } 284 177 285 //....oooOO0OOooo........oooOO0OOooo........oo 178 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 286 179 287 #endif 180 #endif 288 181 289 182