Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:30:13

0001 #ifndef LowEnergyFastSimParam_h
0002 #define LowEnergyFastSimParam_h
0003 
0004 #include "G4Types.hh"
0005 #include "Randomize.hh"
0006 #include "G4Log.hh"
0007 
0008 class LowEnergyFastSimParam {
0009 public:
0010   G4double GetInPointEnergyFraction(G4double energy) const {
0011     // normalisation of fit parameters to have the result
0012     constexpr const G4double a0 = 1.02186764;
0013     constexpr const G4double a1 = 2.14064635e-02 / a0;
0014     constexpr const G4double a2 = 1.96988997e-04 / a0;
0015     constexpr const G4double a3 = -6.42310317e-07 / a0;
0016     const G4double e2 = energy * energy;
0017     const G4double e3 = e2 * energy;
0018     return a3 * e3 + a2 * e2 - a1 * energy + 1.0;
0019   }
0020 
0021   G4double GetRadius(G4double energy) const {
0022     constexpr const G4double r1 = 156.52094133;
0023     constexpr const G4double r2 = -1.02220543;
0024     const G4double r0 = r1 + r2 * energy;
0025     return std::sqrt(r0 / G4UniformRand() - r0);
0026   }
0027 
0028   G4double GetZ() const {
0029     constexpr const G4double alpha = 1.0 / 0.02211515;
0030     constexpr const G4double t = 0.66968625;
0031     return -G4Log(G4UniformRand()) * alpha + t;
0032   }
0033 };
0034 
0035 #endif