Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JShower3EZRegressor.hh
Go to the documentation of this file.
1#ifndef __JFIT__JSHOWER3EZREGRESSOR__
2#define __JFIT__JSHOWER3EZREGRESSOR__
3
4#include <array>
5
10
14#include "JTools/JRange.hh"
15#include "JTools/JResult.hh"
19
23
24#include "JMath/JZero.hh"
25
26#include "JFit/JTimeRange.hh"
27#include "JFit/JPMTW0.hh"
28#include "JFit/JSimplex.hh"
29#include "JFit/JGandalf.hh"
30#include "JFit/JMEstimator.hh"
31#include "JFit/JRegressor.hh"
32#include "JFit/JShower3EZ.hh"
33#include "JFit/JFitToolkit.hh"
34#include "JFit/JLine3Z.hh"
35
36#include "Jeep/JMessage.hh"
37
38/**
39 * \file
40 * Data regression method for JFIT::JShower3EZ.
41 * \author mdejong, vcarretero
42 */
43
44
45namespace JFIT {
46
51
52 /**
53 * Constrain PMT angle to [0,pi].
54 *
55 * \param angle angle [rad]
56 * \return angle [rad]
57 */
58 inline double getPMTAngle(const double angle)
59 {
60 const double epsilon = 1.0e-6;
61 const JTOOLS::JRange<double> range(epsilon, JMATH::PI - epsilon);
62
63 return range.constrain(fabs(angle));
64 }
65
66
67 /**
68 * Function to constrain the versor and energy during the fit, to prevent unphysical values.
69 *
70 * \param value model (I/O)
71 */
72 void model(JShower3EZ& value)
73 {
74 using namespace std;
75
76
77 double Tx = value.getDX();
78 double Ty = value.getDY();
79 double E = max(0.0,value.getE());
80 const double u = hypot(Tx, Ty);
81
82 if (u > 1.0) {
83 Tx /= u;
84 Ty /= u;
85 }
86
87 value = JShower3EZ(static_cast<const JPoint4D&>(value), JVersor3Z(Tx,Ty), E, value.getBy());
88
89 }
90
91 /**
92 * Template specialisation for storage of PDF tables.
93 */
94 template<>
96 {
103
109
110
111 static const int NUMBER_OF_PDFS = 2;
112
114
115 /**
116 * Default constructor.
117 */
120
121 /**
122 * Constructor
123 *
124 * The PDF file descriptor should contain the wild card character JPHYSICS::WILDCARD which
125 * will be replaced by the corresponding PDF types listed in JRegressorStorage<JShower3Z, JSimplex>::pdf_t.
126 *
127 * \param fileDescriptor PDF file descriptor
128 */
129
130 JRegressorStorage(const std::string& fileDescriptor)
131 {
132 using namespace std;
133 using namespace JPP;
134
135 const JPDF_t::JSupervisor supervisor(new JPDF_t::JDefaultResult(JMATH::zero));
136
137 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
138
139 const string file_name = getFilename(fileDescriptor, pdf_t[i]);
140
141 JPDF_t _pdf;
142 _pdf.load(file_name.c_str());
143
144 _pdf.setExceptionHandler(supervisor);
145
146 _npe[ i ] = JNPE_t(_pdf);
147 }
148 // Add NPEs
149 for (int i = 1; i < NUMBER_OF_PDFS; i += 2) {
150
151 _npe[ i ].add(_npe[i-1]);
152
153 JNPE_t buffer;
154
155 _npe[i-1].swap(buffer);
156 }
157 }
158
159
160
161 /**
162 * Get NPEs.
163 *
164 * \return PDFs
165 */
166 const JNPEs_t& getNPE() const
167 {
168 return _npe;
169 }
170
171 /**
172 * PDF types.
173 */
174 static const JPDFType_t pdf_t[NUMBER_OF_PDFS];
175
176 private:
177 JNPEs_t _npe; //!< PDFs
178 };
179
180 /**
181 * PDF types.
182 */
184 DIRECT_LIGHT_FROM_EMSHOWER,
185 SCATTERED_LIGHT_FROM_EMSHOWER
186 };
187
188 /**
189 * Regressor function object for JShower3EZ fit using JGandalf minimiser.
190 */
191 template<>
193 public JAbstractRegressor<JShower3EZ, JSimplex>,
194 public JRegressorStorage <JShower3EZ, JSimplex>
195 {
196 using JAbstractRegressor<JShower3EZ, JSimplex>::operator();
197
199
200 /**
201 * Default constructor
202 */
204 storage_type(),
205 npe(getNPE()),
206 estimator()
207 {}
208
209 /**
210 * Constructor.
211 *
212 * The PDF file descriptor should contain the wild card character JPHYSICS::WILDCARD which
213 * will be replaced by the PDF types listed in JRegressorStorage<JShower3EZ, JSimplex>::pdf_t.
214 *
215 * \param fileDescriptor PDF file descriptor
216 */
217 JRegressor(const std::string& fileDescriptor) :
218 storage_type(fileDescriptor),
219 npe(getNPE()),
220 estimator(new JMEstimatorNull())
221 {}
222
223 /**
224 * Constructor.
225 *
226 * \param storage PDF storage
227 */
228 JRegressor(const storage_type& storage) :
229 npe(storage.getNPE()),
230 estimator(new JMEstimatorNull())
231 {}
232
233
234 /**
235 * Fit function.
236 * This method is used to determine the chi2 of given PMT with respect to shower hypothesis.
237 *
238 * \param shower shower
239 * \param pmt pmt
240 * \return chi2
241 */
242 double operator()(const JShower3EZ& shower, const JPMTW0& pmt) const
243 {
244 using namespace JPP;
245
246 JPosition3D D(pmt.getPosition());
247 JDirection3D U(pmt.getDirection());
248
249 D.sub(shower.getPosition());
250
251 const double z = D.getDot(shower.getDirection());
252 const double x = D.getX();
253 const double y = D.getY();
254 const double cd = z/D.getLength(); // cosine angle between shower direction and PMT position
255
256 U.rotate(JRotation3Z(-atan2(y,x))); // rotate PMT axis to x-z plane
257
258 const double theta = getPMTAngle(U.getTheta());
259 const double phi = getPMTAngle(U.getPhi());
260
261 JNPE_t::result_type H0 = getH0(pmt.getR()); // background hypothesis value for time integrated PDF.
262 JNPE_t::result_type H1 = getH1(D.getLength(), cd, theta, phi, shower.getE()); // signal hypothesis value for time integrated PDF.
263
264 if (get_value(H1) >= Vmax_npe) {
265 H1 *= Vmax_npe / get_value(H1);
266 }
267
268 H1 += H0; // now H1 is signal + background
269
270 const bool hit = pmt.getN() != 0;
271 const double u = getChi2(get_value(H1), hit) - getChi2(get_value(H0), hit); // - log likelihood ratio
272
273 return estimator->getRho(u);
274 }
275
276 /**
277 * Get background hypothesis value for time integrated PDF.
278 *
279 * \param R_Hz rate [Hz]
280 * \return hypothesis value
281 */
282 JNPE_t::result_type getH0(const double R_Hz) const
283 {
284 return JNPE_t::result_type(R_Hz * 1e-9 * T_ns.getLength());
285 }
286
287 /**
288 * Get signal hypothesis value for time integrated PDF.
289 *
290 * \param D PMT distance from shower [m]
291 * \param cd cosine angle between shower direction and PMT position
292 * \param theta PMT zenith angle [deg]
293 * \param phi PMT azimuth angle [deg]
294 * \param E shower energy [GeV]
295 * \return hypothesis value
296 */
298 const double cd,
299 const double theta,
300 const double phi,
301 const double E) const
302 {
304
305 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
306
307 if (!npe[i].empty() && D <= npe[i].getXmax()) {
308
309 try {
310
311 JNPE_t::result_type y1 = E * npe[i](std::max(D, npe[i].getXmin()), cd, theta, phi);
312
313 // safety measure
314
315 if(y1 < 0){
316 y1 = 0;
317 }
318
319 h1 += y1;
320
321 }
322 catch(JLANG::JException& error) {
323 ERROR(error << std::endl);
324 }
325 }
326 }
327
328 return h1;
329 }
330
331
332 static JTimeRange T_ns; //!< Time window with respect to Cherenkov hypothesis [ns]
333 static double Vmax_npe; //!< Maximal integral of PDF [npe]
334
335 const JNPEs_t& npe;
336
337 std::shared_ptr<JMEstimator> estimator; //!< M-Estimator function
338 };
339
340 /**
341 * Template specialisation for storage of PDF tables.
342 */
343 template<>
345 {
352
358
359
360 static const int NUMBER_OF_PDFS = 2;
361
363
364 /**
365 * Default constructor.
366 */
369
370 /**
371 * Parameterized constructor
372 *
373 * The PDF file descriptor should contain the wild card character JPHYSICS::WILDCARD which
374 * will be replaced by the corresponding PDF types listed in JRegressorStorage<JShower3Z, JGandalf>::pdf_t.
375 *
376 * \param fileDescriptor PDF file descriptor
377 */
378
379 JRegressorStorage(const std::string& fileDescriptor)
380 {
381 using namespace std;
382 using namespace JPP;
383
384 const JPDF_t::JSupervisor supervisor(new JPDF_t::JDefaultResult(JMATH::zero));
385
386 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
387
388 const string file_name = getFilename(fileDescriptor, pdf_t[i]);
389
390 JPDF_t _pdf;
391 _pdf.load(file_name.c_str());
392
393 _pdf.setExceptionHandler(supervisor);
394
395 _npe[i] = JNPE_t(_pdf);
396
397 }
398
399 // Add PDFs
400 for (int i = 1; i < NUMBER_OF_PDFS; i += 2) {
401
402 _npe[ i ].add(_npe[i-1]);
403
404 JNPE_t buffer;
405
406 _npe[i-1].swap(buffer);
407 }
408 }
409
410
411 /**
412 * Get NPEs.
413 *
414 * \return PDFs
415 */
416 const JNPEs_t& getNPE() const
417 {
418 return _npe;
419 }
420
421 /**
422 * PDF types.
423 */
424 static const JPDFType_t pdf_t[NUMBER_OF_PDFS];
425
426 private:
427 JNPEs_t _npe; //!< PDFs
428 };
429
430 /**
431 * PDF types.
432 */
434 DIRECT_LIGHT_FROM_EMSHOWER,
435 SCATTERED_LIGHT_FROM_EMSHOWER
436 };
437
438 /**
439 * Regressor function object for JShower3EZ fit using JGandalf minimiser.
440 */
441 template<>
443 public JAbstractRegressor<JShower3EZ, JGandalf>,
444 public JRegressorStorage <JShower3EZ, JGandalf>
445 {
446 using JAbstractRegressor<JShower3EZ, JGandalf>::operator();
447
448 typedef JRegressorStorage<JShower3EZ, JGandalf> storage_type;
449
450 /**
451 * Default constructor
452 */
453 JRegressor() :
454 storage_type(),
455 npe(getNPE()),
456 estimator()
457 {}
458
459 /**
460 * Constructor.
461 *
462 * The PDF file descriptor should contain the wild card character JPHYSICS::WILDCARD which
463 * will be replaced by the PDF types listed in JRegressorStorage<JShower3EZ, JSimplex>::pdf_t.
464 *
465 * \param fileDescriptor PDF file descriptor
466 */
467 JRegressor(const std::string& fileDescriptor) :
468 storage_type(fileDescriptor),
469 npe(getNPE()),
470 estimator(new JMEstimatorNull())
471 {}
472
473 /**
474 * Constructor.
475 *
476 * \param storage PDF storage
477 */
478 JRegressor(const storage_type& storage) :
479 npe(storage.getNPE()),
480 estimator(new JMEstimatorNull())
481 {}
482
483
484 /**
485 * Fit function.
486 * This method is used to determine the chi2 of given PMT with respect to shower hypothesis.
487 *
488 * \param shower shower
489 * \param pmt pmt
490 * \return chi2
491 */
492 result_type operator()(const JShower3EZ& shower, const JPMTW0& pmt) const
493 {
494 using namespace JPP;
495 using namespace std;
496
497 JPosition3D D(pmt.getPosition());
498 JDirection3D U(pmt.getDirection());
499
500 D.sub(shower.getPosition());
501
502 const double x = D.getX();
503 const double y = D.getY();
504 const double d = D.getLength();
505 const double cd = D.getDot(shower.getDirection())/d; // cosine angle between shower direction and PMT position
506
507 U.rotate(JRotation3Z(-atan2(y,x))); // rotate PMT axis to x-z plane
508
509 const double theta = getPMTAngle(U.getTheta());
510 const double phi = getPMTAngle(U.getPhi());
511
512 JNPE_t::result_type H0 = getH0(pmt.getR()); // background hypothesis value for time integrated PDF.
513 JNPE_t::result_type H1 = getH1(d, cd, theta, phi, shower.getE()); // signal hypothesis value for time integrated PDF.
514
515 if (get_value(H1) >= Vmax_npe) {
516 H1 *= Vmax_npe / get_value(H1);
517 }
518
519 double signal_npe = get_value(H1);
520
521 H1 += H0; // now H1 is signal + background
522
523 double expectation = get_value(H1);
524
525 const bool hit = pmt.getN() != 0;
526 const double u = H1.getChi2(hit) - H0.getChi2(hit);
527
528 result_type result;
529
530 result.chi2 = estimator->getRho(u);
531
532 double energy_gradient = signal_npe/shower.getE(); // dP/dE
533 if(hit) energy_gradient *= -exp(-expectation)/(1-exp(-expectation)); //dchi2/d(H1), if !hit is 1
534
535 result.gradient = JShower3EZ(JPoint4D(JVector3D(0, // d(cos_th0)/d(x)
536 0, // d(cos_th0)/d(y)
537 0), // d(cos_th0)/d(z)
538 0.0), // d(cos_th0)/d(t)
539 JVersor3Z(x/d, // d(cos_th0)/d(dx)
540 y/d), // d(cos_th0)/d(dy)
541 energy_gradient); // d(chi2)/d(E)
542
543 result.gradient.mul(estimator->getPsi(u));
544 static_cast<JShower3Z&>(result.gradient).mul(H1.getDerivativeOfChi2(hit) - H0.getDerivativeOfChi2(hit)); // x d(chi2)/d(cos_th0)
545
546 return result;
547 }
548
549 /**
550 * Get background hypothesis value for time integrated PDF.
551 *
552 * \param R_Hz rate [Hz]
553 * \return hypothesis value
554 */
555 JNPE_t::result_type getH0(const double R_Hz) const
556 {
557 return JNPE_t::result_type(R_Hz * 1e-9 * T_ns.getLength(), 0.0);
558 }
559
560 /**
561 * Get signal hypothesis value for time integrated PDF.
562 *
563 * \param D PMT distance from shower [m]
564 * \param cd cosine angle between shower direction and PMT position
565 * \param theta PMT zenith angle [deg]
566 * \param phi PMT azimuth angle [deg]
567 * \param E shower energy [GeV]
568 * \return hypothesis value
569 */
570 JNPE_t::result_type getH1(const double D,
571 const double cd,
572 const double theta,
573 const double phi,
574 const double E) const
575 {
576 JNPE_t::result_type h1 = JMATH::zero;
577
578 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
579
580 if (!npe[i].empty() && D <= npe[i].getXmax()) {
581
582 try {
583
584 JNPE_t::result_type y1 = E * npe[i](std::max(D, npe[i].getXmin()), cd, theta, phi);
585
586 if (get_value(y1) > 0.0) {
587 h1 += y1;
588 }
589
590 }
591 catch(JLANG::JException& error) {
592 ERROR(error << std::endl);
593 }
594 }
595 }
596
597 return h1;
598 }
599
600
601 static JTimeRange T_ns; //!< Time window with respect to Cherenkov hypothesis [ns]
602 static double Vmax_npe; //!< Maximal integral of PDF [npe]
603
604 const JNPEs_t& npe;
605
606 std::shared_ptr<JMEstimator> estimator; //!< M-Estimator function
607 };
608
609
610
611 /**
612 * Template specialisation for storage of PDF tables.
613 */
614 template<>
616 {
623
629
630
631 static const int NUMBER_OF_PDFS = 2;
632
634
635 /**
636 * Default constructor.
637 */
640
641 /**
642 * Parameterized constructor
643 *
644 * The PDF file descriptor should contain the wild card character JPHYSICS::WILDCARD which
645 * will be replaced by the corresponding PDF types listed in JRegressorStorage<JShower3Z, JAbstractMinimiser>::pdf_t.
646 *
647 * \param fileDescriptor PDF file descriptor
648 */
649
650 JRegressorStorage(const std::string& fileDescriptor)
651 {
652 using namespace std;
653 using namespace JPP;
654
655 const JPDF_t::JSupervisor supervisor(new JPDF_t::JDefaultResult(JMATH::zero));
656
657 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
658
659 const string file_name = getFilename(fileDescriptor, pdf_t[i]);
660
661 JPDF_t _pdf;
662 _pdf.load(file_name.c_str());
663
664 _pdf.setExceptionHandler(supervisor);
665
666 _npe[i] = JNPE_t(_pdf);
667
668 }
669
670 // Add PDFs
671 for (int i = 1; i < NUMBER_OF_PDFS; i += 2) {
672
673 _npe[i].add(_npe[i-1]);
674
675 JNPE_t buffer;
676
677 _npe[i-1].swap(buffer);
678 }
679 }
680
681
682
683 /**
684 * Get NPEs.
685 *
686 * \return PDFs
687 */
688 const JNPEs_t& getNPE() const
689 {
690 return _npe;
691 }
692
693 /**
694 * PDF types.
695 */
696 static const JPDFType_t pdf_t[NUMBER_OF_PDFS];
697
698 private:
699 JNPEs_t _npe; //!< PDFs
700 };
701
702 /**
703 * PDF types.
704 */
706 DIRECT_LIGHT_FROM_EMSHOWER,
707 SCATTERED_LIGHT_FROM_EMSHOWER
708 };
709
710 /**
711 * Regressor function object for JShower3EZ fit using JGandalf minimiser.
712 */
713 template<>
715 public JAbstractRegressor<JShower3EZ, JAbstractMinimiser>,
716 public JRegressorStorage <JShower3EZ, JAbstractMinimiser>
717 {
719
721
722 /**
723 * Default constructor
724 */
725 JRegressor() :
726 storage_type(),
727 npe(getNPE()),
728 estimator()
729 {}
730
731 /**
732 * Constructor.
733 *
734 * The PDF file descriptor should contain the wild card character JPHYSICS::WILDCARD which
735 * will be replaced by the PDF types listed in JRegressorStorage<JShower3EZ, JSimplex>::pdf_t.
736 *
737 * \param fileDescriptor PDF file descriptor
738 */
739 JRegressor(const std::string& fileDescriptor) :
740 storage_type(fileDescriptor),
741 npe(getNPE()),
742 estimator(new JMEstimatorNull())
743 {}
744
745 /**
746 * Constructor.
747 *
748 * \param storage PDF storage
749 */
750 JRegressor(const storage_type& storage) :
751 npe(storage.getNPE()),
752 estimator(new JMEstimatorNull())
753 {}
754
755 /**
756 * Fit function.
757 * This method is used to determine the chi2 of given PMT with respect to shower hypothesis.
758 *
759 * \param shower shower
760 * \param pmt pmt
761 * \return chi2
762 */
763 double operator()(const JShower3EZ& shower, const JPMTW0& pmt) const
764 {
765 using namespace JPP;
766
767 JPosition3D D(pmt.getPosition());
768 JDirection3D U(pmt.getDirection());
769
770 D.sub(shower.getPosition());
771
772 const double z = D.getDot(shower.getDirection());
773 const double x = D.getX();
774 const double y = D.getY();
775 const double cd = z/D.getLength(); // cosine angle between shower direction and PMT position
776
777 U.rotate(JRotation3Z(-atan2(y,x))); // rotate PMT axis to x-z plane
778
779 const double theta = getPMTAngle(U.getTheta());
780 const double phi = getPMTAngle(U.getPhi());
781
782 JNPE_t::result_type H0 = getH0(pmt.getR()); // background hypothesis value for time integrated PDF.
783 JNPE_t::result_type H1 = getH1(D.getLength(), cd, theta, phi, shower.getE()); // signal hypothesis value for time integrated PDF.
784
785 if (get_value(H1) >= Vmax_npe) {
786 H1 *= Vmax_npe / get_value(H1);
787 }
788
789 H1 += H0; // now H1 is signal + background
790
791 const bool hit = pmt.getN() != 0;
792 const double u = getChi2(get_value(H1), hit) - getChi2(get_value(H0), hit); // -log likelihood ratio
793
794 return estimator->getRho(u);
795 }
796
797 /**
798 * Get background hypothesis value for time integrated PDF.
799 *
800 * \param R_Hz rate [Hz]
801 * \return hypothesis value
802 */
803 JNPE_t::result_type getH0(const double R_Hz) const
804 {
805 return JNPE_t::result_type(R_Hz * 1e-9 * T_ns.getLength());
806 }
807
808 /**
809 * Get signal hypothesis value for time integrated PDF.
810 *
811 * \param D PMT distance from shower [m]
812 * \param cd cosine angle between shower direction and PMT position
813 * \param theta PMT zenith angle [deg]
814 * \param phi PMT azimuth angle [deg]
815 * \param E shower energy [GeV]
816 * \return hypothesis value
817 */
818 JNPE_t::result_type getH1(const double D,
819 const double cd,
820 const double theta,
821 const double phi,
822 const double E) const
823 {
824 JNPE_t::result_type h1 = JMATH::zero;
825
826 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
827
828 if (!npe[i].empty() && D <= npe[i].getXmax()) {
829
830 try {
831
832 JNPE_t::result_type y1 = E * npe[i](std::max(D, npe[i].getXmin()), cd, theta, phi);
833
834 // safety measure
835
836 if(y1 < 0){
837 y1 = 0;
838 }
839
840 h1 += y1;
841
842 }
843 catch(JLANG::JException& error) {
844 ERROR(error << std::endl);
845 }
846 }
847 }
848
849 return h1;
850 }
851
852 /**
853 * Get signal hypothesis value for time integrated PDF.
854 *
855 * \param shower shower
856 * \param pmt pmt
857 * \return hypothesis value
858 */
859 JNPE_t::result_type getH1(const JShower3EZ& shower, const JPMTW0& pmt) const
860 {
861 using namespace JPP;
862
863 JPosition3D D(pmt.getPosition());
864 JDirection3D U(pmt.getDirection());
865
866
867 const double z = D.getDot(shower.getDirection());
868 const double x = D.getX();
869 const double y = D.getY();
870 const double cd = z/D.getLength(); // cosine angle between shower direction and PMT position
871
872 U.rotate(JRotation3Z(-atan2(y,x))); // rotate PMT axis to x-z plane
873
874 const double theta = getPMTAngle(U.getTheta());
875 const double phi = getPMTAngle(U.getPhi());
876
877 JNPE_t::result_type H1 = getH1(D.getLength(), cd, theta, phi, 1.0); // signal hypothesis value for time integrated PDF. E=1 because it is linear with E.
878
879 if (get_value(H1) >= Vmax_npe) {
880 H1 *= Vmax_npe / get_value(H1);
881 }
882
883 return H1;
884 }
885 static JTimeRange T_ns; //!< Time window with respect to Cherenkov hypothesis [ns]
886 static double Vmax_npe; //!< Maximal integral of PDF [npe]
887
888 const JNPEs_t& npe;
889
890 std::shared_ptr<JMEstimator> estimator; //!< M-Estimator function
891 };
892
893 /**
894 * Default values.
895 */
897 double JRegressor<JShower3EZ, JSimplex>::Vmax_npe = std::numeric_limits<double>::max();
898
900 double JRegressor<JShower3EZ, JGandalf>::Vmax_npe = std::numeric_limits<double>::max();
901
903 double JRegressor<JShower3EZ, JAbstractMinimiser>::Vmax_npe = std::numeric_limits<double>::max();
904
905
906
907}
908
909#endif
Auxiliary methods to evaluate Poisson probabilities and chi2.
Various implementations of functional maps.
Maximum likelihood estimator (M-estimators).
General purpose messaging.
#define ERROR(A)
Definition JMessage.hh:66
Auxiliary methods for PDF calculations.
Numbering scheme for PDF types.
Physics constants.
Auxiliary class to define a range between two values.
General purpose data regression method.
This include file containes various data structures that can be used as specific return types for the...
Definition of zero value for any class.
Place holder for custom implementation.
Abstract minimiser.
Definition JRegressor.hh:27
Fit method based on the Levenberg-Marquardt method.
Definition JGandalf.hh:87
Data structure for vertex fit.
Definition JPoint4D.hh:24
Data structure for fit of straight line in positive z-direction with energy.
Definition JShower3EZ.hh:30
double getBy() const
Get bjorken y.
Definition JShower3EZ.hh:76
double getE() const
Get E.
Definition JShower3EZ.hh:86
Data structure for cascade in positive z-direction.
Definition JShower3Z.hh:36
const JVersor3Z & getDirection() const
Get direction.
Definition JVersor3Z.hh:81
Simple fit method based on Powell's algorithm, see reference: Numerical Recipes in C++,...
Definition JSimplex.hh:44
Data structure for direction in three dimensions.
JDirection3D & rotate(const JRotation3D &R)
Rotate.
const JDirection3D & getDirection() const
Get direction.
Data structure for position in three dimensions.
double getDot(const JAngle3D &angle) const
Get dot product.
const JPosition3D & getPosition() const
Get position.
Rotation around Z-axis.
Data structure for vector in three dimensions.
Definition JVector3D.hh:36
double getY() const
Get y position.
Definition JVector3D.hh:104
double getLength() const
Get length.
Definition JVector3D.hh:246
JVector3D & sub(const JVector3D &vector)
Subtract vector.
Definition JVector3D.hh:158
double getX() const
Get x position.
Definition JVector3D.hh:94
double getTheta() const
Get theta angle.
Definition JVersor3D.hh:128
double getPhi() const
Get phi angle.
Definition JVersor3D.hh:144
Data structure for normalised vector in positive z-direction.
Definition JVersor3Z.hh:41
double getDY() const
Get y direction.
Definition JVersor3Z.hh:158
double getDX() const
Get x direction.
Definition JVersor3Z.hh:147
General exception.
Definition JException.hh:24
Custom class for integrated values of the PDF of the arrival time of Cherenkov light.
Definition JNPETable.hh:46
Multi-dimensional PDF table for arrival time of Cherenkov light.
Definition JPDFTable.hh:44
void setExceptionHandler(const typename function_type::supervisor_type &supervisor)
Set the supervisor for handling of exceptions.
Range of values.
Definition JRange.hh:42
T constrain(argument_type x) const
Constrain value to range.
Definition JRange.hh:350
double getNPE(const Hit &hit)
Get true charge of hit.
Auxiliary classes and methods for linear and iterative data regression.
Definition JEnergy.hh:15
double getPMTAngle(const double angle)
Constrain PMT angle to [0,pi].
double getChi2(const double P)
Get chi2 corresponding to given probability.
void model(JModel_t &value)
Auxiliary function to constrain model during fit.
Definition JGandalf.hh:57
static const JZero zero
Function object to assign zero value.
Definition JZero.hh:105
static const double PI
Mathematical constants.
JPDFType_t
PDF types.
Definition JPDFTypes.hh:24
@ SCATTERED_LIGHT_FROM_EMSHOWER
scattered light from EM shower
Definition JPDFTypes.hh:38
@ DIRECT_LIGHT_FROM_EMSHOWER
direct light from EM shower
Definition JPDFTypes.hh:37
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JResultEvaluator< JResult_t >::result_type get_value(const JResult_t &value)
Helper method to recursively evaluate a to function value.
Definition JResult.hh:998
Abstract class for global fit method.
Definition JRegressor.hh:79
Null M-estimator.
Auxiliary class for handling PMT geometry, rate and response.
Definition JPMTW0.hh:24
int getN() const
Get number of hits.
Definition JPMTW0.hh:67
double getR() const
Get rate.
Definition JPMTW0.hh:56
JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap > > > > JPDFMaplist_t
JPHYSICS::JPDFTable< JFunction1D_t, JPDFMaplist_t > JPDF_t
JPHYSICS::JNPETable< double, double, JNPEMaplist_t > JNPE_t
JRegressorStorage(const std::string &fileDescriptor)
Parameterized constructor.
JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap > > > > JNPEMaplist_t
JRegressorStorage(const std::string &fileDescriptor)
Parameterized constructor.
std::array< JNPE_t, NUMBER_OF_PDFS > JNPEs_t
NPEs.
JPHYSICS::JPDFTable< JFunction1D_t, JPDFMaplist_t > JPDF_t
JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap > > > > JPDFMaplist_t
JTOOLS::JMapList< JTOOLS::JPolint1FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint1FunctionalMapH, JTOOLS::JMapList< JTOOLS::JPolint1FunctionalGridMap, JTOOLS::JMapList< JTOOLS::JPolint1FunctionalGridMap > > > > JNPEMaplist_t
JPHYSICS::JNPETable< double, double, JNPEMaplist_t > JNPE_t
Template specialisation for storage of PDF tables.
JPHYSICS::JPDFTable< JFunction1D_t, JPDFMaplist_t > JPDF_t
std::array< JNPE_t, NUMBER_OF_PDFS > JNPEs_t
NPEs.
JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap > > > > JNPEMaplist_t
JRegressorStorage(const std::string &fileDescriptor)
Constructor.
JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap > > > > JPDFMaplist_t
JPHYSICS::JNPETable< double, double, JNPEMaplist_t > JNPE_t
Template data structure for storage of internal data.
JRegressorStorage< JShower3EZ, JSimplex > storage_type
std::shared_ptr< JMEstimator > estimator
M-Estimator function.
static double Vmax_npe
Maximal integral of PDF [npe].
JNPE_t::result_type getH0(const double R_Hz) const
Get background hypothesis value for time integrated PDF.
JNPE_t::result_type getH1(const double D, const double cd, const double theta, const double phi, const double E) const
Get signal hypothesis value for time integrated PDF.
double operator()(const JShower3EZ &shower, const JPMTW0 &pmt) const
Fit function.
JRegressor(const storage_type &storage)
Constructor.
static JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].
JRegressor(const std::string &fileDescriptor)
Constructor.
Template definition of a data regressor of given model.
Definition JRegressor.hh:70
void load(const char *file_name)
Load from input file.
Map list.
Definition JMapList.hh:25
Type definition of a zero degree polynomial interpolation based on a JGridMap implementation.
Type definition of a zero degree polynomial interpolation based on a JMap implementation.
Type definition of a 1st degree polynomial interpolation with result type double.
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 1st degree polynomial interpolation based on a JMap implementation.