Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JRadiation2D.cc File Reference

Example program to histogram shower energy as a function of the muon energy. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TH2D.h"
#include "JPhysics/JRadiation.hh"
#include "JPhysics/JRadiationFunction.hh"
#include "JPhysics/JRadiationSource.hh"
#include "JPhysics/JGeane.hh"
#include "JPhysics/JConstants.hh"
#include "JSirene/JSeaWater.hh"
#include "JLang/JSharedPointer.hh"
#include "Jeep/JPrint.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Detailed Description

Example program to histogram shower energy as a function of the muon energy.

Author
mdejong

Definition in file JRadiation2D.cc.

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )

Definition at line 29 of file JRadiation2D.cc.

30{
31 using namespace std;
32
33 string outputFile;
35 int debug;
36
37 try {
38
39 JParser<> zap("Example program to histogram shower energy.");
40
41 zap['o'] = make_field(outputFile) = "radiation.root";
42 zap['n'] = make_field(numberOfPoints) = 0;
43 zap['d'] = make_field(debug) = 0;
44
45 zap(argc, argv);
46 }
47 catch(const exception &error) {
48 FATAL(error.what() << endl);
49 }
50
51
52 using namespace JPP;
53
54
55 TFile out(outputFile.c_str(), "recreate");
56
57 TH2* h0 = new TH2D("total", NULL, 24, 2.0, 10.0, 50, 0.0, 10.0); // master histogram
58
59 NOTICE("Setting up radiation tables... " << flush);
60
62 typedef vector<tuple> ntuple;
63
64 ntuple radiation;
65
66 const JRadiation hydrogen ( 1.0, 1.0, 40, 0.01, 0.1, 0.1);
67 const JRadiation oxygen ( 8.0, 16.0, 40, 0.01, 0.1, 0.1);
68 const JRadiation chlorine (17.0, 35.0, 40, 0.01, 0.1, 0.1);
69 const JRadiation sodium (11.0, 23.0, 40, 0.01, 0.1, 0.1);
70
71 JSharedPointer<JRadiation> Hydrogen (new JRadiationFunction(hydrogen, 300, 0.2, 1.0e11));
72 JSharedPointer<JRadiation> Oxygen (new JRadiationFunction(oxygen, 300, 0.2, 1.0e11));
73 JSharedPointer<JRadiation> Chlorine (new JRadiationFunction(chlorine, 300, 0.2, 1.0e11));
74 JSharedPointer<JRadiation> Sodium (new JRadiationFunction(sodium, 300, 0.2, 1.0e11));
75
76 radiation.push_back(tuple(new JRadiationSource(11, Oxygen, DENSITY_SEA_WATER * JSeaWater::O(), EErad_t), (TH2D*) h0->Clone("[eerad O]" )));
77 radiation.push_back(tuple(new JRadiationSource(12, Chlorine, DENSITY_SEA_WATER * JSeaWater::Cl(), EErad_t), (TH2D*) h0->Clone("[eerad Cl]")));
78 radiation.push_back(tuple(new JRadiationSource(13, Hydrogen, DENSITY_SEA_WATER * JSeaWater::H(), EErad_t), (TH2D*) h0->Clone("[eerad H]" )));
79 radiation.push_back(tuple(new JRadiationSource(14, Sodium, DENSITY_SEA_WATER * JSeaWater::Na(), EErad_t), (TH2D*) h0->Clone("[eerad Na]" )));
80
81 radiation.push_back(tuple(new JRadiationSource(21, Oxygen, DENSITY_SEA_WATER * JSeaWater::O(), Brems_t), (TH2D*) h0->Clone("[Brems O]" )));
82 radiation.push_back(tuple(new JRadiationSource(22, Chlorine, DENSITY_SEA_WATER * JSeaWater::Cl(), Brems_t), (TH2D*) h0->Clone("[Brems Cl]")));
83 radiation.push_back(tuple(new JRadiationSource(23, Hydrogen, DENSITY_SEA_WATER * JSeaWater::H(), Brems_t), (TH2D*) h0->Clone("[Brems H]" )));
84 radiation.push_back(tuple(new JRadiationSource(24, Sodium, DENSITY_SEA_WATER * JSeaWater::Na(), Brems_t), (TH2D*) h0->Clone("[Brems Na]" )));
85
86 radiation.push_back(tuple(new JRadiationSource(31, Oxygen, DENSITY_SEA_WATER * JSeaWater::O(), GNrad_t), (TH2D*) h0->Clone("[gnrad O]" )));
87 radiation.push_back(tuple(new JRadiationSource(32, Chlorine, DENSITY_SEA_WATER * JSeaWater::Cl(), GNrad_t), (TH2D*) h0->Clone("[gnrad Cl]")));
88 radiation.push_back(tuple(new JRadiationSource(33, Hydrogen, DENSITY_SEA_WATER * JSeaWater::H(), GNrad_t), (TH2D*) h0->Clone("[gnrad H]" )));
89 radiation.push_back(tuple(new JRadiationSource(34, Sodium, DENSITY_SEA_WATER * JSeaWater::Na(), GNrad_t), (TH2D*) h0->Clone("[gnrad Na]" )));
90
91 NOTICE("OK" << endl);
92
93 for (int i = 1; i <= h0->GetXaxis()->GetNbins(); ++i) {
94
95 const double x = h0->GetXaxis()->GetBinCenter(i);
96 const double E = pow(10.0, x);
97
98 STATUS("Energy: " << SCIENTIFIC(8,1) << E << '\r'); DEBUG(endl);
99
100 for (ntuple::iterator p = radiation.begin(); p != radiation.end(); ++p) {
101
102 for (int n = 0; n != numberOfPoints; ++n) {
103
104 const double Es = p->first->getEnergyOfShower(E);
105
106 p->second->Fill(x, log10(Es), 1.0 / (double) numberOfPoints);
107 }
108 }
109 STATUS(endl);
110 }
111
112 delete h0;
113
114 out.Write();
115 out.Close();
116}
string outputFile
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define STATUS(A)
Definition JMessage.hh:63
#define NOTICE(A)
Definition JMessage.hh:64
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
int numberOfPoints
Definition JResultPDF.cc:22
The template JSharedPointer class can be used to share a pointer to an object.
Utility class to parse command line options.
Definition JParser.hh:1698
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.
Definition JRadiation.hh:36
T pow(const T &x, const double y)
Power .
Definition JMath.hh:97
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
const int n
Definition JPolint.hh:791
Auxiliary data structure for floating point format specification.
Definition JManip.hh:488