1#ifndef __JRECONSTRUCTION__JEVTTOOLKIT__
2#define __JRECONSTRUCTION__JEVTTOOLKIT__
85#define MAKE_ENTRY(A) std::make_pair(#A, A)
127 return this->count(key) != 0;
139 double operator()(
const JFit& fit,
const std::string& key,
const double value)
const
141 const_iterator p = this->find(key);
143 if (p != this->end() && fit.
hasW(p->second))
144 return fit.
getW(p->second);
239 const double energy = 0.0,
268 const double energy = 0.0,
295 const double energy = 0.0,
368 inline double getQuality(
const double chi2,
const int N,
const int NDF)
370 return N - 0.25 * chi2 / NDF;
384 return NDF - 0.25 * chi2 / NDF;
411 return first.
getQ() > second.
getQ();
598 template<
class JTrackSelector_t>
601 return std::find_if(evt.begin(), evt.end(), selector) != evt.end();
639 template<
class JTrackSelector_t,
class JQualitySorter_t>
641 JTrackSelector_t selector,
642 JQualitySorter_t comparator)
644 JEvt::const_iterator p = std::find_if(evt.begin(), evt.end(), selector);
646 for (JEvt::const_iterator i = p; i != evt.end(); ++i) {
647 if (selector(*i) && comparator(*i, *p)) {
742 else if (dot <= -1.0)
772 return std::min_element(__begin, __end, *
this);
819 return std::min_element(__begin, __end, *
this);
866 return std::min_element(__begin, __end, *
this);
882 inline JEvt::iterator
gridify(JEvt::iterator __begin, JEvt::iterator __end,
const int N)
887 static const double MINIMAL_ANGLE_DEG = 60.0;
891 double angle_deg = 10.0 * sqrt((
double) 240 / (
double) N);
893 if (angle_deg > MINIMAL_ANGLE_DEG) {
894 angle_deg = MINIMAL_ANGLE_DEG;
897 const JOmega3D ps(angle_deg * PI/180.0);
899 JEvt::iterator out = __begin;
901 for (JOmega3D_t::const_iterator dir = ps.begin(); dir != ps.end() && out != __end; ++dir) {
905 sort(out, __end, pointing);
907 JEvt::iterator p = out;
909 for (JEvt::iterator i = out; i != __end && pointing.
getAngle(*i) <= angle_deg; ++i) {
947 const double theta2) :
961 JEvt::const_iterator __end)
const
966 for (JEvt::const_iterator i = __begin; i != __end; ++i) {
968 if (i->getDZ() >=
dot1) {
970 if (i->getQ() > Qup) {
974 }
else if (i->getDZ() <=
dot2) {
976 if (i->getQ() > Qdown) {
995 double theta1, theta2;
997 in >> theta1 >> theta2;
999 object.dot1 = cos(theta1 *
JMATH::PI/180.0);
1000 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 see JRECONSTRUCTION::JMuonGandalf
static const int JSTART_ZMAX_M
end position of track see JRECONSTRUCTION::JMuonStart
static const int JENERGY_NDF
number of degrees of freedom see JRECONSTRUCTION::JMuonEnergy
static const int JGANDALF_LAMBDA
largest eigenvalue of error matrix see JRECONSTRUCTION::JMuonGandalf
static const int JENERGY_ENERGY
uncorrected energy [GeV] see JRECONSTRUCTION::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 see JRECONSTRUCTION::JMuonEnergy
static const int JENERGY_CHI2
chi2 see JRECONSTRUCTION::JMuonEnergy
static const int JSTART_NPE_MIP_TOTAL
number of photo-electrons along the whole track see JRECONSTRUCTION::JMuonStart
static const int JENERGY_MUON_RANGE_METRES
range of a muon with the reconstructed energy [m] see JRECONSTRUCTION::JMuonEnergy
static const int JPP_COVERAGE_POSITION
coverage of dynamic position calibration of this event
static const int JENERGY_NUMBER_OF_HITS
number of hits see JRECONSTRUCTION::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 JSTART_ZMIN_M
start position of track see JRECONSTRUCTION::JMuonStart
static const int JGANDALF_BETA0_RAD
ile KM3NeT Data Definitions v3.6.1-27-ge2759ac https://git.km3net.de/common/km3net-dataformat
static const int JGANDALF_NUMBER_OF_ITERATIONS
number of iterations see JRECONSTRUCTION::JMuonGandalf
static const int JSHOWERFIT_ENERGY
uncorrected energy [GeV] see JRECONSTRUCTION::JShowerFit
static const int JPP_COVERAGE_ORIENTATION
coverage of dynamic orientation calibration of this event
static const int JSTART_BACKGROUND_LOGP
summed logarithm of background probabilities see JRECONSTRUCTION::JMuonStart
static const int JGANDALF_BETA1_RAD
uncertainty on the reconstructed track direction from the error matrix [rad] see JRECONSTRUCTION::JMu...
static const int JENERGY_MINIMAL_ENERGY
minimal energy [GeV] see JRECONSTRUCTION::JMuonEnergy
static const int AASHOWERFIT_ENERGY
uncorrected energy [GeV]
static const int JSTART_NPE_MIP_MISSED
number of photo-electrons missed see JRECONSTRUCTION::JMuonStart
static const int JENERGY_MAXIMAL_ENERGY
maximal energy [GeV] see JRECONSTRUCTION::JMuonEnergy
static const int JGANDALF_NUMBER_OF_HITS
number of hits see JRECONSTRUCTION::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.
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.
static const int JVETO_NPE
number of photo-electrons
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.
static const int JVETO_NUMBER_OF_HITS
number of hits
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.