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