Jpp 20.0.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JPlotPDE.cc File Reference

Auxiliary program to draw PDF of Cherenkov light from EM-shower including shower profile using interpolation tables. More...

#include <string>
#include <iostream>
#include <fstream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "JTools/JFunction1D_t.hh"
#include "JTools/JFunctionalMap_t.hh"
#include "JTools/JAbstractHistogram.hh"
#include "JPhysics/JPDFTransformer.hh"
#include "JPhysics/JPDFTable.hh"
#include "JPhysics/JPDFTypes.hh"
#include "JPhysics/JGeanz.hh"
#include "JGeometry3D/JAngle3D.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

Auxiliary program to draw PDF of Cherenkov light from EM-shower including shower profile using interpolation tables.

Author
mdejong

Definition in file JPlotPDE.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 30 of file JPlotPDE.cc.

31{
32 using namespace std;
33 using namespace JPP;
34
36
37 string inputFile;
38 string outputFile;
39 double E;
40 double D;
41 double cd;
42 JAngle3D dir;
43 double TTS_ns;
44 JHistogram_t histogram;
45 int debug;
46
47 try {
48
49 JParser<> zap("Auxiliary program to draw PDF of Cherenkov light from EM-shower including shower profile using interpolation tables.");
50
51 zap['f'] = make_field(inputFile);
52 zap['o'] = make_field(outputFile) = "";
53 zap['E'] = make_field(E, "shower energy [GeV]") = 1.0;
54 zap['R'] = make_field(D, "distance [m]");
55 zap['c'] = make_field(cd, "cosine emission angle");
56 zap['D'] = make_field(dir, "(theta, phi) of PMT [rad]");
57 zap['T'] = make_field(TTS_ns, "PMT time smearing [ns]") = 0.0; // [ns]
58 zap['H'] = make_field(histogram, "histogram binning") = JHistogram_t();
59 zap['d'] = make_field(debug) = 0;
60
61 zap(argc, argv);
62 }
63 catch(const exception &error) {
64 FATAL(error.what() << endl);
65 }
66
67
68 typedef JSplineFunction1S_t JFunction1D_t;
73 JPolint1FunctionalGridMap>::maplist JMapList_t;
75
76 JPDF_t pdf;
77
78 try {
79
80 NOTICE("loading input from file " << inputFile << "... " << flush);
81
82 pdf.load(inputFile.c_str());
83
84 pdf.setExceptionHandler(new JFunction1D_t::JDefaultResult(JMATH::zero));
85
86 if (TTS_ns > 0.0) {
87 pdf.blur(TTS_ns);
88 }
89
90 NOTICE("OK" << endl);
91 }
92 catch(const JException& error) {
93 FATAL(error.what() << endl);
94 }
95
96 const double x = log10(E);
97
98 if (outputFile == "") {
99
100 for (double dt; cin >> dt; ) {
101
102 JFunction1D_t::result_type y = pdf(x, D, cd, dir.getTheta(), dir.getPhi(), dt);
103
104 cout << SCIENTIFIC(7,1) << E << ' '
105 << FIXED(5,1) << D << ' '
106 << FIXED(5,2) << cd << ' '
107 << FIXED(5,2) << dir.getTheta() << ' '
108 << FIXED(5,2) << dir.getPhi() << ' '
109 << FIXED(5,1) << dt << ' '
110 << SCIENTIFIC(9,3) << get_value(y) << ' '
111 << SCIENTIFIC(9,3) << get_derivative(y) << ' '
112 << SCIENTIFIC(9,3) << get_integral(y) << ' '
113 << SCIENTIFIC(9,3) << get_total_integral(y) << endl;
114 }
115
116 return 0;
117 }
118
119
120 TFile out(outputFile.c_str(), "recreate");
121
122 //const double t0 = D * getIndexOfRefraction() / C; // time [ns]
123 const double t0 = 0.0; // time [ns]
124
125 if (!histogram.is_valid()) {
126
127 histogram = JHistogram_t(t0 - 20.0, t0 + 500.0);
128
129 histogram.setBinWidth(0.5);
130 }
131
132 TH1D h0("h0", NULL, histogram.getNumberOfBins(), histogram.getLowerLimit(), histogram.getUpperLimit());
133
134 for (int i = 1; i <= h0.GetNbinsX(); ++i) {
135
136 const double dt = h0.GetBinCenter(i) - t0;
137
138 JFunction1D_t::result_type Y = pdf(x, D, cd, dir.getTheta(), dir.getPhi(), dt) * E;
139
140 h0.SetBinContent(i, get_value(Y));
141 }
142
143 out.Write();
144 out.Close();
145}
string outputFile
#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
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
General exception.
Definition JException.hh:24
virtual const char * what() const override
Get error message.
Definition JException.hh:64
Utility class to parse command line options.
Definition JParser.hh:1698
Multi-dimensional PDF table for arrival time of Cherenkov light.
Definition JPDFTable.hh:44
T getLowerLimit() const
Get lower limit.
Definition JRange.hh:202
T getUpperLimit() const
Get upper limit.
Definition JRange.hh:213
static const JZero zero
Function object to assign zero value.
Definition JZero.hh:105
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JResultEvaluator< JResult_t >::result_type get_derivative(const JResult_t &value)
Helper method to convert function value to derivative value.
Definition JResult.hh:1011
JResultEvaluator< JResult_t >::result_type get_total_integral(const JResult_t &value)
Helper method to convert function value to total integral value.
Definition JResult.hh:1037
JResultEvaluator< JResult_t >::result_type get_integral(const JResult_t &value)
Helper method to convert function value to partial integral value.
Definition JResult.hh:1024
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
Simple data structure for histogram binning.
void setBinWidth(const abscissa_type dx, int option=0)
Set bin width.
bool is_valid() const
Check validity of histogram binning.
int getNumberOfBins() const
Get number of bins.
Auxiliary class for recursive map list generation.
Definition JMapList.hh:109
Type definition of a 1st degree polynomial interpolation based on a JGridMap implementation.
Type definition of a 1st degree polynomial interpolation based on a JMap implementation.
Type definition of a spline interpolation method based on a JCollection with JResultPDF result type.
Auxiliary data structure for floating point format specification.
Definition JManip.hh:488