Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DTrackTimeBased.h
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DTrackTimeBased.h
4 // Created: Thu Sep 4 14:02:44 EDT 2008
5 // Creator: davidl (on Darwin harriet.jlab.org 8.11.1 i386)
6 //
7 
8 #ifndef _DTrackTimeBased_
9 #define _DTrackTimeBased_
10 
11 #include <JANA/JObject.h>
12 #include <JANA/JFactory.h>
13 #include "DTrackingData.h"
14 #include "DTrackFitter.h"
15 #include "CDC/DCDCTrackHit.h"
16 #include "FDC/DFDCPseudo.h"
17 
18 using namespace jana;
19 using namespace std;
20 
22  public:
23  JOBJECT_PUBLIC(DTrackTimeBased);
24 
25  double dEdx(void) const{return ((dNumHitsUsedFordEdx_CDC >= dNumHitsUsedFordEdx_FDC) ? ddEdx_CDC_amp : ddEdx_FDC);}
26  typedef struct{
27  unsigned int inner_layer;
28  unsigned int outer_layer;
29  unsigned int total_hits;
30  }hit_usage_t;
31 
34 
39 
40  oid_t trackid; ///< id of DTrackWireBased corresponding to this track
41  oid_t candidateid; ///< id of DTrackCandidate corresponding to this track
42  float chisq; ///< Chi-squared for the track (not chisq/dof!)
43  int Ndof; ///< Number of degrees of freedom in the fit
44  vector<DTrackFitter::pull_t> pulls; ///< Holds pulls used in chisq calc. (not including off-diagonals)
45  map<DetectorSystem_t,vector<DTrackFitter::Extrapolation_t> >extrapolations;
46  int flags;
48  FLAG__GOODFIT=0,
49  FLAG__USED_WIREBASED_FIT=1,
50  FLAG__USED_OTHER_HYPOTHESIS=2,
51  };
52 
53 
54  bool GetProjection(DetectorSystem_t detector,DVector3 &pos,
55  DVector3 *mom=nullptr,double *t=nullptr) const;
56 
57 
58  bool IsSmoothed; // Boolean value to indicate whether the smoother was run succesfully over this track.
59 
60  typedef struct{
61  double t0,t0_sigma;
63  }DStartTime_t;
64  vector<DStartTime_t>start_times;
65 
66  double FOM;
67 
68  double ddEdx_FDC;
69  double ddx_FDC;
71  double ddEdx_CDC,ddEdx_CDC_amp;
72  double ddx_CDC,ddx_CDC_amp;
74 
75  // Hit CDC Rings & FDC Planes
76  // use the DParticleID Get_CDCRings & Get_FDCPlanes functions to extract the information from these
77  unsigned int dCDCRings; //CDC rings where the track has an associated DCDCTrackHit //rings correspond to bits (1 -> 28)
78  unsigned int dFDCPlanes; //FDC planes where the track has an associated DFDCPseudoHit //planes correspond to bits (1 -> 24)
79 
80  // Matching to MC: Highest % of track hits matched to a thrown
81  int dMCThrownMatchMyID; //MC track match myid (-1 if somehow no match)
83 
84  void toStrings(vector<pair<string,string> > &items)const{
86  AddString(items, "candidate","%d",candidateid);
87  //AddString(items, "wirebased","%d",trackid);
88  AddString(items, "chisq", "%f", chisq);
89  AddString(items, "Ndof", "%d", Ndof);
90  AddString(items, "FOM", "%f",(float)FOM);
91  AddString(items, "Flags","%d",flags);
92  //AddString(items, "MCMatchID", "%d",dMCThrownMatchMyID);
93  //AddString(items, "#HitsMCMatched", "%d",dNumHitsMatchedToThrown);
94  }
95 };
96 
97 size_t Get_NumTrackHits(const DTrackTimeBased* locTrackTimeBased);
98 inline size_t Get_NumTrackHits(const DTrackTimeBased* locTrackTimeBased)
99 {
100  vector<const DCDCTrackHit*> locCDCHits;
101  locTrackTimeBased->Get(locCDCHits);
102  vector<const DFDCPseudo*> locFDCHits;
103  locTrackTimeBased->Get(locFDCHits);
104 
105  size_t locNumHits = locCDCHits.size() + locFDCHits.size();
106  if(locNumHits > 0)
107  return locNumHits;
108 
109  return locTrackTimeBased->Ndof + 5; //is WRONG because FDC DoF != FDC Hits
110 }
111 
113  DVector3 &pos,
114  DVector3 *mom,double *t) const{
115  if (extrapolations.at(detector).size()>0){
116  DTrackFitter::Extrapolation_t extrapolation=extrapolations.at(detector)[0];
117  pos=extrapolation.position;
118  if (mom){
119  *mom=extrapolation.momentum;
120  }
121  if (t){
122  *t=extrapolation.t;
123  }
124  return true;
125  }
126 
127 
128  return false;
129 }
130 
131 #endif // _DTrackTimeBased_
132 
float chisq
Chi-squared for the track (not chisq/dof!)
bool GetProjection(DetectorSystem_t detector, DVector3 &pos, DVector3 *mom=nullptr, double *t=nullptr) const
TVector3 DVector3
Definition: DVector3.h:14
oid_t trackid
id of DTrackWireBased corresponding to this track
unsigned int potential_cdc_hits_on_track
DetectorSystem_t
Definition: GlueX.h:15
oid_t candidateid
id of DTrackCandidate corresponding to this track
unsigned int dFDCPlanes
hit_usage_t cdc_hit_usage
size_t Get_NumTrackHits(const DTrackTimeBased *locTrackTimeBased)
unsigned int potential_fdc_hits_on_track
int Ndof
Number of degrees of freedom in the fit.
hit_usage_t fdc_hit_usage
unsigned int dCDCRings
vector< DTrackFitter::pull_t > pulls
Holds pulls used in chisq calc. (not including off-diagonals)
unsigned int measured_cdc_hits_on_track
double dEdx(void) const
void toStrings(vector< pair< string, string > > &items) const
void toStrings(vector< pair< string, string > > &items) const
map< DetectorSystem_t, vector< DTrackFitter::Extrapolation_t > > extrapolations
unsigned int dNumHitsUsedFordEdx_FDC
unsigned int measured_fdc_hits_on_track
unsigned int dNumHitsUsedFordEdx_CDC
vector< DStartTime_t > start_times