1#ifndef __JRECONSTRUCTION__JEVTTOOLKIT__
2#define __JRECONSTRUCTION__JEVTTOOLKIT__
82#define MAKE_ENTRY(A) std::make_pair(#A, A)
123 return this->count(key) != 0;
135 double operator()(
const JFit& fit,
const std::string& key,
const double value)
const
137 const_iterator p = this->find(key);
139 if (p != this->end() && fit.
hasW(p->second))
140 return fit.
getW(p->second);
235 const double energy = 0.0,
264 const double energy = 0.0,
291 const double energy = 0.0,
364 inline double getQuality(
const double chi2,
const int N,
const int NDF)
366 return N - 0.25 * chi2 / NDF;
380 return NDF - 0.25 * chi2 / NDF;
407 return first.
getQ() > second.
getQ();
594 template<
class JTrackSelector_t>
597 return std::find_if(evt.begin(), evt.end(), selector) != evt.end();
635 template<
class JTrackSelector_t,
class JQualitySorter_t>
637 JTrackSelector_t selector,
638 JQualitySorter_t comparator)
640 JEvt::const_iterator p = std::find_if(evt.begin(), evt.end(), selector);
642 for (JEvt::const_iterator i = p; i != evt.end(); ++i) {
643 if (selector(*i) && comparator(*i, *p)) {
738 else if (dot <= -1.0)
768 return std::min_element(__begin, __end, *
this);
815 return std::min_element(__begin, __end, *
this);
862 return std::min_element(__begin, __end, *
this);
878 inline JEvt::iterator
gridify(JEvt::iterator __begin, JEvt::iterator __end,
const int N)
883 static const double MINIMAL_ANGLE_DEG = 60.0;
887 double angle_deg = 10.0 * sqrt((
double) 240 / (
double) N);
889 if (angle_deg > MINIMAL_ANGLE_DEG) {
890 angle_deg = MINIMAL_ANGLE_DEG;
893 const JOmega3D ps(angle_deg * PI/180.0);
895 JEvt::iterator out = __begin;
897 for (JOmega3D_t::const_iterator dir = ps.begin(); dir != ps.end() && out != __end; ++dir) {
901 sort(out, __end, pointing);
903 JEvt::iterator p = out;
905 for (JEvt::iterator i = out; i != __end && pointing.
getAngle(*i) <= angle_deg; ++i) {
943 const double theta2) :
957 JEvt::const_iterator __end)
const
962 for (JEvt::const_iterator i = __begin; i != __end; ++i) {
964 if (i->getDZ() >=
dot1) {
966 if (i->getQ() > Qup) {
970 }
else if (i->getDZ() <=
dot2) {
972 if (i->getQ() > Qdown) {
991 double theta1, theta2;
993 in >> theta1 >> theta2;
995 object.dot1 = cos(theta1 *
JMATH::PI/180.0);
996 object.dot2 = cos(theta2 *
JMATH::PI/180.0);
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition for fit results.
Auxiliary class to define a range between two values.
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.
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
double getZ(const JPosition3D &pos) const
Get point of emission of Cherenkov light along muon path.
Data structure for cascade in positive z-direction.
Data structure for angles in three dimensions.
double getDY() const
Get y direction.
double getDZ() const
Get z direction.
double getDX() const
Get x direction.
Data structure for direction in three dimensions.
Direction set covering (part of) solid angle.
Data structure for position in three dimensions.
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
Data structure for vector in three dimensions.
double getY() const
Get y position.
double getDistance(const JVector3D &pos) const
Get distance to point.
double getZ() const
Get z position.
double getX() const
Get x position.
double getDY() const
Get y direction.
double getDX() const
Get x direction.
double getDZ() const
Get z direction.
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.
JAtmosphericMuon()
Default 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.
JPointing()
Default 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.
JPosition(JVector3D pos)
Constructor.
T operator()(T __begin, T __end) const
Select best fit result.
Auxiliary class to compare fit results with respect to a reference energy.
JShowerEnergy(double E)
Constructor.
T operator()(T __begin, T __end) const
Select best fit result.
bool operator()(const JFit &first, const JFit &second) const
Comparison of fit results.
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-2-g905a24d 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.
Auxiliary classes and methods for mathematical operations.
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.
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.
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.
Container for historical events.
const JHistory & getHistory() const
Get history.
General purpose sorter of fit results.
JFunctionAdaptor< bool, const JFit &, const JFit & > function_adaptor_type
JQualitySorter()
Default constructor.
function_adaptor_type::pF pF
Auxiliary data structure to get weight of given fit.
JWeight()
Default constructor.
bool operator()(const std::string &key) const
Has weight.
double operator()(const JFit &fit, const std::string &key, const double value) const
Get weight.