Lutz.h
Go to the documentation of this file.
1 ///
2 /// \file Lutz.h
3 /// \brief "Break-point" track fitter
4 /// \author messier@indiana.edu
5 ///
6 #include "TVector.h"
7 #include "TMatrix.h"
8 
9 namespace bpfit {
10  ///
11  /// \brief Break-point track fitter
12  ///
13  /// Implementation of
14  ///...................................................................
15  /// OPTIMUM TRACK FITTING IN THE PRESENCE OF MULTIPLE SCATTERING
16  /// G. LUTZ
17  /// Nuclear Instruments and Methods in Physics Research
18  /// A273 (1998) pp. 349-361
19  ///...................................................................
20  class Lutz {
21  public:
22  ///
23  /// \brief Construct a fitter for n measurements and N scattering planes
24  /// \param n - number of measurements to be added
25  /// \param N - number of scattering surfaces to be added
26  ///
27  Lutz(unsigned int n, unsigned int N);
28 
29  ///
30  /// \brief Add measurements
31  /// \param i - measurement index [0...n)
32  /// \param z - z location of measurement (longitudinal location)
33  /// \param x - x location of measurement (transverse location)
34  /// \param sigx - measurement error on x position
35  ///
36  void SetMeasurement(unsigned int i, double z, double x, double sigx);
37 
38  ///
39  /// \brief Set Z location of a scattering plane j
40  /// \param j - index of scattering plane (start from 0)
41  /// \param Z - longitudinal location of scattering plane
42  /// \param sigSJ - RMS scattering of track slope at this plane
43  ///
44  void SetScatteringPlane(unsigned int j, double Z, double sigSJ);
45 
46  ///
47  /// \brief Do the fit
48  ///
49  /// \param a - on return, fitted intercept. OK to pass 0.
50  /// \param b - on return, fitted initial slope. OK to pass 0.
51  /// \param alpha - on return, fitted scattering slopes. OK to pass 0.
52  /// \param chi2 - on return, the chi^2 result of the fit. OK to pass 0.
53  ///
54  void Fit(double *a, double* b, double* alpha, double* chi2);
55 
56  ///
57  /// \brief After fit, contribution to chi^2 of the ith measurement
58  ///
59  double Chi2XIi(unsigned int i) const;
60 
61  ///
62  /// \brief After fit, contribution to chi^2 of the jth scattering plane
63  ///
64  double Chi2BetaJ(unsigned int j) const;
65 
66  //
67  // \brief After fit, contribution from measurements to chi^2
68  //
69  double Chi2XI() const;
70 
71  //
72  // \brief After fit, contribution from scattering to chi^2
73  //
74  double Chi2Beta() const;
75 
76  ///
77  /// \brief After fit, best-fit x location of track at location z
78  ///
79  double X(double z) const;
80 
81  private:
82  void CalcZeta();
83  void CalcD();
84  bool CalcAinv();
85  void Calcq();
86  void Calcx();
87  void NullResult();
88 
89  private:
90  unsigned int fn; ///< Number of measurements
91  unsigned int fN; ///< Number of scattering planes
92  std::vector<double> fz; ///< Measurement plane longitudinal locations
93  TVectorT<double> fXI; ///< Measurements in transverse location
94  std::vector<double> fwx; ///< Measurement weight (1/sigx^2)
95  std::vector<double> fZ; ///< Location of scattering planes
96  std::vector<double> fwSJ; ///< Scattering angle weight (1/sigSJ^2)
97  std::vector< std::vector<double> > fZeta; ///< measurement-scattering plane distances
98  TMatrixT<double> fD; ///< Eqn. 31
99  TMatrixTSym<double> fAinv; ///< System of equations, Eqn. 29
100  double fa; ///< Fitted intercept
101  double fb; ///< Fitted slope
102  std::vector<double> fAlpha;///< Fitted scatters
103  std::vector<double> fx; ///< Fitted track locations
104  };
105 }
106 
107 ////////////////////////////////////////////////////////////////////////
void Calcx()
Definition: Lutz.cxx:194
TMatrixTSym< double > fAinv
System of equations, Eqn. 29.
Definition: Lutz.h:99
std::vector< double > fz
Measurement plane longitudinal locations.
Definition: Lutz.h:92
double Chi2XIi(unsigned int i) const
After fit, contribution to chi^2 of the ith measurement.
Definition: Lutz.cxx:251
void SetScatteringPlane(unsigned int j, double Z, double sigSJ)
Set Z location of a scattering plane j.
Definition: Lutz.cxx:54
void SetMeasurement(unsigned int i, double z, double x, double sigx)
Add measurements.
Definition: Lutz.cxx:38
Lutz(unsigned int n, unsigned int N)
Construct a fitter for n measurements and N scattering planes.
Definition: Lutz.cxx:13
std::vector< double > fZ
Location of scattering planes.
Definition: Lutz.h:95
unsigned int fn
Number of measurements.
Definition: Lutz.h:90
double fa
Fitted intercept.
Definition: Lutz.h:100
double chi2()
double X(double z) const
After fit, best-fit x location of track at location z.
Definition: Lutz.cxx:207
Float_t Z
Definition: plot.C:38
void Fit(double *a, double *b, double *alpha, double *chi2)
Do the fit.
Definition: Lutz.cxx:221
Break-point track fitter.
Definition: Lutz.h:20
TMatrixT< double > fD
Eqn. 31.
Definition: Lutz.h:98
TVectorT< double > fXI
Measurements in transverse location.
Definition: Lutz.h:93
const double a
double fb
Fitted slope.
Definition: Lutz.h:101
std::vector< double > fwx
Measurement weight (1/sigx^2)
Definition: Lutz.h:94
double Chi2XI() const
Definition: Lutz.cxx:277
std::vector< double > fwSJ
Scattering angle weight (1/sigSJ^2)
Definition: Lutz.h:96
const double j
Definition: BetheBloch.cxx:29
double Chi2BetaJ(unsigned int j) const
After fit, contribution to chi^2 of the jth scattering plane.
Definition: Lutz.cxx:264
z
Definition: test.py:28
std::vector< double > fAlpha
Fitted scatters.
Definition: Lutz.h:102
std::vector< std::vector< double > > fZeta
measurement-scattering plane distances
Definition: Lutz.h:97
unsigned int fN
Number of scattering planes.
Definition: Lutz.h:91
void Calcq()
Definition: Lutz.cxx:173
const hit & b
Definition: hits.cxx:21
void CalcZeta()
Definition: Lutz.cxx:69
bool CalcAinv()
Definition: Lutz.cxx:100
double Chi2Beta() const
Definition: Lutz.cxx:287
void CalcD()
Definition: Lutz.cxx:84
void NullResult()
Definition: Lutz.cxx:297
std::vector< double > fx
Fitted track locations.
Definition: Lutz.h:103