MCSFitResult.h
Go to the documentation of this file.
1 #ifndef MCSFitResult_h
2 #define MCSFitResult_h
3 
4 namespace recob {
5  /**
6  * @file lardataobj/RecoBase/MCSFitResult.h
7  * @class recob::MCSFitResult
8  *
9  * @brief Class storing the result of the Maximum Likelihood fit of Multiple Coulomb Scattering angles between segments within a Track or Trajectory.
10  *
11  * Class storing the result of the Maximum Likelihood fit of Multiple Coulomb Scattering angles between segments within a Track or Trajectory.
12  * It stores: the resulting momentum, momentum uncertainty, and best likelihood value (both for fwd and bwd fit);
13  * the vectors of segment (radiation) lengths and of scattering angles; the PID hypothesis used in the fit.
14  *
15  * @author G. Cerati (FNAL, MicroBooNE)
16  * @date 2017
17  * @version 1.0
18  */
19  class MCSFitResult {
20  public:
21  MCSFitResult()=default;
22  MCSFitResult(int pid, float momFwd, float momFwdUnc, float llhdFwd, float momBwd, float momBwdUnc, float llhdBwd, const std::vector<float>& radlengths, const std::vector<float>& angles)
23  : pid_(pid), momFwd_(momFwd), momFwdUnc_(momFwdUnc), llhdFwd_(llhdFwd), momBwd_(momBwd), momBwdUnc_(momBwdUnc), llhdBwd_(llhdBwd), radlengths_(radlengths), angles_(angles) {}
24 
25  /// particle id hypothesis used in the fit
26  int particleIdHyp() const { return pid_; }
27 
28  /// momentum value from fit assuming a forward track direction
29  float fwdMomentum() const { return momFwd_; }
30 
31  /// momentum uncertainty from fit assuming a forward track direction
32  float fwdMomUncertainty() const { return momFwdUnc_;}
33 
34  /// minimum negative log likelihood value from fit assuming a forward track direction
35  float fwdLogLikelihood() const { return llhdFwd_; }
36 
37  /// momentum value from fit assuming a backward track direction
38  float bwdMomentum() const { return momBwd_; }
39 
40  /// momentum uncertainty from fit assuming a backward track direction
41  float bwdMomUncertainty() const { return momBwdUnc_;}
42 
43  /// minimum negative log likelihood value from fit assuming a backward track direction
44  float bwdLogLikelihood() const { return llhdBwd_; }
45 
46  /// vector of radiation lengths of the segments used in the fit
47  const std::vector<float>& segmentRadLengths() const { return radlengths_;}
48 
49  /// vector of angles between the segments used in the fit
50  const std::vector<float>& scatterAngles() const { return angles_; }
51 
52  /// determines best fit direction based on minumum log likelihood between forward and backward fit
53  bool isBestFwd() const { return llhdFwd_<llhdBwd_; }
54 
55  /// momentum for best direction fit
56  float bestMomentum() const { return isBestFwd() ? momFwd_ : momBwd_; }
57 
58  /// momentum uncertainty for best direction fit
59  float bestMomUncertainty() const { return isBestFwd() ? momFwdUnc_ : momBwdUnc_;}
60 
61  /// negative log likelihood for best direction fit
62  float bestLogLikelihood() const { return isBestFwd() ? llhdFwd_ : llhdBwd_; }
63 
64  /// difference in log likelihood between forward and backward fit (absolute value)
65  float deltaLogLikelihood() const { return std::abs(llhdFwd_-llhdBwd_); }
66  //
67  private:
68  int pid_; ///< particle id hypothesis used in the fit
69  float momFwd_; ///< momentum value from fit assuming a forward track direction
70  float momFwdUnc_; ///< momentum uncertainty from fit assuming a forward track direction
71  float llhdFwd_; ///< minimum negative log likelihood value from fit assuming a forward track direction
72  float momBwd_; ///< momentum value from fit assuming a backward track direction
73  float momBwdUnc_; ///< momentum uncertainty from fit assuming a backward track direction
74  float llhdBwd_; ///< minimum negative log likelihood value from fit assuming a backward track direction
75  std::vector<float> radlengths_; ///< vector of radiation lengths of the segments used in the fit
76  std::vector<float> angles_; ///< vector of angles between the segments used in the fit
77  };
78 }
79 
80 #endif
float bestMomUncertainty() const
momentum uncertainty for best direction fit
Definition: MCSFitResult.h:59
std::vector< float > radlengths_
vector of radiation lengths of the segments used in the fit
Definition: MCSFitResult.h:75
Reconstruction base classes.
float bwdLogLikelihood() const
minimum negative log likelihood value from fit assuming a backward track direction ...
Definition: MCSFitResult.h:44
float momFwdUnc_
momentum uncertainty from fit assuming a forward track direction
Definition: MCSFitResult.h:70
float bwdMomentum() const
momentum value from fit assuming a backward track direction
Definition: MCSFitResult.h:38
float fwdMomUncertainty() const
momentum uncertainty from fit assuming a forward track direction
Definition: MCSFitResult.h:32
int particleIdHyp() const
particle id hypothesis used in the fit
Definition: MCSFitResult.h:26
std::vector< float > angles_
vector of angles between the segments used in the fit
Definition: MCSFitResult.h:76
const std::vector< float > & scatterAngles() const
vector of angles between the segments used in the fit
Definition: MCSFitResult.h:50
float bestLogLikelihood() const
negative log likelihood for best direction fit
Definition: MCSFitResult.h:62
MCSFitResult()=default
bool isBestFwd() const
determines best fit direction based on minumum log likelihood between forward and backward fit ...
Definition: MCSFitResult.h:53
T abs(T value)
float bestMomentum() const
momentum for best direction fit
Definition: MCSFitResult.h:56
float momBwdUnc_
momentum uncertainty from fit assuming a backward track direction
Definition: MCSFitResult.h:73
int pid_
particle id hypothesis used in the fit
Definition: MCSFitResult.h:68
float deltaLogLikelihood() const
difference in log likelihood between forward and backward fit (absolute value)
Definition: MCSFitResult.h:65
Class storing the result of the Maximum Likelihood fit of Multiple Coulomb Scattering angles between ...
Definition: MCSFitResult.h:19
float llhdFwd_
minimum negative log likelihood value from fit assuming a forward track direction ...
Definition: MCSFitResult.h:71
float momFwd_
momentum value from fit assuming a forward track direction
Definition: MCSFitResult.h:69
float bwdMomUncertainty() const
momentum uncertainty from fit assuming a backward track direction
Definition: MCSFitResult.h:41
float llhdBwd_
minimum negative log likelihood value from fit assuming a backward track direction ...
Definition: MCSFitResult.h:74
float momBwd_
momentum value from fit assuming a backward track direction
Definition: MCSFitResult.h:72
float fwdLogLikelihood() const
minimum negative log likelihood value from fit assuming a forward track direction ...
Definition: MCSFitResult.h:35
float fwdMomentum() const
momentum value from fit assuming a forward track direction
Definition: MCSFitResult.h:29
const std::vector< float > & segmentRadLengths() const
vector of radiation lengths of the segments used in the fit
Definition: MCSFitResult.h:47
MCSFitResult(int pid, float momFwd, float momFwdUnc, float llhdFwd, float momBwd, float momBwdUnc, float llhdBwd, const std::vector< float > &radlengths, const std::vector< float > &angles)
Definition: MCSFitResult.h:22