39{
42
45 double epsilon;
49 int function;
52
53 try {
54
56
60
61 JParser<> zap(
"Program to create interpolation tables of the PDF of the arrival time of the Cherenkov light from a shower.");
62
64 <<
"possible options absorptionLength: " <<
get_keys(absorptionLength) << endl
65 <<
"possible options scatteringLength: " <<
get_keys(scatteringLength) << endl
69 zap[
'e'] =
make_field(epsilon,
"precision for integration") = 1.0e-10;
72 DIRECT_LIGHT_FROM_EMSHOWER,
73 SCATTERED_LIGHT_FROM_EMSHOWER;
76
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
94
95 const double P_atm = NAMESPACE::getAmbientPressure();
98
99
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
120
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;
145 JFunction4DTransformer_t transformer = zmap[function].second;
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
176
178
180 C.insert(i->getX());
181
182 C.insert(-1.00);
183 C.insert(+1.00);
184
185
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;
271
272 const double alpha = 2.0 * sqrt(1.0 - cos(grid * PI / 180.0));
273
274
276
277 const double D_m = *d;
278
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
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
314
315 } else {
316
317 if (y_old != 0.0) {
319 }
320 }
321
322 t_old = t;
324 }
325 }
326 }
327 }
328 }
329
330 pdf.transform(transformer);
331 pdf.compile();
332
334
335 try {
336
338
340
342 }
345 }
346}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Utility class to parse parameter values.
virtual const char * what() const override
Get error message.
Utility class to parse command line options.
Function object for the probability density function of photon emission from EM-shower as a function ...
Probability density function of photon emission from EM-shower as a function of cosine of the emissio...
Multi-dimensional PDF table for arrival time of Cherenkov light.
Probability Density Functions of the time response of a PMT with an implementation of the JAbstractPM...
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
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)...
Empty structure for specification of parser element that is not initialised (i.e. does require input)...
Auxiliary data structure for muon PDF.
Auxiliary data structure to customize absorption length.
Auxiliary data structure to customize scattering length.
Auxiliary data structure to customize scattering probability.