Jpp 21.0.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JMakePDG.cc File Reference

Program to create interpolation tables of the PDF of the arrival time of the Cherenkov light from a shower. More...

#include <string>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <set>
#include <map>
#include <cmath>
#include "JTools/JFunction1D_t.hh"
#include "JTools/JFunctionalMap_t.hh"
#include "JTools/JQuadrature.hh"
#include "JPhysics/JPDF.hh"
#include "JPhysics/JPDFTable.hh"
#include "JPhysics/Antares.hh"
#include "JPhysics/KM3NeT.hh"
#include "JPhysics/JPDFSupportkit.hh"
#include "Jeep/JProperties.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

Program to create interpolation tables of the PDF of the arrival time of the Cherenkov light from a shower.

The PDFs are tabulated as a function of (D, cos(theta), theta, phi, t), where:

  • D is the distance between the vertex and the PMT;
  • cos(theta) the cosine of the photon emission angle;
  • (theta, phi) the orientation of the PMT; and
  • t the arrival time of the light with respect to the Cherenkov hypothesis.

The orientation of the PMT is defined in the coordinate system in which the shower developes along the z-axis and the PMT is located in the x-z plane.

Author
mdejong

Definition in file JMakePDG.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 38 of file JMakePDG.cc.

39{
40 using namespace std;
41 using namespace JPP;
42
43 string outputFile;
45 double epsilon;
46 PDF::configuration_type configuration;
47 int function;
48 set<double> D; // distance [m]
49 int debug;
50
51 try {
52
53 JProperties properties = configuration.getProperties();
54
55 JParser<> zap("Program to create interpolation tables of the PDF of the arrival time of the Cherenkov light from a shower.");
56
57 zap['@'] = make_field(properties, PDF::help() << configuration) = JPARSER::initialised();
58 zap['o'] = make_field(outputFile);
59 zap['n'] = make_field(numberOfPoints, "points for integration") = 25;
60 zap['e'] = make_field(epsilon, "precision for integration") = 1.0e-10;
61 zap['F'] = make_field(function, "PDF type") =
63 DIRECT_LIGHT_FROM_EMSHOWER,
64 SCATTERED_LIGHT_FROM_EMSHOWER;
65 zap['D'] = make_field(D, "distance [m]") = JPARSER::initialised();
66 zap['d'] = make_field(debug) = 0;
67
68 zap['F'] = JPARSER::not_initialised();
69
70 zap(argc, argv);
71 }
72 catch(const exception &error) {
73 FATAL(error.what() << endl);
74 }
75
76
77 typedef double (JPDF::*fcn)(const double,
78 const double,
79 const double,
80 const double,
81 const double) const;
82
83
84 // set global parameters
85
86 const double P_atm = NAMESPACE::getAmbientPressure();
87 const double wmin = getMinimalWavelength();
88 const double wmax = getMaximalWavelength();
89
90
91 const JPDF_C
92 pdf_c(NAMESPACE::getPhotocathodeArea(),
93 PDF::getQE,
94 PDF::getAngularAcceptance,
95 PDF::getAbsorptionLength,
96 PDF::getScatteringLength,
97 PDF::getScatteringProbability,
98 P_atm,
99 wmin,
100 wmax,
102 epsilon);
103
104
105 typedef JSplineFunction1D_t JFunction1D_t;
109 JPolint1FunctionalGridMap>::maplist JMapList_t;
111
112 typedef JPDFTransformer<4, JFunction1D_t::argument_type> JFunction4DTransformer_t;
114
115 JPDF_t pdf;
116
117
118 NOTICE("building multi-dimensional function object <" << function << ">... " << flush);
119
120 const double ng[] = {
121 pdf_c.getIndexOfRefractionGroup(wmax),
122 pdf_c.getIndexOfRefractionGroup(wmin)
123 };
124
126
127 zmap[SCATTERED_LIGHT_FROM_MUON_5D] = make_pair((fcn) &JPDF::getScatteredLightFromMuon, JFunction4DTransformer_t(21.5, 2, ng[0], 0.0, JGeant(JGeanx(0.33, -9.5)), 6e-4, NAMESPACE::getAngularAcceptance, 0.06));
128 zmap[DIRECT_LIGHT_FROM_EMSHOWER] = make_pair((fcn) &JPDF::getDirectLightFromEMshower, JFunction4DTransformer_t(21.5, 2, ng[0], ng[1], JGeant(JGeanx(0.35, -5.4)), 1e-5, NAMESPACE::getAngularAcceptance, 0.001));
129 zmap[SCATTERED_LIGHT_FROM_EMSHOWER] = make_pair((fcn) &JPDF::getScatteredLightFromEMshower, JFunction4DTransformer_t(21.5, 2, ng[0], 0.0, JGeant(JGeanx(0.55, -4.5)), 1e-2, NAMESPACE::getAngularAcceptance, 0.05));
130
131 if (zmap.find(function) == zmap.end()) {
132 FATAL("illegal function specifier" << endl);
133 }
134
135 fcn f = zmap[function].first; // PDF
136 JFunction4DTransformer_t transformer = zmap[function].second; // transformer
137
138
139 if (D.empty()) {
140 D.insert( 0.10);
141 D.insert( 0.50);
142 D.insert( 1.00);
143 D.insert( 5.00);
144 D.insert( 10.00);
145 D.insert( 20.00);
146 D.insert( 30.00);
147 D.insert( 40.00);
148 D.insert( 50.00);
149 D.insert( 60.00);
150 D.insert( 70.00);
151 D.insert( 80.00);
152 D.insert( 90.00);
153 D.insert(100.00);
154 D.insert(120.00);
155 D.insert(150.00);
156 D.insert(170.00);
157 D.insert(190.00);
158 D.insert(210.00);
159 D.insert(230.00);
160 D.insert(250.00);
161 D.insert(270.00);
162 D.insert(290.00);
163 D.insert(310.00);
164 }
165
166 set<double> C; // cosine emission angle
167
168 JQuadrature qeant(-1.0, +1.0, 60, geanx);
169
170 for (JQuadrature::const_iterator i = qeant.begin(); i != qeant.end(); ++i)
171 C.insert(i->getX());
172
173 C.insert(-1.00);
174 C.insert(+1.00);
175
176
177 set<double> X; // time [ns]
178
179 if (function == DIRECT_LIGHT_FROM_EMSHOWER) {
180
181 for (double buffer[] = { 0.0, 0.005, 0.01, 0.015, -1 }, *x = buffer; *x >= 0; ++x) {
182 X.insert(0.0 + *x);
183 X.insert(1.0 - *x);
184 }
185
186 for (double x = 0.02; x < 0.99; x += 0.01)
187 X.insert(x);
188
189 } else {
190
191 X.insert( 0.00);
192 X.insert( 0.10);
193 X.insert( 0.20);
194 X.insert( 0.30);
195 X.insert( 0.40);
196 X.insert( 0.50);
197 X.insert( 0.60);
198 X.insert( 0.70);
199 X.insert( 0.80);
200 X.insert( 0.90);
201 X.insert( 1.00);
202 X.insert( 1.00);
203 X.insert( 1.10);
204 X.insert( 1.20);
205 X.insert( 1.30);
206 X.insert( 1.40);
207 X.insert( 1.50);
208 X.insert( 1.60);
209 X.insert( 1.70);
210 X.insert( 1.80);
211 X.insert( 1.90);
212 X.insert( 2.00);
213 X.insert( 2.20);
214 X.insert( 2.40);
215 X.insert( 2.60);
216 X.insert( 2.80);
217 X.insert( 3.00);
218 X.insert( 3.25);
219 X.insert( 3.50);
220 X.insert( 3.75);
221 X.insert( 4.00);
222 X.insert( 4.25);
223 X.insert( 4.50);
224 X.insert( 4.75);
225 X.insert( 5.0);
226 X.insert( 6.0);
227 X.insert( 7.0);
228 X.insert( 8.0);
229 X.insert( 9.0);
230 X.insert( 10.0);
231 X.insert( 15.0);
232 X.insert( 20.0);
233 X.insert( 25.0);
234 X.insert( 30.0);
235 X.insert( 40.0);
236 X.insert( 50.0);
237 X.insert( 60.0);
238 X.insert( 70.0);
239 X.insert( 80.0);
240 X.insert( 90.0);
241 X.insert(100.0);
242 X.insert(120.0);
243 X.insert(140.0);
244 X.insert(160.0);
245 X.insert(180.0);
246 X.insert(200.0);
247 X.insert(250.0);
248 X.insert(300.0);
249 X.insert(350.0);
250 X.insert(400.0);
251 X.insert(450.0);
252 X.insert(500.0);
253 X.insert(600.0);
254 X.insert(700.0);
255 X.insert(800.0);
256 X.insert(900.0);
257 X.insert(1200.0);
258 X.insert(1500.0);
259 }
260
261 const double grid = 7.0; // [deg]
262
263 const double alpha = 2.0 * sqrt(1.0 - cos(grid * PI / 180.0)); // azimuth angle unit step size
264
265
266 for (set<double>::const_iterator d = D.begin(); d != D.end(); ++d) {
267
268 const double D_m = *d;
269
270 for (set<double>::const_iterator c = C.begin(); c != C.end(); ++c) {
271
272 const double cd = *c;
273
274 const unsigned int number_of_theta_points = max(2u, (unsigned int) (180.0/(1.4 * grid)));
275
276 for (double theta = 0.0; theta <= PI + epsilon; theta += PI/number_of_theta_points) {
277
278 const unsigned int number_of_phi_points = max(2u, (unsigned int) (PI * sin(theta) / alpha));
279
280 for (double phi = 0.0; phi <= PI + epsilon; phi += PI/number_of_phi_points) {
281
282 JFunction1D_t& f1 = pdf[D_m][cd][theta][phi];
283
284 const JArray_t array(D_m, cd, theta, phi);
285
286 double t_old = transformer.getXn(array, *X.begin());
287 double y_old = 0.0;
288
289 for (set<double>::const_iterator x = X.begin(); x != X.end(); ++x) {
290
291 const double t = transformer.getXn(array, *x);
292 const double y = (pdf_c.*f)(D_m, cd, theta, phi, t);
293
294 if (y != 0.0) {
295
296 if (*x < 0.0) {
297 WARNING("dt < 0 " << *x << ' ' << D_m << ' ' << t << ' ' << y << endl);
298 }
299
300 if (y_old == 0.0) {
301 f1[t_old] = y_old;
302 }
303
304 f1[t] = y;
305
306 } else {
307
308 if (y_old != 0.0) {
309 f1[t] = y;
310 }
311 }
312
313 t_old = t;
314 y_old = y;
315 }
316 }
317 }
318 }
319 }
320
321 pdf.transform(transformer);
322 pdf.compile();
323
324 NOTICE("OK" << endl);
325
326 try {
327
328 NOTICE("storing output to file " << outputFile << "... " << flush);
329
330 pdf.store(outputFile.c_str());
331
332 NOTICE("OK" << endl);
333 }
334 catch(const JException& error) {
335 FATAL(error.what() << endl);
336 }
337}
string outputFile
#define NOTICE(A)
Definition JMessage.hh:64
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:74
#define WARNING(A)
Definition JMessage.hh:65
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2107
int numberOfPoints
Definition JResultPDF.cc:22
Utility class to parse parameter values.
General exception.
Definition JException.hh:25
virtual const char * what() const override
Get error message.
Definition JException.hh:65
Utility class to parse command line options.
Definition JParser.hh:1664
Function object for the probability density function of photon emission from EM-shower as a function ...
Definition JGeant.hh:32
Probability density function of photon emission from EM-shower as a function of cosine of the emissio...
Definition JGeanx.hh:32
Multi-dimensional PDF table for arrival time of Cherenkov light.
Definition JPDFTable.hh:44
Template definition of transformer of the probability density function (PDF) of the time response of ...
Probability Density Functions of the time response of a PMT with an implementation of the JAbstractPM...
Definition JPDF.hh:2188
container_type::const_iterator const_iterator
Functional map with polynomial interpolation.
Definition JPolint.hh:1153
Type definition for numerical integration.
Template class for spline interpolation in 1D.
Definition JSpline.hh:734
double getMinimalWavelength()
Get minimal wavelength for PDF evaluations.
@ SCATTERED_LIGHT_FROM_MUON_5D
scattered light from muon
Definition JPDFTypes.hh:35
double getMaximalWavelength()
Get maximal wavelength for PDF evaluations.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
double getAngularAcceptance(const double x)
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:66
Empty structure for specification of parser element that is not initialised (i.e. does require input)...
Definition JParser.hh:72
Auxiliary data structure for muon PDF.
Definition JPDF_t.hh:26
Auxiliary data structure for complete configuration.
JProperties getProperties()
Get properties.
Manipulator for help output.
Wrapper data structure around std::array.
Definition JArray.hh:43
Auxiliary class for recursive map list generation.
Definition JMapList.hh:109