13#include "FairPrimaryGenerator.h"
14#include "TDatabasePDG.h"
32 theta = 180 * theta / TMath::Pi();
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)));
44 double r3 =
rng->Uniform();
46 TMath::ErfInverse(r3 * norm +
47 TMath::Erf(gamma * (offset + TMath::Log(minE)))) /
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));
81 px = TMath::Sin(phi) * TMath::Sin(
theta);
82 pz = TMath::Cos(phi) * TMath::Sin(
theta);
94 TDatabasePDG* pdgBase = TDatabasePDG::Instance();
95 mass = pdgBase->GetParticle(13)->Mass();
96 cout <<
"--------------------------------------------------------------------"
99 cout <<
"configuration for the CMBG as defined in "
100 "$FAIRSHIP/python/CMBG_conf.py: "
102 cout <<
"x_dist: " <<
xdist << endl;
103 cout <<
"z_dist: " <<
zdist << endl;
104 cout <<
"x_box: " <<
xBox << endl;
105 cout <<
"y_box: " <<
yBox << endl;
106 cout <<
"z_box: " <<
zBox << endl;
107 cout <<
"n_EVENTS:" <<
n_EVENTS << endl;
108 cout <<
"minE: " <<
minE << endl << endl;
110 cout <<
"check the configuration for unphysical behavior." << endl
111 <<
"We stop the execution." << endl
118 cout <<
"Simulation for high momentum" << endl;
120 cout <<
"Simulation for low momentum" << endl;
128 double weight_flux, weight_DetectorBox;
132 cout <<
"choose minE < 100 !" << endl;
135 double dt = TMath::Pi() / 2 / 100;
136 for (
double t = dt / 2; t < TMath::Pi() / 2; t += dt) {
145 cout <<
"High E CM flux: " <<
FluxIntegral <<
"m-2s-1" << endl;
156 weight = weight_flux / weight_DetectorBox;
157 cout <<
"weight_DetectorBox: " << weight_DetectorBox <<
", weight: " <<
weight
159 cout <<
"--------------------------------------------------------------------"
185 PID,
px,
py,
pz,
x,
y,
z, -1,
true, TMath::Sqrt(
P *
P +
mass *
mass), 0,
188 cout <<
nInside / 10000 <<
"10k events have been simulated" << endl;
double fSpectrumL(double theta, double minE, Bool_t generateP)
double Uniform(Float_t min, Float_t max)
Bool_t ReadEvent(FairPrimaryGenerator *) override
virtual Bool_t Init(Bool_t largeMom)