FairShip
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 23 of file CosmicsGenerator.h.

Constructor & Destructor Documentation

◆ Co3Rng()

Co3Rng::Co3Rng ( )
inline

Definition at line 25 of file CosmicsGenerator.h.

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

◆ ~Co3Rng()

virtual Co3Rng::~Co3Rng ( )
inlinevirtual

Definition at line 33 of file CosmicsGenerator.h.

33 {
34 delete rng;
35 delete fTheta;
36 delete fSpectrumH;
37 };

Member Function Documentation

◆ fSpectrumL()

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

Definition at line 22 of file CosmicsGenerator.cxx.

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

◆ Uniform()

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

Definition at line 38 of file CosmicsGenerator.h.

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

Member Data Documentation

◆ fSpectrumH

TF1* Co3Rng::fSpectrumH

Definition at line 39 of file CosmicsGenerator.h.

◆ fTheta

TF1* Co3Rng::fTheta

Definition at line 40 of file CosmicsGenerator.h.

◆ rng

TRandom3* Co3Rng::rng
private

Definition at line 44 of file CosmicsGenerator.h.


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