27 static const std::string LENGTH =
"length";
28 static const std::string ENERGY =
"energy";
29 static const std::string RANGE =
"range";
30 static const std::string ELOSS =
"eloss";
39 inline TH1* clone(TH1* h1,
const char* buffer)
42 return (TH1*) h1->Clone(buffer);
56 int main(
int argc,
char* argv[])
67 JParser<> zap(
"Example program to histogram radiation cross sections, shower energy, range and b(E).");
71 zap[
'O'] =
make_field(option) = LENGTH, ENERGY, RANGE, ELOSS;
76 catch(
const exception &error) {
77 FATAL(error.what() << endl);
88 if (option == LENGTH) {
89 h0 =
new TH1D(
"total", NULL, 160, 2.0, 10.0);
92 if (option == ENERGY) {
93 h0 =
new TH1D(
"total", NULL, 24, 2.0, 10.0);
96 NOTICE(
"Setting up radiation tables... " << flush);
103 const JRadiation hydrogen ( 1.0, 1.0, 40, 0.01, 0.1, 0.1);
104 const JRadiation oxygen ( 8.0, 16.0, 40, 0.01, 0.1, 0.1);
105 const JRadiation chlorine (17.0, 35.0, 40, 0.01, 0.1, 0.1);
106 const JRadiation sodium (11.0, 23.0, 40, 0.01, 0.1, 0.1);
131 if (option == LENGTH) {
133 for (
int i = 1; i <= h0->GetNbinsX(); ++i) {
135 const double x = h0->GetBinCenter(i);
136 const double E =
pow(10.0,
x);
140 for (ntuple::iterator p = radiation.begin(); p != radiation.end(); ++p) {
142 const double li = p->first->getInverseInteractionLength(E);
144 p->second->Fill(
x, 1.0/li);
151 if (option == ENERGY) {
153 for (
int i = 1; i <= h0->GetNbinsX(); ++i) {
155 const double x = h0->GetBinCenter(i);
156 const double E =
pow(10.0,
x);
160 for (ntuple::iterator p = radiation.begin(); p != radiation.end(); ++p) {
165 Q.
put(p->first->getEnergyOfShower(E));
168 p->second->SetBinContent(i, Q.
getMean());
176 if (option == RANGE) {
178 TH1D* Ra =
new TH1D(
"R[analytical]", NULL, 12, 2.0, 8.0);
179 TH1D* Rb =
new TH1D(
"R[numerical]", NULL, 12, 2.0, 8.0);
181 for (
int i = 1; i <= Ra->GetNbinsX(); ++i) {
183 const double x = Ra->GetBinCenter(i);
184 const double E0 =
pow(10.0,
x);
185 const double Z =
gWater(E0);
187 Ra->SetBinContent(i, Z*1e-3);
190 for (
int j = 1;
j <= Rb->GetNbinsX(); ++
j) {
192 const double x = Rb->GetBinCenter(
j);
193 const double E0 =
pow(10.0,
x);
206 const int N = radiation.size();
211 for (
int i = 0; i != N; ++i) {
212 ls += li[i] = radiation[i].first->getInverseInteractionLength(E);
215 double dz = min(gRandom->Exp(1.0) /
ls,
gWater(E));
220 double y = gRandom->Uniform(
ls);
222 for (
int i = 0; i != N; ++i) {
227 Es = radiation[i].first->getEnergyOfShower(E);
239 Rb->SetBinContent(
j, Q.
getMean() * 1e-3);
246 if (option == ELOSS) {
248 TH1D* hb =
new TH1D(
"hb", NULL, 12, 2.0, 8.0);
250 for (
int j = 1;
j <= hb->GetNbinsX(); ++
j) {
252 const double x = hb->GetBinCenter(
j);
253 const double E =
pow(10.0,
x);
259 const int N = radiation.size();
264 for (
int i = 0; i != N; ++i) {
265 ls += li[i] = radiation[i].first->getInverseInteractionLength(E);
271 double y = gRandom->Uniform(
ls);
273 for (
int i = 0; i != N; ++i) {
278 Es = radiation[i].first->getEnergyOfShower(E);
General purpose messaging.
#define DEBUG(A)
Message macros.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
I/O formatting auxiliaries.
int main(int argc, char *argv[])
Muon radiative cross sections.
Utility class to parse command line options.
virtual double getA() const override
Get energy loss constant.
Fast implementation of class JRadiation.
Implementation for calculation of inverse interaction length and shower energy.
Auxiliary class for the calculation of the muon radiative cross sections.
T pow(const T &x, const double y)
Power .
static const JRadiationSource_t GNrad_t
static const double DENSITY_SEA_WATER
Fixed environment values.
static const JRadiationSource_t Brems_t
static const double H
Planck constant [eV s].
static const JGeaneWater gWater
Function object for energy loss of muon in sea water.
static const JRadiationSource_t EErad_t
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure to list files in directory.
Auxiliary data structure for floating point format specification.