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  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...
 
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...
 
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...
 
static const int JKM3DELTAPOS = 10000
 This is not a fit, this gives position information only. 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

◆ 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  {
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  {
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/9]

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/9]

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/9]

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/9]

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/9]

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 161 of file JFitToolkit.hh.

163  {
164  return V.getDot(Y);
165  }

◆ getChi2() [6/9]

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 178 of file JFitToolkit.hh.

182  {
183  const JVectorNZ Y(track, __begin, __end);
184 
185  return getChi2(Y, V);
186  }

◆ getChi2() [7/9]

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 200 of file JFitToolkit.hh.

201  {
202  JMatrixNZ V(track, __begin, __end, alpha, sigma);
203 
204  V.invert();
205 
206  return getChi2(track, __begin, __end, V);
207  }

◆ getChi2() [8/9]

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 218 of file JFitToolkit.hh.

221  {
222  double chi2 = 0.0;
223 
224  for (size_t j = 0; j != V.size(); ++j) {
225  chi2 += V(i,j) * Y[j];
226  }
227 
228  return chi2*chi2 / V(i,i);
229  }

◆ getChi2() [9/9]

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 251 of file JFitToolkit.hh.

252  {
253  double chi2 = 0.0;
254 
255  for (T hit = __begin; hit != __end; ++hit) {
256  chi2 += fit(model, *hit);
257  }
258 
259  return chi2;
260  }

Variable Documentation

◆ JPP_RECONSTRUCTION_TYPE

const int JFIT::JPP_RECONSTRUCTION_TYPE = 4000
static

Jpp reconstruction type for AAnet.

Definition at line 19 of file JFitApplications.hh.

◆ JKM3DELTAPOS

const int JFIT::JKM3DELTAPOS = 10000
static

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

Definition at line 21 of file JFitApplications.hh.

JMUONENERGY
static const int JMUONENERGY
Definition: reconstruction.hh:17
JGEOMETRY3D::JVersor3D::getDZ
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:114
JFIT::JFit::getZ
double getZ() const
Get Z-position.
Definition: JEvt.hh:146
JSHOWERPOSITIONFIT
static const int JSHOWERPOSITIONFIT
Definition: reconstruction.hh:24
JFIT::JFit::getDX
double getDX() const
Get X-slope.
Definition: JEvt.hh:147
JFIT::JMatrixNZ::getDot
static double getDot(const variance &first, const variance &second)
Get dot product.
Definition: JMatrixNZ.hh:196
JTRIGGER::JHitR1::getN
int getN() const
Get count.
Definition: JHitR1.hh:183
JMUONSTART
static const int JMUONSTART
Definition: reconstruction.hh:18
JLANG::JIndexOutOfRange
Exception for accessing an index in a collection that is outside of its range.
Definition: JException.hh:90
JFIT::INSUFFICIENT_NUMBER_OF_DOMS
Definition: JFitStatus.hh:20
JFIT::JLine1Z::getT
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
Definition: JLine1Z.hh:114
JTOOLS::w
data_type w[N+1][M+1]
Definition: JPolint.hh:708
JMUONPREFIT
static const int JMUONPREFIT
Definition: reconstruction.hh:14
JMUONEND
static const int JMUONEND
end range of reconstruction stages
Definition: reconstruction.hh:20
JFIT::INSUFFICIENT_NUMBER_OF_HITS
Definition: JFitStatus.hh:19
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
JGEOMETRY3D::JVector3D::getZ
double getZ() const
Get z position.
Definition: JVector3D.hh:114
JGEOMETRY3D::JAxis3D
Axis object.
Definition: JAxis3D.hh:38
JSHOWERBEGIN
static const int JSHOWERBEGIN
begin range of reconstruction stages
Definition: reconstruction.hh:22
JFIT::getAxis
JAxis3D getAxis(const JFit &fit)
Get axis.
Definition: JEvtToolkit.hh:87
JFIT::JFit::getE
double getE() const
Get energy.
Definition: JEvt.hh:153
JTOOLS::JRange< int >
JGEOMETRY3D::JDirection3D
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:32
JTOOLS::j
int j
Definition: JPolint.hh:634
JSHOWERCOMPLETEFIT
static const int JSHOWERCOMPLETEFIT
Definition: reconstruction.hh:25
JFIT::JFit::getDZ
double getDZ() const
Get Z-slope.
Definition: JEvt.hh:149
JMATH::JMatrixND_t::size
size_t size() const
Get dimension of matrix.
Definition: JMatrixND.hh:154
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
JGEOMETRY3D::JTrack3D::getT
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
Definition: JTrack3D.hh:126
JMUONBEGIN
static const int JMUONBEGIN
begin range of reconstruction stages
Definition: reconstruction.hh:13
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::JFit::getQ
double getQ() const
Get quality.
Definition: JEvt.hh:151
ERROR
#define ERROR(A)
Definition: JMessage.hh:66
JFIT::has_shower_fit
bool has_shower_fit(const JFit &fit)
Test whether given fit has shower fit in history.
Definition: JEvtToolkit.hh:399
JGEOMETRY3D::JPosition3D
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
JMUONSIMPLEX
static const int JMUONSIMPLEX
Definition: reconstruction.hh:15
THROW
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
JGEOMETRY3D::JAngle3D::getDX
double getDX() const
Get x direction.
Definition: JAngle3D.hh:106
JGEOMETRY3D::JVersor3D::getDX
double getDX() const
Get x direction.
Definition: JVersor3D.hh:92
JMUONGANDALF
static const int JMUONGANDALF
Definition: reconstruction.hh:16
JGEOMETRY3D::JTrack3E
3D track with energy.
Definition: JTrack3E.hh:29
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:251
JGEOMETRY3D::JVersor3D::getDY
double getDY() const
Get y direction.
Definition: JVersor3D.hh:103
JSHOWEREND
static const int JSHOWEREND
end range of reconstruction stages
Definition: reconstruction.hh:27
JFIT::JFit::getX
double getX() const
Get X-position.
Definition: JEvt.hh:144
JGEOMETRY3D::JAngle3D::getDZ
double getDZ() const
Get z direction.
Definition: JAngle3D.hh:128
JFIT::JLine1Z::getZ
double getZ(const JPosition3D &pos) const
Get point of emission of Cherenkov light along muon path.
Definition: JLine1Z.hh:134
JFIT::JVectorNZ
Determination of the time residual vector of hits for a track along z-axis (JFIT::JLine1Z).
Definition: JVectorNZ.hh:28
JGEOMETRY3D::JVector3D::getY
double getY() const
Get y position.
Definition: JVector3D.hh:103
JGEOMETRY3D::JTrack3D
3D track.
Definition: JTrack3D.hh:30
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
JGEOMETRY3D::JAngle3D::getDY
double getDY() const
Get y direction.
Definition: JAngle3D.hh:117
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:148
JSHOWERPREFIT
static const int JSHOWERPREFIT
Definition: reconstruction.hh:23
JGEOMETRY3D::JVector3D::getX
double getX() const
Get x position.
Definition: JVector3D.hh:93
JFIT::JFit::getT
double getT() const
Get time.
Definition: JEvt.hh:150
JFIT::JFit::getY
double getY() const
Get Y-position.
Definition: JEvt.hh:145
JMATH::getDot
double getDot(const JFirst_t &first, const JSecond_t &second)
Get dot product of objects.
Definition: JMathToolkit.hh:131
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::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