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 // 26 // 27 // ------------------------------------------- 27 // ----------------------------------------------------------------------------- 28 // 28 // 29 // GEANT4 Class header file 29 // GEANT4 Class header file 30 // 30 // 31 // File name: G4GoudsmitSaundersonTable 31 // File name: G4GoudsmitSaundersonTable 32 // 32 // 33 // Author: Mihaly Novak / (Omrane Kadri 33 // Author: Mihaly Novak / (Omrane Kadri) 34 // 34 // 35 // Creation date: 20.02.2009 35 // Creation date: 20.02.2009 36 // 36 // 37 // Class description: 37 // Class description: 38 // Class to handle multiple scattering angul 38 // Class to handle multiple scattering angular distributions precomputed by 39 // using Kawrakow-Bielajew Goudsmit-Saunders 39 // using Kawrakow-Bielajew Goudsmit-Saunderson MSC model based on the screened 40 // Rutherford DCS for elastic scattering of 40 // Rutherford DCS for elastic scattering of electrons/positrons [1,2]. This 41 // class is used by G4GoudsmitSaundersonMscM 41 // class is used by G4GoudsmitSaundersonMscModel to sample the angular 42 // deflection of electrons/positrons after t 42 // deflection of electrons/positrons after travelling a given path. 43 // 43 // 44 // Modifications: 44 // Modifications: 45 // 04.03.2009 V.Ivanchenko cleanup and format 45 // 04.03.2009 V.Ivanchenko cleanup and format according to Geant4 EM style 46 // 18.05.2015 M. Novak This class has been com 46 // 18.05.2015 M. Novak This class has been completely replaced (only the original 47 // class name was kept; class descr 47 // class name was kept; class description was also inserted): 48 // A new version of Kawrakow-Bielaj 48 // A new version of Kawrakow-Bielajew Goudsmit-Saunderson MSC model 49 // based on the screened Rutherford 49 // based on the screened Rutherford DCS for elastic scattering of 50 // electrons/positrons has been int 50 // electrons/positrons has been introduced[1,2]. The corresponding MSC 51 // angular distributions over a 2D 51 // angular distributions over a 2D parameter grid have been recomputed 52 // and the CDFs are now stored in a 52 // and the CDFs are now stored in a variable transformed (smooth) form 53 // together with the corresponding 53 // together with the corresponding rational interpolation parameters. 54 // The new version is several times 54 // The new version is several times faster, more robust and accurate 55 // compared to the earlier version 55 // compared to the earlier version (G4GoudsmitSaundersonMscModel class 56 // that use these data has been als 56 // that use these data has been also completely replaced) 57 // 28.04.2017 M. Novak: the GS angular distrib 57 // 28.04.2017 M. Novak: the GS angular distributions has been recomputed, the 58 // data size has been reduced from 58 // data size has been reduced from 16 MB down to 5 MB by using a new 59 // representation, the class has be 59 // representation, the class has been modified significantly due to 60 // this new data representation. 60 // this new data representation. 61 // 23.08.2017 M. Novak: Added funtionality to 61 // 23.08.2017 M. Novak: Added funtionality to handle Mott-correction to the 62 // base GS angular distributions an 62 // base GS angular distributions and some other factors (screening 63 // parameter, first and second mome 63 // parameter, first and second moments) when Mott-correction is 64 // activated in the GS-MSC model. 64 // activated in the GS-MSC model. 65 // 65 // 66 // References: 66 // References: 67 // [1] A.F.Bielajew, NIMB, 111 (1996) 195-20 67 // [1] A.F.Bielajew, NIMB, 111 (1996) 195-208 68 // [2] I.Kawrakow, A.F.Bielajew, NIMB 134(19 68 // [2] I.Kawrakow, A.F.Bielajew, NIMB 134(1998) 325-336 69 // 69 // 70 // ------------------------------------------- 70 // ----------------------------------------------------------------------------- 71 71 72 72 73 #ifndef G4GoudsmitSaundersonTable_h 73 #ifndef G4GoudsmitSaundersonTable_h 74 #define G4GoudsmitSaundersonTable_h 1 74 #define G4GoudsmitSaundersonTable_h 1 75 75 76 #include <vector> 76 #include <vector> 77 77 78 #include "G4Types.hh" 78 #include "G4Types.hh" 79 79 80 class G4GSMottCorrection; 80 class G4GSMottCorrection; 81 class G4MaterialCutsCouple; 81 class G4MaterialCutsCouple; 82 82 83 class G4GoudsmitSaundersonTable { 83 class G4GoudsmitSaundersonTable { 84 84 85 public: 85 public: 86 G4GoudsmitSaundersonTable(G4bool iselectron) 86 G4GoudsmitSaundersonTable(G4bool iselectron); 87 ~G4GoudsmitSaundersonTable(); 87 ~G4GoudsmitSaundersonTable(); 88 88 89 void Initialise(G4double lownergylimit, G4do 89 void Initialise(G4double lownergylimit, G4double highenergylimit); 90 90 91 // structure to store one GS transformed ang 91 // structure to store one GS transformed angular distribution (for a given s/lambda_el,s/lambda_elG1) 92 struct GSMSCAngularDtr { 92 struct GSMSCAngularDtr { 93 G4int fNumData; // # of data points 93 G4int fNumData; // # of data points 94 G4double *fUValues; // array of transfo 94 G4double *fUValues; // array of transformed variables 95 G4double *fParamA; // array of interpo 95 G4double *fParamA; // array of interpolation parameters a 96 G4double *fParamB; // array of interpo 96 G4double *fParamB; // array of interpolation parameters b 97 }; 97 }; 98 98 99 void LoadMSCData(); 99 void LoadMSCData(); 100 100 101 G4bool Sampling(G4double lambdaval, G4doub 101 G4bool Sampling(G4double lambdaval, G4double qval, G4double scra, 102 G4double &cost, G4doub 102 G4double &cost, G4double &sint, G4double lekin, 103 G4double beta2, G4int 103 G4double beta2, G4int matindx, GSMSCAngularDtr **gsDtr, 104 G4int &mcekini, G4int &mcd 104 G4int &mcekini, G4int &mcdelti, G4double &transfPar, 105 G4bool isfirst); 105 G4bool isfirst); 106 106 107 G4double SampleCosTheta(G4double lambdaval, 107 G4double SampleCosTheta(G4double lambdaval, G4double qval, G4double scra, 108 G4double lekin, 108 G4double lekin, G4double beta2, G4int matindx, 109 GSMSCAngularDtr **gs 109 GSMSCAngularDtr **gsDtr, G4int &mcekini, G4int &mcdelti, 110 G4double &transfPar, 110 G4double &transfPar, G4bool isfirst); 111 111 112 G4double SampleGSSRCosTheta(const GSMSCAngul 112 G4double SampleGSSRCosTheta(const GSMSCAngularDtr* gsDrt, G4double transfpar); 113 113 114 G4double SingleScattering(G4double lambdaval 114 G4double SingleScattering(G4double lambdaval, G4double scra, G4double lekin, 115 G4double beta2, G4 115 G4double beta2, G4int matindx); 116 116 117 GSMSCAngularDtr* GetGSAngularDtr(G4double sc 117 GSMSCAngularDtr* GetGSAngularDtr(G4double scra, G4double &lambdaval, 118 G4double &q 118 G4double &qval, G4double &transfpar); 119 119 120 // material dependent MSC parameters (comput 120 // material dependent MSC parameters (computed at initialisation) regarding 121 // Moliere's screening parameter 121 // Moliere's screening parameter 122 G4double GetMoliereBc(G4int matindx) { retu 122 G4double GetMoliereBc(G4int matindx) { return gMoliereBc[matindx]; } 123 123 124 G4double GetMoliereXc2(G4int matindx) { retu 124 G4double GetMoliereXc2(G4int matindx) { return gMoliereXc2[matindx]; } 125 125 126 void GetMottCorrectionFactors(G4double l 126 void GetMottCorrectionFactors(G4double logekin, G4double beta2, 127 G4int mati 127 G4int matindx, G4double &mcToScr, 128 G4double & 128 G4double &mcToQ1, G4double &mcToG2PerG1); 129 129 130 // set option to activate/inactivate Mott-co 130 // set option to activate/inactivate Mott-correction 131 void SetOptionMottCorrection(G4bool val) 131 void SetOptionMottCorrection(G4bool val) { fIsMottCorrection = val; } 132 // set option to activate/inactivate PWA-cor 132 // set option to activate/inactivate PWA-correction 133 void SetOptionPWACorrection(G4bool val) 133 void SetOptionPWACorrection(G4bool val) { fIsPWACorrection = val; } 134 134 135 // this method returns with the scattering p 135 // this method returns with the scattering power correction (to avoid double counting of sub-threshold deflections) 136 // interpolated from tables prepared at init 136 // interpolated from tables prepared at initialisation 137 G4double ComputeScatteringPowerCorrection(co 137 G4double ComputeScatteringPowerCorrection(const G4MaterialCutsCouple *matcut, G4double ekin); 138 138 139 void InitSCPCorrection(); 139 void InitSCPCorrection(); 140 140 141 private: 141 private: 142 // initialisation of material dependent Moli 142 // initialisation of material dependent Moliere's MSC parameters 143 void InitMoliereMSCParams(); 143 void InitMoliereMSCParams(); 144 144 145 145 146 private: 146 private: 147 static G4bool gIsInitialised; 147 static G4bool gIsInitialised; // are the precomputed angular distributions already loaded in? 148 static constexpr G4int gLAMBNUM = 64; 148 static constexpr G4int gLAMBNUM = 64; // # L=s/lambda_el in [fLAMBMIN,fLAMBMAX] 149 static constexpr G4int gQNUM1 = 15; 149 static constexpr G4int gQNUM1 = 15; // # Q=s/lambda_el G1 in [fQMIN1,fQMAX1] in the 1-st Q grid 150 static constexpr G4int gQNUM2 = 32; 150 static constexpr G4int gQNUM2 = 32; // # Q=s/lambda_el G1 in [fQMIN2,fQMAX2] in the 2-nd Q grid 151 static constexpr G4int gNUMSCR1 = 201; 151 static constexpr G4int gNUMSCR1 = 201; // # of screening parameters in the A(G1) function 152 static constexpr G4int gNUMSCR2 = 51; 152 static constexpr G4int gNUMSCR2 = 51; // # of screening parameters in the A(G1) function 153 static constexpr G4double gLAMBMIN = 1.0; 153 static constexpr G4double gLAMBMIN = 1.0; // minimum s/lambda_el 154 static constexpr G4double gLAMBMAX = 100000 154 static constexpr G4double gLAMBMAX = 100000.0; // maximum s/lambda_el 155 static constexpr G4double gQMIN1 = 0.001; 155 static constexpr G4double gQMIN1 = 0.001; // minimum s/lambda_el G1 in the 1-st Q grid 156 static constexpr G4double gQMAX1 = 0.99; 156 static constexpr G4double gQMAX1 = 0.99; // maximum s/lambda_el G1 in the 1-st Q grid 157 static constexpr G4double gQMIN2 = 0.99; 157 static constexpr G4double gQMIN2 = 0.99; // minimum s/lambda_el G1 in the 2-nd Q grid 158 static constexpr G4double gQMAX2 = 7.99; 158 static constexpr G4double gQMAX2 = 7.99; // maximum s/lambda_el G1 in the 2-nd Q grid 159 // 159 // 160 G4bool fIsElectron; // GS-table 160 G4bool fIsElectron; // GS-table for e- (for e+ otherwise) 161 G4bool fIsMottCorrection; // flag to i 161 G4bool fIsMottCorrection; // flag to indicate if Mott-correction was requested to be used 162 G4bool fIsPWACorrection; // flag to i 162 G4bool fIsPWACorrection; // flag to indicate is PWA corrections were requested to be used 163 G4double fLogLambda0; // ln(gLAMBM 163 G4double fLogLambda0; // ln(gLAMBMIN) 164 G4double fLogDeltaLambda; // ln(gLAMBM 164 G4double fLogDeltaLambda; // ln(gLAMBMAX/gLAMBMIN)/(gLAMBNUM-1) 165 G4double fInvLogDeltaLambda; // 1/[ln(gLA 165 G4double fInvLogDeltaLambda; // 1/[ln(gLAMBMAX/gLAMBMIN)/(gLAMBNUM-1)] 166 G4double fInvDeltaQ1; // 1/[(gQMAX 166 G4double fInvDeltaQ1; // 1/[(gQMAX1-gQMIN1)/(gQNUM1-1)] 167 G4double fDeltaQ2; // [(gQMAX2- 167 G4double fDeltaQ2; // [(gQMAX2-gQMIN2)/(gQNUM2-1)] 168 G4double fInvDeltaQ2; // 1/[(gQMAX 168 G4double fInvDeltaQ2; // 1/[(gQMAX2-gQMIN2)/(gQNUM2-1)] 169 // 169 // 170 G4double fLowEnergyLimit; 170 G4double fLowEnergyLimit; 171 G4double fHighEnergyLimit; 171 G4double fHighEnergyLimit; 172 // 172 // 173 int fNumSPCEbinPerDec; // scatterin 173 int fNumSPCEbinPerDec; // scattering power correction energy grid bins per decade 174 struct SCPCorrection { 174 struct SCPCorrection { 175 bool fIsUse; // 175 bool fIsUse; // 176 double fPrCut; // sec. e- p 176 double fPrCut; // sec. e- production cut energy 177 double fLEmin; // log min e 177 double fLEmin; // log min energy 178 double fILDel; // inverse l 178 double fILDel; // inverse log delta kinetic energy 179 //std::vector<double> fVEkin; // scatter 179 //std::vector<double> fVEkin; // scattering power correction energies 180 std::vector<double> fVSCPC; // scatterin 180 std::vector<double> fVSCPC; // scattering power correction vector 181 }; 181 }; 182 std::vector<SCPCorrection*> fSCPCPerMatCut 182 std::vector<SCPCorrection*> fSCPCPerMatCuts; 183 183 184 184 185 // vector to store all GS transformed angul 185 // vector to store all GS transformed angular distributions (cumputed based on the Screened-Rutherford DCS) 186 static std::vector<GSMSCAngularDtr*> gGSMSC 186 static std::vector<GSMSCAngularDtr*> gGSMSCAngularDistributions1; 187 static std::vector<GSMSCAngularDtr*> gGSMSC 187 static std::vector<GSMSCAngularDtr*> gGSMSCAngularDistributions2; 188 188 189 //@{ 189 //@{ 190 /** Precomputed \f$ b_lambda_{c} $\f and \f 190 /** Precomputed \f$ b_lambda_{c} $\f and \f$ \chi_c^{2} $\f material dependent 191 * Moliere parameters that can be used to 191 * Moliere parameters that can be used to compute the screening parameter, 192 * the elastic scattering cross section (o 192 * the elastic scattering cross section (or \f$ \lambda_{e} $\f) under the 193 * screened Rutherford cross section appro 193 * screened Rutherford cross section approximation. (These are used in 194 * G4GoudsmitSaundersonMscModel if fgIsUse 194 * G4GoudsmitSaundersonMscModel if fgIsUsePWATotalXsecData is FALSE.) 195 */ 195 */ 196 static std::vector<double> gMoliereBc; 196 static std::vector<double> gMoliereBc; 197 static std::vector<double> gMoliereXc2; 197 static std::vector<double> gMoliereXc2; 198 // 198 // 199 // 199 // 200 G4GSMottCorrection *fMottCorrection; 200 G4GSMottCorrection *fMottCorrection; 201 }; 201 }; 202 202 203 #endif 203 #endif 204 204