Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JPDFTransformer.hh
Go to the documentation of this file.
1#ifndef __JPHYSICS__JPDFTRANSFORMER__
2#define __JPHYSICS__JPDFTRANSFORMER__
3
4#include <cmath>
5
6#include "JLang/JCC.hh"
11#include "JTools/JGrid.hh"
12#include "JPhysics/JGeant_t.hh"
13
14
15/**
16 * \author mdejong
17 */
18
19namespace JPHYSICS {}
20namespace JPP { using namespace JPHYSICS; }
21
22namespace JPHYSICS {
23
24 using JIO::JReader;
25 using JIO::JWriter;
27
28
29 /**
30 * Transformer for the 1D probability density function (PDF) of the time response of a PMT to a muon.
31 *
32 * PDFs are evaluated by interpolation for:
33 * -# distance of closest approach of the muon to the PMT [m]
34 * -# arrival time [ns]
35 *
36 * The evaluation of the weights is based on:
37 * -# effective attenuation length
38 */
39 template<class JArgument_t>
41 public JMultiMapTransformer<1, JArgument_t>
42 {
43 public:
44
46
50
52
53 /**
54 * Get shortest distance of approach.
55 *
56 * \return distance [m]
57 */
58 static double getRmin()
59 {
60 return 0.01;
61 }
62
63
64 /**
65 * Default constructor.
66 */
68 ln (0.0),
69 alpha(0),
70 kmin (0.0),
71 kmax (0.0)
72 {}
73
74
75 /**
76 * Constructor.
77 *
78 * \param ln Effective attenuation length [m]
79 * \param alpha Distance dependence (power term)
80 * \param kmin Minimal kappa
81 * \param kmax Maximal kappa
82 */
83 JPDFTransformer_t(const double ln,
84 const int alpha,
85 const double kmin,
86 const double kmax) :
87 ln (ln),
88 alpha(alpha),
89 kmin (kmin),
90 kmax (kmax)
91 {}
92
93
94 /**
95 * Clone object.
96 *
97 * \return pointer to newly created transformer
98 */
99 virtual clone_type clone() const override
100 {
101 return new JPDFTransformer_t(*this);
102 }
103
104
105 /**
106 * Evaluate arrival time.
107 *
108 * \param buffer {R_m}
109 * \param xn old t_ns
110 * \return new t_ns
111 */
112 virtual argument_type putXn(const_array_type& buffer, const argument_type xn) const override
113 {
114 using namespace JTOOLS;
115
116 const double R = buffer[0];
117
118 double x = xn;
119
120 const double t0 = R * getTanThetaC() * getInverseSpeedOfLight();
121 const double t1 = R * kmin * getInverseSpeedOfLight();
122
123 x -= t1 - t0;
124
125 if (kmax > kmin) {
126 x /= R * (kmax - kmin) * getInverseSpeedOfLight();
127 }
128
129 return x;
130 }
131
132
133 /**
134 * Evaluate arrival time.
135 *
136 * \param buffer {R_m}
137 * \param xn old t_ns
138 * \return new t_ns
139 */
140 virtual argument_type getXn(const_array_type& buffer, const argument_type xn) const override
141 {
142 using namespace JTOOLS;
143
144 const double R = buffer[0];
145
146 double x = xn;
147
148 if (kmax > kmin) {
149 x *= R * (kmax - kmin) * getInverseSpeedOfLight();
150 }
151
152 const double t0 = R * getTanThetaC() * getInverseSpeedOfLight();
153 const double t1 = R * kmin * getInverseSpeedOfLight();
154
155 x += t1 - t0;
156
157 return x;
158 }
159
160
161 /**
162 * Weight function.
163 *
164 * \param buffer {R_m}
165 * \return weight
166 */
167 virtual double getWeight(const_array_type& buffer) const override
168 {
169 using namespace JTOOLS;
170
171 const double R = buffer[0];
172
173 const double n = getIndexOfRefraction();
174 const double ct0 = 1.0 / n;
175 const double st0 = sqrt((1.0 + ct0)*(1.0 - ct0));
176
177 const double d = sqrt(getRmin()*getRmin() + R*R) / st0;
178
179 return exp(-d/ln) / pow(d,alpha);
180 }
181
182
183 /**
184 * Read PDF transformer from input.
185 *
186 * \param in reader
187 * \return reader
188 */
189 virtual JReader& read(JReader& in) override
190 {
191 in >> ln;
192 in >> alpha;
193 in >> kmin;
194 in >> kmax;
195
196 return in;
197 }
198
199
200 /**
201 * Write PDF transformer to output.
202 *
203 * \param out writer
204 * \return writer
205 */
206 virtual JWriter& write(JWriter& out) const override
207 {
208 out << ln;
209 out << alpha;
210 out << kmin;
211 out << kmax;
212
213 return out;
214 }
215
216
217 /**
218 * Print PDF transformer to output stream.
219 *
220 * \param out output stream
221 * \return output stream
222 */
223 std::ostream& print(std::ostream& out) const
224 {
225 using namespace std;
226
227 out << "Effective attenuation length [m] " << ln << endl;
228 out << "Distance dependence (power term) " << alpha << endl;
229 out << "Minimal kappa " << kmin << endl;
230 out << "Maximal kappa " << kmax << endl;
231
232 return out;
233 }
234
235
236 double ln; //!< Effective attenuation length [m]
237 int alpha; //!< Distance dependence (power term)
238 double kmin; //!< minimal kappa
239 double kmax; //!< maximal kappa
240 };
241
242
243 /**
244 * Transformer for the 1D probability density function (PDF) of the time response of a PMT due to a point source.
245 *
246 * PDFs are evaluated by interpolation for:
247 * -# distance between point source and PMT [m]
248 * -# arrival time [ns]
249 *
250 * The evaluation of the weights is based on:
251 * -# effective attenuation length
252 */
253 template<class JArgument_t>
255 public JMultiMapTransformer<1, JArgument_t>
256 {
257 public:
258
260
264
266
267 /**
268 * Get shortest distance.
269 *
270 * \return distance [m]
271 */
272 static double getDmin()
273 {
274 return 0.01;
275 }
276
277
278 /**
279 * Default constructor.
280 */
282 ln (0.0),
283 alpha(0),
284 kmin (0.0),
285 kmax (0.0)
286 {}
287
288
289 /**
290 * Constructor.
291 *
292 * \param ln Effective attenuation length [m]
293 * \param alpha Distance dependence (power term)
294 * \param kmin Minimal kappa
295 * \param kmax Maximal kappa
296 */
297 JPD0Transformer_t(const double ln,
298 const int alpha,
299 const double kmin,
300 const double kmax) :
301 ln (ln),
302 alpha(alpha),
303 kmin (kmin),
304 kmax (kmax)
305 {}
306
307
308 /**
309 * Clone object.
310 *
311 * \return pointer to newly created transformer
312 */
313 virtual clone_type clone() const override
314 {
315 return new JPD0Transformer_t(*this);
316 }
317
318
319 /**
320 * Evaluate arrival time.
321 *
322 * \param buffer {D_m}
323 * \param xn old t_ns
324 * \return new t_ns
325 */
326 virtual argument_type putXn(const_array_type& buffer, const argument_type xn) const override
327 {
328 using namespace JTOOLS;
329
330 const double D = buffer[0];
331
332 double x = xn;
333
334 const double t0 = D * getIndexOfRefraction() * getInverseSpeedOfLight();
335 const double t1 = D * kmin * getInverseSpeedOfLight();
336
337 x -= t1 - t0;
338
339 if (kmax > kmin) {
340 x /= D * (kmax - kmin) * getInverseSpeedOfLight();
341 }
342
343 return x;
344 }
345
346
347 /**
348 * Evaluate arrival time.
349 *
350 * \param buffer {D_m}
351 * \param xn old t_ns
352 * \return new t_ns
353 */
354 virtual argument_type getXn(const_array_type& buffer, const argument_type xn) const override
355 {
356 using namespace JTOOLS;
357
358 const double D = buffer[0];
359
360 double x = xn;
361
362 if (kmax > kmin) {
363 x *= D * (kmax - kmin) * getInverseSpeedOfLight();
364 }
365
366 const double t0 = D * getIndexOfRefraction() * getInverseSpeedOfLight();
367 const double t1 = D * kmin * getInverseSpeedOfLight();
368
369 x += t1 - t0;
370
371 return x;
372 }
373
374
375 /**
376 * Weight function.
377 *
378 * \param buffer {D_m}
379 * \return weight
380 */
381 virtual double getWeight(const_array_type& buffer) const override
382 {
383 using namespace JTOOLS;
384
385 const double D = buffer[0];
386
387 const double d = sqrt(getDmin()*getDmin() + D*D);
388
389 return exp(-d/ln) / pow(d,alpha);
390 }
391
392
393 /**
394 * Read PDF transformer from input.
395 *
396 * \param in reader
397 * \return reader
398 */
399 virtual JReader& read(JReader& in) override
400 {
401 in >> ln;
402 in >> alpha;
403 in >> kmin;
404 in >> kmax;
405
406 return in;
407 }
408
409
410 /**
411 * Write PDF transformer to output.
412 *
413 * \param out writer
414 * \return writer
415 */
416 virtual JWriter& write(JWriter& out) const override
417 {
418 out << ln;
419 out << alpha;
420 out << kmin;
421 out << kmax;
422
423 return out;
424 }
425
426
427 /**
428 * Print PDF transformer to output stream.
429 *
430 * \param out output stream
431 * \return output stream
432 */
433 std::ostream& print(std::ostream& out) const
434 {
435 using namespace std;
436
437 out << "Effective attenuation length [m] " << ln << endl;
438 out << "Distance dependence (power term) " << alpha << endl;
439 out << "Minimal kappa " << kmin << endl;
440 out << "Maximal kappa " << kmax << endl;
441
442 return out;
443 }
444
445
446 double ln; //!< Effective attenuation length [m]
447 int alpha; //!< Distance dependence (power term)
448 double kmin; //!< minimal kappa
449 double kmax; //!< maximal kappa
450 };
451
452
453 /**
454 * Transformer for the 2D probability density function (PDF) of the time response of a PMT due to an EM shower.
455 *
456 * PDFs are evaluated by interpolation for:
457 * -# distance between EM shower and PMT [m]
458 * -# cosine angle EM shower direction and EM shower - PMT position
459 * -# arrival time [ns]
460 *
461 * The evaluation of the weights is based on:
462 * -# effective attenuation length
463 * -# emission profile of the photons
464 */
465 template<class JArgument_t>
467 public JMultiMapTransformer<2, JArgument_t>
468 {
469 public:
470
471 typedef JPD0Transformer_t <JArgument_t> JFunction1DTransformer_t;
473
477
479
480
481 /**
482 * Default constructor.
483 */
488
489
490 /**
491 * Constructor.
492 *
493 * \param ln Effective attenuation length [m]
494 * \param alpha Distance dependence (power term)
495 * \param kmin Minimal kappa
496 * \param kmax Maximal kappa
497 * \param geant Function photon emission from EM-shower
498 * \param bmin Baseline photon emission from EM-shower
499 */
500 JPDGTransformer_t(const double ln,
501 const int alpha,
502 const double kmin,
503 const double kmax,
504 const JGeant_t& geant,
505 const double bmin) :
506 transformer(ln, alpha, kmin, kmax),
508 {
509 getShowerProbability.add(bmin);
510 getShowerProbability.compile();
511 }
512
513
514 /**
515 * Clone object.
516 *
517 * \return pointer to newly created transformer
518 */
519 virtual clone_type clone() const override
520 {
521 return new JPDGTransformer_t(*this);
522 }
523
524
525 /**
526 * Evaluate arrival time.
527 *
528 * \param buffer {D_m, cd}
529 * \param xn old t_ns
530 * \return new t_ns
531 */
532 virtual argument_type putXn(const_array_type& buffer, const argument_type xn) const override
533 {
534 return transformer.putXn(buffer, xn);
535 }
536
537
538 /**
539 * Evaluate arrival time.
540 *
541 * \param buffer {D_m, cd}
542 * \param xn old t_ns
543 * \return new t_ns
544 */
545 virtual argument_type getXn(const_array_type& buffer, const argument_type xn) const override
546 {
547 return transformer.getXn(buffer, xn);
548 }
549
550
551 /**
552 * Weight function.
553 *
554 * \param buffer {D_m, cd}
555 * \return weight
556 */
557 virtual double getWeight(const_array_type& buffer) const override
558 {
559 using namespace JTOOLS;
560
561 //const double D = buffer[0];
562 const double cd = buffer[1];
563
565 }
566
567
568 /**
569 * Read PDF transformer from input.
570 *
571 * \param in reader
572 * \return reader
573 */
574 virtual JReader& read(JReader& in) override
575 {
576 in >> transformer;
578
579 return in;
580 }
581
582
583 /**
584 * Write PDF transformer to output.
585 *
586 * \param out writer
587 * \return writer
588 */
589 virtual JWriter& write(JWriter& out) const override
590 {
591 out << transformer;
593
594 return out;
595 }
596
597
598 /**
599 * Print PDF transformer to output stream.
600 *
601 * \param out output stream
602 * \return output stream
603 */
604 std::ostream& print(std::ostream& out) const
605 {
606 return transformer.print(out);
607 }
608
609
612 };
613
614
615 /**
616 * Template definition of transformer of the probability density function (PDF) of the time response of a PMT.\n
617 * The actual implementation follows from the number of dimensions.
618 */
619 template<unsigned int N, class JArgument_t>
621
622
623 /**
624 * Template specialisation of transformer of the 2D probability density function (PDF) of the time response of a PMT due to a bright point.
625 *
626 * PDFs are evaluated by interpolation for:
627 * -# distance between bright point and PMT [m]
628 * -# cosine PMT angle
629 * -# arrival time [ns]
630 *
631 * The evaluation of the weights is based on:
632 * -# effective attenuation length
633 */
634 template<class JArgument_t>
635 class JPDFTransformer<2, JArgument_t> :
636 public JMultiMapTransformer<2, JArgument_t>
637 {
638 public:
639
640 typedef JPD0Transformer_t <JArgument_t> JFunction1DTransformer_t;
642
646
647
648 /**
649 * Default constructor.
650 */
652 transformer()
653 {}
654
655
656 /**
657 * Constructor.
658 *
659 * \param ln Effective attenuation length [m]
660 * \param alpha Distance dependence (power term)
661 * \param kmin Minimal kappa
662 * \param kmax Maximal kappa
663 */
664 JPDFTransformer(const double ln,
665 const int alpha,
666 const double kmin,
667 const double kmax) :
668 transformer(ln, alpha, kmin, kmax)
669 {}
670
671
672 /**
673 * Clone object.
674 *
675 * \return pointer to newly created transformer
676 */
677 virtual clone_type clone() const override
678 {
679 return new JPDFTransformer(*this);
680 }
681
682
683 /**
684 * Evaluate arrival time.
685 *
686 * \param buffer {D_m, ct}
687 * \param xn old t_ns
688 * \return new t_ns
689 */
690 virtual argument_type putXn(const_array_type& buffer, const argument_type xn) const override
691 {
692 return transformer.putXn(buffer, xn);
693 }
694
695
696 /**
697 * Evaluate arrival time.
698 *
699 * \param buffer {D_m, ct}
700 * \param xn old t_ns
701 * \return new t_ns
702 */
703 virtual argument_type getXn(const_array_type& buffer, const argument_type xn) const override
704 {
705 return transformer.getXn(buffer, xn);
706 }
707
708
709 /**
710 * Weight function.
711 *
712 * \param buffer {D_m, ct}
713 * \return weight
714 */
715 virtual double getWeight(const_array_type& buffer) const override
716 {
717 return transformer.getWeight(buffer);
718 }
719
720
721 /**
722 * Read PDF transformer from input.
723 *
724 * \param in reader
725 * \return reader
726 */
727 virtual JReader& read(JReader& in) override
728 {
729 in >> transformer;
730
731 return in;
732 }
733
734
735 /**
736 * Write PDF transformer to output.
737 *
738 * \param out writer
739 * \return writer
740 */
741 virtual JWriter& write(JWriter& out) const override
742 {
743 out << transformer;
744
745 return out;
746 }
747
748
749 /**
750 * Print PDF transfomer to output stream.
751 *
752 * \param out output stream
753 * \return output stream
754 */
755 std::ostream& print(std::ostream& out) const
756 {
757 return transformer.print(out);
758 }
759
760
762 };
763
764
765 /**
766 * Template specialisation of transformer of the 3D probability density function (PDF) of the time response of a PMT due to a muon.
767 *
768 * PDFs are evaluated by interpolation for:
769 * -# distance of closest approach of the muon to the PMT [m]
770 * -# zenith angle of the PMT
771 * -# azimuthal angle of the PMT
772 * -# arrival time [ns]
773 *
774 * The evaluation of the weights is based on:
775 * -# effective attenuation length
776 * -# angular acceptance of PMT
777 */
778 template<class JArgument_t>
779 class JPDFTransformer<3, JArgument_t> :
780 public JMultiMapTransformer<3, JArgument_t>
781 {
782 public:
783
784 typedef JPDFTransformer_t <JArgument_t> JFunction1DTransformer_t;
786
790
792
793 using JMultiMapTransformer_t::getWeight;
794
795
796 /**
797 * Default constructor.
798 */
800 transformer(),
802 {}
803
804
805 /**
806 * Constructor.
807 *
808 * \param ln Effective attenuation length [m]
809 * \param alpha Distance dependence (power term)
810 * \param kmin Minimal kappa
811 * \param kmax Maximal kappa
812 * \param pmt Function angular acceptance of PMT
813 * \param amin Baseline angular acceptance of PMT
814 */
815 template<class T>
816 JPDFTransformer(const double ln,
817 const int alpha,
818 const double kmin,
819 const double kmax,
820 T pmt,
821 const double amin) :
822 transformer(ln, alpha, kmin, kmax),
824 {
825 getAngularAcceptance.configure(JTOOLS::make_grid(1000, -1.0, +1.0), pmt);
826 getAngularAcceptance.add(amin);
827 getAngularAcceptance.compile();
828 getAngularAcceptance.setExceptionHandler(new JFunction1D_t::JDefaultResult(0.0));
829 }
830
831
832 /**
833 * Clone object.
834 *
835 * \return pointer to newly created transformer
836 */
837 virtual clone_type clone() const override
838 {
839 return new JPDFTransformer(*this);
840 }
841
842
843 /**
844 * Evaluate arrival time.
845 *
846 * \param buffer {R_m, theta, phi}
847 * \param xn old t_ns
848 * \return new t_ns
849 */
850 virtual argument_type putXn(const_array_type& buffer, const argument_type xn) const override
851 {
852 return transformer.putXn(buffer, xn);
853 }
854
855
856 /**
857 * Evaluate arrival time.
858 *
859 * \param buffer {R_m, theta, phi}
860 * \param xn old t_ns
861 * \return new t_ns
862 */
863 virtual argument_type getXn(const_array_type& buffer, const argument_type xn) const override
864 {
865 return transformer.getXn(buffer, xn);
866 }
867
868
869 /**
870 * Weight function.
871 *
872 * \param buffer {R_m, theta, phi}
873 * \return weight
874 */
875 virtual double getWeight(const_array_type& buffer) const override
876 {
877 using namespace JTOOLS;
878
879 //const double R = buffer[0];
880 const double theta = buffer[1];
881 const double phi = buffer[2];
882
883 const double n = getIndexOfRefraction();
884 const double ct0 = 1.0 / n;
885 const double st0 = sqrt((1.0 + ct0)*(1.0 - ct0));
886
887 const double px = sin(theta)*cos(phi);
888 //const double py = sin(theta)*sin(phi);
889 const double pz = cos(theta);
890
891 const double ct = st0*px + ct0*pz;
892
893 return transformer.getWeight(buffer) * getAngularAcceptance(ct);
894 }
895
896
897 /**
898 * Read PDF transformer from input.
899 *
900 * \param in reader
901 * \return reader
902 */
903 virtual JReader& read(JReader& in) override
904 {
905 in >> transformer;
907
908 getAngularAcceptance.compile();
909
910 return in;
911 }
912
913
914 /**
915 * Write PDF transformer to output.
916 *
917 * \param out writer
918 * \return writer
919 */
920 virtual JWriter& write(JWriter& out) const override
921 {
922 out << transformer;
924
925 return out;
926 }
927
928
929 /**
930 * Print PDF transformer to output stream.
931 *
932 * \param out output stream
933 * \return output stream
934 */
935 std::ostream& print(std::ostream& out) const
936 {
937 return transformer.print(out);
938 }
939
940
943 };
944
945
946 /**
947 * Template specialisation of transformer of the 4D probability density function (PDF) of the time response of a PMT due to an EM shower.
948 *
949 * PDFs are evaluated by interpolation for:
950 * -# distance between EM shower and PMT [m]
951 * -# cosine angle EM shower direction and EM shower - PMT position
952 * -# zenith angle of the PMT
953 * -# azimuthal angle of the PMT
954 * -# arrival time [ns]
955 *
956 * The evaluation of the weights is based on:
957 * -# effective attenuation length
958 * -# emission profile of the photons
959 * -# angular acceptance of PMT
960 */
961 template<class JArgument_t>
962 class JPDFTransformer<4, JArgument_t> :
963 public JMultiMapTransformer<4, JArgument_t>
964 {
965 public:
966
967 typedef JPDGTransformer_t <JArgument_t> JFunction2DTransformer_t;
969
973
975
976 using JMultiMapTransformer_t::getWeight;
977
978
979 /**
980 * Default constructor.
981 */
983 transformer(),
985 {}
986
987
988 /**
989 * Constructor.
990 *
991 * \param ln Effective attenuation length [m]
992 * \param alpha Distance dependence (power term)
993 * \param kmin Minimal kappa
994 * \param kmax Maximal kappa
995 * \param geant Function photon emission from EM-shower
996 * \param bmin Baseline photon emission from EM-shower
997 * \param pmt Function angular acceptance of PMT
998 * \param amin Baseline angular acceptance of PMT
999 */
1000 template<class T>
1001 JPDFTransformer(const double ln,
1002 const int alpha,
1003 const double kmin,
1004 const double kmax,
1005 const JGeant_t& geant,
1006 const double bmin,
1007 T pmt,
1008 const double amin) :
1009 transformer(ln, alpha, kmin, kmax, geant, bmin),
1011 {
1012 getAngularAcceptance.configure(JTOOLS::make_grid(1000, -1.0, +1.0), pmt);
1013 getAngularAcceptance.add(amin);
1014 getAngularAcceptance.compile();
1015 getAngularAcceptance.setExceptionHandler(new JFunction1D_t::JDefaultResult(0.0));
1016 }
1017
1018
1019 /**
1020 * Clone object.
1021 *
1022 * \return pointer to newly created transformer
1023 */
1024 virtual clone_type clone() const override
1025 {
1026 return new JPDFTransformer(*this);
1027 }
1028
1029
1030 /**
1031 * Evaluate arrival time.
1032 *
1033 * \param buffer {D_m, cd, theta, phi}
1034 * \param xn old t_ns
1035 * \return new t_ns
1036 */
1037 virtual argument_type putXn(const_array_type& buffer, const argument_type xn) const override
1038 {
1039 return transformer.putXn(buffer, xn);
1040 }
1041
1042
1043 /**
1044 * Evaluate arrival time.
1045 *
1046 * \param buffer {D_m, cd, theta, phi}
1047 * \param xn old t_ns
1048 * \return new t_ns
1049 */
1050 virtual argument_type getXn(const_array_type& buffer, const argument_type xn) const override
1051 {
1052 return transformer.getXn(buffer, xn);
1053 }
1054
1055
1056 /**
1057 * Weight function.
1058 *
1059 * \param buffer {D_m, cd, theta, phi}
1060 * \return weight
1061 */
1062 virtual double getWeight(const_array_type& buffer) const override
1063 {
1064 const double cd = buffer[1];
1065 const double theta = buffer[2];
1066 const double phi = buffer[3];
1067
1068 const double ct0 = (cd > -1.0 ? cd < +1.0 ? cd : +1.0 : -1.0);
1069 const double st0 = sqrt((1.0 + ct0)*(1.0 - ct0));
1070
1071 const double px = sin(theta)*cos(phi);
1072 //const double py = sin(theta)*sin(phi);
1073 const double pz = cos(theta);
1074
1075 const double ct = st0*px + ct0*pz;
1076
1077 return transformer.getWeight(buffer) * getAngularAcceptance(ct);
1078 }
1079
1080
1081 /**
1082 * Read PDF transformer from input.
1083 *
1084 * \param in reader
1085 * \return reader
1086 */
1087 virtual JReader& read(JReader& in) override
1088 {
1089 in >> transformer;
1091
1092 getAngularAcceptance.compile();
1093
1094 return in;
1095 }
1096
1097
1098 /**
1099 * Write PDF transformer to output.
1100 *
1101 * \param out writer
1102 * \return writer
1103 */
1104 virtual JWriter& write(JWriter& out) const override
1105 {
1106 out << transformer;
1107 out << getAngularAcceptance;
1108
1109 return out;
1110 }
1111
1112
1113 /**
1114 * Print PDF transfomer to output stream.
1115 *
1116 * \param out output stream
1117 * \return output stream
1118 */
1119 std::ostream& print(std::ostream& out) const
1120 {
1121 return transformer.print(out);
1122 }
1123
1124
1127 };
1128
1129
1130 /**
1131 * Template specialisation of transformer of the 5D probability density function (PDF) of the time response of a PMT due to an EM shower.
1132 *
1133 * PDFs are evaluated by interpolation for:
1134 * -# energy of the EM shower
1135 * -# distance between EM shower and PMT [m]
1136 * -# cosine angle EM shower direction and EM shower - PMT position
1137 * -# zenith angle of the PMT
1138 * -# azimuthal angle of the PMT
1139 * -# arrival time [ns]
1140 *
1141 * The evaluation of the weights is based on:
1142 * -# energy of the EM shower
1143 * -# effective attenuation length
1144 * -# emission profile of the photons
1145 * -# angular acceptance of PMT
1146 */
1147 template<class JArgument_t>
1148 class JPDFTransformer<5, JArgument_t> :
1149 public JMultiMapTransformer<5, JArgument_t>
1150 {
1151 public:
1152
1153 typedef JPDFTransformer <4, JArgument_t> JFunction4DTransformer_t;
1155
1159
1160
1161 /**
1162 * Default constructor.
1163 */
1165 transformer()
1166 {}
1167
1168
1169 /**
1170 * Constructor.
1171 *
1172 * \param transformer transformer
1173 */
1175 transformer(transformer)
1176 {}
1177
1178
1179 /**
1180 * Constructor.
1181 *
1182 * \param ln Effective attenuation length [m]
1183 * \param alpha Distance dependence (power term)
1184 * \param kmin Minimal kappa
1185 * \param kmax Maximal kappa
1186 * \param geant Function photon emission from EM-shower
1187 * \param bmin Baseline photon emission from EM-shower
1188 * \param pmt Function angular acceptance of PMT
1189 * \param amin Baseline angular acceptance of PMT
1190 */
1191
1192 template<class T>
1193 JPDFTransformer(const double ln,
1194 const int alpha,
1195 const double kmin,
1196 const double kmax,
1197 const JGeant_t& geant,
1198 const double bmin,
1199 T pmt,
1200 const double amin) :
1201 transformer(ln, alpha, kmin, kmax, geant, bmin, pmt, amin)
1202 {}
1203
1204
1205 /**
1206 * Clone object.
1207 *
1208 * \return pointer to newly created transformer
1209 */
1210 virtual clone_type clone() const override
1211 {
1212 return new JPDFTransformer(*this);
1213 }
1214
1215
1216 /**
1217 * Evaluate arrival time.
1218 *
1219 * \param buffer {E_GeV, D_m, cd, theta, phi}
1220 * \param xn old t_ns
1221 * \return new t_ns
1222 */
1223 virtual argument_type putXn(const_array_type& buffer, const argument_type xn) const override
1224 {
1225 return transformer.putXn(buffer.pop_front(), xn);
1226 }
1227
1228
1229 /**
1230 * Evaluate arrival time.
1231 *
1232 * \param buffer {E_GeV, D_m, cd, theta, phi}
1233 * \param xn old t_ns
1234 * \return new t_ns
1235 */
1236 virtual argument_type getXn(const_array_type& buffer, const argument_type xn) const override
1237 {
1238 return transformer.getXn(buffer.pop_front(), xn);
1239 }
1240
1241
1242 /**
1243 * Weight function.
1244 *
1245 * \param buffer {E_GeV, D_m, cd, theta, phi}
1246 * \return weight
1247 */
1248 virtual double getWeight(const_array_type& buffer) const override
1249 {
1250 const double E = buffer[0];
1251
1252 return transformer.getWeight(buffer.pop_front()) / E;
1253 }
1254
1255
1256 /**
1257 * Read PDF transformer from input.
1258 *
1259 * \param in reader
1260 * \return reader
1261 */
1262 virtual JReader& read(JReader& in) override
1263 {
1264 in >> transformer;
1265
1266 return in;
1267 }
1268
1269
1270 /**
1271 * Write PDF transformer to output.
1272 *
1273 * \param out writer
1274 * \return writer
1275 */
1276 virtual JWriter& write(JWriter& out) const override
1277 {
1278 out << transformer;
1279
1280 return out;
1281 }
1282
1283
1284 /**
1285 * Print PDF transfomer to output stream.
1286 *
1287 * \param out output stream
1288 * \return output stream
1289 */
1290 std::ostream& print(std::ostream& out) const
1291 {
1292 return transformer.print(out);
1293 }
1294
1296 };
1297}
1298
1299#endif
Compiler version dependent expressions, macros, etc.
double getAngularAcceptance(const double x)
Angular acceptence of PMT.
Definition JDrawLED.cc:68
Base class for photon emission profile EM-shower.
Physics constants.
Interface for binary input.
Interface for binary output.
Base class for the probability density function of photon emission from EM-shower as a function of th...
Definition JGeant_t.hh:34
Transformer for the 1D probability density function (PDF) of the time response of a PMT due to a poin...
JMultiMapTransformer_t::const_array_type const_array_type
virtual JReader & read(JReader &in) override
Read PDF transformer from input.
virtual argument_type getXn(const_array_type &buffer, const argument_type xn) const override
Evaluate arrival time.
static double getDmin()
Get shortest distance.
virtual double getWeight(const_array_type &buffer) const override
Weight function.
JMultiMapTransformer_t::clone_type clone_type
JMultiMapTransformer_t::argument_type argument_type
JPD0Transformer_t(const double ln, const int alpha, const double kmin, const double kmax)
Constructor.
JPD0Transformer_t()
Default constructor.
JMultiMapTransformer< 1, JArgument_t > JMultiMapTransformer_t
virtual argument_type putXn(const_array_type &buffer, const argument_type xn) const override
Evaluate arrival time.
int alpha
Distance dependence (power term)
double ln
Effective attenuation length [m].
std::ostream & print(std::ostream &out) const
Print PDF transformer to output stream.
virtual clone_type clone() const override
Clone object.
virtual JWriter & write(JWriter &out) const override
Write PDF transformer to output.
virtual clone_type clone() const override
Clone object.
JPD0Transformer_t< JArgument_t > JFunction1DTransformer_t
JPDFTransformer(const double ln, const int alpha, const double kmin, const double kmax)
Constructor.
virtual argument_type putXn(const_array_type &buffer, const argument_type xn) const override
Evaluate arrival time.
JMultiMapTransformer_t::const_array_type const_array_type
virtual JWriter & write(JWriter &out) const override
Write PDF transformer to output.
JMultiMapTransformer_t::clone_type clone_type
JMultiMapTransformer_t::argument_type argument_type
virtual double getWeight(const_array_type &buffer) const override
Weight function.
std::ostream & print(std::ostream &out) const
Print PDF transfomer to output stream.
virtual JReader & read(JReader &in) override
Read PDF transformer from input.
virtual argument_type getXn(const_array_type &buffer, const argument_type xn) const override
Evaluate arrival time.
JMultiMapTransformer< 2, JArgument_t > JMultiMapTransformer_t
JMultiMapTransformer_t::const_array_type const_array_type
JPDFTransformer(const double ln, const int alpha, const double kmin, const double kmax, T pmt, const double amin)
Constructor.
JMultiMapTransformer< 3, JArgument_t > JMultiMapTransformer_t
virtual argument_type putXn(const_array_type &buffer, const argument_type xn) const override
Evaluate arrival time.
JPDFTransformer_t< JArgument_t > JFunction1DTransformer_t
JMultiMapTransformer_t::argument_type argument_type
std::ostream & print(std::ostream &out) const
Print PDF transformer to output stream.
virtual argument_type getXn(const_array_type &buffer, const argument_type xn) const override
Evaluate arrival time.
virtual JReader & read(JReader &in) override
Read PDF transformer from input.
virtual JWriter & write(JWriter &out) const override
Write PDF transformer to output.
virtual double getWeight(const_array_type &buffer) const override
Weight function.
virtual clone_type clone() const override
Clone object.
JMultiMapTransformer_t::clone_type clone_type
JTOOLS::JGridPolint1Function1D_t JFunction1D_t
Template specialisation of transformer of the 4D probability density function (PDF) of the time respo...
virtual clone_type clone() const override
Clone object.
std::ostream & print(std::ostream &out) const
Print PDF transfomer to output stream.
JPDGTransformer_t< JArgument_t > JFunction2DTransformer_t
JPDFTransformer(const double ln, const int alpha, const double kmin, const double kmax, const JGeant_t &geant, const double bmin, T pmt, const double amin)
Constructor.
virtual argument_type getXn(const_array_type &buffer, const argument_type xn) const override
Evaluate arrival time.
JTOOLS::JGridPolint1Function1D_t JFunction1D_t
JMultiMapTransformer_t::const_array_type const_array_type
JMultiMapTransformer_t::clone_type clone_type
virtual JReader & read(JReader &in) override
Read PDF transformer from input.
JMultiMapTransformer_t::argument_type argument_type
virtual JWriter & write(JWriter &out) const override
Write PDF transformer to output.
JMultiMapTransformer< 4, JArgument_t > JMultiMapTransformer_t
virtual double getWeight(const_array_type &buffer) const override
Weight function.
virtual argument_type putXn(const_array_type &buffer, const argument_type xn) const override
Evaluate arrival time.
virtual argument_type getXn(const_array_type &buffer, const argument_type xn) const override
Evaluate arrival time.
virtual JReader & read(JReader &in) override
Read PDF transformer from input.
virtual double getWeight(const_array_type &buffer) const override
Weight function.
JMultiMapTransformer_t::clone_type clone_type
virtual JWriter & write(JWriter &out) const override
Write PDF transformer to output.
JPDFTransformer< 4, JArgument_t > JFunction4DTransformer_t
JMultiMapTransformer_t::const_array_type const_array_type
JMultiMapTransformer< 5, JArgument_t > JMultiMapTransformer_t
std::ostream & print(std::ostream &out) const
Print PDF transfomer to output stream.
virtual argument_type putXn(const_array_type &buffer, const argument_type xn) const override
Evaluate arrival time.
JPDFTransformer(const double ln, const int alpha, const double kmin, const double kmax, const JGeant_t &geant, const double bmin, T pmt, const double amin)
Constructor.
JMultiMapTransformer_t::argument_type argument_type
JPDFTransformer(const JFunction4DTransformer_t &transformer)
Constructor.
virtual clone_type clone() const override
Clone object.
Transformer for the 1D probability density function (PDF) of the time response of a PMT to a muon.
virtual clone_type clone() const override
Clone object.
static double getRmin()
Get shortest distance of approach.
virtual double getWeight(const_array_type &buffer) const override
Weight function.
std::ostream & print(std::ostream &out) const
Print PDF transformer to output stream.
JPDFTransformer_t()
Default constructor.
JMultiMapTransformer_t::clone_type clone_type
virtual JReader & read(JReader &in) override
Read PDF transformer from input.
virtual JWriter & write(JWriter &out) const override
Write PDF transformer to output.
int alpha
Distance dependence (power term)
virtual argument_type getXn(const_array_type &buffer, const argument_type xn) const override
Evaluate arrival time.
JMultiMapTransformer< 1, JArgument_t > JMultiMapTransformer_t
JMultiMapTransformer_t::argument_type argument_type
JMultiMapTransformer_t::const_array_type const_array_type
JPDFTransformer_t(const double ln, const int alpha, const double kmin, const double kmax)
Constructor.
virtual argument_type putXn(const_array_type &buffer, const argument_type xn) const override
Evaluate arrival time.
double ln
Effective attenuation length [m].
Template definition of transformer of the probability density function (PDF) of the time response of ...
Transformer for the 2D probability density function (PDF) of the time response of a PMT due to an EM ...
virtual argument_type getXn(const_array_type &buffer, const argument_type xn) const override
Evaluate arrival time.
virtual JReader & read(JReader &in) override
Read PDF transformer from input.
JMultiMapTransformer_t::clone_type clone_type
virtual clone_type clone() const override
Clone object.
JFunction1DTransformer_t transformer
JPDGTransformer_t(const double ln, const int alpha, const double kmin, const double kmax, const JGeant_t &geant, const double bmin)
Constructor.
virtual argument_type putXn(const_array_type &buffer, const argument_type xn) const override
Evaluate arrival time.
std::ostream & print(std::ostream &out) const
Print PDF transformer to output stream.
JMultiMapTransformer< 2, JArgument_t > JMultiMapTransformer_t
JMultiMapTransformer_t::argument_type argument_type
virtual JWriter & write(JWriter &out) const override
Write PDF transformer to output.
JPDGTransformer_t()
Default constructor.
JPD0Transformer_t< JArgument_t > JFunction1DTransformer_t
JMultiMapTransformer_t::const_array_type const_array_type
virtual double getWeight(const_array_type &buffer) const override
Weight function.
One dimensional array of template objects with fixed length.
Definition JArray.hh:43
JArray< N-1, T > pop_front() const
Make a copy in which the first element is removed.
Definition JArray.hh:328
Interface for weight application and coordinate transformation of function.
virtual double getWeight(const_array_type &buffer) const =0
Weight function.
JClonable< multimaptransformer_type >::clone_type clone_type
Auxiliary methods for light properties of deep-sea water.
double getIndexOfRefraction()
Get average index of refraction of water corresponding to group velocity.
const double getInverseSpeedOfLight()
Get inverse speed of light.
double getTanThetaC()
Get average tangent of Cherenkov angle of water corresponding to group velocity.
static const JGeant geant(geanx, 0.0001)
Function object for the number of photons from EM-shower as a function of emission angle.
double getIndexOfRefractionPhase()
Get average index of refraction of water corresponding to phase velocity.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for multi-dimensional interpolations and histograms.
JGrid< JAbscissa_t > make_grid(const int nx, const JAbscissa_t Xmin, const JAbscissa_t Xmax)
Helper method for JGrid.
Definition JGrid.hh:209
Type definition of a 1st degree polynomial interpolation based on a JGridCollection with result type ...