Jpp 20.0.0-195-g190c9e876
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 JAbsorptionLength absorptionLength;
47 JScatteringLength scatteringLength;
48 JScatteringProbability scatteringProbability;
49 int function;
50 set<double> D; // distance [m]
51 int debug;
52
53 try {
54
55 JProperties properties;
56
57 properties.insert(gmake_property(absorptionLength));
58 properties.insert(gmake_property(scatteringLength));
59 properties.insert(gmake_property(scatteringProbability));
60
61 JParser<> zap("Program to create interpolation tables of the PDF of the arrival time of the Cherenkov light from a shower.");
62
63 zap['@'] = make_field(properties, endl
64 << "possible options absorptionLength: " << get_keys(absorptionLength) << endl
65 << "possible options scatteringLength: " << get_keys(scatteringLength) << endl
66 << "possible options scatteringProbability: " << get_keys(scatteringProbability) << endl) = JPARSER::initialised();
67 zap['o'] = make_field(outputFile);
68 zap['n'] = make_field(numberOfPoints, "points for integration") = 25;
69 zap['e'] = make_field(epsilon, "precision for integration") = 1.0e-10;
70 zap['F'] = make_field(function, "PDF type") =
72 DIRECT_LIGHT_FROM_EMSHOWER,
73 SCATTERED_LIGHT_FROM_EMSHOWER;
74 zap['D'] = make_field(D, "distance [m]") = JPARSER::initialised();
75 zap['d'] = make_field(debug) = 0;
76
77 zap['F'] = JPARSER::not_initialised();
78
79 zap(argc, argv);
80 }
81 catch(const exception &error) {
82 FATAL(error.what() << endl);
83 }
84
85
86 typedef double (JPDF::*fcn)(const double,
87 const double,
88 const double,
89 const double,
90 const double) const;
91
92
93 // set global parameters
94
95 const double P_atm = NAMESPACE::getAmbientPressure();
96 const double wmin = getMinimalWavelength();
97 const double wmax = getMaximalWavelength();
98
99
100 const JPDF_C
101 pdf_c(NAMESPACE::getPhotocathodeArea(),
102 NAMESPACE::getQE,
103 NAMESPACE::getAngularAcceptance,
104 JAbsorptionLength::getAbsorptionLength,
105 JScatteringLength::getScatteringLength,
106 JScatteringProbability::getScatteringProbability,
107 P_atm,
108 wmin,
109 wmax,
111 epsilon);
112
113
114 typedef JSplineFunction1D_t JFunction1D_t;
118 JPolint1FunctionalGridMap>::maplist JMapList_t;
120
121 typedef JPDFTransformer<4, JFunction1D_t::argument_type> JFunction4DTransformer_t;
123
124 JPDF_t pdf;
125
126
127 NOTICE("building multi-dimensional function object <" << function << ">... " << flush);
128
129 const double ng[] = {
130 pdf_c.getIndexOfRefractionGroup(wmax),
131 pdf_c.getIndexOfRefractionGroup(wmin)
132 };
133
135
136 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));
137 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));
138 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));
139
140 if (zmap.find(function) == zmap.end()) {
141 FATAL("illegal function specifier" << endl);
142 }
143
144 fcn f = zmap[function].first; // PDF
145 JFunction4DTransformer_t transformer = zmap[function].second; // transformer
146
147
148 if (D.empty()) {
149 D.insert( 0.10);
150 D.insert( 0.50);
151 D.insert( 1.00);
152 D.insert( 5.00);
153 D.insert( 10.00);
154 D.insert( 20.00);
155 D.insert( 30.00);
156 D.insert( 40.00);
157 D.insert( 50.00);
158 D.insert( 60.00);
159 D.insert( 70.00);
160 D.insert( 80.00);
161 D.insert( 90.00);
162 D.insert(100.00);
163 D.insert(120.00);
164 D.insert(150.00);
165 D.insert(170.00);
166 D.insert(190.00);
167 D.insert(210.00);
168 D.insert(230.00);
169 D.insert(250.00);
170 D.insert(270.00);
171 D.insert(290.00);
172 D.insert(310.00);
173 }
174
175 set<double> C; // cosine emission angle
176
177 JQuadrature qeant(-1.0, +1.0, 60, geanx);
178
179 for (JQuadrature::const_iterator i = qeant.begin(); i != qeant.end(); ++i)
180 C.insert(i->getX());
181
182 C.insert(-1.00);
183 C.insert(+1.00);
184
185
186 set<double> X; // time [ns]
187
188 if (function == DIRECT_LIGHT_FROM_EMSHOWER) {
189
190 for (double buffer[] = { 0.0, 0.005, 0.01, 0.015, -1 }, *x = buffer; *x >= 0; ++x) {
191 X.insert(0.0 + *x);
192 X.insert(1.0 - *x);
193 }
194
195 for (double x = 0.02; x < 0.99; x += 0.01)
196 X.insert(x);
197
198 } else {
199
200 X.insert( 0.00);
201 X.insert( 0.10);
202 X.insert( 0.20);
203 X.insert( 0.30);
204 X.insert( 0.40);
205 X.insert( 0.50);
206 X.insert( 0.60);
207 X.insert( 0.70);
208 X.insert( 0.80);
209 X.insert( 0.90);
210 X.insert( 1.00);
211 X.insert( 1.00);
212 X.insert( 1.10);
213 X.insert( 1.20);
214 X.insert( 1.30);
215 X.insert( 1.40);
216 X.insert( 1.50);
217 X.insert( 1.60);
218 X.insert( 1.70);
219 X.insert( 1.80);
220 X.insert( 1.90);
221 X.insert( 2.00);
222 X.insert( 2.20);
223 X.insert( 2.40);
224 X.insert( 2.60);
225 X.insert( 2.80);
226 X.insert( 3.00);
227 X.insert( 3.25);
228 X.insert( 3.50);
229 X.insert( 3.75);
230 X.insert( 4.00);
231 X.insert( 4.25);
232 X.insert( 4.50);
233 X.insert( 4.75);
234 X.insert( 5.0);
235 X.insert( 6.0);
236 X.insert( 7.0);
237 X.insert( 8.0);
238 X.insert( 9.0);
239 X.insert( 10.0);
240 X.insert( 15.0);
241 X.insert( 20.0);
242 X.insert( 25.0);
243 X.insert( 30.0);
244 X.insert( 40.0);
245 X.insert( 50.0);
246 X.insert( 60.0);
247 X.insert( 70.0);
248 X.insert( 80.0);
249 X.insert( 90.0);
250 X.insert(100.0);
251 X.insert(120.0);
252 X.insert(140.0);
253 X.insert(160.0);
254 X.insert(180.0);
255 X.insert(200.0);
256 X.insert(250.0);
257 X.insert(300.0);
258 X.insert(350.0);
259 X.insert(400.0);
260 X.insert(450.0);
261 X.insert(500.0);
262 X.insert(600.0);
263 X.insert(700.0);
264 X.insert(800.0);
265 X.insert(900.0);
266 X.insert(1200.0);
267 X.insert(1500.0);
268 }
269
270 const double grid = 7.0; // [deg]
271
272 const double alpha = 2.0 * sqrt(1.0 - cos(grid * PI / 180.0)); // azimuth angle unit step size
273
274
275 for (set<double>::const_iterator d = D.begin(); d != D.end(); ++d) {
276
277 const double D_m = *d;
278
279 for (set<double>::const_iterator c = C.begin(); c != C.end(); ++c) {
280
281 const double cd = *c;
282
283 const unsigned int number_of_theta_points = max(2u, (unsigned int) (180.0/(1.4 * grid)));
284
285 for (double theta = 0.0; theta <= PI + epsilon; theta += PI/number_of_theta_points) {
286
287 const unsigned int number_of_phi_points = max(2u, (unsigned int) (PI * sin(theta) / alpha));
288
289 for (double phi = 0.0; phi <= PI + epsilon; phi += PI/number_of_phi_points) {
290
291 JFunction1D_t& f1 = pdf[D_m][cd][theta][phi];
292
293 const JArray_t array(D_m, cd, theta, phi);
294
295 double t_old = transformer.getXn(array, *X.begin());
296 double y_old = 0.0;
297
298 for (set<double>::const_iterator x = X.begin(); x != X.end(); ++x) {
299
300 const double t = transformer.getXn(array, *x);
301 const double y = (pdf_c.*f)(D_m, cd, theta, phi, t);
302
303 if (y != 0.0) {
304
305 if (*x < 0.0) {
306 WARNING("dt < 0 " << *x << ' ' << D_m << ' ' << t << ' ' << y << endl);
307 }
308
309 if (y_old == 0.0) {
310 f1[t_old] = y_old;
311 }
312
313 f1[t] = y;
314
315 } else {
316
317 if (y_old != 0.0) {
318 f1[t] = y;
319 }
320 }
321
322 t_old = t;
323 y_old = y;
324 }
325 }
326 }
327 }
328 }
329
330 pdf.transform(transformer);
331 pdf.compile();
332
333 NOTICE("OK" << endl);
334
335 try {
336
337 NOTICE("storing output to file " << outputFile << "... " << flush);
338
339 pdf.store(outputFile.c_str());
340
341 NOTICE("OK" << endl);
342 }
343 catch(const JException& error) {
344 FATAL(error.what() << endl);
345 }
346}
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:2142
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
int numberOfPoints
Definition JResultPDF.cc:22
Utility class to parse parameter values.
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
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:2186
One dimensional array of template objects with fixed length.
Definition JArray.hh:43
container_type::const_iterator const_iterator
Type definition for numerical integration.
const array_type< JKey_t > & get_keys(const std::map< JKey_t, JValue_t, JComparator_t, JAllocator_t > &data)
Method to create array of keys of map.
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).
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:68
Empty structure for specification of parser element that is not initialised (i.e. does require input)...
Definition JParser.hh:74
Auxiliary data structure for muon PDF.
Definition JPDF_t.hh:26
Auxiliary data structure to customize absorption length.
Auxiliary data structure to customize scattering length.
Auxiliary data structure to customize scattering probability.
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 double result type.