[819] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
[961] | 26 | // $Id: G4EnergyLossForExtrapolator.hh,v 1.12 2008/11/13 14:14:07 vnivanch Exp $ |
---|
[1007] | 27 | // GEANT4 tag $Name: geant4-09-02 $ |
---|
[819] | 28 | // |
---|
| 29 | //--------------------------------------------------------------------------- |
---|
| 30 | // |
---|
| 31 | // ClassName: G4EnergyLossForExtrapolator |
---|
| 32 | // |
---|
| 33 | // Description: This class provide calculation of energy loss, fluctuation, |
---|
| 34 | // and msc angle |
---|
| 35 | // |
---|
| 36 | // Author: 09.12.04 V.Ivanchenko |
---|
| 37 | // |
---|
| 38 | // Modification: |
---|
| 39 | // 08-04-05 Rename Propogator -> Extrapolator |
---|
| 40 | // 16-03-06 Add muon tables |
---|
| 41 | // 21-03-06 Add verbosity defined in the constructor and Initialisation |
---|
| 42 | // start only when first public method is called (V.Ivanchenko) |
---|
| 43 | // 03-05-06 Remove unused pointer G4Material* from number of methods (VI) |
---|
| 44 | // 28-07-07 Add maxEnergyTransfer for computation of energy loss (VI) |
---|
| 45 | // |
---|
| 46 | //---------------------------------------------------------------------------- |
---|
| 47 | // |
---|
| 48 | |
---|
| 49 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 50 | |
---|
| 51 | #ifndef G4EnergyLossForExtrapolator_h |
---|
| 52 | #define G4EnergyLossForExtrapolator_h 1 |
---|
| 53 | |
---|
| 54 | |
---|
| 55 | #include "globals.hh" |
---|
| 56 | #include "G4PhysicsTable.hh" |
---|
| 57 | #include <vector> |
---|
| 58 | |
---|
| 59 | class G4ParticleDefinition; |
---|
| 60 | class G4Material; |
---|
| 61 | class G4MaterialCutsCouple; |
---|
| 62 | class G4ProductionCuts; |
---|
| 63 | |
---|
| 64 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 65 | |
---|
| 66 | class G4EnergyLossForExtrapolator |
---|
| 67 | { |
---|
| 68 | public: |
---|
| 69 | G4EnergyLossForExtrapolator(G4int verb = 1); |
---|
| 70 | |
---|
| 71 | ~G4EnergyLossForExtrapolator(); |
---|
| 72 | |
---|
| 73 | G4double ComputeDEDX(G4double kinEnergy, const G4ParticleDefinition*); |
---|
| 74 | |
---|
| 75 | G4double ComputeRange(G4double kinEnergy, const G4ParticleDefinition*); |
---|
| 76 | |
---|
| 77 | G4double ComputeEnergy(G4double range, const G4ParticleDefinition*); |
---|
| 78 | |
---|
| 79 | G4double EnergyAfterStep(G4double kinEnergy, G4double step, |
---|
| 80 | const G4Material*, const G4ParticleDefinition*); |
---|
| 81 | |
---|
| 82 | G4double EnergyBeforeStep(G4double kinEnergy, G4double step, |
---|
[961] | 83 | const G4Material*, const G4ParticleDefinition*); |
---|
[819] | 84 | |
---|
[961] | 85 | G4double TrueStepLength(G4double kinEnergy, G4double step, |
---|
| 86 | const G4Material*, const G4ParticleDefinition* part); |
---|
| 87 | |
---|
[819] | 88 | inline G4double EnergyAfterStep(G4double kinEnergy, G4double step, |
---|
[961] | 89 | const G4Material*, const G4String& particleName); |
---|
[819] | 90 | |
---|
| 91 | inline G4double EnergyBeforeStep(G4double kinEnergy, G4double step, |
---|
[961] | 92 | const G4Material*, const G4String& particleName); |
---|
[819] | 93 | |
---|
| 94 | inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step, |
---|
[961] | 95 | const G4Material*, |
---|
| 96 | const G4ParticleDefinition* part); |
---|
[819] | 97 | |
---|
| 98 | inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step, |
---|
[961] | 99 | const G4Material*, |
---|
| 100 | const G4String& particleName); |
---|
[819] | 101 | |
---|
[961] | 102 | inline G4double ComputeTrueStep(const G4Material*, const G4ParticleDefinition* part, |
---|
| 103 | G4double kinEnergy, G4double stepLength); |
---|
| 104 | |
---|
[819] | 105 | inline G4double EnergyDispersion(G4double kinEnergy, G4double step, |
---|
[961] | 106 | const G4Material*, const G4ParticleDefinition*); |
---|
[819] | 107 | |
---|
| 108 | inline G4double EnergyDispersion(G4double kinEnergy, G4double step, |
---|
| 109 | const G4Material*, const G4String& particleName); |
---|
| 110 | |
---|
| 111 | inline void SetVerbose(G4int val); |
---|
| 112 | |
---|
| 113 | inline void SetMinKinEnergy(G4double); |
---|
| 114 | |
---|
| 115 | inline void SetMaxKinEnergy(G4double); |
---|
| 116 | |
---|
| 117 | inline void SetMaxEnergyTransfer(G4double); |
---|
| 118 | |
---|
| 119 | private: |
---|
| 120 | |
---|
| 121 | void Initialisation(); |
---|
| 122 | |
---|
[961] | 123 | G4bool SetupKinematics(const G4ParticleDefinition*, const G4Material*, |
---|
| 124 | G4double kinEnergy); |
---|
| 125 | |
---|
[819] | 126 | G4PhysicsTable* PrepareTable(); |
---|
| 127 | |
---|
| 128 | const G4ParticleDefinition* FindParticle(const G4String& name); |
---|
| 129 | |
---|
| 130 | void ComputeElectronDEDX(const G4ParticleDefinition* part, G4PhysicsTable* table); |
---|
| 131 | |
---|
| 132 | void ComputeMuonDEDX(const G4ParticleDefinition* part, G4PhysicsTable* table); |
---|
| 133 | |
---|
| 134 | void ComputeProtonDEDX(const G4ParticleDefinition* part, G4PhysicsTable* table); |
---|
| 135 | |
---|
[961] | 136 | void ComputeTrasportXS(const G4ParticleDefinition* part, G4PhysicsTable* table); |
---|
[819] | 137 | |
---|
| 138 | inline G4double ComputeValue(G4double x, const G4PhysicsTable* table); |
---|
| 139 | |
---|
| 140 | // hide assignment operator |
---|
| 141 | G4EnergyLossForExtrapolator & operator=(const G4EnergyLossForExtrapolator &right); |
---|
| 142 | G4EnergyLossForExtrapolator(const G4EnergyLossForExtrapolator&); |
---|
| 143 | |
---|
| 144 | const G4ParticleDefinition* currentParticle; |
---|
| 145 | const G4ParticleDefinition* electron; |
---|
| 146 | const G4ParticleDefinition* positron; |
---|
| 147 | const G4ParticleDefinition* muonPlus; |
---|
| 148 | const G4ParticleDefinition* muonMinus; |
---|
| 149 | const G4ParticleDefinition* proton; |
---|
| 150 | |
---|
| 151 | G4ProductionCuts* cuts; |
---|
| 152 | std::vector<const G4MaterialCutsCouple*> couples; |
---|
| 153 | |
---|
| 154 | G4String currentParticleName; |
---|
| 155 | |
---|
| 156 | G4PhysicsTable* dedxElectron; |
---|
| 157 | G4PhysicsTable* dedxPositron; |
---|
| 158 | G4PhysicsTable* dedxMuon; |
---|
| 159 | G4PhysicsTable* dedxProton; |
---|
| 160 | G4PhysicsTable* rangeElectron; |
---|
| 161 | G4PhysicsTable* rangePositron; |
---|
| 162 | G4PhysicsTable* rangeMuon; |
---|
| 163 | G4PhysicsTable* rangeProton; |
---|
| 164 | G4PhysicsTable* invRangeElectron; |
---|
| 165 | G4PhysicsTable* invRangePositron; |
---|
| 166 | G4PhysicsTable* invRangeMuon; |
---|
| 167 | G4PhysicsTable* invRangeProton; |
---|
[961] | 168 | G4PhysicsTable* mscElectron; |
---|
[819] | 169 | |
---|
| 170 | const G4Material* currentMaterial; |
---|
| 171 | G4int index; |
---|
| 172 | G4double electronDensity; |
---|
| 173 | G4double radLength; |
---|
| 174 | G4double mass; |
---|
| 175 | G4double charge2; |
---|
| 176 | G4double kineticEnergy; |
---|
| 177 | G4double gam; |
---|
| 178 | G4double bg2; |
---|
| 179 | G4double beta2; |
---|
| 180 | G4double tmax; |
---|
| 181 | |
---|
| 182 | G4double linLossLimit; |
---|
| 183 | G4double emin; |
---|
| 184 | G4double emax; |
---|
| 185 | G4double maxEnergyTransfer; |
---|
| 186 | |
---|
| 187 | G4int nbins; |
---|
| 188 | G4int nmat; |
---|
| 189 | G4int verbose; |
---|
| 190 | G4bool isInitialised; |
---|
| 191 | }; |
---|
| 192 | |
---|
| 193 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 194 | |
---|
| 195 | inline G4double G4EnergyLossForExtrapolator::EnergyAfterStep(G4double kinEnergy, |
---|
| 196 | G4double step, |
---|
| 197 | const G4Material* mat, |
---|
| 198 | const G4String& name) |
---|
| 199 | { |
---|
| 200 | return EnergyAfterStep(kinEnergy,step,mat,FindParticle(name)); |
---|
| 201 | } |
---|
| 202 | |
---|
| 203 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 204 | |
---|
| 205 | inline G4double G4EnergyLossForExtrapolator::EnergyBeforeStep(G4double kinEnergy, |
---|
| 206 | G4double step, |
---|
| 207 | const G4Material* mat, |
---|
| 208 | const G4String& name) |
---|
| 209 | { |
---|
| 210 | return EnergyBeforeStep(kinEnergy,step,mat,FindParticle(name)); |
---|
| 211 | } |
---|
| 212 | |
---|
| 213 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 214 | |
---|
| 215 | inline G4double G4EnergyLossForExtrapolator::AverageScatteringAngle(G4double kinEnergy, |
---|
| 216 | G4double step, |
---|
| 217 | const G4Material* mat, |
---|
| 218 | const G4String& name) |
---|
| 219 | { |
---|
| 220 | return AverageScatteringAngle(kinEnergy,step,mat,FindParticle(name)); |
---|
| 221 | } |
---|
| 222 | |
---|
| 223 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 224 | |
---|
[961] | 225 | inline G4double |
---|
| 226 | G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy, |
---|
| 227 | G4double step, |
---|
| 228 | const G4Material* mat, |
---|
| 229 | const G4String& name) |
---|
[819] | 230 | { |
---|
| 231 | return EnergyDispersion(kinEnergy,step,mat,FindParticle(name)); |
---|
| 232 | } |
---|
| 233 | |
---|
| 234 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 235 | |
---|
[961] | 236 | inline G4double |
---|
| 237 | G4EnergyLossForExtrapolator::AverageScatteringAngle(G4double kinEnergy, |
---|
| 238 | G4double stepLength, |
---|
| 239 | const G4Material* mat, |
---|
| 240 | const G4ParticleDefinition* part) |
---|
[819] | 241 | { |
---|
| 242 | G4double theta = 0.0; |
---|
[961] | 243 | if(SetupKinematics(part, mat, kinEnergy)) { |
---|
| 244 | G4double t = stepLength/radLength; |
---|
| 245 | G4double y = std::max(0.001, t); |
---|
| 246 | theta = 19.23*MeV*std::sqrt(charge2*t)*(1.0 + 0.038*std::log(y))/(beta2*gam*mass); |
---|
[819] | 247 | } |
---|
| 248 | return theta; |
---|
| 249 | } |
---|
| 250 | |
---|
| 251 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 252 | |
---|
[961] | 253 | inline G4double |
---|
| 254 | G4EnergyLossForExtrapolator::ComputeTrueStep(const G4Material* mat, |
---|
| 255 | const G4ParticleDefinition* part, |
---|
| 256 | G4double kinEnergy, |
---|
| 257 | G4double stepLength) |
---|
[819] | 258 | { |
---|
[961] | 259 | G4double theta = AverageScatteringAngle(kinEnergy,stepLength,mat,part); |
---|
| 260 | return stepLength*std::sqrt(1.0 + 0.625*theta*theta); |
---|
| 261 | } |
---|
[819] | 262 | |
---|
| 263 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 264 | |
---|
[961] | 265 | inline |
---|
| 266 | G4double G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy, |
---|
[819] | 267 | G4double stepLength, |
---|
| 268 | const G4Material* mat, |
---|
| 269 | const G4ParticleDefinition* part) |
---|
| 270 | { |
---|
| 271 | G4double sig2 = 0.0; |
---|
[961] | 272 | if(SetupKinematics(part, mat, kinEnergy)) { |
---|
[819] | 273 | G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength); |
---|
[961] | 274 | sig2 = (1.0/beta2 - 0.5)*twopi_mc2_rcl2*tmax*step*electronDensity*charge2; |
---|
[819] | 275 | } |
---|
| 276 | return sig2; |
---|
| 277 | } |
---|
| 278 | |
---|
| 279 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 280 | |
---|
| 281 | inline G4double G4EnergyLossForExtrapolator::ComputeValue(G4double x, |
---|
| 282 | const G4PhysicsTable* table) |
---|
| 283 | { |
---|
| 284 | G4double res = 0.0; |
---|
[961] | 285 | G4bool b; |
---|
| 286 | if(table) res = ((*table)[index])->GetValue(x, b); |
---|
[819] | 287 | return res; |
---|
| 288 | } |
---|
| 289 | |
---|
| 290 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 291 | |
---|
| 292 | inline void G4EnergyLossForExtrapolator::SetVerbose(G4int val) |
---|
| 293 | { |
---|
| 294 | verbose = val; |
---|
| 295 | } |
---|
| 296 | |
---|
| 297 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 298 | |
---|
| 299 | inline void G4EnergyLossForExtrapolator::SetMinKinEnergy(G4double val) |
---|
| 300 | { |
---|
| 301 | emin = val; |
---|
| 302 | } |
---|
| 303 | |
---|
| 304 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 305 | |
---|
| 306 | inline void G4EnergyLossForExtrapolator::SetMaxKinEnergy(G4double val) |
---|
| 307 | { |
---|
| 308 | emax = val; |
---|
| 309 | } |
---|
| 310 | |
---|
| 311 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 312 | |
---|
| 313 | inline void G4EnergyLossForExtrapolator::SetMaxEnergyTransfer(G4double val) |
---|
| 314 | { |
---|
| 315 | maxEnergyTransfer = val; |
---|
| 316 | } |
---|
| 317 | |
---|
| 318 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 319 | |
---|
| 320 | #endif |
---|
| 321 | |
---|