PDF types.
PDF types.
41{
44
45 string fileDescriptor;
47 string option;
48 double E;
49 double cd;
51 double TMax_ns;
52 string particle;
54
55 try {
56
58
61 zap[
'O'] =
make_field(option) =
"KM3NeT",
"Antares";
62 zap[
'E'] =
make_field(E,
"muon/shower energy [GeV]");
63 zap[
'c'] =
make_field(cd,
"cosine emission angle");
64 zap[
'D'] =
make_field(dir,
"(theta, phi) of PMT [rad]");
65 zap[
'T'] =
make_field(TMax_ns,
"L1 coincidence time window [ns]") = 20.0;
66 zap[
'P'] =
make_field(particle) = MUON_t, SHOWER_t;
68
69 zap(argc, argv);
70 }
71 catch(const exception &error) {
72 FATAL(error.what() << endl);
73 }
74
75
76 const double epsilon = 1.0e-6;
78
79
80
81
83
84 if (option == "KM3NeT") {
85
117
118 } else if (option == "Antares") {
119
123
124 } else {
125
126 FATAL(
"Fatal error at detector option " << option << endl);
127 };
128
129
130
131
133
136 }
137
138
140
141
142 TH1D h00("L00", NULL, 300, 1.0, 151.0);
143
144 TH1D h0m("L0m", NULL, 300, 1.0, 151.0);
145 TH1D h1m("L1m", NULL, 300, 1.0, 151.0);
146
147 TH1D h0s("L0s", NULL, 300, 1.0, 151.0);
148 TH1D h1s("L1s", NULL, 300, 1.0, 151.0);
149
150
151 if (particle == MUON_t) {
152
158
159
160
161
163 DIRECT_LIGHT_FROM_MUON,
164 SCATTERED_LIGHT_FROM_MUON,
165 DIRECT_LIGHT_FROM_EMSHOWERS,
166 SCATTERED_LIGHT_FROM_EMSHOWERS,
167 DIRECT_LIGHT_FROM_DELTARAYS,
168 SCATTERED_LIGHT_FROM_DELTARAYS
169 };
170
171 const double TTS = 2.0;
173 const double epsilon = 1.0e-10;
174
175 const int NUMBER_OF_PDFS = sizeof(type)/sizeof(type[0]);
176
177 JPDF_t pdf[NUMBER_OF_PDFS];
178
179 const JPDF_t::JSupervisor supervisor(
new JPDF_t::JDefaultResult(
JMATH::zero));
180
181 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
182
183 try {
184
185 const string file_name = getFilename(fileDescriptor, type[i]);
186
187 NOTICE(
"loading PDF from file " << file_name <<
"... " << flush);
188
189 pdf[i].load(file_name.c_str());
190
192
193 pdf[i].setExceptionHandler(supervisor);
195 }
198 }
199 }
200
201 const double Tmin = -15.0;
202 const double Tmax = +250.0;
203 const double dt = 1.0;
204
205 for (int ix = 1; ix <= h00.GetNbinsX(); ++ix) {
206
207 const double R = h00.GetBinCenter(ix);
208
209 double W = 0.0;
210
211 for (vector<JAngle3D>::const_iterator pmt =
PMT.begin(); pmt !=
PMT.end(); ++pmt) {
212
213 const double theta = pi.constrain(pmt->getTheta());
214 const double phi = pi.constrain(fabs(pmt->getPhi()));
215
216 double w = 0.0;
217
218 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
219
220 double yi = pdf[i](R, theta, phi, Tmax).v;
221
223 yi *= E;
225 yi *= JDeltaRays::getEnergyLossFromMuon(E);
226 }
227
228 w += yi;
229 }
230
231 W += 1.0 - TMath::PoissonI(0,w);
232 }
233
235
236 h00.SetBinContent(ix, W);
237 }
238
239 for (int ix = 1; ix <= h0m.GetNbinsX(); ++ix) {
240
241 const double R = h0m.GetBinCenter(ix);
242
243 double V = 0.0;
244
245 for (vector<JAngle3D>::const_iterator pmt =
PMT.begin(); pmt !=
PMT.end(); ++pmt) {
246
247 const double theta = pi.constrain(pmt->getTheta());
248 const double phi = pi.constrain(fabs(pmt->getPhi()));
249
250 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
251
252 double yi = pdf[i](R, theta, phi, Tmax).v;
253
255 yi *= E;
257 yi *= JDeltaRays::getEnergyLossFromMuon(E);
258 }
259
260 V += yi;
261 }
262
263 h0m.SetBinContent(ix, 1.0 - TMath::PoissonI(0,V));
264 }
265 }
266
267
268 const int NUMBER_OF_PMTS =
PMT.size();
269
270 double Vi[NUMBER_OF_PMTS];
271
272 for (int ix = 1; ix <= h1m.GetNbinsX(); ++ix) {
273
274 const double R = h1m.GetBinCenter(ix);
275
276 double Y = 0.0;
277
278 for (
double x = Tmin;
x <= Tmax;
x += dt) {
279
280 double V = 0.0;
281
282 for (int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
283
284 Vi[pmt] = 0.0;
285
286 const double theta = pi.constrain(
PMT[pmt].getTheta());
287 const double phi = pi.constrain(fabs(
PMT[pmt].getPhi()));
288
289 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
290
291 double yi[] = {
292 pdf[i](R, theta, phi,
x).v,
293 pdf[i](R, theta, phi, x + TMax_ns).v
294 };
295
297 yi[0] *= E;
298 yi[1] *= E;
300 yi[0] *= JDeltaRays::getEnergyLossFromMuon(E);
301 yi[1] *= JDeltaRays::getEnergyLossFromMuon(E);
302 }
303
304 Vi[pmt] += yi[1] - yi[0];
305 }
306
307 V += Vi[pmt];
308 }
309
310 for (int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
311
312 const double theta = pi.constrain(
PMT[pmt].getTheta());
313 const double phi = pi.constrain(fabs(
PMT[pmt].getPhi()));
314
316
317 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
318
319 double yi = pdf[i](R, theta, phi,
x).f;
320
322 yi *= E;
324 yi *= JDeltaRays::getEnergyLossFromMuon(E);
325 }
326
328 }
329
330 if (y > 0.0) {
331 Y +=
y * (1.0 - TMath::PoissonI(0, V - Vi[pmt])) * dt;
332 }
333 }
334 }
335
336 h1m.SetBinContent(ix, 1.0 - TMath::PoissonI(0,Y));
337 }
338 }
339
340
341 if (particle == SHOWER_t) {
342
349
350
351
352
354 DIRECT_LIGHT_FROM_EMSHOWER,
355 SCATTERED_LIGHT_FROM_EMSHOWER
356 };
357
358 const double TTS = 2.0;
360 const double epsilon = 1.0e-10;
361
362 const int NUMBER_OF_PDFS = sizeof(type)/sizeof(type[0]);
363
364 JPDF_t pdf[NUMBER_OF_PDFS];
365
366 const JPDF_t::JSupervisor supervisor(
new JPDF_t::JDefaultResult(
JMATH::zero));
367
368 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
369
370 try {
371
372 const string file_name = getFilename(fileDescriptor, type[i]);
373
374 NOTICE(
"loading PDF from file " << file_name <<
"... " << flush);
375
376 pdf[i].load(file_name.c_str());
377
379
380 pdf[i].setExceptionHandler(supervisor);
382 }
385 }
386 }
387
388 const double Tmin = -15.0;
389 const double Tmax = +250.0;
390 const double dt = 1.0;
391
392 for (int ix = 1; ix <= h0s.GetNbinsX(); ++ix) {
393
394 const double D = h0s.GetBinCenter(ix);
395
396 double V = 0.0;
397
398 for (vector<JAngle3D>::const_iterator pmt =
PMT.begin(); pmt !=
PMT.end(); ++pmt) {
399
400 const double theta = pi.constrain(pmt->getTheta());
401 const double phi = pi.constrain(fabs(pmt->getPhi()));
402
403 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
404
405 double yi = pdf[i](D, cd, theta, phi, Tmax).V;
406
407 yi *= E;
408
409 V += yi;
410 }
411 }
412
413 h0s.SetBinContent(ix, 1.0 - TMath::PoissonI(0,V));
414 }
415
416
417 const int NUMBER_OF_PMTS =
PMT.size();
418
419 double Vi[NUMBER_OF_PMTS];
420
421 for (int ix = 1; ix <= h1s.GetNbinsX(); ++ix) {
422
423 const double D = h1s.GetBinCenter(ix);
424
425 double Y = 0.0;
426
427 for (
double x = Tmin;
x <= Tmax;
x += dt) {
428
429 double V = 0.0;
430
431 for (int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
432
433 Vi[pmt] = 0.0;
434
435 const double theta = pi.constrain(
PMT[pmt].getTheta());
436 const double phi = pi.constrain(fabs(
PMT[pmt].getPhi()));
437
438 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
439
440 double yi[] = {
441 pdf[i](D, cd, theta, phi,
x).v,
442 pdf[i](D, cd, theta, phi, x + TMax_ns).v
443 };
444
445 yi[0] *= E;
446 yi[1] *= E;
447
448 Vi[pmt] += yi[1] - yi[0];
449 }
450
451 V += Vi[pmt];
452 }
453
454 for (int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
455
456 const double theta = pi.constrain(
PMT[pmt].getTheta());
457 const double phi = pi.constrain(fabs(
PMT[pmt].getPhi()));
458
460
461 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
462
463 double yi = pdf[i](D, cd, theta, phi,
x).f;
464
465 yi *= E;
466
468 }
469
470 if (y > 0.0) {
471 Y +=
y * (1.0 - TMath::PoissonI(0, V - Vi[pmt])) * dt;
472 }
473 }
474 }
475
476 h1s.SetBinContent(ix, 1.0 - TMath::PoissonI(0,Y));
477 }
478 }
479
480
481 out.Write();
482 out.Close();
483}
JDAQPMTIdentifier PMT
Command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Data structure for angles in three dimensions.
Data structure for direction in three dimensions.
JDirection3D & rotate(const JRotation3D &R)
Rotate.
virtual const char * what() const override
Get error message.
Utility class to parse command line options.
Multi-dimensional PDF table for arrival time of Cherenkov light.
static const JZero zero
Function object to assign zero value.
bool is_deltarays(const int pdf)
Test if given PDF type corresponds to Cherenkov light from delta-rays.
bool is_bremsstrahlung(const int pdf)
Test if given PDF type corresponds to Cherenkov light from Bremsstrahlung.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).