Jpp
Classes | Typedefs | Enumerations | Functions | Variables
JFIT Namespace Reference

Auxiliary classes and methods for linear and iterative data regression. More...

Classes

struct  JAbstractMinimiser
 Abstract minimiser. More...
 
struct  JAbstractRegressor
 Abstract class for global fit method. More...
 
class  JAtmosphericMuon
 Auxiliary class to evaluate atmospheric muon hypothesis. More...
 
class  JEnergy
 Data structure for fit of energy. More...
 
class  JEnergyCorrection
 Auxiliary class for correction of energy determined by JEnergy.cc. More...
 
struct  JEstimator
 Template definition of linear fit. More...
 
class  JEstimator< JLine1Z >
 Linear fit of straight line parallel to z-axis to set of hits (objects with position and time). More...
 
class  JEstimator< JPoint3D >
 Linear fit of crossing point (position) between axes (objects with position and direction). More...
 
class  JEstimator< JPoint4D >
 Linear fit of bright point (position and time) between hits (objects with position and time). More...
 
struct  JEvent
 Auxiliary class for historical event. More...
 
class  JEvt
 Data structure for set of track fit results. More...
 
class  JFit
 Data structure for track fit results. More...
 
class  JGandalf
 Fit method based on the Levenberg-Marquardt method. More...
 
struct  JHistory
 Container for historical events. More...
 
struct  JHitL1Comparator
 Auxiliary class for permutations of L1 hits. More...
 
class  JHitW0
 Auxiliary class for a hit with background rate value. More...
 
struct  JK40
 Auxiliary class for converting various rates to expectation values of the number of hits within a given time interval. More...
 
struct  JK40Hit
 Auxiliary class for simultaneously handling light yields and response of module. More...
 
class  JLine1Z
 Data structure for fit of straight line paralel to z-axis. More...
 
class  JLine3EZ
 Data structure for fit of straight line in positive z-direction with energy. More...
 
class  JLine3Z
 Data structure for fit of straight line in positive z-direction. More...
 
class  JMatrixNZ
 Determination of the co-variance matrix of hits for a track along z-axis (JFIT::JLine1Z). More...
 
struct  JMEstimator
 Interface for maximum likelihood estimator (M-estimator). More...
 
struct  JMEstimatorLinear
 Linear M-estimator. More...
 
struct  JMEstimatorLorentzian
 Lorentzian M-estimator. More...
 
struct  JMEstimatorNormal
 Normal M-estimator. More...
 
struct  JMEstimatorNull
 Null M-estimator. More...
 
struct  JMEstimatorTukey
 Tukey's biweight M-estimator. More...
 
struct  JModel
 Auxiliary class to match data points with given model. More...
 
struct  JModel< JEnergy >
 Template specialisation of class JModel to match hit with muon energy. More...
 
struct  JModel< JLine1Z >
 Template specialisation of class JModel to match hit with muon trajectory along z-axis. More...
 
struct  JModel< JPoint4D >
 Template specialisation of class JModel to match hit with bright point. More...
 
class  JMuonGandalf
 class to handle Muon Gandalf reconstruction first, two other angular reconstructionS should be ran : JMuonPrefit and JMuonSimplex More...
 
struct  JMuonGandalfParameters_t
 
struct  JMuonParameters
 
class  JMuonPrefit
 class to handle Prefit angular reconstruction. More...
 
struct  JMuonPrefitParameters_t
 Data struct that holds the parameters for JMuonPrefit angular reconstruction This is part of the constructor parameters of JMuonPrefit
More...
 
class  JMuonSimplex
 class to handle the Simplex angular reconstruction. More...
 
struct  JMuonSimplexParameters_t
 
struct  JNPE
 Auxiliary class for handling various light yields. More...
 
struct  JNPEHit
 Auxiliary class for simultaneously handling light yields and response of PMT. More...
 
class  JORCAShowerFit
 
class  JORCAShowerPositionFit
 class to handle the second step of the shower reconstruction, mainly dedicated for ORCA More...
 
class  JORCAShowerPrefit
 class to handle first step of the shower reconstruction, mainly dedicated for ORCA More...
 
struct  JPMTW0
 Auxiliary class for handling PMT geometry, rate and response. More...
 
class  JPoint3D
 Data structure for position fit. More...
 
class  JPoint4D
 Data structure for vertex fit. More...
 
