SND@LHC Software
Loading...
Searching...
No Matches
Co3Rng Class Reference

#include <CosmicsGenerator.h>

Public Member Functions

 Co3Rng ()
 
virtual ~Co3Rng ()
 
double Uniform (Float_t min, Float_t max)
 
double fSpectrumL (double theta, double minE, Bool_t generateP)
 

Public Attributes

TF1 * fSpectrumH
 
TF1 * fTheta
 

Private Attributes

TRandom3 * rng
 

Detailed Description

Definition at line 21 of file CosmicsGenerator.h.

Constructor & Destructor Documentation

◆ Co3Rng()

Co3Rng::Co3Rng ( )
inline

Definition at line 23 of file CosmicsGenerator.h.

23 {
24 rng = new TRandom3(gRandom->GetSeed());
25 fTheta = new TF1("f2","cos(x)*cos(x)",0,TMath::Pi()/2);
26 fTheta->SetNpx(10);
27 fSpectrumH = new TF1("f4","1400*TMath::Power(x,-2.7)*(1/(1+x/115)+0.054/(1+x/850))",100,1000); // momentum above 100GeV
28 };
TF1 * fSpectrumH
TRandom3 * rng

◆ ~Co3Rng()

virtual Co3Rng::~Co3Rng ( )
inlinevirtual

Definition at line 29 of file CosmicsGenerator.h.

29{delete rng; delete fTheta; delete fSpectrumH;};

Member Function Documentation

◆ fSpectrumL()

double Co3Rng::fSpectrumL ( double  theta,
double  minE,
Bool_t  generateP = 1 
)

Definition at line 16 of file CosmicsGenerator.cxx.

16 {
17 // 2 Options: a) generateP, b) calcInt
18 // see doi: 10.1016/j.nuclphysbps.2005.07.056. for flux details
19 // ad a) returns a random P between minE and 100GeV taken from the
20 // zenith angle dependend momentum distribution
21 // Here, the inverse of the function is computed and a random
22 // number between 0 and 1 mapped to the interval [minE, 100[ GeV
23 // ad b) return the momentum-integrated flux for a given zenith angle
24 // from minE to 100 GeV. Result in cm-2s-1
25
26 theta = 180*theta/TMath::Pi(); // theta in degrees
27 double a = -0.8816/10000 /(1/theta -0.1117/1000 * theta) - 0.1096 - 0.01966*TMath::Exp(-0.02040*theta);
28 double b = 0.4169/100 /(1/theta -0.9891/10000 * theta) + 4.0395 - 4.3118*TMath::Exp(0.9235/1000*theta);
29 double btilde = b + 1.0/TMath::Ln10();
30 double gamma = sqrt(-TMath::Ln10()*a);
31 double offset = 0.5*btilde/a;
32 double norm = TMath::Erf(gamma*(TMath::Log(100)+offset)) - TMath::Erf(gamma*(offset + TMath::Log(minE)));
33
34 if (generateP){
35 double r3 = rng->Uniform();
36 return exp(TMath::ErfInverse(r3*norm+TMath::Erf(gamma*(offset + TMath::Log(minE))))/gamma-offset);
37 }
38 else{
39 double c = -0.3516/1000 * theta*theta + 0.8861/100 * theta - 2.5985 -0.8745/100000*TMath::Exp(0.1457*theta);
40 double scale = 0.5*TMath::Sqrt(TMath::Pi())/gamma * TMath::Power(10,(-0.25/a*btilde*btilde + c));
41 return scale * norm;
42 }
43}
c
Definition hnl.py:100

◆ Uniform()

double Co3Rng::Uniform ( Float_t  min,
Float_t  max 
)
inline

Definition at line 30 of file CosmicsGenerator.h.

30{return rng->Uniform(min,max);};

Member Data Documentation

◆ fSpectrumH

TF1* Co3Rng::fSpectrumH

Definition at line 31 of file CosmicsGenerator.h.

◆ fTheta

TF1* Co3Rng::fTheta

Definition at line 32 of file CosmicsGenerator.h.

◆ rng

TRandom3* Co3Rng::rng
private

Definition at line 35 of file CosmicsGenerator.h.


The documentation for this class was generated from the following files: