[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 | // |
---|
| 26 | // $Id: G4EnergyLossForExtrapolator.hh,v 1.9 2007/07/28 13:44:25 vnivanch Exp $ |
---|
| 27 | // GEANT4 tag $Name: $ |
---|
| 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, |
---|
| 83 | const G4Material*, const G4ParticleDefinition*); |
---|
| 84 | |
---|
| 85 | inline G4double EnergyAfterStep(G4double kinEnergy, G4double step, |
---|
| 86 | const G4Material*, const G4String& particleName); |
---|
| 87 | |
---|
| 88 | inline G4double EnergyBeforeStep(G4double kinEnergy, G4double step, |
---|
| 89 | const G4Material*, const G4String& particleName); |
---|
| 90 | |
---|
| 91 | inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step, |
---|
| 92 | const G4Material*, const G4ParticleDefinition* part); |
---|
| 93 | |
---|
| 94 | inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step, |
---|
| 95 | const G4Material*, const G4String& particleName); |
---|
| 96 | |
---|
| 97 | inline G4double EnergyDispersion(G4double kinEnergy, G4double step, |
---|
| 98 | const G4Material*, const G4ParticleDefinition*); |
---|
| 99 | |
---|
| 100 | inline G4double EnergyDispersion(G4double kinEnergy, G4double step, |
---|
| 101 | const G4Material*, const G4String& particleName); |
---|
| 102 | |
---|
| 103 | inline void SetVerbose(G4int val); |
---|
| 104 | |
---|
| 105 | inline void SetMinKinEnergy(G4double); |
---|
| 106 | |
---|
| 107 | inline void SetMaxKinEnergy(G4double); |
---|
| 108 | |
---|
| 109 | inline void SetMaxEnergyTransfer(G4double); |
---|
| 110 | |
---|
| 111 | private: |
---|
| 112 | |
---|
| 113 | void Initialisation(); |
---|
| 114 | |
---|
| 115 | G4PhysicsTable* PrepareTable(); |
---|
| 116 | |
---|
| 117 | const G4ParticleDefinition* FindParticle(const G4String& name); |
---|
| 118 | |
---|
| 119 | void ComputeElectronDEDX(const G4ParticleDefinition* part, G4PhysicsTable* table); |
---|
| 120 | |
---|
| 121 | void ComputeMuonDEDX(const G4ParticleDefinition* part, G4PhysicsTable* table); |
---|
| 122 | |
---|
| 123 | void ComputeProtonDEDX(const G4ParticleDefinition* part, G4PhysicsTable* table); |
---|
| 124 | |
---|
| 125 | G4double ComputeTrueStep(const G4Material*, const G4ParticleDefinition* part, |
---|
| 126 | G4double kinEnergy, G4double stepLength); |
---|
| 127 | |
---|
| 128 | inline G4double ComputeValue(G4double x, const G4PhysicsTable* table); |
---|
| 129 | |
---|
| 130 | inline G4double ComputeScatteringAngle(G4double x); |
---|
| 131 | |
---|
| 132 | // hide assignment operator |
---|
| 133 | G4EnergyLossForExtrapolator & operator=(const G4EnergyLossForExtrapolator &right); |
---|
| 134 | G4EnergyLossForExtrapolator(const G4EnergyLossForExtrapolator&); |
---|
| 135 | |
---|
| 136 | const G4ParticleDefinition* currentParticle; |
---|
| 137 | const G4ParticleDefinition* electron; |
---|
| 138 | const G4ParticleDefinition* positron; |
---|
| 139 | const G4ParticleDefinition* muonPlus; |
---|
| 140 | const G4ParticleDefinition* muonMinus; |
---|
| 141 | const G4ParticleDefinition* proton; |
---|
| 142 | |
---|
| 143 | G4ProductionCuts* cuts; |
---|
| 144 | std::vector<const G4MaterialCutsCouple*> couples; |
---|
| 145 | |
---|
| 146 | G4String currentParticleName; |
---|
| 147 | |
---|
| 148 | G4PhysicsTable* dedxElectron; |
---|
| 149 | G4PhysicsTable* dedxPositron; |
---|
| 150 | G4PhysicsTable* dedxMuon; |
---|
| 151 | G4PhysicsTable* dedxProton; |
---|
| 152 | G4PhysicsTable* rangeElectron; |
---|
| 153 | G4PhysicsTable* rangePositron; |
---|
| 154 | G4PhysicsTable* rangeMuon; |
---|
| 155 | G4PhysicsTable* rangeProton; |
---|
| 156 | G4PhysicsTable* invRangeElectron; |
---|
| 157 | G4PhysicsTable* invRangePositron; |
---|
| 158 | G4PhysicsTable* invRangeMuon; |
---|
| 159 | G4PhysicsTable* invRangeProton; |
---|
| 160 | |
---|
| 161 | const G4Material* currentMaterial; |
---|
| 162 | G4int index; |
---|
| 163 | G4double electronDensity; |
---|
| 164 | G4double radLength; |
---|
| 165 | G4double mass; |
---|
| 166 | G4double charge2; |
---|
| 167 | G4double kineticEnergy; |
---|
| 168 | G4double gam; |
---|
| 169 | G4double bg2; |
---|
| 170 | G4double beta2; |
---|
| 171 | G4double tmax; |
---|
| 172 | |
---|
| 173 | G4double linLossLimit; |
---|
| 174 | G4double emin; |
---|
| 175 | G4double emax; |
---|
| 176 | G4double maxEnergyTransfer; |
---|
| 177 | |
---|
| 178 | G4int nbins; |
---|
| 179 | G4int nmat; |
---|
| 180 | G4int verbose; |
---|
| 181 | G4bool isInitialised; |
---|
| 182 | }; |
---|
| 183 | |
---|
| 184 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 185 | |
---|
| 186 | inline G4double G4EnergyLossForExtrapolator::EnergyAfterStep(G4double kinEnergy, |
---|
| 187 | G4double step, |
---|
| 188 | const G4Material* mat, |
---|
| 189 | const G4String& name) |
---|
| 190 | { |
---|
| 191 | return EnergyAfterStep(kinEnergy,step,mat,FindParticle(name)); |
---|
| 192 | } |
---|
| 193 | |
---|
| 194 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 195 | |
---|
| 196 | inline G4double G4EnergyLossForExtrapolator::EnergyBeforeStep(G4double kinEnergy, |
---|
| 197 | G4double step, |
---|
| 198 | const G4Material* mat, |
---|
| 199 | const G4String& name) |
---|
| 200 | { |
---|
| 201 | return EnergyBeforeStep(kinEnergy,step,mat,FindParticle(name)); |
---|
| 202 | } |
---|
| 203 | |
---|
| 204 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 205 | |
---|
| 206 | inline G4double G4EnergyLossForExtrapolator::AverageScatteringAngle(G4double kinEnergy, |
---|
| 207 | G4double step, |
---|
| 208 | const G4Material* mat, |
---|
| 209 | const G4String& name) |
---|
| 210 | { |
---|
| 211 | return AverageScatteringAngle(kinEnergy,step,mat,FindParticle(name)); |
---|
| 212 | } |
---|
| 213 | |
---|
| 214 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 215 | |
---|
| 216 | inline G4double G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy, |
---|
| 217 | G4double step, |
---|
| 218 | const G4Material* mat, |
---|
| 219 | const G4String& name) |
---|
| 220 | { |
---|
| 221 | return EnergyDispersion(kinEnergy,step,mat,FindParticle(name)); |
---|
| 222 | } |
---|
| 223 | |
---|
| 224 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 225 | |
---|
| 226 | inline G4double G4EnergyLossForExtrapolator::AverageScatteringAngle(G4double kinEnergy, |
---|
| 227 | G4double stepLength, |
---|
| 228 | const G4Material* mat, |
---|
| 229 | const G4ParticleDefinition* part) |
---|
| 230 | { |
---|
| 231 | if(!isInitialised) Initialisation(); |
---|
| 232 | G4double theta = 0.0; |
---|
| 233 | if(mat && part && kinEnergy > 0.0) { |
---|
| 234 | G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength); |
---|
| 235 | if(step > 0.001*radLength) theta = ComputeScatteringAngle(stepLength); |
---|
| 236 | } |
---|
| 237 | return theta; |
---|
| 238 | } |
---|
| 239 | |
---|
| 240 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 241 | |
---|
| 242 | inline G4double G4EnergyLossForExtrapolator::ComputeScatteringAngle(G4double x) |
---|
| 243 | { |
---|
| 244 | G4double t = x/radLength; |
---|
| 245 | return 19.23*MeV*std::sqrt(charge2*t)*(1.0 + 0.038*std::log(t))/(beta2*gam*mass); |
---|
| 246 | } |
---|
| 247 | |
---|
| 248 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 249 | |
---|
| 250 | inline G4double G4EnergyLossForExtrapolator::EnergyDispersion( |
---|
| 251 | G4double kinEnergy, |
---|
| 252 | G4double stepLength, |
---|
| 253 | const G4Material* mat, |
---|
| 254 | const G4ParticleDefinition* part) |
---|
| 255 | { |
---|
| 256 | if(!isInitialised) Initialisation(); |
---|
| 257 | G4double sig2 = 0.0; |
---|
| 258 | if(mat && part ) { |
---|
| 259 | G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength); |
---|
| 260 | sig2 = (1.0/beta2 - 0.5)* twopi_mc2_rcl2 * tmax*step * electronDensity * charge2; |
---|
| 261 | } |
---|
| 262 | return sig2; |
---|
| 263 | } |
---|
| 264 | |
---|
| 265 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 266 | |
---|
| 267 | inline G4double G4EnergyLossForExtrapolator::ComputeValue(G4double x, |
---|
| 268 | const G4PhysicsTable* table) |
---|
| 269 | { |
---|
| 270 | G4double res = 0.0; |
---|
| 271 | bool b; |
---|
| 272 | res = ((*table)[index])->GetValue(x, b); |
---|
| 273 | return res; |
---|
| 274 | } |
---|
| 275 | |
---|
| 276 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 277 | |
---|
| 278 | inline void G4EnergyLossForExtrapolator::SetVerbose(G4int val) |
---|
| 279 | { |
---|
| 280 | verbose = val; |
---|
| 281 | } |
---|
| 282 | |
---|
| 283 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 284 | |
---|
| 285 | inline void G4EnergyLossForExtrapolator::SetMinKinEnergy(G4double val) |
---|
| 286 | { |
---|
| 287 | emin = val; |
---|
| 288 | } |
---|
| 289 | |
---|
| 290 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 291 | |
---|
| 292 | inline void G4EnergyLossForExtrapolator::SetMaxKinEnergy(G4double val) |
---|
| 293 | { |
---|
| 294 | emax = val; |
---|
| 295 | } |
---|
| 296 | |
---|
| 297 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 298 | |
---|
| 299 | inline void G4EnergyLossForExtrapolator::SetMaxEnergyTransfer(G4double val) |
---|
| 300 | { |
---|
| 301 | maxEnergyTransfer = val; |
---|
| 302 | } |
---|
| 303 | |
---|
| 304 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 305 | |
---|
| 306 | #endif |
---|
| 307 | |
---|