Jpp 21.0.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JDrawPDE.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 "TH1D.h"
9
10#include "JPhysics/JPDF.hh"
11#include "JPhysics/Antares.hh"
12#include "JPhysics/KM3NeT.hh"
15#include "JTools/JQuantiles.hh"
18#include "Jeep/JProperties.hh"
19#include "Jeep/JPrint.hh"
20#include "Jeep/JParser.hh"
21#include "Jeep/JMessage.hh"
22
23
24/**
25 * \file
26 *
27 * Auxiliary program to draw PDF of Cherenkov light from EM-shower including shower profile.
28 * \author mdejong
29 */
30int main(int argc, char **argv)
31{
32 using namespace std;
33 using namespace JPP;
34
36
37 string outputFile;
39 double epsilon;
40 PDF::configuration_type configuration;
41 double E;
42 double D;
43 double cd;
44 JAngle3D dir;
45 vector<int> function;
46 JHistogram_t histogram;
47 int debug;
48
49 try {
50
51 JProperties properties = configuration.getProperties();
52
53 JParser<> zap("Auxiliary program to draw PDF of Cherenkov light from EM-shower including shower profile.");
54
55 zap['@'] = make_field(properties, PDF::help() << configuration) = JPARSER::initialised();
56 zap['o'] = make_field(outputFile) = "";
57 zap['n'] = make_field(numberOfPoints, "points for integration") = 25;
58 zap['e'] = make_field(epsilon, "precision for integration") = 1.0e-10;
59 zap['E'] = make_field(E, "shower energy [GeV]");
60 zap['R'] = make_field(D, "distance [m]");
61 zap['c'] = make_field(cd, "cosine emission angle");
62 zap['D'] = make_field(dir, "(theta, phi) of PMT [rad]");
63 zap['F'] = make_field(function, "PDF type");
64 zap['H'] = make_field(histogram, "histogram binning") = JHistogram_t();
65 zap['d'] = make_field(debug) = 0;
66
67 zap(argc, argv);
68 }
69 catch(const exception &error) {
70 FATAL(error.what() << endl);
71 }
72
73
74 const JPDF_C
75 pdf(NAMESPACE::getPhotocathodeArea(),
76 PDF::getQE,
77 PDF::getAngularAcceptance,
78 PDF::getAbsorptionLength,
79 PDF::getScatteringLength,
80 PDF::getScatteringProbability,
81 NAMESPACE::getAmbientPressure(),
82 getMinimalWavelength(),
83 getMaximalWavelength(),
85 epsilon);
86
87
88 if (outputFile == "") {
89
90 cout << "enter time (^C to exit) > " << flush;
91
92 for (double dt; cin >> dt; ) {
93
94 for (vector<int>::const_iterator F = function.begin(); F != function.end(); ++F) {
95
96 cout << setw(2) << *F << ' '
97 << SCIENTIFIC(7,1) << E << ' '
98 << FIXED(5,1) << D << ' '
99 << FIXED(5,2) << cd << ' '
100 << FIXED(5,2) << dir.getTheta() << ' '
101 << FIXED(5,2) << dir.getPhi() << ' '
102 << FIXED(5,1) << dt << ' '
103 << SCIENTIFIC(9,3) << pdf.getLightFromEMshower(*F, E, D, cd, dir.getTheta(), dir.getPhi(), dt) << endl;
104 }
105 }
106
107 return 0;
108 }
109
110
111 TFile out(outputFile.c_str(), "recreate");
112
113 //const double t0 = D * getIndexOfRefraction() / C; // time [ns]
114 const double t0 = 0.0; // time [ns]
115
116 if (!histogram.is_valid()) {
117
118 if (function.size() == 1 && function[0] == DIRECT_LIGHT_FROM_EMSHOWER) {
119
120 histogram = JHistogram_t(t0 - 20.0, t0 + 50.0);
121
122 histogram.setBinWidth(0.1);
123
124 } else {
125
126 histogram = JHistogram_t(t0 - 20.0, t0 + 500.0);
127
128 histogram.setBinWidth(0.5);
129 }
130 }
131
132 TH1D h0("h0", NULL, histogram.getNumberOfBins(), histogram.getLowerLimit(), histogram.getUpperLimit());
133
135
136 for (int i = 1; i <= h0.GetNbinsX(); ++i) {
137
138 const double dt = h0.GetBinCenter(i) - t0;
139
140 double value = 0.0;
141
142 for (vector<int>::const_iterator F = function.begin(); F != function.end(); ++F) {
143 value += pdf.getLightFromEMshower(*F, E, D, cd, dir.getTheta(), dir.getPhi(), dt);
144 }
145
146 h0.SetBinContent(i, value);
147
148 f1[dt] = value;
149 }
150
151 f1.compile();
152
153 try {
154
155 JQuantiles quantiles(f1);
156
157 DEBUG("int " << quantiles.getIntegral() << endl);
158 DEBUG("x " << quantiles.getX() << endl);
159 DEBUG("y " << quantiles.getY() << endl);
160 DEBUG("FWHM " << quantiles.getFWHM() << endl);
161 }
162 catch(const exception&) {}
163
164 out.Write();
165 out.Close();
166}
Properties of Antares PMT and deep-sea water.
string outputFile
General purpose messaging.
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:74
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2107
I/O formatting auxiliaries.
Utility class to parse parameter values.
int numberOfPoints
Definition JResultPDF.cc:22
Properties of KM3NeT PMT and deep-sea water.
Utility class to parse parameter values.
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:1664
Probability Density Functions of the time response of a PMT with an implementation of the JAbstractPM...
Definition JPDF.hh:2188
double getLightFromEMshower(const int type, const double D_m, const double cd, const double theta, const double phi, const double t_ns) const
Probability density function for light from EM-shower.
Definition JPDF.hh:1821
Quantile calculator for a given interpolating function.
Definition JQuantiles.hh:34
double getIntegral() const
Get integral of function.
double getY() const
Get value of maximum.
double getX() const
Get position of maximum.
double getFWHM() const
Get Full Width at Half Maximum.
T getLowerLimit() const
Get lower limit.
Definition JRange.hh:202
T getUpperLimit() const
Get upper limit.
Definition JRange.hh:213
Template class for spline interpolation in 1D.
Definition JSpline.hh:734
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:66
Auxiliary data structure for complete configuration.
JProperties getProperties()
Get properties.
Manipulator for help output.
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 data structure for floating point format specification.
Definition JManip.hh:488