Geant4 Cross Reference |
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 // G4ElasticHadrNucleusHe.hh 27 28 // The generator of high energy hadron-nucleus elastic scattering 29 // The hadron kinetic energy T > 1 GeV 30 // N.Starkov 2003. 31 // 32 // 19.11.05 The HE elastic scattering on proton is added (N.Starkov) 33 // 16.11.06 General redesign (N.Starkov) 34 // 23.11.06 General cleanup, ONQ0=3 (V.Ivanchenko) 35 // 15.05.07 Redesign and cleanup (V.Ivanchenko) 36 // 18.05.07 Cleanup (V.Grichine) 37 // 19.04.12 Fixed reproducibility violation (A.Ribon) 38 // 12.06.12 Fixed warnings of shadowed variables (A.Ribon) 39 // 40 41 #ifndef G4ElasticHadrNucleusHE_h 42 #define G4ElasticHadrNucleusHE_h 1 43 44 #include <vector> 45 #include <iostream> 46 #include <fstream> 47 48 #include "globals.hh" 49 #include "G4ParticleDefinition.hh" 50 #include "G4ParticleChange.hh" 51 #include "G4Nucleus.hh" 52 #include "G4HadronElastic.hh" 53 #include "G4Threading.hh" 54 55 class G4NistManager; 56 57 static const G4int NHADRONS = 26; // Number of allowed hadrons 58 static const G4int ONQ2 = 102; // Number of points on Q2 59 static const G4int NENERGY = 24; 60 static const G4int ZMAX = 93; 61 62 /////////////////////////////////////////////////////////////////////// 63 64 class G4ElasticData 65 { 66 67 friend class G4ElasticHadrNucleusHE; 68 69 public: 70 71 G4ElasticData(const G4ParticleDefinition* h, G4int Z, G4int A, 72 const G4double* e); 73 74 ~G4ElasticData() {} 75 76 private: 77 78 void DefineNucleusParameters(G4int A); 79 80 // hide assignment operator 81 G4ElasticData & operator=(const G4ElasticData &right); 82 G4ElasticData(const G4ElasticData&); 83 84 G4double R1, R2, Pnucl, Aeff; 85 G4double dQ2; 86 G4double massA; 87 G4double massA2; 88 G4double maxQ2[NENERGY]; 89 std::vector<G4double> fCumProb[NENERGY]; 90 }; 91 92 ///////////////////////////////////////////////////////////////////// 93 94 class G4ElasticHadrNucleusHE : public G4HadronElastic 95 { 96 public: 97 98 explicit G4ElasticHadrNucleusHE(const G4String& name = "hElasticGlauber"); 99 100 ~G4ElasticHadrNucleusHE() override; 101 102 G4double SampleInvariantT(const G4ParticleDefinition* p, G4double plab, 103 G4int Z, G4int A) override; 104 105 void InitialiseModel() override; 106 107 void ModelDescription(std::ostream&) const override; 108 109 private: 110 111 G4double HadronNucleusQ2_2(const G4ElasticData *pElD, G4double plabGeV, 112 G4double tmax); 113 114 void DefineHadronValues(G4int Z); 115 G4int FillFq2(G4int A); 116 117 G4double GetLightFq2(G4int Z, G4int A, G4double Q); 118 119 G4double GetQ2_2(G4int N, G4int Nmax, 120 const std::vector<G4double>& F, G4double rand); 121 122 G4double HadrNucDifferCrSec(G4int A, G4double Q2); 123 124 void InterpolateHN(G4int n, const G4double EnP[], 125 const G4double C0P[], const G4double C1P[], 126 const G4double B0P[], const G4double B1P[]); 127 128 G4double GetFt(G4double Q2); 129 130 G4double HadronProtonQ2(G4double plab, G4double tmax); 131 132 void Binom(); 133 134 void FillData(const G4ParticleDefinition* p, G4int idx, G4int Z); 135 136 void InFileName(std::ostringstream&, const G4ParticleDefinition* p, G4int Z); 137 138 void OutFileName(std::ostringstream&, const G4ParticleDefinition* p, G4int Z); 139 140 G4bool ReadLine(std::ifstream&, std::vector<G4double>&); 141 142 void WriteLine(std::ofstream&, std::vector<G4double>&); 143 144 inline G4double LineInterpol(G4double p0, G4double p2, 145 G4double c1, G4double c2, G4double p); 146 147 inline G4double GetBinomCof( G4int n, G4int m ); 148 149 // hide assignment operator 150 G4ElasticHadrNucleusHE & operator=(const G4ElasticHadrNucleusHE &right); 151 G4ElasticHadrNucleusHE(const G4ElasticHadrNucleusHE&); 152 153 // fields 154 G4int iHadrCode; 155 G4int iHadron; 156 G4int iHadron1; 157 static const G4int fHadronCode[NHADRONS]; 158 static const G4int fHadronType[NHADRONS]; 159 static const G4int fHadronType1[NHADRONS]; 160 161 static G4bool fStoreToFile; 162 static G4bool fRetrieveFromFile; 163 164 // momemtum limits 165 G4double ekinLowLimit; 166 G4double dQ2; 167 168 // projectile kinematics in GeV 169 G4double hMass; 170 G4double hMass2; 171 G4double hLabMomentum; 172 G4double hLabMomentum2; 173 G4double HadrEnergy; 174 175 // elastic parameters 176 G4double HadrTot, HadrSlope, HadrReIm, TotP; 177 G4double DDSect2, DDSect3, ConstU; 178 179 // momentum limits for different models of hadron/nucleon scatetring 180 G4double BoundaryP[7], BoundaryTL[7], BoundaryTG[7]; 181 182 // parameterisation of scattering 183 G4double Slope1, Slope2, Coeff1, Coeff2; 184 G4double Slope0, Coeff0; 185 186 G4double aAIm, aDIm, Dtot11; 187 188 // nucleaus parameters 189 G4double R1, R2, Pnucl, Aeff, Q2max; 190 191 static G4double fLineF[ONQ2]; 192 static G4double fEnergy[NENERGY]; 193 static G4double fLowEdgeEnergy[NENERGY]; 194 static G4double fBinom[240][240]; 195 196 static G4ElasticData* fElasticData[NHADRONS][ZMAX]; 197 G4NistManager* nistManager; 198 const char* fDirectory; 199 200 G4bool isMaster; 201 202 #ifdef G4MULTITHREADED 203 static G4Mutex elasticMutex; 204 #endif 205 206 }; 207 208 //////////////////////////////////////////////////////////////// 209 210 inline 211 G4double G4ElasticHadrNucleusHE::LineInterpol(G4double p1, G4double p2, 212 G4double c1, G4double c2, 213 G4double p) 214 { 215 return c1+(p-p1)*(c2-c1)/(p2-p1); 216 } 217 218 //////////////////////////////////////////////////////////////// 219 220 inline 221 G4double G4ElasticHadrNucleusHE::GetBinomCof(G4int numN, G4int numM) 222 { 223 return (numN >= numM && numN < 240) ? fBinom[numN][numM] : 0.0; 224 } 225 226 //////////////////////////////////////////////////////////////// 227 228 #endif 229