class  JPointing
 Auxiliary class to compare fit results with respect to a reference direction (e.g. More...
 
struct  JQualitySorter
 General purpose sorter of fit results. More...
 
struct  JRegressor
 Template definition of a data regressor of given model. More...
 
struct  JRegressor< JEnergy >
 Regressor function object for JEnergy fit. More...
 
struct  JRegressor< JLine3Z, JGandalf >
 Regressor function object for JLine3Z fit using JGandalf minimiser. More...
 
struct  JRegressor< JLine3Z, JSimplex >
 Regressor function object for JLine3Z fit using JSimplex minimiser. More...
 
struct  JRegressor< JPoint4D, JSimplex >
 Regressor function object for JPoint4D fit using JSimplex minimiser. More...
 
struct  JRegressor< JShower3EZ, JSimplex >
 Regressor function object for JShower3EZ fit using JSimplex minimiser. More...
 
class  JShower3EZ
 Data structure for fit of straight line in positive z-direction with energy. More...
 
class  JShower3Z
 Data structure for cascade in positive z-direction. More...
 
struct  JShowerFitParameters_t
 struct that holds the Parameters used for JORCAShowerFit More...
 
struct  JShowerParameters
 
struct  JShowerPositionFitParameters_t
 
struct  JShowerPrefitParameters_t
 
class  JSimplex
 Simple fit method based on Powell's algorithm, see reference: Numerical Recipes in C++, W.H. More...
 
struct  JStart
 Auxiliary class for start or end point evaluation. More...
 
class  JVectorNZ
 Determination of the time residual vector of hits for a track along z-axis (JFIT::JLine1Z). More...
 

Typedefs

typedef JTOOLS::JRange< double > JZRange
 

Enumerations

enum  JFitApplication_t {
  JMUONBEGIN = 0, JMUONPREFIT, JMUONSIMPLEX, JMUONGANDALF,
  JMUONENERGY, JMUONSTART, JLINEFIT, JMUONEND = 99,
  JSHOWERBEGIN = 100, JSHOWERPREFIT, JSHOWERPOSITIONFIT, JSHOWERCOMPLETEFIT,
  JSHOWER_BJORKEN_Y, JSHOWEREND = 199, JUSERBEGIN = 1000, JMUONVETO,
  JPRESIM, JMUONPATH, JMCEVT, JUSEREND = 1099,
  JKM3DELTAPOS = 10000
}
 
enum  JFitParameter_t {
  JGANDALF_BETA0_RAD = 0, JGANDALF_BETA1_RAD = 1, JGANDALF_CHI2 = 2, JGANDALF_NUMBER_OF_HITS = 3,
  JENERGY_ENERGY = 4, JENERGY_CHI2 = 5, JGANDALF_LAMBDA = 6, JGANDALF_NUMBER_OF_ITERATIONS = 7,
  JSTART_NPE_MIP = 8, JSTART_NPE_MIP_TOTAL = 9, JSTART_LENGTH_METRES = 10, JVETO_NPE = 11,
  JVETO_NUMBER_OF_HITS = 12, JENERGY_MUON_RANGE_METRES = 13, JENERGY_NOISE_LIKELIHOOD = 14, JENERGY_NDF = 15,
  JENERGY_NUMBER_OF_HITS = 16, JCOPY_Z_M = 17
}
 
enum  JFitStatus_t { ERROR = -100, INSUFFICIENT_NUMBER_OF_HITS, INSUFFICIENT_NUMBER_OF_DOMS, OKAY = 1 }
 

Functions

JPosition3D getPosition (const JFit &fit)
 Get position. More...
 
JDirection3D getDirection (const JFit &fit)
 Get direction. More...
 
JAxis3D getAxis (const JFit &fit)
 Get axis. More...
 
JTrack3E getTrack (const JFit &fit)
 Get track. More...
 
JFit getFit (const JHistory &history, const JTrack3D &track, const double Q, const int NDF, const double energy=0.0, const int status=0)
 Get fit. More...
 
JFit getFit (const JHistory &history, const JLine1Z &track, const JAngle3D &angle, const double Q, const int NDF, const double energy=0.0, const int status=0)
 Get fit. More...
 
double getDot (const JFit &first, const JFit &second)
 Get dot product. More...
 
double getDot (const JFit &fit, const JDirection3D &dir)
 Get dot product. More...
 
double getQuality (const double chi2, const int NDF)
 Get quality of fit. More...
 
double getQuality (const double chi2)
 Get quality of fit. More...
 
bool qualitySorter (const JFit &first, const JFit &second)
 Comparison of fit results. More...
 
bool has_history (const JFit &fit, const int type)
 Test whether given fit has specified history. More...
 
bool has_history (const JFit &fit, const JRange< int > &range)
 Test whether given fit has specified history. More...
 
bool has_muon_prefit (const JFit &fit)
 Test whether given fit has muon prefit in history. More...
 
bool has_muon_simplex (const JFit &fit)
 Test whether given fit has muon simplex in history. More...
 
bool has_muon_gandalf (const JFit &fit)
 Test whether given fit has muon gandalf in history. More...
 
bool has_muon_energy (const JFit &fit)
 Test whether given fit has muon energy in history. More...
 
bool has_muon_start (const JFit &fit)
 Test whether given fit has muon start in history. More...
 
bool has_muon_fit (const JFit &fit)
 Test whether given fit has muon fit in history. More...
 
bool has_shower_prefit (const JFit &fit)
 Test whether given fit has shower prefit in history. More...
 
bool has_shower_positionfit (const JFit &fit)
 Test whether given fit has shower position fit in history. More...
 
bool has_shower_completefit (const JFit &fit)
 Test whether given fit has shower complete fit in history. More...
 
bool has_shower_fit (const JFit &fit)
 Test whether given fit has shower fit in history. More...
 
template<class JTrackSelector_t >
bool has_reconstructed_track (const JEvt &evt, JTrackSelector_t selector)
 Test whether given event has a track according selection. More...
 
bool has_reconstructed_muon (const JEvt &evt)
 Test whether given event has a track with muon reconstruction. More...
 
bool has_reconstructed_shower (const JEvt &evt)
 Test whether given event has a track with shower reconstruction. More...
 
template<class JTrackSelector_t , class JQualitySorter_t >
const JFitget_best_reconstructed_track (const JEvt &evt, JTrackSelector_t selector, JQualitySorter_t comparator)
 Get best reconstructed track. More...
 
const JFitget_best_reconstructed_muon (const JEvt &evt)
 Get best reconstructed muon. More...
 
const JFitget_best_reconstructed_shower (const JEvt &evt)
 Get best reconstructed shower. More...
 
int getCount (const JHitL0 &hit)
 Get hit count. More...
 
int getCount (const JHitL1 &hit)
 Get hit count. More...
 
int getCount (const JHitR1 &hit)
 Get hit count. More...
 
template<class T >
int getCount (T __begin, T __end)
 Get hit count. More...
 
double getP (const double expval, bool hit)
 Get Poisson probability to observe a hit or not for given expectation value for the number of hits. More...
 
double getP (const double expval, const unsigned int numberOfHits, const double precision=1.0e-5)
 Get Poisson probability to observe given number of hits or more for the given expectation value for the number of hits. More...
 
double getChi2 (const double P)
 Get chi2 corresponding to given probability. More...
 
double getChi2 (const double expval, bool hit)
 Get chi2 to observe a hit or not for given expectation value for the number of hits. More...
 
template<class JModel_t , class JHit_t >
double getChi2 (const JModel_t &model, const JHit_t &hit, const double sigma)
 Determine chi2 of a hit for a given model and time resolution. More...
 
template<class JModel_t , class T >
double getChi2 (const JModel_t &model, T __begin, T __end, const double sigma)
 Determine chi2 of data for given model and time resolution. More...
 
template<class T >
double getChi2 (T __begin, T __end, const JMatrixNZ &V)
 Determine chi2 of data using full covariance matrix. More...
 
double getChi2 (const JVectorNZ &Y, const JMatrixNZ &V)
 Determine chi2 using full covariance matrix. More...
 
template<class T >
double getChi2 (const JLine1Z &track, T __begin, T __end, const JMatrixNZ &V)
 Determine chi2 of data for given track using full covariance matrix. More...
 
template<class T >
double getChi2 (const JLine1Z &track, T __begin, T __end, const double alpha, const double sigma)
 Determine chi2 of data for given track and angular and time resolution. More...
 
template<class T >
double getChi2 (T __begin, T __end, const JMatrixNZ &V, const int i)
 Determine difference between chi2 with and without hit using full covariance matrix. More...
 
double getChi2 (const JVectorNZ &Y, const JMatrixNZ &V, const int i)
 Determine difference between chi2 with and without hit using full covariance matrix. More...
 
template<class JModel_t , class JFit_t , class T >
double getChi2 (const JModel_t &model, const JFit_t &fit, T __begin, T __end)
 Get chi2 of data for given model and fit function. More...
 

Variables

static const int JPP_RECONSTRUCTION_TYPE = 4000
 Jpp reconstruction type for AAnet. More...
 

Detailed Description

Auxiliary classes and methods for linear and iterative data regression.

Author
mdejong
mdejong, gmaggi
gmaggi
adomi, gmaggi
adomi
lquinn
adomi

Class used for EM shower reconstruction in ORCA. It sets the optimal values for the shower position reconstruction. These values can be changed from command line if needed.

Typedef Documentation

◆ JZRange

typedef JTOOLS::JRange<double> JFIT::JZRange

Definition at line 21 of file JModel.hh.

Enumeration Type Documentation

◆ JFitApplication_t

Enumerator
JMUONBEGIN 

Start of muon fit applications.

JMUONPREFIT 

JPrefit.cc.

JMUONSIMPLEX 

JSimplex.cc.

JMUONGANDALF 

JGandalf.cc.

JMUONENERGY 

JEnergy.cc.

JMUONSTART 

JStart.cc.

JLINEFIT 

An angular reco guess. It could be a seed for JPrefit

JMUONEND 

End of muon fit applications.

JSHOWERBEGIN 

Start of shower fit applications.

JSHOWERPREFIT 

JShowerPrefit.cc.

JSHOWERPOSITIONFIT 

JShowerPositionFit.cc.

JSHOWERCOMPLETEFIT 

JShowerFit.cc.

JSHOWER_BJORKEN_Y 

JShowerBjY.cc.

JSHOWEREND 

End of shower fit applications.

JUSERBEGIN 

Start of user applications.

JMUONVETO 

JVeto.cc.

JPRESIM 

JPreSim_HTR.cc.

JMUONPATH 

JPath.cc.

JMCEVT 

JMCEvt.cc.

JUSEREND 

End of user applications.

JKM3DELTAPOS 

This is not a fit, this gives position information only.

Definition at line 20 of file JFitApplications.hh.

20  {
21 
22  JMUONBEGIN = 0, //!< Start of muon fit applications
23  JMUONPREFIT, //!< JPrefit.cc
24  JMUONSIMPLEX, //!< JSimplex.cc
25  JMUONGANDALF, //!< JGandalf.cc
26  JMUONENERGY, //!< JEnergy.cc
27  JMUONSTART, //!< JStart.cc
28  JLINEFIT, //!< An angular reco guess. It could be a seed for JPrefit
29  JMUONEND = 99, //!< End of muon fit applications
30 
31  JSHOWERBEGIN = 100, //!< Start of shower fit applications
32  JSHOWERPREFIT, //!< JShowerPrefit.cc
33  JSHOWERPOSITIONFIT, //!< JShowerPositionFit.cc
34  JSHOWERCOMPLETEFIT, //!< JShowerFit.cc
35  JSHOWER_BJORKEN_Y, //!< JShowerBjY.cc
36  JSHOWEREND = 199, //!< End of shower fit applications
37 
38  JUSERBEGIN = 1000, //!< Start of user applications
39  JMUONVETO, //!< JVeto.cc
40  JPRESIM, //!< JPreSim_HTR.cc
41  JMUONPATH, //!< JPath.cc
42  JMCEVT, //!< JMCEvt.cc
43  JUSEREND = 1099, //!< End of user applications
44 
45  JKM3DELTAPOS = 10000 //!< This is not a fit, this gives position information only
46  };

◆ JFitParameter_t

Enumerator
JGANDALF_BETA0_RAD 

angular resolution [rad] from JGandalf.cc

JGANDALF_BETA1_RAD 

angular resolution [rad] from JGandalf.cc

JGANDALF_CHI2 

chi2 from JGandalf.cc

JGANDALF_NUMBER_OF_HITS 

number of hits from JGandalf.cc

JENERGY_ENERGY 

uncorrected energy [GeV] from JEnergy.cc

JENERGY_CHI2 

chi2 from JEnergy.cc

JGANDALF_LAMBDA 

control parameter from JGandalf.cc

JGANDALF_NUMBER_OF_ITERATIONS 

number of iterations from JGandalf.cc

JSTART_NPE_MIP 

number of photo-electrons up to the barycentre from JStart.cc

JSTART_NPE_MIP_TOTAL 

number of photo-electrons along the whole track from JStart.cc

JSTART_LENGTH_METRES 

distance between first and last hits in metres from JStart.cc

JVETO_NPE 

number of photo-electrons from JVeto.cc

JVETO_NUMBER_OF_HITS 

number of hits from JVeto.cc

JENERGY_MUON_RANGE_METRES 

range of a muon with the reconstructed energy [m] from JEnergy.cc

JENERGY_NOISE_LIKELIHOOD 

log likelihood of every hit being K40 from JEnergy.cc

JENERGY_NDF 

number of degrees of freedom from JEnergy.cc

JENERGY_NUMBER_OF_HITS 

number of hits from JEnergy.cc

JCOPY_Z_M 

true vertex position along track [m] from JCopy.cc

Definition at line 15 of file JFitParameters.hh.

15  {
16 
17  JGANDALF_BETA0_RAD = 0, //!< angular resolution [rad] from JGandalf.cc
18  JGANDALF_BETA1_RAD = 1, //!< angular resolution [rad] from JGandalf.cc
19  JGANDALF_CHI2 = 2, //!< chi2 from JGandalf.cc
20  JGANDALF_NUMBER_OF_HITS = 3, //!< number of hits from JGandalf.cc
21  JENERGY_ENERGY = 4, //!< uncorrected energy [GeV] from JEnergy.cc
22  JENERGY_CHI2 = 5, //!< chi2 from JEnergy.cc
23  JGANDALF_LAMBDA = 6, //!< control parameter from JGandalf.cc
24  JGANDALF_NUMBER_OF_ITERATIONS = 7, //!< number of iterations from JGandalf.cc
25  JSTART_NPE_MIP = 8, //!< number of photo-electrons up to the barycentre from JStart.cc
26  JSTART_NPE_MIP_TOTAL = 9, //!< number of photo-electrons along the whole track from JStart.cc
27  JSTART_LENGTH_METRES = 10, //!< distance between first and last hits in metres from JStart.cc
28  JVETO_NPE = 11, //!< number of photo-electrons from JVeto.cc
29  JVETO_NUMBER_OF_HITS = 12, //!< number of hits from JVeto.cc
30  JENERGY_MUON_RANGE_METRES = 13, //!< range of a muon with the reconstructed energy [m] from JEnergy.cc
31  JENERGY_NOISE_LIKELIHOOD = 14, //!< log likelihood of every hit being K40 from JEnergy.cc
32  JENERGY_NDF = 15, //!< number of degrees of freedom from JEnergy.cc
33  JENERGY_NUMBER_OF_HITS = 16, //!< number of hits from JEnergy.cc
34  JCOPY_Z_M = 17 //!< true vertex position along track [m] from JCopy.cc
35  };

◆ JFitStatus_t

Enumerator
ERROR 
INSUFFICIENT_NUMBER_OF_HITS 
INSUFFICIENT_NUMBER_OF_DOMS 
OKAY 

Definition at line 16 of file JFitStatus.hh.

16  {
17 
18  ERROR = -100,
21 
22  OKAY = 1
23  };

Function Documentation

◆ getPosition()

JPosition3D JFIT::getPosition ( const JFit fit)
inline

Get position.

Parameters
fitfit
Returns
position

Definition at line 63 of file JEvtToolkit.hh.

64  {
65  return JPosition3D(fit.getX(), fit.getY(), fit.getZ());
66  }

◆ getDirection()

JDirection3D JFIT::getDirection ( const JFit fit)
inline

Get direction.

Parameters
fitfit
Returns
direction

Definition at line 75 of file JEvtToolkit.hh.

76  {
77  return JDirection3D(fit.getDX(), fit.getDY(), fit.getDZ());
78  }

◆ getAxis()

JAxis3D JFIT::getAxis ( const JFit fit)
inline

Get axis.

Parameters
fitfit
Returns
axis

Definition at line 87 of file JEvtToolkit.hh.

88  {
89  return JAxis3D(getPosition(fit), getDirection(fit));
90  }

◆ getTrack()

JTrack3E JFIT::getTrack ( const JFit fit)
inline

Get track.

Parameters
fitfit
Returns
track

Definition at line 99 of file JEvtToolkit.hh.

100  {
101  return JTrack3E(JTrack3D(getAxis(fit), fit.getT()), fit.getE());
102  }

◆ getFit() [1/2]

JFit JFIT::getFit ( const JHistory history,
const JTrack3D track,
const double  Q,
const int  NDF,
const double  energy = 0.0,
const int  status = 0 
)
inline

Get fit.

Parameters
historyhistory
tracktrack
Qquality
NDFnumber of degrees of freedom
energyEnergy, which would be set as 0, if the fit does not reconstruct energy
statusstatus of the fit as defined in enum JFitStatus.hh
Returns
fit

Definition at line 116 of file JEvtToolkit.hh.

122  {
123  return JFit(history,
124  track.getX(), track.getY(), track.getZ(),
125  track.getDX(), track.getDY(), track.getDZ(),
126  track.getT(),
127  Q, NDF,
128  energy, status);
129  }

◆ getFit() [2/2]

JFit JFIT::getFit ( const JHistory history,
const JLine1Z track,
const JAngle3D angle,
const double  Q,
const int  NDF,
const double  energy = 0.0,
const int  status = 0 
)
inline

Get fit.

Parameters
historyhistory
tracktrack
angleangle
Qquality
NDFnumber of degrees of freedom
energyEnergy, which would be set as 0, if the fit does not reconstruct energy
statusstatus of the fit as defined in JFitStatus.hh
Returns
fit

Definition at line 144 of file JEvtToolkit.hh.

151  {
152  return JFit(history,
153  track.getX(), track.getY(), track.getZ(),
154  angle.getDX(), angle.getDY(), angle.getDZ(),
155  track.getT(),
156  Q, NDF,
157  energy, status);
158  }

◆ getDot() [1/2]

double JFIT::getDot ( const JFit first,
const JFit second 
)
inline

Get dot product.

Parameters
firstfirst fit
secondsecond fit
Returns
dot product

Definition at line 168 of file JEvtToolkit.hh.

169  {
170  return JMATH::getDot(getDirection(first), getDirection(second));
171  }

◆ getDot() [2/2]

double JFIT::getDot ( const JFit fit,
const JDirection3D dir 
)
inline

Get dot product.

Parameters
fitfit
dirdirection
Returns
dot product

Definition at line 181 of file JEvtToolkit.hh.

182  {
183  return JMATH::getDot(getDirection(fit), dir);
184  }

◆ getQuality() [1/2]

double JFIT::getQuality ( const double  chi2,
const int  NDF 
)
inline

Get quality of fit.

The larger the quality, the better the fit.

Parameters
chi2chi2
NDFnumber of degrees of freedom
Returns
quality

Definition at line 195 of file JEvtToolkit.hh.

196  {
197  const double w = NDF - 0.25 * chi2 / NDF;
198 
199  return w;
200  }

◆ getQuality() [2/2]

double JFIT::getQuality ( const double  chi2)
inline

Get quality of fit.

The larger the quality, the better the fit.

Parameters
chi2chi2
Returns
quality

Definition at line 210 of file JEvtToolkit.hh.

211  {
212  return -chi2;
213  }

◆ qualitySorter()

bool JFIT::qualitySorter ( const JFit first,
const JFit second 
)
inline

Comparison of fit results.

Parameters
firstfirst fit
secondsecond fit
Returns
true if first fit has better quality than second; else false

Definition at line 223 of file JEvtToolkit.hh.

224  {
225  if (first.getHistory().size() == second.getHistory().size())
226  return first.getQ() > second.getQ();
227  else
228  return first.getHistory().size() > second.getHistory().size();
229  }

◆ has_history() [1/2]

bool JFIT::has_history ( const JFit fit,
const int  type 
)
inline

Test whether given fit has specified history.

Parameters
fitfit
typeapplication type
Returns
true if type in history; else false

Definition at line 262 of file JEvtToolkit.hh.

263  {
264  return std::find_if(fit.getHistory().begin(),
265  fit.getHistory().end(),
266  JLANG::make_predicate(&JEvent::type, type)) != fit.getHistory().end();
267  }

◆ has_history() [2/2]

bool JFIT::has_history ( const JFit fit,
const JRange< int > &  range 
)
inline

Test whether given fit has specified history.

Parameters
fitfit
rangeapplication type range
Returns
true if type in history; else false

Definition at line 277 of file JEvtToolkit.hh.

278  {
279  return std::find_if(fit.getHistory().begin(),
280  fit.getHistory().end(),
281  JLANG::make_find_if(&JEvent::type, range)) != fit.getHistory().end();
282  }

◆ has_muon_prefit()

bool JFIT::has_muon_prefit ( const JFit fit)
inline

Test whether given fit has muon prefit in history.

Parameters
fitfit
Returns
true if muon prefit in history; else false

Definition at line 291 of file JEvtToolkit.hh.

292  {
293  return has_history(fit, JMUONPREFIT);
294  }

◆ has_muon_simplex()

bool JFIT::has_muon_simplex ( const JFit fit)
inline

Test whether given fit has muon simplex in history.

Parameters
fitfit
Returns
true if muon simplex in history; else false

Definition at line 303 of file JEvtToolkit.hh.

304  {
305  return has_history(fit, JMUONSIMPLEX);
306  }

◆ has_muon_gandalf()

bool JFIT::has_muon_gandalf ( const JFit fit)
inline

Test whether given fit has muon gandalf in history.

Parameters
fitfit
Returns
true if muon gandalf in history; else false

Definition at line 315 of file JEvtToolkit.hh.

316  {
317  return has_history(fit, JMUONGANDALF);
318  }

◆ has_muon_energy()

bool JFIT::has_muon_energy ( const JFit fit)
inline

Test whether given fit has muon energy in history.

Parameters
fitfit
Returns
true if muon energy in history; else false

Definition at line 327 of file JEvtToolkit.hh.

328  {
329  return has_history(fit, JMUONENERGY);
330  }

◆ has_muon_start()

bool JFIT::has_muon_start ( const JFit fit)
inline

Test whether given fit has muon start in history.

Parameters
fitfit
Returns
true if muon start in history; else false

Definition at line 339 of file JEvtToolkit.hh.

340  {
341  return has_history(fit, JMUONSTART);
342  }

◆ has_muon_fit()

bool JFIT::has_muon_fit ( const JFit fit)
inline

Test whether given fit has muon fit in history.

Parameters
fitfit
Returns
true if muon fit in history; else false

Definition at line 351 of file JEvtToolkit.hh.

352  {
353  return has_history(fit, JRange<int>(JMUONBEGIN, JMUONEND));
354  }

◆ has_shower_prefit()

bool JFIT::has_shower_prefit ( const JFit fit)
inline

Test whether given fit has shower prefit in history.

Parameters
fitfit
Returns
true if shower prefit in history; else false

Definition at line 363 of file JEvtToolkit.hh.

364  {
365  return has_history(fit, JSHOWERPREFIT);
366  }

◆ has_shower_positionfit()

bool JFIT::has_shower_positionfit ( const JFit fit)
inline

Test whether given fit has shower position fit in history.

Parameters
fitfit
Returns
true if shower position fit in history; else false

Definition at line 375 of file JEvtToolkit.hh.

376  {
377  return has_history(fit, JSHOWERPOSITIONFIT);
378  }

◆ has_shower_completefit()

bool JFIT::has_shower_completefit ( const JFit fit)
inline

Test whether given fit has shower complete fit in history.

Parameters
fitfit
Returns
true if shower complete fit in history; else false

Definition at line 387 of file JEvtToolkit.hh.

388  {
389  return has_history(fit, JSHOWERCOMPLETEFIT);
390  }

◆ has_shower_fit()

bool JFIT::has_shower_fit ( const JFit fit)
inline

Test whether given fit has shower fit in history.

Parameters
fitfit
Returns
true if shower fit in history; else false

Definition at line 399 of file JEvtToolkit.hh.

400  {
401  return has_history(fit, JRange<int>(JSHOWERBEGIN, JSHOWEREND));
402  }

◆ has_reconstructed_track()

template<class JTrackSelector_t >
bool JFIT::has_reconstructed_track ( const JEvt evt,
JTrackSelector_t  selector 
)
inline

Test whether given event has a track according selection.


The track selector corresponds to the function operator bool selector(const Trk&);.

Parameters
evtevent
selectortrack selector
Returns
true if at least one corresponding track; else false

Definition at line 414 of file JEvtToolkit.hh.

415  {
416  return std::find_if(evt.begin(), evt.end(), selector) != evt.end();
417  }

◆ has_reconstructed_muon()

bool JFIT::has_reconstructed_muon ( const JEvt evt)
inline

Test whether given event has a track with muon reconstruction.

Parameters
evtevent
Returns
true if at least one reconstructed muon; else false

Definition at line 426 of file JEvtToolkit.hh.

427  {
429  }

◆ has_reconstructed_shower()

bool JFIT::has_reconstructed_shower ( const JEvt evt)
inline

Test whether given event has a track with shower reconstruction.

Parameters
evtevent
Returns
true if at least one reconstructed shower; else false

Definition at line 438 of file JEvtToolkit.hh.

439  {
441  }

◆ get_best_reconstructed_track()

template<class JTrackSelector_t , class JQualitySorter_t >
const JFit& JFIT::get_best_reconstructed_track ( const JEvt evt,
JTrackSelector_t  selector,
JQualitySorter_t  comparator 
)
inline

Get best reconstructed track.


The track selector corresponds to the function operator bool selector(const Trk&); and the track comparator to bool comprator(const Trk&, const Trk&);.

Parameters
evtevent
selectortrack selector
comparatortrack comparator
Returns
track

Definition at line 455 of file JEvtToolkit.hh.

458  {
459  JEvt::const_iterator p = std::find_if(evt.begin(), evt.begin(), selector);
460 
461  for (JEvt::const_iterator i = p; i != evt.end(); ++i) {
462  if (selector(*i) && comparator(*i, *p)) {
463  p = i;
464  }
465  }
466 
467  if (p != evt.end())
468  return *p;
469  else
470  THROW(JIndexOutOfRange, "This event has no fit with given selector.");
471  }

◆ get_best_reconstructed_muon()

const JFit& JFIT::get_best_reconstructed_muon ( const JEvt evt)
inline

Get best reconstructed muon.

Parameters
evtevent
Returns
track

Definition at line 480 of file JEvtToolkit.hh.

481  {
483  }

◆ get_best_reconstructed_shower()

const JFit& JFIT::get_best_reconstructed_shower ( const JEvt evt)
inline

Get best reconstructed shower.

Parameters
evtevent
Returns
track

Definition at line 492 of file JEvtToolkit.hh.

493  {
495  }

◆ getCount() [1/4]

int JFIT::getCount ( const JHitL0 hit)
inline

Get hit count.

Parameters
hitL0 hit
Returns
1

Definition at line 728 of file JEvtToolkit.hh.

729  {
730  return 1;
731  }

◆ getCount() [2/4]

int JFIT::getCount ( const JHitL1 hit)
inline

Get hit count.

Parameters
hithit
Returns
count

Definition at line 740 of file JEvtToolkit.hh.

741  {
742  return hit.size();
743  }

◆ getCount() [3/4]

int JFIT::getCount ( const JHitR1 hit)
inline

Get hit count.

Parameters
hithit
Returns
count

Definition at line 752 of file JEvtToolkit.hh.

753  {
754  return hit.getN();
755  }

◆ getCount() [4/4]

template<class T >
int JFIT::getCount ( __begin,
__end 
)
inline

Get hit count.

Parameters
__beginbegin of L0/L1 data
__endend of L0/L1 data
Returns
hit count

Definition at line 766 of file JEvtToolkit.hh.

767  {
768  int count = 0;
769 
770  for (T hit = __begin; hit !=__end; ++hit) {
771  count += getCount(*hit);
772  }
773 
774  return count;
775  }

◆ getP() [1/2]

double JFIT::getP ( const double  expval,
bool  hit 
)
inline

Get Poisson probability to observe a hit or not for given expectation value for the number of hits.

Parameters
expvalexpectation value
hithit
Returns
probability

Definition at line 37 of file JFitToolkit.hh.

38  {
39  if (hit)
40  return 1.0 - exp(-expval); // 1 - P(0)
41  else
42  return exp(-expval); // P(0)
43  }

◆ getP() [2/2]

double JFIT::getP ( const double  expval,
const unsigned int  numberOfHits,
const double  precision = 1.0e-5 
)
inline

Get Poisson probability to observe given number of hits or more for the given expectation value for the number of hits.

Parameters
expvalexpectation value
numberOfHitsnumber of hits
precisionprecision
Returns
propability

Definition at line 55 of file JFitToolkit.hh.

56  {
57  double P = 0.0;
58 
59  for (int i = numberOfHits; ; ++i) {
60 
61  const double p = TMath::PoissonI(i, expval);
62 
63  P += p;
64 
65  if ((double) i > expval && p < precision) {
66  break;
67  }
68  }
69 
70  return P;
71  }

◆ getChi2() [1/11]

double JFIT::getChi2 ( const double  P)
inline

Get chi2 corresponding to given probability.

Parameters
Pprobability
Returns
chi2

Definition at line 80 of file JFitToolkit.hh.

81  {
82  return -log(P);
83  }

◆ getChi2() [2/11]

double JFIT::getChi2 ( const double  expval,
bool  hit 
)
inline

Get chi2 to observe a hit or not for given expectation value for the number of hits.

Parameters
expvalexpectation value
hithit
Returns
probability

Definition at line 93 of file JFitToolkit.hh.

94  {
95  if (hit)
96  return -log(1.0 - exp(-expval));
97  else
98  return expval;
99  }

◆ getChi2() [3/11]

template<class JModel_t , class JHit_t >
double JFIT::getChi2 ( const JModel_t &  model,
const JHit_t hit,
const double  sigma 
)
inline

Determine chi2 of a hit for a given model and time resolution.

The template argument JModel_t refers to a data structure which should provide for the following method:

  double getT(const JHit_t& hit) const;    // get expected time of hit
Parameters
modelmodel
hithit
sigmasigma
Returns
chi2

Definition at line 117 of file JFitToolkit.hh.

118  {
119  const double ds = (hit.getT() - model.getT(hit)) / sigma;
120 
121  return ds * ds;
122  }

◆ getChi2() [4/11]

template<class JModel_t , class T >
double JFIT::getChi2 ( const JModel_t &  model,
__begin,
__end,
const double  sigma 
)
inline

Determine chi2 of data for given model and time resolution.

The template argument JModel_t refers to a data structure which should provide for the following method:

  double getT(const value_type& hit) const;    // expected time of hit

where value_type corresponds to the value type if the input data.

Parameters
modelmodel
__beginbegin of data
__endend of data
sigmatime resolution [ns]
Returns
chi2

Definition at line 142 of file JFitToolkit.hh.

143  {
144  double chi2 = 0.0;
145 
146  for (T hit = __begin; hit != __end; ++hit) {
147  chi2 += getChi2(model, *hit, sigma);
148  }
149 
150  return chi2;
151  }

◆ getChi2() [5/11]

template<class T >
double JFIT::getChi2 ( __begin,
__end,
const JMatrixNZ V 
)
inline

Determine chi2 of data using full covariance matrix.

Parameters
__beginbegin of residuals
__endend of residuals
Vcovariance matrix
Returns
chi2

Definition at line 163 of file JFitToolkit.hh.

164  {
165  return JMATH::getDot(__begin, __end, V);
166  }

◆ getChi2() [6/11]

double JFIT::getChi2 ( const JVectorNZ Y,
const JMatrixNZ V 
)
inline

Determine chi2 using full covariance matrix.

Parameters
Yresiduals
Vcovariance matrix
Returns
chi2

Definition at line 176 of file JFitToolkit.hh.

178  {
179  return getChi2(Y.begin(), Y.end(), V);
180  }

◆ getChi2() [7/11]

template<class T >
double JFIT::getChi2 ( const JLine1Z track,
__begin,
__end,
const JMatrixNZ V 
)
inline

Determine chi2 of data for given track using full covariance matrix.

Parameters
tracktrack
__beginbegin of data
__endend of data
Vcovariance matrix
Returns
chi2

Definition at line 193 of file JFitToolkit.hh.

197  {
198  const JVectorNZ Y(track, __begin, __end);
199 
200  return getChi2(Y, V);
201  }

◆ getChi2() [8/11]

template<class T >
double JFIT::getChi2 ( const JLine1Z track,
__begin,
__end,
const double  alpha,
const double  sigma 
)
inline

Determine chi2 of data for given track and angular and time resolution.

Parameters
tracktrack
__beginbegin of data
__endend of data
alphaangular resolution [deg]
sigmatime resolution [ns]
Returns
chi2

Definition at line 215 of file JFitToolkit.hh.

216  {
217  JMatrixNZ V(track, __begin, __end, alpha, sigma);
218 
219  V.invert();
220 
221  return getChi2(track, __begin, __end, V);
222  }

◆ getChi2() [9/11]

template<class T >
double JFIT::getChi2 ( __begin,
__end,
const JMatrixNZ V,
const int  i 
)
inline

Determine difference between chi2 with and without hit using full covariance matrix.

Parameters
__beginbegin of residuals
__endend of residuals
Vcovariance matrix
iindex of excluded hit
Returns
difference between chi2 w/o hit i

Definition at line 235 of file JFitToolkit.hh.

236  {
237  double chi2 = 0.0;
238 
239  T y = __begin;
240 
241  for (unsigned int j = 0; j != V.size(); ++j, ++y) {
242  chi2 += V(i,j) * (*y);
243  }
244 
245  return chi2*chi2 / V(i,i);
246  }

◆ getChi2() [10/11]

double JFIT::getChi2 ( const JVectorNZ Y,
const JMatrixNZ V,
const int  i 
)
inline

Determine difference between chi2 with and without hit using full covariance matrix.

Parameters
Yresiduals
Vcovariance matrix
iindex of excluded hit
Returns
chi2

Definition at line 257 of file JFitToolkit.hh.

260  {
261  return getChi2(Y.begin(), Y.end(), V, i);
262  }

◆ getChi2() [11/11]

template<class JModel_t , class JFit_t , class T >
double JFIT::getChi2 ( const JModel_t &  model,
const JFit_t &  fit,
__begin,
__end 
)
inline

Get chi2 of data for given model and fit function.

The template argument JFit_t refers to a data structure which should provide for the function object operator:

  double operator()(const JModel_t& model, const value_type&) const;    // chi2

where JModel_t refers to the given model and value_type to the value type if the input data. The return value should correspond to the chi2 of the hit.

Parameters
modelmodel
fitfit function
__beginbegin of data
__endend of data

Definition at line 284 of file JFitToolkit.hh.

285  {
286  double chi2 = 0.0;
287 
288  for (T hit = __begin; hit != __end; ++hit) {
289  chi2 += fit(model, *hit);
290  }
291 
292  return chi2;
293  }

Variable Documentation

◆ JPP_RECONSTRUCTION_TYPE

const int JFIT::JPP_RECONSTRUCTION_TYPE = 4000
static

Jpp reconstruction type for AAnet.

Definition at line 18 of file JFitApplications.hh.

JFIT::JMUONSIMPLEX
JSimplex.cc.
Definition: JFitApplications.hh:24
JFIT::JKM3DELTAPOS
This is not a fit, this gives position information only.
Definition: JFitApplications.hh:45
JFIT::JFit::getZ
double getZ() const
Get Z-position.
Definition: JEvt.hh:145
JFIT::JFit::getDX
double getDX() const
Get X-slope.
Definition: JEvt.hh:146
JFIT::JMUONENERGY
JEnergy.cc.
Definition: JFitApplications.hh:26
JFIT::INSUFFICIENT_NUMBER_OF_DOMS
Definition: JFitStatus.hh:20
JFIT::JENERGY_NDF
number of degrees of freedom from JEnergy.cc
Definition: JFitParameters.hh:32
JFIT::JLine1Z::getT
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
Definition: JLine1Z.hh:114
JFIT::JGANDALF_NUMBER_OF_ITERATIONS
number of iterations from JGandalf.cc
Definition: JFitParameters.hh:24
JTOOLS::w
data_type w[N+1][M+1]
Definition: JPolint.hh:708
JFIT::JUSEREND
End of user applications.
Definition: JFitApplications.hh:43
JFIT::JENERGY_CHI2
chi2 from JEnergy.cc
Definition: JFitParameters.hh:22
JFIT::INSUFFICIENT_NUMBER_OF_HITS
Definition: JFitStatus.hh:19
JFIT::JMUONVETO
JVeto.cc.
Definition: JFitApplications.hh:39
JFIT::JMUONGANDALF
JGandalf.cc.
Definition: JFitApplications.hh:25
JFIT::getCount
int getCount(T __begin, T __end)
Get hit count.
Definition: JEvtToolkit.hh:766
JEvent::type
int type
Definition: JProperties.cc:16
qualitySorter
bool qualitySorter(const JFIT::JFit &first, const JFIT::JFit &second)
Comparison of fit results.
Definition: quality_sorter.cc:10
JFIT::JSHOWERPOSITIONFIT
JShowerPositionFit.cc.
Definition: JFitApplications.hh:33
JFIT::JGANDALF_CHI2
chi2 from JGandalf.cc
Definition: JFitParameters.hh:19
JFIT::JMUONSTART
JStart.cc.
Definition: JFitApplications.hh:27
JFIT::getAxis
JAxis3D getAxis(const JFit &fit)
Get axis.
Definition: JEvtToolkit.hh:87
JFIT::JGANDALF_BETA0_RAD
angular resolution [rad] from JGandalf.cc
Definition: JFitParameters.hh:17
JFIT::JFit::getE
double getE() const
Get energy.
Definition: JEvt.hh:152
JFIT::JSHOWERPREFIT
JShowerPrefit.cc.
Definition: JFitApplications.hh:32
JFIT::JENERGY_NOISE_LIKELIHOOD
log likelihood of every hit being K40 from JEnergy.cc
Definition: JFitParameters.hh:31
JTOOLS::j
int j
Definition: JPolint.hh:634
JFIT::JFit::getDZ
double getDZ() const
Get Z-slope.
Definition: JEvt.hh:148
JFIT::get_best_reconstructed_track
const JFit & get_best_reconstructed_track(const JEvt &evt, JTrackSelector_t selector, JQualitySorter_t comparator)
Get best reconstructed track.
Definition: JEvtToolkit.hh:455
JFIT::has_reconstructed_track
bool has_reconstructed_track(const JEvt &evt, JTrackSelector_t selector)
Test whether given event has a track according selection.
Definition: JEvtToolkit.hh:414
JFIT::has_history
bool has_history(const JFit &fit, const JRange< int > &range)
Test whether given fit has specified history.
Definition: JEvtToolkit.hh:277
JFIT::JVETO_NUMBER_OF_HITS
number of hits from JVeto.cc
Definition: JFitParameters.hh:29
JLANG::make_find_if
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
JFIT::JSHOWERBEGIN
Start of shower fit applications.
Definition: JFitApplications.hh:31
JFIT::JFit::getQ
double getQ() const
Get quality.
Definition: JEvt.hh:150
ERROR
#define ERROR(A)
Definition: JMessage.hh:66
JFIT::JMCEVT
JMCEvt.cc.
Definition: JFitApplications.hh:42
JFIT::has_shower_fit
bool has_shower_fit(const JFit &fit)
Test whether given fit has shower fit in history.
Definition: JEvtToolkit.hh:399
JFIT::JSHOWER_BJORKEN_Y
JShowerBjY.cc.
Definition: JFitApplications.hh:35
JFIT::JMUONPREFIT
JPrefit.cc.
Definition: JFitApplications.hh:23
JFIT::JUSERBEGIN
Start of user applications.
Definition: JFitApplications.hh:38
THROW
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:669
JFIT::JGANDALF_LAMBDA
control parameter from JGandalf.cc
Definition: JFitParameters.hh:23
JFIT::JENERGY_ENERGY
uncorrected energy [GeV] from JEnergy.cc
Definition: JFitParameters.hh:21
JFIT::getChi2
double getChi2(const JModel_t &model, const JFit_t &fit, T __begin, T __end)
Get chi2 of data for given model and fit function.
Definition: JFitToolkit.hh:284
JFIT::JMUONPATH
JPath.cc.
Definition: JFitApplications.hh:41
JFIT::JGANDALF_NUMBER_OF_HITS
number of hits from JGandalf.cc
Definition: JFitParameters.hh:20
JFIT::JGANDALF_BETA1_RAD
angular resolution [rad] from JGandalf.cc
Definition: JFitParameters.hh:18
JFIT::JSTART_NPE_MIP
number of photo-electrons up to the barycentre from JStart.cc
Definition: JFitParameters.hh:25
JFIT::JMUONEND
End of muon fit applications.
Definition: JFitApplications.hh:29
JFIT::JFit::getX
double getX() const
Get X-position.
Definition: JEvt.hh:143
JFIT::JCOPY_Z_M
true vertex position along track [m] from JCopy.cc
Definition: JFitParameters.hh:34
JFIT::JENERGY_NUMBER_OF_HITS
number of hits from JEnergy.cc
Definition: JFitParameters.hh:33
JFIT::JLine1Z::getZ
double getZ(const JPosition3D &pos) const
Get point of emission of Cherenkov light along muon path.
Definition: JLine1Z.hh:134
JFIT::JSTART_LENGTH_METRES
distance between first and last hits in metres from JStart.cc
Definition: JFitParameters.hh:27
JFIT::JVectorNZ
Determination of the time residual vector of hits for a track along z-axis (JFIT::JLine1Z).
Definition: JVectorNZ.hh:25
JGEOMETRY3D::JVector3D::getY
double getY() const
Get y position.
Definition: JVector3D.hh:103
JFIT::has_muon_fit
bool has_muon_fit(const JFit &fit)
Test whether given fit has muon fit in history.
Definition: JEvtToolkit.hh:351
JFIT::JMatrixNZ
Determination of the co-variance matrix of hits for a track along z-axis (JFIT::JLine1Z).
Definition: JMatrixNZ.hh:28
JFIT::JSHOWERCOMPLETEFIT
JShowerFit.cc.
Definition: JFitApplications.hh:34
JLANG::make_predicate
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
Definition: JPredicate.hh:128
JFIT::JFit::getDY
double getDY() const
Get Y-slope.
Definition: JEvt.hh:147
JFIT::JENERGY_MUON_RANGE_METRES
range of a muon with the reconstructed energy [m] from JEnergy.cc
Definition: JFitParameters.hh:30
JFIT::JMUONBEGIN
Start of muon fit applications.
Definition: JFitApplications.hh:22
JFIT::JLINEFIT
An angular reco guess. It could be a seed for JPrefit
Definition: JFitApplications.hh:28
JGEOMETRY3D::JVector3D::getX
double getX() const
Get x position.
Definition: JVector3D.hh:93
JFIT::JSHOWEREND
End of shower fit applications.
Definition: JFitApplications.hh:36
JFIT::JFit::getT
double getT() const
Get time.
Definition: JEvt.hh:149
JFIT::JFit::getY
double getY() const
Get Y-position.
Definition: JEvt.hh:144
JMATH::getDot
double getDot(const JFirst_t &first, const JSecond_t &second)
Get dot product of objects.
Definition: JMathToolkit.hh:131
JFIT::JSTART_NPE_MIP_TOTAL
number of photo-electrons along the whole track from JStart.cc
Definition: JFitParameters.hh:26
JFIT::getPosition
JPosition3D getPosition(const JFit &fit)
Get position.
Definition: JEvtToolkit.hh:63
JFIT::getDirection
JDirection3D getDirection(const JFit &fit)
Get direction.
Definition: JEvtToolkit.hh:75
JFIT::JPRESIM
JPreSim_HTR.cc.
Definition: JFitApplications.hh:40
JFIT::JVETO_NPE
number of photo-electrons from JVeto.cc
Definition: JFitParameters.hh:28
JFIT::JFit
Data structure for track fit results.
Definition: JEvt.hh:31
JFIT::OKAY
Definition: JFitStatus.hh:22
JFIT::JHistory::getHistory
const JHistory & getHistory() const
Get history.
Definition: JHistory.hh:225