39{
42
45 double epsilon;
47 int function;
50
51 try {
52
54
55 JParser<> zap(
"Program to create interpolation tables of the PDF of the arrival time of the Cherenkov light from a shower.");
56
60 zap[
'e'] =
make_field(epsilon,
"precision for integration") = 1.0e-10;
63 DIRECT_LIGHT_FROM_EMSHOWER,
64 SCATTERED_LIGHT_FROM_EMSHOWER;
67
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
85
86 const double P_atm = NAMESPACE::getAmbientPressure();
89
90
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
111
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
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;
136 JFunction4DTransformer_t transformer = zmap[function].second;
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
167
169
171 C.insert(i->getX());
172
173 C.insert(-1.00);
174 C.insert(+1.00);
175
176
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;
262
263 const double alpha = 2.0 * sqrt(1.0 - cos(grid * PI / 180.0));
264
265
267
268 const double D_m = *d;
269
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
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
305
306 } else {
307
308 if (y_old != 0.0) {
310 }
311 }
312
313 t_old = t;
315 }
316 }
317 }
318 }
319 }
320
321 pdf.transform(transformer);
322 pdf.compile();
323
325
326 try {
327
329
331
333 }
336 }
337}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement 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...
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).
double getAngularAcceptance(const double x)
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 for complete configuration.
JProperties getProperties()
Get properties.
Manipulator for help output.