Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DTrackFitterALT1.h
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DTrackFitterALT1.h
4 // Created: Tue Sep 2 11:18:22 EDT 2008
5 // Creator: davidl
6 //
7 
8 #ifndef _DTrackFitterALT1_
9 #define _DTrackFitterALT1_
10 
11 #include <vector>
12 
13 #include <DVector3.h>
14 #include <DMatrix.h>
15 #include <TH2.h>
16 #include <TH3.h>
17 
18 #include <JANA/JFactory.h>
19 #include <JANA/JGeometry.h>
21 #include "DTrackWireBased.h"
22 #include "DReferenceTrajectory.h"
23 #include "DCoordinateSystem.h"
24 #include "DTrackFitter.h"
25 
26 class DTrackCandidate;
27 class DTrackWireBased;
28 class DCDCTrackHit;
29 class DFDCPseudo;
30 class DMCThrown;
31 
32 /// \htmlonly
33 /// <A href="index.html#legend">
34 /// <IMG src="ND.png" width="100">
35 /// <IMG src="DEP.png" width="100">
36 /// </A>
37 /// \endhtmlonly
38 
39 /// A global least-squares track fitter. This has been superceded by the DTrackFitterKalmanSIMD class.
40 
42  public:
43  DTrackFitterALT1(JEventLoop *loop);
45 
47 
48  // Virtual methods from TrackFitter base class
49  string Name(void) const {return string("ALT1");}
50  fit_status_t FitTrack(void);
51 
52  private:
54  state_px, ///< x-momentum in RT coordinate system in GeV/c
55  state_py, ///< y-momentum in RT coordinate system in GeV/c
56  state_pz, ///< z-momentum in RT coordinate system in GeV/c
57  state_x, ///< x-coordinate in RT coordinate system in cm
58  state_v, ///< position-coordinate in RT coordinate system in cm perpendicular to x both and momentum direction
59  };
60 
61  enum resi_types{
66  };
67 
68  class hitInfo{
69  public:
70  const DCoordinateSystem* wire; ///< Wire definitions
71  double dist; ///< Effective wire shifts due to drift time
72  double err; ///< Errors on drift time (or wire position) measurement
73  double u_dist; ///< Distances along the wire (for FDC cathodes)
74  double u_lorentz; ///< Lorentz correction to u_dist ( u = u_dist + u_lorentz )
75  double u_err; ///< Errors on distance along the wire (for FDC cathodes)
76  bool good; ///< Set by GetResiInfo if dist is used
77  bool good_u; ///< Set by GetResiInfo if u_dist is used
78  };
79 
80  typedef vector<hitInfo> hitsInfo;
81 
82  class resiInfo{
83  public:
85  int layer;
86  int resi_type;
87  double resi;
88  double err;
89  const swim_step_t *step;
90  };
91 
92  double ChiSq(fit_type_t fit_type, DReferenceTrajectory *rt, double *chisq_ptr=NULL, int *dof_ptr=NULL, vector<pull_t> *pulls_ptr=NULL);
93  double ChiSq(vector<resiInfo> &residuals, double *chisq_ptr=NULL, int *dof_ptr=NULL);
95  vector<bool> GetResiInfo(DMatrix &state, const swim_step_t *start_step, DReferenceTrajectory *rt, hitsInfo &hinfo, vector<resiInfo> &residuals);
96  vector<bool> GetResiInfo(DReferenceTrajectory *rt, hitsInfo &hinfo, vector<resiInfo> &residuals);
98  void FilterGood(DMatrix &my_resiv, vector<bool> &my_good, vector<bool> &good_all);
100  void ForceLRTruth(JEventLoop *loop, DReferenceTrajectory *rt, hitsInfo &hinfo);
101  void FillDebugHists(DReferenceTrajectory *rt, DVector3 &vertex_pos, DVector3 &vertex_mom);
102 
103  // The following are filled by the last call to one of the
104  // ChiSq(...) methods
105  DMatrix resiv; ///< residuals vector (Nmeasurements x 1)
106  DMatrix cov_meas; ///< Measurement errors of hits (diagonal Nmeasurements x Nmeasurements)
107  DMatrix cov_muls; ///< Covariance of hits due to multiple scattering (Nmeasurements x Nmeasurements)
108  DMatrix weights; ///< Inverse of cov_meas + cov_muls
109 
110  // The following are filled by the last call to LeastSquaresB(...)
111  DMatrix cov_parm; ///< Covariance of fit parameters (Nparms x Nparms (where Nparms=5))
112 
113  // Other data members
115 
116  uint64_t eventnumber;
117 // const JGeometry *dgeom;
118  vector<DReferenceTrajectory*>rtv;
120 // bool hit_based;
125  double SIGMA_CDC;
134  double DEFAULT_MASS;
138  bool USE_FDC;
140  bool USE_CDC;
142 
150  TH1F *Npasses;
151  TH1F *ptotal;
159  TH1F *lambda;
160 };
161 
162 #endif // _DTrackFitterALT1_
163 
TMatrixD DMatrix
Definition: DMatrix.h:14
double dist
Effective wire shifts due to drift time.
The DTrackFitter class is a base class for different charged track fitting algorithms. It does not actually fit the track itself, but provides the interface and some common support features most algorthims will need to implement.
Definition: DTrackFitter.h:61
double u_lorentz
Lorentz correction to u_dist ( u = u_dist + u_lorentz )
TVector3 DVector3
Definition: DVector3.h:14
DReferenceTrajectory * tmprt
char string[256]
TH2F * initial_chisq_vs_Npasses
fit_type_t fit_type
Definition: DTrackFitter.h:227
void PrintChisqElements(DMatrix &resiv, DMatrix &cov_meas, DMatrix &cov_muls, DMatrix &weights)
double u_err
Errors on distance along the wire (for FDC cathodes)
x-coordinate in RT coordinate system in cm
vector< bool > GetResiInfo(DMatrix &state, const swim_step_t *start_step, DReferenceTrajectory *rt, hitsInfo &hinfo, vector< resiInfo > &residuals)
void FilterGood(DMatrix &my_resiv, vector< bool > &my_good, vector< bool > &good_all)
class DFDCPseudo: definition for a reconstructed point in the FDC
Definition: DFDCPseudo.h:74
DReferenceTrajectory * rt
DCoordinateSystem * target
TH3F * residuals_fdc_cathode_vs_s
unsigned int LEAST_SQUARES_MIN_HITS
DTrackFitterALT1(JEventLoop *loop)
void ForceLRTruth(JEventLoop *loop, DReferenceTrajectory *rt, hitsInfo &hinfo)
const DCoordinateSystem * wire
Wire definitions.
z-momentum in RT coordinate system in GeV/c
bool good
Set by GetResiInfo if dist is used.
void GetHits(fit_type_t fit_type, DReferenceTrajectory *rt, hitsInfo &hinfo)
TH3F * cdcdoca_vs_dist_vs_ring
DReferenceTrajectory::swim_step_t swim_step_t
fit_status_t FitTrack(void)
position-coordinate in RT coordinate system in cm perpendicular to x both and momentum direction ...
bool good_u
Set by GetResiInfo if u_dist is used.
const swim_step_t * step
x-momentum in RT coordinate system in GeV/c
y-momentum in RT coordinate system in GeV/c
double err
Errors on drift time (or wire position) measurement.
&lt;A href=&quot;index.html#legend&quot;&gt; &lt;IMG src=&quot;CORE.png&quot; width=&quot;100&quot;&gt; &lt;/A&gt;
DMatrix cov_meas
Measurement errors of hits (diagonal Nmeasurements x Nmeasurements)
string Name(void) const
double ChiSq(fit_type_t fit_type, DReferenceTrajectory *rt, double *chisq_ptr=NULL, int *dof_ptr=NULL, vector< pull_t > *pulls_ptr=NULL)
DMatrix weights
Inverse of cov_meas + cov_muls.
&lt;A href=&quot;index.html#legend&quot;&gt; &lt;IMG src=&quot;ND.png&quot; width=&quot;100&quot;&gt; &lt;IMG src=&quot;DEP.png&quot; width=&quot;100&quot;&gt; &lt;...
JEventLoop * loop
Definition: DTrackFitter.h:231
TH3F * residuals_fdc_anode_vs_s
double LEAST_SQUARES_MAX_E2NORM
vector< DReferenceTrajectory * > rtv
vector< hitInfo > hitsInfo
fit_status_t LeastSquaresB(hitsInfo &hinfo, DReferenceTrajectory *rt)
void FillDebugHists(DReferenceTrajectory *rt, DVector3 &vertex_pos, DVector3 &vertex_mom)
DMatrix cov_muls
Covariance of hits due to multiple scattering (Nmeasurements x Nmeasurements)
double u_dist
Distances along the wire (for FDC cathodes)
DMatrix cov_parm
Covariance of fit parameters (Nparms x Nparms (where Nparms=5))
DMatrix resiv
residuals vector (Nmeasurements x 1)