Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // >> 26 // >> 27 // ------------------------------------------------------------------- >> 28 // >> 29 // >> 30 // GEANT4 Class header file >> 31 // >> 32 // 26 // File name: G4UrbanAdjointMscModel 33 // File name: G4UrbanAdjointMscModel 27 // 34 // 28 // Author: Laszlo Urban 35 // Author: Laszlo Urban 29 // 36 // >> 37 // Creation date: 19.02.2013 >> 38 // >> 39 // Created from G4UrbanAdjointMscModel96 >> 40 // >> 41 // New parametrization for theta0 >> 42 // Correction for very small step length >> 43 // 30 // Class Description: 44 // Class Description: 31 // Implementation of the model of multiple s << 45 // 32 // H.W.Lewis Phys Rev 78 (1950) 526 and L.Ur << 46 // Implementation of the model of multiple scattering based on >> 47 // H.W.Lewis Phys Rev 78 (1950) 526 and L.Urban model >> 48 33 // ------------------------------------------- 49 // ------------------------------------------------------------------- >> 50 // 34 51 35 #ifndef G4UrbanAdjointMscModel_h 52 #ifndef G4UrbanAdjointMscModel_h 36 #define G4UrbanAdjointMscModel_h 1 53 #define G4UrbanAdjointMscModel_h 1 37 54 38 #include "G4Electron.hh" << 55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 39 #include "G4Exp.hh" << 56 40 #include "G4Log.hh" << 57 #include <CLHEP/Units/SystemOfUnits.h> 41 #include "G4MscStepLimitType.hh" << 58 42 #include "G4VMscModel.hh" 59 #include "G4VMscModel.hh" >> 60 #include "G4MscStepLimitType.hh" >> 61 #include "G4Log.hh" >> 62 #include "G4Exp.hh" >> 63 #include "G4Electron.hh" >> 64 43 65 44 class G4LossTableManager; << 45 class G4MaterialCutsCouple; << 46 class G4ParticleChangeForMSC; 66 class G4ParticleChangeForMSC; 47 class G4ParticleDefinition; << 48 class G4SafetyHelper; 67 class G4SafetyHelper; >> 68 class G4LossTableManager; 49 69 50 //....oooOO0OOooo........oooOO0OOooo........oo 70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 51 71 52 class G4UrbanAdjointMscModel : public G4VMscMo 72 class G4UrbanAdjointMscModel : public G4VMscModel 53 { 73 { 54 public: << 74 >> 75 public: >> 76 55 explicit G4UrbanAdjointMscModel(const G4Stri 77 explicit G4UrbanAdjointMscModel(const G4String& nam = "UrbanMsc"); 56 78 57 ~G4UrbanAdjointMscModel() override; << 79 virtual ~G4UrbanAdjointMscModel(); 58 80 59 void Initialise(const G4ParticleDefinition*, << 81 virtual void Initialise(const G4ParticleDefinition*, >> 82 const G4DataVector&) override; 60 83 61 void StartTracking(G4Track*) override; << 84 virtual void StartTracking(G4Track*) override; 62 85 63 G4double ComputeCrossSectionPerAtom(const G4 << 86 virtual G4double 64 G4double << 87 ComputeCrossSectionPerAtom(const G4ParticleDefinition* particle, 65 G4double << 88 G4double KineticEnergy, 66 G4double << 89 G4double AtomicNumber, 67 G4double << 90 G4double AtomicWeight=0., 68 G4double << 91 G4double cut =0., >> 92 G4double emax=DBL_MAX) override; 69 93 70 G4ThreeVector& SampleScattering(const G4Thre << 94 virtual G4ThreeVector& SampleScattering(const G4ThreeVector&, 71 G4double saf << 95 G4double safety) override; 72 96 73 G4double ComputeTruePathLengthLimit(const G4 << 97 virtual G4double 74 G4double << 98 ComputeTruePathLengthLimit(const G4Track& track, >> 99 G4double& currentMinimalStep) override; 75 100 76 G4double ComputeGeomPathLength(G4double true << 101 virtual G4double ComputeGeomPathLength(G4double truePathLength) override; 77 102 78 G4double ComputeTrueStepLength(G4double geom << 103 virtual G4double ComputeTrueStepLength(G4double geomStepLength) override; 79 104 80 G4double ComputeTheta0(G4double truePathLeng 105 G4double ComputeTheta0(G4double truePathLength, G4double KineticEnergy); 81 106 82 inline void SetNewDisplacementFlag(G4bool); 107 inline void SetNewDisplacementFlag(G4bool); 83 108 84 G4UrbanAdjointMscModel& operator=(const G4Ur << 109 private: 85 delete; << 86 G4UrbanAdjointMscModel(const G4UrbanAdjointM << 87 110 88 private: << 89 G4double SampleCosineTheta(G4double trueStep 111 G4double SampleCosineTheta(G4double trueStepLength, G4double KineticEnergy); 90 112 91 void SampleDisplacement(G4double sinTheta, G 113 void SampleDisplacement(G4double sinTheta, G4double phi); 92 114 93 void SampleDisplacementNew(G4double sinTheta 115 void SampleDisplacementNew(G4double sinTheta, G4double phi); 94 116 95 inline void SetParticle(const G4ParticleDefi 117 inline void SetParticle(const G4ParticleDefinition*); 96 118 97 inline void UpdateCache(); 119 inline void UpdateCache(); 98 120 99 inline G4double Randomizetlimit(); 121 inline G4double Randomizetlimit(); 100 << 122 101 inline G4double SimpleScattering(G4double xm 123 inline G4double SimpleScattering(G4double xmeanth, G4double x2meanth); 102 124 103 CLHEP::HepRandomEngine* rndmEngineMod; << 125 // hide assignment operator >> 126 G4UrbanAdjointMscModel & operator=(const G4UrbanAdjointMscModel &right) = delete; >> 127 G4UrbanAdjointMscModel(const G4UrbanAdjointMscModel&) = delete; >> 128 >> 129 CLHEP::HepRandomEngine* rndmEngineMod; 104 130 105 const G4ParticleDefinition* particle; 131 const G4ParticleDefinition* particle; 106 const G4ParticleDefinition* positron; 132 const G4ParticleDefinition* positron; 107 G4ParticleChangeForMSC* fParticleChange; << 133 G4ParticleChangeForMSC* fParticleChange; 108 134 109 const G4MaterialCutsCouple* couple; 135 const G4MaterialCutsCouple* couple; 110 G4LossTableManager* theManager; << 136 G4LossTableManager* theManager; 111 137 112 G4double mass; 138 G4double mass; 113 G4double charge, ChargeSquare; << 139 G4double charge,ChargeSquare; 114 G4double masslimite, lambdalimit, fr; << 140 G4double masslimite,lambdalimit,fr; 115 141 116 G4double taubig; 142 G4double taubig; 117 G4double tausmall; 143 G4double tausmall; 118 G4double taulim; 144 G4double taulim; 119 G4double currentTau; 145 G4double currentTau; 120 G4double tlimit; 146 G4double tlimit; 121 G4double tlimitmin; 147 G4double tlimitmin; 122 G4double tlimitminfix, tlimitminfix2; << 148 G4double tlimitminfix,tlimitminfix2; 123 G4double tgeom; 149 G4double tgeom; 124 150 125 G4double geombig; 151 G4double geombig; 126 G4double geommin; 152 G4double geommin; 127 G4double geomlimit; 153 G4double geomlimit; 128 G4double skindepth; 154 G4double skindepth; 129 G4double smallstep; 155 G4double smallstep; 130 156 131 G4double presafety; 157 G4double presafety; 132 158 133 G4double lambda0; 159 G4double lambda0; 134 G4double lambdaeff; 160 G4double lambdaeff; 135 G4double tPathLength; 161 G4double tPathLength; 136 G4double zPathLength; 162 G4double zPathLength; 137 G4double par1, par2, par3; << 163 G4double par1,par2,par3; 138 164 139 G4double stepmin; 165 G4double stepmin; 140 166 141 G4double currentKinEnergy; 167 G4double currentKinEnergy; 142 G4double currentRange; << 168 G4double currentRange; 143 G4double rangeinit; 169 G4double rangeinit; 144 G4double currentRadLength; 170 G4double currentRadLength; 145 171 >> 172 G4int currentMaterialIndex; >> 173 146 G4double Zold; 174 G4double Zold; 147 G4double Zeff, Z2, Z23, lnZ; << 175 G4double Zeff,Z2,Z23,lnZ; 148 G4double coeffth1, coeffth2; << 176 G4double coeffth1,coeffth2; 149 G4double coeffc1, coeffc2, coeffc3, coeffc4; << 177 G4double coeffc1,coeffc2,coeffc3,coeffc4; 150 178 151 G4double rangecut; << 179 G4bool firstStep; 152 G4double drr, finalr; << 180 G4bool insideskin; 153 181 154 G4int currentMaterialIndex; << 182 G4bool latDisplasmentbackup ; >> 183 G4bool displacementFlag; 155 184 156 G4bool firstStep; << 185 G4double rangecut; 157 G4bool insideskin; << 186 G4double drr,finalr; 158 187 159 G4bool latDisplasmentbackup; << 160 G4bool displacementFlag; << 161 }; 188 }; 162 189 163 //....oooOO0OOooo........oooOO0OOooo........oo 190 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 191 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 192 >> 193 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 194 164 inline void G4UrbanAdjointMscModel::SetNewDisp 195 inline void G4UrbanAdjointMscModel::SetNewDisplacementFlag(G4bool val) 165 { 196 { 166 displacementFlag = val; 197 displacementFlag = val; 167 } 198 } 168 199 169 inline void G4UrbanAdjointMscModel::SetParticl << 200 inline 170 { << 201 void G4UrbanAdjointMscModel::SetParticle(const G4ParticleDefinition* p) 171 const G4ParticleDefinition* p1 = p; << 202 { const G4ParticleDefinition* p1 =p; 172 << 203 173 if(p->GetParticleName() == "adj_e-") << 204 if (p->GetParticleName() =="adj_e-") p1= G4Electron::Electron(); 174 p1 = G4Electron::Electron(); << 205 175 << 206 if (p1 != particle) { 176 if(p1 != particle) << 207 particle = p1; 177 { << 208 mass = p1->GetPDGMass(); 178 particle = p1; << 209 charge = p1->GetPDGCharge()/CLHEP::eplus; 179 mass = p1->GetPDGMass(); << 210 ChargeSquare = charge*charge; 180 charge = p1->GetPDGCharge() / CLHEP: << 181 ChargeSquare = charge * charge; << 182 } 211 } 183 } 212 } 184 213 185 //....oooOO0OOooo........oooOO0OOooo........oo 214 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 215 186 inline G4double G4UrbanAdjointMscModel::Random 216 inline G4double G4UrbanAdjointMscModel::Randomizetlimit() 187 { 217 { 188 G4double temptlimit = tlimit; 218 G4double temptlimit = tlimit; 189 if(tlimit > tlimitmin) 219 if(tlimit > tlimitmin) 190 { 220 { 191 G4double delta = tlimit - tlimitmin; << 221 G4double delta = tlimit-tlimitmin; 192 do << 222 do { 193 { << 223 temptlimit = G4RandGauss::shoot(rndmEngineMod,tlimit,0.1*delta); 194 temptlimit = G4RandGauss::shoot(rndmEngi << 224 // Loop checking, 10-Apr-2016, Laszlo Urban 195 // Loop checking, 10-Apr-2016, Laszlo Ur << 225 } while ((temptlimit < tlimit-delta) || 196 } while((temptlimit < tlimit - delta) || ( << 226 (temptlimit > tlimit+delta)); 197 } << 198 else << 199 { << 200 temptlimit = tlimitmin; << 201 } 227 } >> 228 else { temptlimit = tlimitmin; } 202 229 203 return temptlimit; 230 return temptlimit; 204 } 231 } 205 232 206 //....oooOO0OOooo........oooOO0OOooo........oo 233 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 234 207 inline void G4UrbanAdjointMscModel::UpdateCach 235 inline void G4UrbanAdjointMscModel::UpdateCache() 208 { 236 { 209 lnZ = G4Log(Zeff); 237 lnZ = G4Log(Zeff); 210 // correction in theta0 formula 238 // correction in theta0 formula 211 G4double w = G4Exp(lnZ / 6.); << 239 G4double w = G4Exp(lnZ/6.); 212 G4double facz = 0.990395 + w * (-0.168386 + << 240 G4double facz = 0.990395+w*(-0.168386+w*0.093286) ; 213 coeffth1 = facz * (1. - 8.7780e-2 / Zef << 241 coeffth1 = facz*(1. - 8.7780e-2/Zeff); 214 coeffth2 = facz * (4.0780e-2 + 1.7315e- << 242 coeffth2 = facz*(4.0780e-2 + 1.7315e-4*Zeff); 215 243 216 // tail parameters 244 // tail parameters 217 G4double Z13 = w * w; << 245 G4double Z13 = w*w; 218 coeffc1 = 2.3785 - Z13 * (4.1981e-1 - Z << 246 coeffc1 = 2.3785 - Z13*(4.1981e-1 - Z13*6.3100e-2); 219 coeffc2 = 4.7526e-1 + Z13 * (1.7694 - Z << 247 coeffc2 = 4.7526e-1 + Z13*(1.7694 - Z13*3.3885e-1); 220 coeffc3 = 2.3683e-1 - Z13 * (1.8111 - Z << 248 coeffc3 = 2.3683e-1 - Z13*(1.8111 - Z13*3.2774e-1); 221 coeffc4 = 1.7888e-2 + Z13 * (1.9659e-2 << 249 coeffc4 = 1.7888e-2 + Z13*(1.9659e-2 - Z13*2.6664e-3); 222 << 250 223 Z2 = Zeff * Zeff; << 251 Z2 = Zeff*Zeff; 224 Z23 = Z13 * Z13; << 252 Z23 = Z13*Z13; 225 << 253 226 Zold = Zeff; 254 Zold = Zeff; 227 } 255 } 228 256 229 //....oooOO0OOooo........oooOO0OOooo........oo 257 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 230 inline G4double G4UrbanAdjointMscModel::Simple << 258 231 << 259 inline >> 260 G4double G4UrbanAdjointMscModel::SimpleScattering(G4double xmeanth, G4double x2meanth) 232 { 261 { 233 // 'large angle scattering' 262 // 'large angle scattering' 234 // 2 model functions with correct xmean and 263 // 2 model functions with correct xmean and x2mean 235 G4double a = << 264 G4double a = (2.*xmeanth+9.*x2meanth-3.)/(2.*xmeanth-3.*x2meanth+1.); 236 (2. * xmeanth + 9. * x2meanth - 3.) / (2. << 265 G4double prob = (a+2.)*xmeanth/a; 237 G4double prob = (a + 2.) * xmeanth / a; << 238 266 239 // sampling 267 // sampling 240 G4double cth = 1.; 268 G4double cth = 1.; 241 if(rndmEngineMod->flat() < prob) << 269 if(rndmEngineMod->flat() < prob) { 242 { << 270 cth = -1.+2.*G4Exp(G4Log(rndmEngineMod->flat())/(a+1.)); 243 cth = -1. + 2. * G4Exp(G4Log(rndmEngineMod << 271 } else { 244 } << 272 cth = -1.+2.*rndmEngineMod->flat(); 245 else << 246 { << 247 cth = -1. + 2. * rndmEngineMod->flat(); << 248 } 273 } 249 return cth; 274 return cth; 250 } 275 } 251 276 >> 277 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 278 >> 279 252 #endif 280 #endif >> 281 253 282