Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:11

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4ElasticHadrNucleusHe.hh
0027 
0028 //  The generator of high energy hadron-nucleus elastic scattering
0029 //  The hadron kinetic energy T > 1 GeV
0030 //  N.Starkov 2003.
0031 //
0032 //  19.11.05 The HE elastic scattering on proton is added (N.Starkov)
0033 //  16.11.06 General redesign (N.Starkov)
0034 //  23.11.06 General cleanup, ONQ0=3 (V.Ivanchenko)
0035 //  15.05.07 Redesign and cleanup (V.Ivanchenko)
0036 //  18.05.07 Cleanup (V.Grichine)
0037 //  19.04.12 Fixed reproducibility violation (A.Ribon)
0038 //  12.06.12 Fixed warnings of shadowed variables (A.Ribon)
0039 //
0040 
0041 #ifndef G4ElasticHadrNucleusHE_h
0042 #define G4ElasticHadrNucleusHE_h 1
0043 
0044 #include <vector>
0045 #include <iostream>
0046 #include <fstream>
0047 
0048 #include "globals.hh"
0049 #include "G4ParticleDefinition.hh"
0050 #include "G4ParticleChange.hh"
0051 #include "G4Nucleus.hh"
0052 #include "G4HadronElastic.hh"
0053 #include "G4Threading.hh"
0054 
0055 class G4NistManager;
0056 
0057 static const G4int  NHADRONS = 26;     // Number of allowed hadrons 
0058 static const G4int  ONQ2     = 102;    // Number of points on Q2
0059 static const G4int  NENERGY  = 24;
0060 static const G4int  ZMAX     = 93;
0061 
0062 ///////////////////////////////////////////////////////////////////////
0063 
0064 class G4ElasticData
0065 {
0066 
0067 friend class G4ElasticHadrNucleusHE;
0068 
0069 public:
0070 
0071   G4ElasticData(const G4ParticleDefinition* h, G4int Z, G4int A, 
0072                 const G4double* e);
0073 
0074   ~G4ElasticData() {}
0075 
0076 private:
0077 
0078   void DefineNucleusParameters(G4int A);
0079 
0080   // hide assignment operator
0081   G4ElasticData & operator=(const G4ElasticData &right);
0082   G4ElasticData(const G4ElasticData&);
0083 
0084   G4double  R1, R2, Pnucl, Aeff;
0085   G4double  dQ2;
0086   G4double  massA;
0087   G4double  massA2;
0088   G4double  maxQ2[NENERGY];
0089   std::vector<G4double> fCumProb[NENERGY];
0090 };
0091 
0092 /////////////////////////////////////////////////////////////////////
0093 
0094 class G4ElasticHadrNucleusHE : public G4HadronElastic
0095 {
0096 public:
0097 
0098   explicit G4ElasticHadrNucleusHE(const G4String& name = "hElasticGlauber");
0099 
0100   ~G4ElasticHadrNucleusHE() override;
0101 
0102   G4double SampleInvariantT(const G4ParticleDefinition* p, G4double plab, 
0103                 G4int Z, G4int A) override;
0104 
0105   void InitialiseModel() override;
0106 
0107   void ModelDescription(std::ostream&) const override;
0108 
0109 private:
0110 
0111   G4double HadronNucleusQ2_2(const G4ElasticData *pElD, G4double plabGeV, 
0112                              G4double tmax);
0113 
0114   void DefineHadronValues(G4int Z);
0115   G4int FillFq2(G4int A); 
0116 
0117   G4double GetLightFq2(G4int Z, G4int A, G4double Q);
0118 
0119   G4double GetQ2_2(G4int N, G4int Nmax, 
0120            const std::vector<G4double>& F, G4double rand);
0121 
0122   G4double HadrNucDifferCrSec(G4int A, G4double Q2); 
0123 
0124   void InterpolateHN(G4int n, const G4double EnP[], 
0125              const G4double C0P[], const G4double C1P[], 
0126              const G4double B0P[], const G4double B1P[]);
0127 
0128   G4double GetFt(G4double Q2);
0129 
0130   G4double HadronProtonQ2(G4double plab, G4double tmax);
0131 
0132   void Binom();
0133 
0134   void FillData(const G4ParticleDefinition* p, G4int idx, G4int Z);
0135 
0136   void InFileName(std::ostringstream&, const G4ParticleDefinition* p, G4int Z);
0137 
0138   void OutFileName(std::ostringstream&, const G4ParticleDefinition* p, G4int Z);
0139 
0140   G4bool ReadLine(std::ifstream&, std::vector<G4double>&);
0141 
0142   void WriteLine(std::ofstream&, std::vector<G4double>&);
0143 
0144   inline G4double LineInterpol(G4double p0, G4double p2,
0145                                G4double c1, G4double c2, G4double p);
0146 
0147   inline G4double GetBinomCof( G4int n, G4int m );
0148 
0149   // hide assignment operator
0150   G4ElasticHadrNucleusHE & operator=(const G4ElasticHadrNucleusHE &right);
0151   G4ElasticHadrNucleusHE(const G4ElasticHadrNucleusHE&);
0152 
0153   //  fields
0154   G4int    iHadrCode;
0155   G4int    iHadron;
0156   G4int    iHadron1;
0157   static const G4int fHadronCode[NHADRONS];
0158   static const G4int fHadronType[NHADRONS];
0159   static const G4int fHadronType1[NHADRONS];
0160 
0161   static G4bool fStoreToFile;
0162   static G4bool fRetrieveFromFile;
0163 
0164   // momemtum limits
0165   G4double ekinLowLimit;
0166   G4double dQ2;  
0167 
0168   // projectile kinematics in GeV
0169   G4double hMass;
0170   G4double hMass2;
0171   G4double hLabMomentum;
0172   G4double hLabMomentum2;
0173   G4double HadrEnergy;
0174 
0175   // elastic parameters
0176   G4double HadrTot, HadrSlope, HadrReIm, TotP; 
0177   G4double DDSect2, DDSect3, ConstU;
0178 
0179   // momentum limits for different models of hadron/nucleon scatetring
0180   G4double BoundaryP[7], BoundaryTL[7], BoundaryTG[7];
0181 
0182   // parameterisation of scattering
0183   G4double Slope1, Slope2, Coeff1, Coeff2;
0184   G4double Slope0, Coeff0;
0185 
0186   G4double aAIm, aDIm, Dtot11;
0187 
0188   // nucleaus parameters
0189   G4double  R1, R2, Pnucl, Aeff, Q2max;
0190 
0191   static G4double fLineF[ONQ2];
0192   static G4double fEnergy[NENERGY];
0193   static G4double fLowEdgeEnergy[NENERGY];
0194   static G4double fBinom[240][240];
0195 
0196   static G4ElasticData* fElasticData[NHADRONS][ZMAX];
0197   G4NistManager*  nistManager;
0198   const char* fDirectory;
0199 
0200   G4bool isMaster;
0201 
0202 #ifdef G4MULTITHREADED
0203   static G4Mutex elasticMutex;
0204 #endif
0205 
0206 };
0207 
0208 ////////////////////////////////////////////////////////////////
0209 
0210 inline
0211 G4double G4ElasticHadrNucleusHE::LineInterpol(G4double p1, G4double p2,
0212                           G4double c1, G4double c2,
0213                           G4double p)
0214 {
0215   return c1+(p-p1)*(c2-c1)/(p2-p1);
0216 }
0217 
0218 ////////////////////////////////////////////////////////////////
0219 
0220 inline
0221 G4double G4ElasticHadrNucleusHE::GetBinomCof(G4int numN, G4int numM)
0222 {
0223   return (numN >= numM && numN < 240) ? fBinom[numN][numM] : 0.0;
0224 }
0225 
0226 ////////////////////////////////////////////////////////////////
0227 
0228 #endif