StRoot  1
StFgtLHTracking.h
1 /***************************************************************************
2  *
3  * \$Id: StFgtLHTracking.h,v 1.3 2012/04/11 22:13:30 sgliske Exp \$
4  * Author: S. Gliske, March 2012
5  *
6  ***************************************************************************
7  *
8  * Description: FGT tracking algorithm first fitting (L)ine tracks and
9  * then fitting helix parameters.
10  *
11  ***************************************************************************
12  *
13  * \$Log: StFgtLHTracking.h,v \$
14  * Revision 1.3 2012/04/11 22:13:30 sgliske
15  * update
16  *
17  * Revision 1.2 2012/04/09 21:08:24 sgliske
18  * many bugs fixed--seems to be working
19  *
20  * Revision 1.1 2012/03/16 21:51:22 sgliske
21  * creation
22  *
23  *
24  **************************************************************************/
25
26 #ifndef _ST_FGT_LH_TRACKING_
27 #define _ST_FGT_LH_TRACKING_
28
29 #include "StFgtTracking.h"
30 #include <vector>
31
32 #include "StRoot/StFgtUtil/StFgtConsts.h"
33
34 struct StFgtLHLine {
35  std::vector< Int_t> pointIdx; // the point index values
36  UShort_t discBits; // the disc involved, stored as a bit array--0x1 is disc 0.
37  Double_t mx, my, bx, by; // parameters of the line
38  Double_t vertZ; // derived quantity--z of the vertex
39  Double_t res; // residual
40
41  StFgtLHLine() : mx(0), my(0), bx(0), by(0), vertZ(-1e11), res(0) { /* */ };
42
43  StFgtLHLine( UShort_t bits, Double_t mx_, Double_t my_, Double_t bx_, Double_t by_) :
44  discBits(bits), mx(mx_), my(my_), bx(bx_), by(by_) {
45  vertZ = ( mx || my ? -( mx*bx + my*by )/(mx*mx+my*my) : -1e11 );
46  };
47 };
48
49 struct StFgtLHTrack {
50  StFgtLHLine line;
51  //StFgtLHHelix helix;
52
53  Int_t pointPerDisc[ kFgtNumDiscs ];
54  Double_t resSqPerDisc[ kFgtNumDiscs ];
55  Double_t effResSq;
56
57  StFgtLHTrack( const StFgtLHLine& lineIn ) : line( lineIn ) {
58  for( Int_t i=0; i<kFgtNumDiscs; ++i ){
59  pointPerDisc[i] = -1;
60  resSqPerDisc[i] = 1e10;
61  };
62  };
63
64  StFgtLHTrack() {
65  for( Int_t i=0; i<kFgtNumDiscs; ++i ){
66  pointPerDisc[i] = -1;
67  resSqPerDisc[i] = 1e10;
68  };
69  };
70 };
71
72 typedef std::vector< StFgtLHLine > StFgtLHLineVec;
73 typedef std::vector< StFgtLHTrack > StFgtLHTrackVec;
74
76  public:
77  // constructors
78  StFgtLHTracking( const Char_t* name = "fgtTracking" );
79
80  // deconstructor
81  virtual ~StFgtLHTracking();
82
83  // default equals operator and copy constructor OK
84
85  // uses parent's ::Make()
86  virtual void Clear( const Option_t *opt = "" );
87
88  void setNumPoints( Int_t val );
89  void setNumAgreeThres( Int_t val );
90  void setFitThres( Double_t val );
91  void setIncludeThres( Double_t val );
92  void setUseVertex( Bool_t val );
93
94  const StFgtLHTrackVec& getTrackVec();
95
96  protected:
97  // containers
98  StFgtLHLineVec mLineVec; // array of lines
99  StFgtLHTrackVec mTrackVec; // array of tracks
100
101  // parameters
102  Int_t mPoints; // number of points to use to make the lines
103  Double_t mFitThres; // threshold for sqrt of sum of squared perp distances between line and points [cm]
104  Double_t mIncludeThres; // threshold for sq. perp. dist. between line and point--whether to include point with the track [cm^2]
105  Int_t mNumAgreeThres; // how many points the same for different tracks for of the tracks to be removed
106  Bool_t mUseVertex; // whether to use the vertex point for FGT tracking
107
108  // find the tracks
109  virtual Int_t findTracks();
110  void makePointTuples( StFgtTrPointVec& points, Int_t startDiscIdx, UShort_t discBitArray );
111  void makeLine( StFgtTrPointVec& points, UShort_t discBitArray, StFgtLHLine* linePtr = 0 );
112
113  Double_t perpDistSqLineToPoint( const StFgtLHLine& line, const TVector3& pointPos ) const;
114
115
116  private:
117  ClassDef(StFgtLHTracking,1);
118
119 };
120
121 // inline functions
122
123 inline Double_t StFgtLHTracking::perpDistSqLineToPoint( const StFgtLHLine& line, const TVector3& pointPos ) const {
124  Double_t dx = ( line.mx*pointPos.Z() + line.bx - pointPos.X() );
125  Double_t dy = ( line.my*pointPos.Z() + line.by - pointPos.Y() );
126
127  return dx*dx + dy*dy;
128 };
129
130 inline void StFgtLHTracking::setNumPoints( Int_t val ){ mPoints = val; };
131 inline void StFgtLHTracking::setNumAgreeThres( Int_t val ){ mNumAgreeThres = val; };
132 inline void StFgtLHTracking::setFitThres( Double_t val ){ mFitThres = val; };
133 inline void StFgtLHTracking::setIncludeThres( Double_t val ){ mIncludeThres = val; };
134 inline void StFgtLHTracking::setUseVertex( Bool_t val ){ mUseVertex = val; };
135
136 inline const StFgtLHTrackVec& StFgtLHTracking::getTrackVec(){ return mTrackVec; };
137
138
139 #endif