Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JPhysics/JShowerNPE.cc
Go to the documentation of this file.
1
2#include <string>
3#include <iostream>
4#include <iomanip>
5
6#include "TROOT.h"
7#include "TFile.h"
8#include "TH2D.h"
9
11#include "JPhysics/JNPE_t.hh"
13#include "Jeep/JPrint.hh"
14#include "Jeep/JParser.hh"
15#include "Jeep/JMessage.hh"
16
17
18/**
19 * \file
20 *
21 * Program to plot PDF of Cherenkov light from EM-shower using interpolation tables.
22 * \author lquinn
23 */
24int main(int argc, char **argv)
25{
26 using namespace std;
27 using namespace JPP;
28
30
31 string pdfFile;
32 string outputFile;
33 JAngle3D dir;
36 double E;
38 int debug;
39
40 try {
41
42 JParser<> zap("Program to plot PDF of Cherenkov light from EM-shower using interpolation tables.");
43
44 zap['P'] = make_field(pdfFile);
45 zap['o'] = make_field(outputFile) = "";
46 zap['D'] = make_field(dir, "(theta, phi) of PMT [rad]");
47 zap['x'] = make_field(x, "histogram x-binning") = JHistogram_t();
48 zap['y'] = make_field(y, "histogram y-binning") = JHistogram_t();
49 zap['E'] = make_field(E, "Energy [GeV]") = 0.0;
50 zap['N'] = make_field(numberOfPoints) = 0;
51 zap['d'] = make_field(debug) = 0;
52
53 zap(argc, argv);
54 }
55 catch(const exception &error) {
56 FATAL(error.what() << endl);
57 }
58
59
60 const JShowerNPE_t npe(pdfFile, numberOfPoints);
61
62
63 TFile out(outputFile.c_str(), "recreate");
64
65 if (!x.is_valid()) { x = JHistogram_t(150, 0.0, 150.0); }
66 if (!y.is_valid()) { y = JHistogram_t(200, -1.0, +1.0); }
67
68 TH2D h0("h0", "PDF Projection; D [m]; cos #theta_{0}",
69 x.getNumberOfBins(), x.getLowerLimit(), x.getUpperLimit(),
70 y.getNumberOfBins(), y.getLowerLimit(), y.getUpperLimit());
71
72 for (int ix = 1; ix <= h0.GetNbinsX(); ++ix) {
73 for (int iy = 1; iy <= h0.GetNbinsY(); ++iy) {
74
75 const double cd = h0.GetYaxis()->GetBinCenter(iy);
76 const double D = h0.GetXaxis()->GetBinCenter(ix);
77
78 const double Y = npe.calculate(E, D, cd, dir.getTheta(), dir.getPhi());
79
80 h0.SetBinContent(ix, iy, Y/E);
81 }
82 }
83
84 out.Write();
85 out.Close();
86}
string outputFile
General purpose messaging.
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
Auxiliary data structure for muon PDF.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
int main(int argc, char **argv)
I/O formatting auxiliaries.
int numberOfPoints
Definition JResultPDF.cc:22
Data structure for angles in three dimensions.
Definition JAngle3D.hh:35
double getTheta() const
Get theta angle.
Definition JAngle3D.hh:86
double getPhi() const
Get phi angle.
Definition JAngle3D.hh:97
Utility class to parse command line options.
Definition JParser.hh:1698
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for shower PDF.
Definition JNPE_t.hh:175
double calculate(const double E, const double D, const double cd, const double theta, const double phi) const
Get PDF.
Definition JNPE_t.hh:249
Simple data structure for histogram binning.