Jpp test-rotations-old-533-g2bdbdb559
the software that should make you happy
Loading...
Searching...
No Matches
JReconstruction/JEvtToolkit.hh
Go to the documentation of this file.
1#ifndef __JRECONSTRUCTION__JEVTTOOLKIT__
2#define __JRECONSTRUCTION__JEVTTOOLKIT__
3
4#include <string>
5#include <istream>
6#include <ostream>
7#include <map>
8#include <algorithm>
9#include <cmath>
10
13
14#include "JLang/JException.hh"
15#include "JLang/JPredicate.hh"
16#include "JLang/JFind_if.hh"
17#include "JTools/JRange.hh"
30#include "JMath/JMathToolkit.hh"
31#include "JMath/JConstants.hh"
32#include "JTools/JRange.hh"
34
35#include "JFit/JLine1Z.hh"
36#include "JFit/JShower3EZ.hh"
37
41
42
43/**
44 * \author mdejong
45 */
46namespace JRECONSTRUCTION {}
47namespace JPP { using namespace JRECONSTRUCTION; }
48
49/**
50 * Model fits to data.
51 */
52namespace JRECONSTRUCTION {
53
66 using JTOOLS::JRange;
67 using JFIT::JLine1Z;
68 using JFIT::JShower3Z;
69
70
71 static const int JSTART_ZMIN_M = 11; //!< start position of track
72 static const int JSTART_ZMAX_M = 12; //!< end position of track
73
74
75 /**
76 * Auxiliary data structure to get weight of given fit.
77 */
78 static struct JWeight :
79 public std::map<std::string, int>
80 {
81 /**
82 * Default constructor.
83 */
85 {
86#define MAKE_ENTRY(A) std::make_pair(#A, A)
87
88 this->insert(MAKE_ENTRY(JGANDALF_BETA0_RAD));
89 this->insert(MAKE_ENTRY(JGANDALF_BETA1_RAD));
92 this->insert(MAKE_ENTRY(JENERGY_ENERGY));
93 this->insert(MAKE_ENTRY(JENERGY_CHI2));
94 this->insert(MAKE_ENTRY(JGANDALF_LAMBDA));
96 this->insert(MAKE_ENTRY(JSTART_ZMIN_M));
97 this->insert(MAKE_ENTRY(JSTART_ZMAX_M));
98 this->insert(MAKE_ENTRY(JSTART_NPE_MIP_TOTAL));
99 this->insert(MAKE_ENTRY(JSTART_NPE_MIP_MISSED));
100 this->insert(MAKE_ENTRY(JSTART_LENGTH_METRES));
101 this->insert(MAKE_ENTRY(JSTART_BACKGROUND_LOGP));
102 this->insert(MAKE_ENTRY(JVETO_NPE));
103 this->insert(MAKE_ENTRY(JVETO_NUMBER_OF_HITS));
106 this->insert(MAKE_ENTRY(JENERGY_NDF));
107 this->insert(MAKE_ENTRY(JENERGY_NUMBER_OF_HITS));
108 this->insert(MAKE_ENTRY(JCOPY_Z_M));
110 this->insert(MAKE_ENTRY(JPP_COVERAGE_POSITION));
111 this->insert(MAKE_ENTRY(JENERGY_MINIMAL_ENERGY));
112 this->insert(MAKE_ENTRY(JENERGY_MAXIMAL_ENERGY));
113 this->insert(MAKE_ENTRY(JSHOWERFIT_ENERGY));
114 this->insert(MAKE_ENTRY(AASHOWERFIT_ENERGY));
116
117#undef MAKE_ENTRY
118 }
119
120
121 /**
122 * Has weight.
123 *
124 * \param key key
125 * \return true if valid key; else false
126 */
127 bool operator()(const std::string& key) const
128 {
129 return this->count(key) != 0;
130 }
131
132
133 /**
134 * Get weight.
135 *
136 * \param fit fit
137 * \param key key
138 * \param value default value
139 * \return value
140 */
141 double operator()(const JFit& fit, const std::string& key, const double value) const
142 {
143 const_iterator p = this->find(key);
144
145 if (p != this->end() && fit.hasW(p->second))
146 return fit.getW(p->second);
147 else
148 return value;
149 }
150
152
153
154 /**
155 * Get position.
156 *
157 * \param fit fit
158 * \return position
159 */
160 inline JPosition3D getPosition(const JFit& fit)
161 {
162 return JPosition3D(fit.getX(), fit.getY(), fit.getZ());
163 }
164
165
166 /**
167 * Get direction.
168 *
169 * \param fit fit
170 * \return direction
171 */
172 inline JDirection3D getDirection(const JFit& fit)
173 {
174 return JDirection3D(fit.getDX(), fit.getDY(), fit.getDZ());
175 }
176
177
178 /**
179 * Get vertex.
180 *
181 * \param fit fit
182 * \return vertex
183 */
184 inline JVertex3D getVertex(const JFit& fit)
185 {
186 return JVertex3D(getPosition(fit), fit.getT());
187 }
188
189
190 /**
191 * Get axis.
192 *
193 * \param fit fit
194 * \return axis
195 */
196 inline JAxis3D getAxis(const JFit& fit)
197 {
198 return JAxis3D(getPosition(fit), getDirection(fit));
199 }
200
201
202 /**
203 * Get track.
204 *
205 * \param fit fit
206 * \return track
207 */
208 inline JTrack3E getTrack(const JFit& fit)
209 {
210 return JTrack3E(JTrack3D(getAxis(fit), fit.getT()), fit.getE());
211 }
212
213
214 /**
215 * Get shower.
216 *
217 * \param fit fit
218 * \return shower
219 */
220 inline JShower3E getShower(const JFit& fit)
221 {
222 return JShower3E(JShower3D(getVertex(fit), getDirection(fit)), fit.getE());
223 }
224
225
226 /**
227 * Get fit.
228 *
229 * \param history history
230 * \param track track
231 * \param Q quality
232 * \param NDF number of degrees of freedom
233 * \param energy Energy, which would be set as 0, if the fit does not reconstruct energy
234 * \param status status of the fit as defined in enum JFitStatus.hh
235 * \return fit
236 */
237 inline JFit getFit(const JHistory& history,
238 const JTrack3D& track,
239 const double Q,
240 const int NDF,
241 const double energy = 0.0,
242 const int status = SINGLE_STAGE)
243 {
244 return JFit(history,
245 track.getX(), track.getY(), track.getZ(),
246 track.getDX(), track.getDY(), track.getDZ(),
247 track.getT(),
248 Q, NDF,
249 energy, status);
250 }
251
252
253 /**
254 * Get fit.
255 *
256 * \param history history
257 * \param track track
258 * \param angle angle
259 * \param Q quality
260 * \param NDF number of degrees of freedom
261 * \param energy Energy, which would be set as 0, if the fit does not reconstruct energy
262 * \param status status of the fit as defined in JFitStatus.hh
263 * \return fit
264 */
265 inline JFit getFit(const JHistory& history,
266 const JLine1Z& track,
267 const JAngle3D& angle,
268 const double Q,
269 const int NDF,
270 const double energy = 0.0,
271 const int status = SINGLE_STAGE)
272 {
273 return JFit(history,
274 track.getX(), track.getY(), track.getZ(),
275 angle.getDX(), angle.getDY(), angle.getDZ(),
276 track.getT(),
277 Q, NDF,
278 energy, status);
279 }
280
281
282 /**
283 * Get fit.
284 *
285 * \param history history
286 * \param shower shower
287 * \param Q quality
288 * \param NDF number of degrees of freedom
289 * \param energy Energy, which would be set as 0, if the fit does not reconstruct energy
290 * \param status status of the fit as defined in enum JFitStatus.hh
291 * \return fit
292 */
293 inline JFit getFit(const JHistory& history,
294 const JShower3D& shower,
295 const double Q,
296 const int NDF,
297 const double energy = 0.0,
298 const int status = SINGLE_STAGE)
299 {
300 return JFit(history,
301 shower.getX(), shower.getY(), shower.getZ(),
302 shower.getDX(), shower.getDY(), shower.getDZ(),
303 shower.getT(),
304 Q, NDF,
305 energy, status);
306 }
307
308
309 /**
310 * Get dot product.
311 *
312 * \param first first fit
313 * \param second second fit
314 * \return dot product
315 */
316 inline double getDot(const JFit& first, const JFit& second)
317 {
318 return JMATH::getDot(getDirection(first), getDirection(second));
319 }
320
321
322 /**
323 * Get dot product.
324 *
325 * \param fit fit
326 * \param dir direction
327 * \return dot product
328 */
329 inline double getDot(const JFit& fit, const JDirection3D& dir)
330 {
331 return JMATH::getDot(getDirection(fit), dir);
332 }
333
334
335 /**
336 * Get space angle.
337 *
338 * \param first first fit
339 * \param second second fit
340 * \return angle [deg]
341 */
342 inline double getAngle(const JFit& first, const JFit& second)
343 {
344 return JMATH::getAngle(getDirection(first), getDirection(second));
345 }
346
347
348 /**
349 * Get space angle.
350 *
351 * \param fit fit
352 * \param dir direction
353 * \return angle [deg]
354 */
355 inline double getAngle(const JFit& fit, const JDirection3D& dir)
356 {
357 return JMATH::getAngle(getDirection(fit), dir);
358 }
359
360
361 /**
362 * Get quality of fit.\n
363 * The larger the quality, the better the fit.
364 *
365 * \param chi2 chi2
366 * \param N number of hits
367 * \param NDF number of degrees of freedom
368 * \return quality
369 */
370 inline double getQuality(const double chi2, const int N, const int NDF)
371 {
372 return N - 0.25 * chi2 / NDF;
373 }
374
375
376 /**
377 * Get quality of fit.\n
378 * The larger the quality, the better the fit.
379 *
380 * \param chi2 chi2
381 * \param NDF number of degrees of freedom
382 * \return quality
383 */
384 inline double getQuality(const double chi2, const int NDF)
385 {
386 return NDF - 0.25 * chi2 / NDF;
387 }
388
389
390 /**
391 * Get quality of fit.\n
392 * The larger the quality, the better the fit.
393 *
394 * \param chi2 chi2
395 * \return quality
396 */
397 inline double getQuality(const double chi2)
398 {
399 return -chi2;
400 }
401
402
403 /**
404 * Comparison of fit results.
405 *
406 * \param first first fit
407 * \param second second fit
408 * \return true if first fit has better quality than second; else false
409 */
410 inline bool qualitySorter(const JFit& first, const JFit& second)
411 {
412 if (first.getHistory().size() == second.getHistory().size())
413 return first.getQ() > second.getQ();
414 else
415 return first.getHistory().size() > second.getHistory().size();
416 }
417
418
419 /**
420 * General purpose sorter of fit results.
421 *
422 * The default constructor will sort fit results according the method JRECONSTRUCTION::qualitySorter.\n
423 * A different method can dynamically be loaded from a (shared) library using class JEEP::JFunctionAdaptor.
424 * For the definition of an alternative method, see e.g.\ quality_sorter.cc
425 */
427 public JFunctionAdaptor<bool, const JFit&, const JFit&>
428 {
431
432
433 /**
434 * Default constructor.
435 */
439 };
440
441
442 /**
443 * Test whether given fit has specified history.
444 *
445 * \param fit fit
446 * \param type application type
447 * \return true if type in history; else false
448 */
449 inline bool has_history(const JFit& fit, const int type)
450 {
451 return std::find_if(fit.getHistory().begin(),
452 fit.getHistory().end(),
453 JLANG::make_predicate(&JEvent::type, type)) != fit.getHistory().end();
454 }
455
456
457 /**
458 * Test whether given fit has specified history.
459 *
460 * \param fit fit
461 * \param range application type range
462 * \return true if type in history; else false
463 */
464 inline bool has_history(const JFit& fit, const JRange<int>& range)
465 {
466 return std::find_if(fit.getHistory().begin(),
467 fit.getHistory().end(),
468 JLANG::make_find_if(&JEvent::type, range)) != fit.getHistory().end();
469 }
470
471
472 /**
473 * Test whether given fit has muon prefit in history.
474 *
475 * \param fit fit
476 * \return true if muon prefit in history; else false
477 */
478 inline bool has_muon_prefit(const JFit& fit)
479 {
480 return has_history(fit, JMUONPREFIT);
481 }
482
483
484 /**
485 * Test whether given fit has muon simplex in history.
486 *
487 * \param fit fit
488 * \return true if muon simplex in history; else false
489 */
490 inline bool has_muon_simplex(const JFit& fit)
491 {
492 return has_history(fit, JMUONSIMPLEX);
493 }
494
495
496 /**
497 * Test whether given fit has muon gandalf in history.
498 *
499 * \param fit fit
500 * \return true if muon gandalf in history; else false
501 */
502 inline bool has_muon_gandalf(const JFit& fit)
503 {
504 return has_history(fit, JMUONGANDALF);
505 }
506
507
508 /**
509 * Test whether given fit has muon energy in history.
510 *
511 * \param fit fit
512 * \return true if muon energy in history; else false
513 */
514 inline bool has_muon_energy(const JFit& fit)
515 {
516 return has_history(fit, JMUONENERGY);
517 }
518
519
520 /**
521 * Test whether given fit has muon start in history.
522 *
523 * \param fit fit
524 * \return true if muon start in history; else false
525 */
526 inline bool has_muon_start(const JFit& fit)
527 {
528 return has_history(fit, JMUONSTART);
529 }
530
531
532 /**
533 * Test whether given fit has muon fit in history.
534 *
535 * \param fit fit
536 * \return true if muon fit in history; else false
537 */
538 inline bool has_muon_fit(const JFit& fit)
539 {
541 }
542
543
544 /**
545 * Test whether given fit has shower prefit in history.
546 *
547 * \param fit fit
548 * \return true if shower prefit in history; else false
549 */
550 inline bool has_shower_prefit(const JFit& fit)
551 {
552 return has_history(fit, JSHOWERPREFIT);
553 }
554
555
556 /**
557 * Test whether given fit has shower position fit in history.
558 *
559 * \param fit fit
560 * \return true if shower position fit in history; else false
561 */
562 inline bool has_shower_positionfit(const JFit& fit)
563 {
564 return has_history(fit, JSHOWERPOSITIONFIT);
565 }
566
567
568 /**
569 * Test whether given fit has shower complete fit in history.
570 *
571 * \param fit fit
572 * \return true if shower complete fit in history; else false
573 */
574 inline bool has_shower_completefit(const JFit& fit)
575 {
576 return has_history(fit, JSHOWERCOMPLETEFIT);
577 }
578
579
580 /**
581 * Test whether given fit has shower fit in history.
582 *
583 * \param fit fit
584 * \return true if shower fit in history; else false
585 */
586 inline bool has_shower_fit(const JFit& fit)
587 {
589 }
590
591
592 /**
593 * Test whether given event has a track according selection.\n
594 * The track selector corresponds to the function operator <tt>bool selector(const JFit&);</tt>.
595 *
596 * \param evt event
597 * \param selector track selector
598 * \return true if at least one corresponding track; else false
599 */
600 template<class JTrackSelector_t>
601 inline bool has_reconstructed_track(const JEvt& evt, JTrackSelector_t selector)
602 {
603 return std::find_if(evt.begin(), evt.end(), selector) != evt.end();
604 }
605
606
607 /**
608 * Test whether given event has a track with muon reconstruction.
609 *
610 * \param evt event
611 * \return true if at least one reconstructed muon; else false
612 */
613 inline bool has_reconstructed_muon(const JEvt& evt)
614 {
616 }
617
618
619 /**
620 * Test whether given event has a track with shower reconstruction.
621 *
622 * \param evt event
623 * \return true if at least one reconstructed shower; else false
624 */
625 inline bool has_reconstructed_shower(const JEvt& evt)
626 {
628 }
629
630
631 /**
632 * Get best reconstructed track.\n
633 * The track selector corresponds to the function operator <tt>bool selector(const Trk&);</tt> and
634 * the track comparator to <tt>bool comparator(const Trk&, const Trk&);</tt>.
635 *
636 * \param evt event
637 * \param selector track selector
638 * \param comparator track comparator
639 * \return track
640 */
641 template<class JTrackSelector_t, class JQualitySorter_t>
642 inline const JFit& get_best_reconstructed_track(const JEvt& evt,
643 JTrackSelector_t selector,
644 JQualitySorter_t comparator)
645 {
646 JEvt::const_iterator p = std::find_if(evt.begin(), evt.end(), selector);
647
648 for (JEvt::const_iterator i = p; i != evt.end(); ++i) {
649 if (selector(*i) && comparator(*i, *p)) {
650 p = i;
651 }
652 }
653
654 if (p != evt.end())
655 return *p;
656 else
657 THROW(JIndexOutOfRange, "This event has no fit with given selector.");
658 }
659
660
661 /**
662 * Get best reconstructed muon.
663 *
664 * \param evt event
665 * \return track
666 */
667 inline const JFit& get_best_reconstructed_muon(const JEvt& evt)
668 {
670 }
671
672
673 /**
674 * Get best reconstructed shower.
675 *
676 * \param evt event
677 * \return track
678 */
679 inline const JFit& get_best_reconstructed_shower(const JEvt& evt)
680 {
682 }
683
684
685 /**
686 * Auxiliary class to compare fit results with respect to a reference direction (e.g.\ true muon).
687 * The sort operation results in an ordered set of fit results with increasing angle between
688 * the reference direction and that of the fit results.
689 */
690 class JPointing {
691 public:
692 /**
693 * Default constructor.
694 */
696 {}
697
698
699 /**
700 * Constructor.
701 *
702 * \param dir reference direction
703 */
705 {
706 this->dir = dir;
707 }
708
709
710 /**
711 * Constructor.
712 *
713 * \param fit fit
714 */
715 JPointing(const JFit& fit)
716 {
718 }
719
720
721 /**
722 * Get direction.
723 *
724 * \return direction
725 */
727 {
728 return dir;
729 }
730
731
732 /**
733 * Get angle between reference direction and fit result.
734 *
735 * \param fit fit
736 * \return angle [deg]
737 */
738 inline double getAngle(const JFit& fit) const
739 {
740 const double dot = getDot(fit, dir);
741
742 if (dot >= +1.0)
743 return 0.0;
744 else if (dot <= -1.0)
745 return 180.0;
746 else
747 return acos(dot) * 180.0 / JMATH::PI;
748 }
749
750
751 /**
752 * Comparison of fit results.
753 *
754 * \param first first fit
755 * \param second second fit
756 * \return true if first fit better; else false
757 */
758 inline bool operator()(const JFit& first, const JFit& second) const
759 {
760 return getDot(first, dir) > getDot(second, dir);
761 }
762
763
764 /**
765 * Select best fit result.
766 *
767 * \param __begin begin of fit results
768 * \param __end end of fit results
769 * \return best fit result
770 */
771 template<class T>
772 inline T operator()(T __begin, T __end) const
773 {
774 return std::min_element(__begin, __end, *this);
775 }
776
777 protected:
779 };
780
781
782 /**
783 * Auxiliary class to compare fit results with respect to a reference position.
784 * The sort operation results in an ordered set of fit results with increasing distance between
785 * the reference position and that of the fit results.
786 */
787 class JPosition {
788 public:
789 /**
790 * Constructor.
791 *
792 * \param pos reference position
793 */
795 {
796 this->pos = pos;
797 }
798
799 /**
800 * Comparison of fit results.
801 *
802 * \param first first fit
803 * \param second second fit
804 * \return true if first fit better; else false
805 */
806 inline bool operator()(const JFit& first, const JFit& second) const
807 {
808 return this->pos.getDistance(getPosition(first)) < this->pos.getDistance(getPosition(second));
809 }
810
811 /**
812 * Select best fit result.
813 *
814 * \param __begin begin of fit results
815 * \param __end end of fit results
816 * \return best fit result
817 */
818 template<class T>
819 inline T operator()(T __begin, T __end) const
820 {
821 return std::min_element(__begin, __end, *this);
822 }
823
824 protected:
826 };
827
828
829 /**
830 * Auxiliary class to compare fit results with respect to a reference energy.
831 * The sort operation results in an ordered set of fit results with increasing difference between
832 * the reference energy and that of the fit results.
833 */
835 public:
836 /**
837 * Constructor.
838 *
839 * \param E reference energy
840 */
842 {
843 this->energy = E;
844 }
845
846 /**
847 * Comparison of fit results.
848 *
849 * \param first first fit
850 * \param second second fit
851 * \return true if first fit better; else false
852 */
853 inline bool operator()(const JFit& first, const JFit& second) const
854 {
855 return fabs(this->energy - first.getE()) < fabs(this->energy - second.getE());
856 }
857
858 /**
859 * Select best fit result.
860 *
861 * \param __begin begin of fit results
862 * \param __end end of fit results
863 * \return best fit result
864 */
865 template<class T>
866 inline T operator()(T __begin, T __end) const
867 {
868 return std::min_element(__begin, __end, *this);
869 }
870
871 protected:
872 double energy;
873 };
874
875
876 /**
877 * Gridify set of fits.
878 *
879 * \param __begin begin of fits
880 * \param __end end of fits
881 * \param N number of directions in grid
882 * \return end of fits sorted by quality
883 */
884 inline JEvt::iterator gridify(JEvt::iterator __begin, JEvt::iterator __end, const int N)
885 {
886 using namespace std;
887 using namespace JPP;
888
889 static const double MINIMAL_ANGLE_DEG = 60.0;
890
891 // estimate grid angle
892
893 double angle_deg = 10.0 * sqrt((double) 240 / (double) N);
894
895 if (angle_deg > MINIMAL_ANGLE_DEG) {
896 angle_deg = MINIMAL_ANGLE_DEG;
897 }
898
899 const JOmega3D ps(angle_deg * PI/180.0);
900
901 JEvt::iterator out = __begin;
902
903 for (JOmega3D_t::const_iterator dir = ps.begin(); dir != ps.end() && out != __end; ++dir) {
904
905 const JPointing pointing(*dir);
906
907 sort(out, __end, pointing);
908
909 JEvt::iterator p = out;
910
911 for (JEvt::iterator i = out; i != __end && pointing.getAngle(*i) <= angle_deg; ++i) {
912 if (qualitySorter(*i, *p)) {
913 p = i;
914 }
915 }
916
917 swap(*(out++), *p);
918 }
919
920 sort(__begin, out, qualitySorter);
921
922 return out;
923 }
924
925
926 /**
927 * Auxiliary class to evaluate atmospheric muon hypothesis.
928 * The hypothesis is tested by means of the difference in quality
929 * between the best upward and best downward track.
930 */
932 public:
933 /**
934 * Default constructor.
935 */
937 dot1(0.0),
938 dot2(0.0)
939 {}
940
941
942 /**
943 * Constructor.
944 *
945 * \param theta1 upper hemisphere angle [deg]
946 * \param theta2 lower hemisphere angle [deg]
947 */
948 JAtmosphericMuon(const double theta1,
949 const double theta2) :
950 dot1(cos(theta1 * JMATH::PI/180.0)),
951 dot2(cos(theta2 * JMATH::PI/180.0))
952 {}
953
954
955 /**
956 * Test is event is atmospheric muon.
957 *
958 * \param __begin begin of data
959 * \param __end end of data
960 * \return negative if preferably down / positive if preferably up
961 */
962 double operator()(JEvt::const_iterator __begin,
963 JEvt::const_iterator __end) const
964 {
965 double Qup = 0.0;
966 double Qdown = 0.0;
967
968 for (JEvt::const_iterator i = __begin; i != __end; ++i) {
969
970 if (i->getDZ() >= dot1) {
971
972 if (i->getQ() > Qup) {
973 Qup = i->getQ();
974 }
975
976 } else if (i->getDZ() <= dot2) {
977
978 if (i->getQ() > Qdown) {
979 Qdown = i->getQ();
980 }
981 }
982 }
983
984 return Qup - Qdown;
985 }
986
987
988 /**
989 * Read atmospheric muon analyser from input.
990 *
991 * \param in input stream
992 * \param object atmospheric muon analyser
993 * \return input stream
994 */
995 friend inline std::istream& operator>>(std::istream& in, JAtmosphericMuon& object)
996 {
997 double theta1, theta2;
998
999 in >> theta1 >> theta2;
1000
1001 object.dot1 = cos(theta1 * JMATH::PI/180.0);
1002 object.dot2 = cos(theta2 * JMATH::PI/180.0);
1003
1004 return in;
1005 }
1006
1007
1008 /**
1009 * Write atmospheric muon analyser to output.
1010 *
1011 * \param out output stream
1012 * \param object atmospheric muon analyser
1013 * \return output stream
1014 */
1015 friend inline std::ostream& operator<<(std::ostream& out, const JAtmosphericMuon& object)
1016 {
1017 out << acos(object.dot1) * 180.0 / JMATH::PI << ' '
1018 << acos(object.dot2) * 180.0 / JMATH::PI;
1019
1020 return out;
1021 }
1022
1023
1024 double dot1;
1025 double dot2;
1026 };
1027}
1028
1029#endif
Exceptions.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition for fit results.
Binary methods for member methods.
Mathematical constants.
Auxiliary class to define a range between two values.
#define MAKE_ENTRY(A)
static const int JMUONBEGIN
begin range of reconstruction stages
static const int JSHOWEREND
end range of reconstruction stages
static const int JSHOWERBEGIN
begin range of reconstruction stages
static const int JMUONEND
end range of reconstruction stages
Data structure for set of track fit results.
Data structure for track fit results with history and optional associated values.
double getDZ() const
Get Z-slope.
double getDY() const
Get Y-slope.
double getZ() const
Get Z-position.
double getE() const
Get energy.
double getDX() const
Get X-slope.
double getY() const
Get Y-position.
double getQ() const
Get quality.
const std::vector< double > & getW() const
Get associated values.
double getT() const
Get time.
bool hasW(const int i) const
Check availability of value.
double getX() const
Get X-position.
Data structure for fit of straight line paralel to z-axis.
Definition JLine1Z.hh:29
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
Definition JLine1Z.hh:114
double getZ(const JPosition3D &pos) const
Get point of emission of Cherenkov light along muon path.
Definition JLine1Z.hh:134
Data structure for cascade in positive z-direction.
Definition JShower3Z.hh:36
Data structure for angles in three dimensions.
Definition JAngle3D.hh:35
double getDY() const
Get y direction.
Definition JAngle3D.hh:119
double getDZ() const
Get z direction.
Definition JAngle3D.hh:130
double getDX() const
Get x direction.
Definition JAngle3D.hh:108
Axis object.
Definition JAxis3D.hh:41
Data structure for direction in three dimensions.
Direction set covering (part of) solid angle.
Definition JOmega3D.hh:68
Data structure for position in three dimensions.
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
Definition JShower3D.hh:97
3D shower with energy.
Definition JShower3E.hh:31
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
Definition JTrack3D.hh:87
3D track with energy.
Definition JTrack3E.hh:34
Data structure for vector in three dimensions.
Definition JVector3D.hh:36
double getY() const
Get y position.
Definition JVector3D.hh:104
double getDistance(const JVector3D &pos) const
Get distance to point.
Definition JVector3D.hh:270
double getZ() const
Get z position.
Definition JVector3D.hh:115
double getX() const
Get x position.
Definition JVector3D.hh:94
double getDY() const
Get y direction.
Definition JVersor3D.hh:106
double getDX() const
Get x direction.
Definition JVersor3D.hh:95
double getDZ() const
Get z direction.
Definition JVersor3D.hh:117
Exception for accessing an index in a collection that is outside of its range.
Auxiliary class to evaluate atmospheric muon hypothesis.
friend std::ostream & operator<<(std::ostream &out, const JAtmosphericMuon &object)
Write atmospheric muon analyser to output.
JAtmosphericMuon(const double theta1, const double theta2)
Constructor.
friend std::istream & operator>>(std::istream &in, JAtmosphericMuon &object)
Read atmospheric muon analyser from input.
double operator()(JEvt::const_iterator __begin, JEvt::const_iterator __end) const
Test is event is atmospheric muon.
Auxiliary class to compare fit results with respect to a reference direction (e.g....
bool operator()(const JFit &first, const JFit &second) const
Comparison of fit results.
JPointing(const JFit &fit)
Constructor.
T operator()(T __begin, T __end) const
Select best fit result.
JPointing(const JDirection3D &dir)
Constructor.
JDirection3D getDirection() const
Get direction.
double getAngle(const JFit &fit) const
Get angle between reference direction and fit result.
Auxiliary class to compare fit results with respect to a reference position.
bool operator()(const JFit &first, const JFit &second) const
Comparison of fit results.
T operator()(T __begin, T __end) const
Select best fit result.
Auxiliary class to compare fit results with respect to a reference energy.
T operator()(T __begin, T __end) const
Select best fit result.
bool operator()(const JFit &first, const JFit &second) const
Comparison of fit results.
Range of values.
Definition JRange.hh:42
static const int JGANDALF_LIKELIHOOD_RATIO
likelihood ratio between this and best alternative fit from JMuonGandalf
static const int JENERGY_NDF
number of degrees of freedom from JMuonEnergy
static const int JGANDALF_LAMBDA
largest eigenvalue of error matrix from JMuonGandalf
static const int JENERGY_ENERGY
uncorrected energy [GeV] from JMuonEnergy
static const int AASHOWERFIT_NUMBER_OF_HITS
number of hits used
static const int JENERGY_NOISE_LIKELIHOOD
log likelihood of every hit being K40 from JMuonEnergy
static const int JENERGY_CHI2
chi2 from JMuonEnergy
static const int JSTART_NPE_MIP_TOTAL
number of photo-electrons along the whole track from JMuonStart
static const int JENERGY_MUON_RANGE_METRES
range of a muon with the reconstructed energy [m] from JMuonEnergy
static const int JCOPY_Z_M
true vertex position along track [m] from JCopy.cc
static const int JVETO_NPE
number of photo-electrons from JVeto.cc
static const int JPP_COVERAGE_POSITION
coverage of dynamic position calibration from any Jpp application
static const int JENERGY_NUMBER_OF_HITS
number of hits from JMuonEnergy
static const int JSTART_LENGTH_METRES
distance between projected positions on the track of optical modules for which the response does not ...
static const int JGANDALF_BETA0_RAD
KM3NeT Data Definitions v3.6.1-21-g1b37f88 https://git.km3net.de/common/km3net-dataformat.
static const int JGANDALF_NUMBER_OF_ITERATIONS
number of iterations from JMuonGandalf
static const int JVETO_NUMBER_OF_HITS
number of hits from JVeto.cc
static const int JSHOWERFIT_ENERGY
uncorrected energy [GeV] from JShowerFit
static const int JPP_COVERAGE_ORIENTATION
coverage of dynamic orientation calibration from any Jpp application
static const int JSTART_BACKGROUND_LOGP
summed logarithm of background probabilities from JMuonStart
static const int JGANDALF_BETA1_RAD
uncertainty on the reconstructed track direction from the error matrix [rad] (to be deprecated) from ...
static const int JENERGY_MINIMAL_ENERGY
minimal energy [GeV] from JMuonEnergy
static const int AASHOWERFIT_ENERGY
uncorrected energy [GeV]
static const int JSTART_NPE_MIP_MISSED
number of photo-electrons missed from JMuonStart
static const int JENERGY_MAXIMAL_ENERGY
maximal energy [GeV] from JMuonEnergy
static const int JGANDALF_NUMBER_OF_HITS
number of hits from JMuonGandalf
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
JFind_if< JResult_t T::*, JPredicate_t > make_find_if(JResult_t T::*member, const JPredicate_t &predicate)
Helper method to create find_if for data member.
Definition JFind_if.hh:119
double getAngle(const JFirst_t &first, const JSecond_t &second)
Get space angle between objects.
double getDot(const JFirst_t &first, const JSecond_t &second)
Get dot product of objects.
static const double PI
Mathematical constants.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
double getQuality(const double chi2, const int N, const int NDF)
Get quality of fit.
bool has_shower_fit(const JFit &fit)
Test whether given fit has shower fit in history.
static const int JSTART_ZMAX_M
end position of track
bool has_muon_gandalf(const JFit &fit)
Test whether given fit has muon gandalf in history.
JPosition3D getPosition(const JFit &fit)
Get position.
const JFit & get_best_reconstructed_muon(const JEvt &evt)
Get best reconstructed muon.
bool qualitySorter(const JFit &first, const JFit &second)
Comparison of fit results.
JAxis3D getAxis(const JFit &fit)
Get axis.
double getDot(const JFit &first, const JFit &second)
Get dot product.
const JFit & get_best_reconstructed_track(const JEvt &evt, JTrackSelector_t selector, JQualitySorter_t comparator)
Get best reconstructed track.
JFit getFit(const JHistory &history, const JTrack3D &track, const double Q, const int NDF, const double energy=0.0, const int status=SINGLE_STAGE)
Get fit.
JTrack3E getTrack(const JFit &fit)
Get track.
bool has_history(const JFit &fit, const int type)
Test whether given fit has specified history.
static const int JSTART_ZMIN_M
start position of track
double getAngle(const JFit &first, const JFit &second)
Get space angle.
JVertex3D getVertex(const JFit &fit)
Get vertex.
JShower3E getShower(const JFit &fit)
Get shower.
bool has_shower_prefit(const JFit &fit)
Test whether given fit has shower prefit in history.
bool has_muon_energy(const JFit &fit)
Test whether given fit has muon energy in history.
bool has_muon_fit(const JFit &fit)
Test whether given fit has muon fit in history.
JDirection3D getDirection(const JFit &fit)
Get direction.
JRECONSTRUCTION::JWeight getWeight
bool has_reconstructed_shower(const JEvt &evt)
Test whether given event has a track with shower reconstruction.
bool has_shower_completefit(const JFit &fit)
Test whether given fit has shower complete fit in history.
bool has_muon_prefit(const JFit &fit)
Test whether given fit has muon prefit in history.
bool has_muon_start(const JFit &fit)
Test whether given fit has muon start in history.
bool has_shower_positionfit(const JFit &fit)
Test whether given fit has shower position fit in history.
const JFit & get_best_reconstructed_shower(const JEvt &evt)
Get best reconstructed shower.
bool has_muon_simplex(const JFit &fit)
Test whether given fit has muon simplex in history.
JEvt::iterator gridify(JEvt::iterator __begin, JEvt::iterator __end, const int N)
Gridify set of fits.
bool has_reconstructed_track(const JEvt &evt, JTrackSelector_t selector)
Test whether given event has a track according selection.
bool has_reconstructed_muon(const JEvt &evt)
Test whether given event has a track with muon reconstruction.
JReturn_t(*) pF(Args...)
Type definition of method.
int type
application type
Definition JHistory.hh:136
Container for historical events.
Definition JHistory.hh:151
const JHistory & getHistory() const
Get history.
Definition JHistory.hh:301
General purpose sorter of fit results.
JFunctionAdaptor< bool, const JFit &, const JFit & > function_adaptor_type
Auxiliary data structure to get weight of given fit.
bool operator()(const std::string &key) const
Has weight.
double operator()(const JFit &fit, const std::string &key, const double value) const
Get weight.