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: G4GoudsmitSaundersonMscModel.hh,v 1.2 2009/06/04 13:45:49 gunter Exp $ >> 27 // GEANT4 tag $Name: geant4-09-03-patch-01 $ >> 28 // >> 29 // ------------------------------------------------------------------- 26 // 30 // 27 // ------------------------------------------- << 28 // 31 // 29 // GEANT4 Class header file 32 // GEANT4 Class header file 30 // 33 // >> 34 // 31 // File name: G4GoudsmitSaundersonMscModel 35 // File name: G4GoudsmitSaundersonMscModel 32 // 36 // 33 // Author: Mihaly Novak / (Omrane Kadri << 37 // Author: Omrane Kadri 34 // 38 // 35 // Creation date: 20.02.2009 39 // Creation date: 20.02.2009 36 // 40 // 37 // Modifications: 41 // Modifications: 38 // 04.03.2009 V.Ivanchenko cleanup and format 42 // 04.03.2009 V.Ivanchenko cleanup and format according to Geant4 EM style 39 // 12.05.2010 O.Kadri: adding Qn1 and Qn12 as << 40 // 18.05.2015 M. Novak provide PLERIMINARYY ve << 41 // All algorithms of the class were << 42 // A new version of Kawrakow-Bielaj << 43 // based on the screened Rutherford << 44 // electrons/positrons has been int << 45 // angular distributions over a 2D << 46 // and the CDFs are now stored in a << 47 // together with the corresponding << 48 // These angular distributions are << 49 // G4GoudsmitSaundersonTable class << 50 // it was no, single, few or multip << 51 // angular deflection (i.e. cos(the << 52 // Two screening options are provid << 53 // - if fgIsUsePWATotalXsecData=TR << 54 // was called before initialisat << 55 // determined such that the firs << 56 // computed according to the scr << 57 // scattering will reproduce the << 58 // and first transport mean free << 59 // - if fgIsUsePWATotalXsecData=FA << 60 // SetOptionPWAScreening(FALSE) << 61 // screening parameter value A i << 62 // formula (by using material de << 63 // precomputed for each material << 64 // G4GoudsmitSaundersonTable) [3 << 65 // Elastic and first trasport mean << 66 // The new version is self-consiste << 67 // robust and accurate compared to << 68 // Spin effects as well as a more a << 69 // computations of Lewis moments wi << 70 // 02.09.2015 M. Novak: first version of new s << 71 // fUseSafetyPlus corresponds to Ur << 72 // fUseDistanceToBoundary correspon << 73 // fUseSafety corresponds to EGSnr << 74 // Range factor can be significantl << 75 // 23.08.2017 M. Novak: added corrections to a << 76 // It can be activated by setting t << 77 // before initialization using the << 78 // The fMottCorrection member is re << 79 // correction (rejection) functions << 80 // Goudsmit-Saunderson agnular dist << 81 // effects and screening correction << 82 // GS angular distributions is: DCS << 83 // # DCS_{SR} is the relativisti << 84 // solution of the Klein-Gordo << 85 // scattering of spinless e- o << 86 // note: the default (without << 87 // are based on this DCS_{SR} << 88 // # DCS_{R} is the Rutherford D << 89 // screening << 90 // # DCS_{Mott} is the Mott DCS << 91 // Coulomb potential i.e. scat << 92 // point-like unscreened Coulo << 93 // # moreover, the screening par << 94 // the DCS_{cor} with this cor << 95 // transport cross sections ob << 96 // (i.e. from elsepa [4]) << 97 // Unlike the default GS, the Mott- << 98 // (different for e- and e+ <= the << 99 // (Z and material) dependent. << 100 // 02.02.2018 M. Novak: implemented CrossSecti << 101 // 43 // 102 // Class description: 44 // Class description: 103 // Kawrakow-Bielajew Goudsmit-Saunderson MSC << 104 // for elastic scattering of e-/e+. Option, << 105 // also available now (SetOptionMottCorrecti << 106 // algorithm (UseSafety) is available beyond << 107 // and true to geomerty and geometry to true << 108 // from the Urban model[5]. The most accurat << 109 // with Mott-correction (SetOptionMottCorrec << 110 // << 111 // References: << 112 // [1] A.F.Bielajew, NIMB 111 (1996) 195-208 << 113 // [2] I.Kawrakow, A.F.Bielajew, NIMB 134(19 << 114 // [3] I.Kawrakow, E.Mainegra-Hing, D.W.O.Ro << 115 // Report PIRS-701 (2013) << 116 // [4] F.Salvat, A.Jablonski, C.J. Powell, C << 117 // [5] L.Urban, Preprint CERN-OPEN-2006-077 << 118 // 45 // 119 // ------------------------------------------- << 46 // Multiple scattering model using classical Goudsmit-Saunderson model >> 47 // >> 48 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ >> 49 //REFERENCES: >> 50 //Ref.1:E. Benedito et al.,"Mixed simulation ... cross-sections", NIMB 174 (2001) pp 91-110; >> 51 //Ref.2:I. Kawrakow et al.,"On the condensed ... transport",NIMB 142 (1998) pp 253-280; >> 52 //Ref.3:I. Kawrakow et al.,"On the representation ... calculations",NIMB 134 (1998) pp 325-336; >> 53 //Ref.4:I. Kawrakow et al.,"The EGSnrc code ... Transport",NRCC Report PIRS-701, Sept. 21, 2006; >> 54 //Ref.5:F. Salvat et al.,"ELSEPA--Dirac partial ...molecules", Comp. Phys. Comm. 165 (2005) pp 157-190; >> 55 //Ref.6:G4UrbanMscModel G4_v9.1Ref09; >> 56 //Ref.7:G4eCoulombScatteringModel G4_v9.1Ref09. >> 57 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 120 58 121 #ifndef G4GoudsmitSaundersonMscModel_h 59 #ifndef G4GoudsmitSaundersonMscModel_h 122 #define G4GoudsmitSaundersonMscModel_h 1 60 #define G4GoudsmitSaundersonMscModel_h 1 123 61 124 #include <CLHEP/Units/SystemOfUnits.h> << 125 << 126 #include "G4VMscModel.hh" 62 #include "G4VMscModel.hh" 127 #include "G4PhysicsTable.hh" 63 #include "G4PhysicsTable.hh" 128 #include "G4MaterialCutsCouple.hh" << 129 #include "globals.hh" 64 #include "globals.hh" 130 << 65 #include "G4DataInterpolation.hh" 131 66 132 class G4DataVector; 67 class G4DataVector; 133 class G4ParticleChangeForMSC; 68 class G4ParticleChangeForMSC; 134 class G4LossTableManager; 69 class G4LossTableManager; 135 class G4GoudsmitSaundersonTable; 70 class G4GoudsmitSaundersonTable; 136 class G4GSPWACorrections; << 71 class G4PhysicsTable; 137 72 138 class G4GoudsmitSaundersonMscModel : public G4 73 class G4GoudsmitSaundersonMscModel : public G4VMscModel 139 { 74 { 140 public: 75 public: 141 76 142 G4GoudsmitSaundersonMscModel(const G4String& 77 G4GoudsmitSaundersonMscModel(const G4String& nam = "GoudsmitSaunderson"); 143 78 144 ~G4GoudsmitSaundersonMscModel() override; << 79 virtual ~G4GoudsmitSaundersonMscModel(); 145 << 146 void Initialise(const G4ParticleDefinition*, << 147 << 148 void InitialiseLocal(const G4ParticleDefinit << 149 << 150 G4ThreeVector& SampleScattering(const G4Thre << 151 << 152 G4double ComputeTruePathLengthLimit(const G4 << 153 << 154 G4double ComputeGeomPathLength(G4double true << 155 << 156 G4double ComputeTrueStepLength(G4double geom << 157 << 158 // method to compute first transport cross s << 159 // method is used only for testing and not d << 160 G4double CrossSectionPerVolume(const G4Mater << 161 << 162 void StartTracking(G4Track*) override; << 163 80 164 void SampleMSC(); << 81 virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&); 165 82 166 G4double GetTransportMeanFreePath(const G4Pa << 83 virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition* particle, >> 84 G4double KineticEnergy, >> 85 G4double AtomicNumber, G4double, >> 86 G4double, G4double); 167 87 168 void SetOptionPWACorrection(G4bool opt) { << 88 virtual void SampleScattering(const G4DynamicParticle* , >> 89 G4double ); 169 90 170 G4bool GetOptionPWACorrection() const { << 91 virtual G4double ComputeTruePathLengthLimit( >> 92 const G4Track& track, >> 93 G4PhysicsTable* theLambdaTable, >> 94 G4double currentMinimalStep); 171 95 172 void SetOptionMottCorrection(G4bool opt) { << 96 virtual G4double ComputeGeomPathLength(G4double truePathLength); 173 97 174 G4bool GetOptionMottCorrection() const { << 98 virtual G4double ComputeTrueStepLength(G4double geomStepLength); 175 99 176 G4GoudsmitSaundersonTable* GetGSTable() << 100 private: >> 101 void SampleCosineTheta(G4double,G4double,G4double &,G4double &); 177 102 178 G4GSPWACorrections* GetPWACorrection( << 103 void CalculateIntegrals(const G4ParticleDefinition* ,G4double,G4double, >> 104 G4double&,G4double&); 179 105 180 // hide assignment operator << 106 void LoadELSEPAXSections(); 181 G4GoudsmitSaundersonMscModel & operator=(con << 182 G4GoudsmitSaundersonMscModel(const G4Goudsm << 183 107 184 private: << 108 inline void SetParticle(const G4ParticleDefinition* p); 185 inline void SetParticle(const G4Particle << 186 109 187 inline G4double GetLambda(G4double); 110 inline G4double GetLambda(G4double); 188 111 189 G4double GetTransportMeanFreePathOnly(const << 112 // hide assignment operator 190 << 113 G4GoudsmitSaundersonMscModel & operator=(const G4GoudsmitSaundersonMscModel &right); 191 inline G4double Randomizetlimit(); << 114 G4GoudsmitSaundersonMscModel(const G4GoudsmitSaundersonMscModel&); 192 115 193 private: << 116 G4double lowKEnergy; 194 CLHEP::HepRandomEngine* rndmEngineMod; << 117 G4double highKEnergy; 195 // << 196 G4double currentKinEnergy; 118 G4double currentKinEnergy; 197 G4double currentRange; << 119 G4double currentRange; 198 // << 120 199 G4double fr; << 121 G4double smallstep,tlimitminfix,skindepth; 200 G4double rangeinit; << 122 G4double fr,rangeinit,masslimite,tgeom; 201 G4double geombig; << 123 G4double par1,par2,par3,zPathLength,truePathLength; 202 G4double geomlimit; << 124 G4double tausmall,taulim,tlimit,tlimitmin,geommin,geombig; 203 G4double tlimit; << 125 G4double charge,lambdalimit; 204 G4double tgeom; << 126 G4double tPathLength,stepmin ; 205 // << 127 G4double lambda1,lambda11; 206 G4double par1; << 207 G4double par2; << 208 G4double par3; << 209 G4double tlimitminfix2; << 210 G4double tausmall; << 211 G4double mass; 128 G4double mass; 212 G4double taulim; << 129 G4double lambda0; 213 // << 214 // << 215 G4double presafety; << 216 G4double fZeff; << 217 // << 218 G4int charge; << 219 G4int currentMaterialIndex; 130 G4int currentMaterialIndex; 220 // << 131 221 G4bool firstStep; << 132 G4bool inside; 222 // << 133 G4bool insideskin; 223 G4LossTableManager* theManager; << 134 G4bool isInitialized; >> 135 >> 136 G4PhysicsTable* theLambdaTable; >> 137 G4GoudsmitSaundersonTable* GSTable; >> 138 G4LossTableManager* theManager; 224 const G4ParticleDefinition* particle; 139 const G4ParticleDefinition* particle; 225 G4ParticleChangeForMSC* fParticleChange; 140 G4ParticleChangeForMSC* fParticleChange; >> 141 G4DataInterpolation* MyValue; 226 const G4MaterialCutsCouple* currentCouple; 142 const G4MaterialCutsCouple* currentCouple; 227 143 228 G4GoudsmitSaundersonTable* fGSTable; << 144 static G4double ener[106]; 229 G4GSPWACorrections* fPWACorrection; << 145 static G4double TCSE[103][106]; >> 146 static G4double FTCSE[103][106]; >> 147 static G4double TCSP[103][106]; >> 148 static G4double FTCSP[103][106]; 230 149 231 G4bool fIsUsePWACorrection; << 232 G4bool fIsUseMottCorrection; << 233 // << 234 G4double fLambda0; // elastic mean free path << 235 G4double fLambda1; // first transport mean f << 236 G4double fScrA; // screening parameter << 237 G4double fG1; // first transport coef. << 238 // in case of Mott-correction << 239 G4double fMCtoScrA; << 240 G4double fMCtoQ1; << 241 G4double fMCtoG2PerG1; << 242 // << 243 G4double fTheTrueStepLenght; << 244 G4double fTheTransportDistance; << 245 G4double fTheZPathLenght; << 246 // << 247 G4ThreeVector fTheDisplacementVector; << 248 G4ThreeVector fTheNewDirection; << 249 // << 250 G4bool fIsEndedUpOnBoundary; // step ended << 251 G4bool fIsMultipleSacettring; << 252 G4bool fIsSingleScattering; << 253 G4bool fIsEverythingWasDone; << 254 G4bool fIsNoScatteringInMSC; << 255 G4bool fIsNoDisplace; << 256 G4bool fIsInsideSkin; << 257 G4bool fIsWasOnBoundary; << 258 G4bool fIsFirstRealStep; << 259 // << 260 static G4bool gIsUseAccurate; << 261 static G4bool gIsOptimizationOn; << 262 }; 150 }; >> 151 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 263 152 264 ////////////////////////////////////////////// << 265 inline 153 inline 266 void G4GoudsmitSaundersonMscModel::SetParticle 154 void G4GoudsmitSaundersonMscModel::SetParticle(const G4ParticleDefinition* p) 267 { 155 { 268 if (p != particle) { 156 if (p != particle) { 269 particle = p; 157 particle = p; 270 charge = (G4int)(p->GetPDGCharge()/CLHEP:: << 271 mass = p->GetPDGMass(); 158 mass = p->GetPDGMass(); >> 159 charge = p->GetPDGCharge()/eplus; 272 } 160 } 273 } 161 } 274 162 275 << 276 //....oooOO0OOooo........oooOO0OOooo........oo 163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 277 inline << 164 278 G4double G4GoudsmitSaundersonMscModel::Randomi << 165 inline G4double G4GoudsmitSaundersonMscModel::GetLambda(G4double e) 279 { 166 { 280 G4double temptlimit; << 167 G4double x; 281 do { << 168 if(theLambdaTable) { 282 temptlimit = G4RandGauss::shoot(rndmE << 169 G4bool b; 283 } while ( (temptlimit<0.) || (temptlimi << 170 x = ((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b); >> 171 } else { >> 172 x = CrossSection(currentCouple,particle,e); >> 173 } 284 174 285 return temptlimit; << 175 if(x > DBL_MIN) x = 1./x; >> 176 else x = DBL_MAX; >> 177 return x; 286 } 178 } 287 179 288 << 180 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 289 181 290 #endif 182 #endif >> 183 291 184