MarlinTrkProcessors  2.4.1
Track.h
1 #ifndef TRACK_H
2 #define TRACK_H
3 //
4 // Based on the FTF code written by Pablo Yepes.
5 //
6 // P. Yepes, “A fast track pattern recognition,”
7 // Nuclear Instruments & Methods in Physics Research A
8 // 380(1996) pp. 582-585.
9 //
10 
11 #include "TrackUtil.h"
12 #include "Hit.h"
13 #include "ThreeDPoint.h"
14 #include "TrackFindingParameters.h"
15 
16 int const USE_SEGMENT= 1 ;
17 int const USE_FOLLOW = 2 ;
18 int const GO_DOWN =-1 ;
19 int const GO_UP = 1 ;
20 
21 namespace ftf
22 {
23  class Track
24  {
25 
26  public:
27 
28  //attributes
29 
30  Hit* firstHit; // First hit belonging to track
31  Hit* lastHit ; // Last hit belonging to track
32  Hit* currentHit ;
33  Hit* getCurrentHit ( ) { return currentHit ; } ;
34 
35  double bField ;
36 
37  int id ; // primary key
38  short flag ; // Primaries flag=1, Secondaries flag=0
39  int innerMostRow ;
40  int outerMostRow ;
41  short nHits ; // Number of points assigned to that track
42  short nDedx ; // Number of points used for dEdx
43  short q ; // charge
44  double chi2[2]; // chi squared of the momentum fit
45  double dedx; // dE/dx information
46  double pt ; // pt (transverse momentum) at (r,phi,z)
47  double phi0; // azimuthal angle of point where parameters are given
48  double psi ; // azimuthal angle of the momentum at (r,..
49  double r0 ; // r (in cyl. coord.) for point where parameters given
50  double tanl; // tg of the dip angle at (r,phi,z)
51  double z0 ; // z coordinate of point where parameters are given
52  double length ;
53  double dpt ;
54  double dpsi;
55  double dz0 ;
56  double eta ;
57  double dtanl ;
58 
59  TrackFindingParameters* para ; // Parameters pointer
60 
61  double lastXyAngle ; // Angle in the xy plane of line connecting to last hits
62 
63  double xRefHit ;
64  double yRefHit ;
65  double xLastHit ;
66  double yLastHit ;
67 
68  double s11Xy ; // Fit Parameters
69  double s12Xy ;
70  double s22Xy ;
71  double g1Xy ;
72  double g2Xy ;
73  double s11Sz ;
74  double s12Sz ;
75  double s22Sz ;
76  double g1Sz ;
77  double g2Sz ;
78 
79  double ddXy, a1Xy, a2Xy ; /*fit par in xy */
80  double ddSz, a1Sz, a2Sz ; /*fit par in sz */
81 
82  Track* nxatrk ;
83 
84  //methods
85 
86  Track ( ) ;
87  virtual ~Track(){};
88 
89  int fitHelix ( ) ;
90  int fitCircle ( ) ;
91  int fitLine ( ) ;
92  TrackFindingParameters* getPara() { return para ; } ;
93  int getErrorsCircleFit ( double a, double b, double r ) ;
94 
95 
96  double arcLength ( double x1, double y1, double x2, double y2 ) ;
97  ThreeDPoint closestApproach ( double xBeam, double yBeam ) ;
98  ThreeDPoint extraRadius ( double r ) ;
99  int extraRCyl ( double& r, double& phi, double& z, double& rc, double& xc, double& yc ) ;
100  int intersectorZLine( double a, double b, ThreeDPoint& cross ) ;
101  ThreeDPoint getClosest ( double xBeam, double yBeam, double& rc, double& xc, double& yc ) ;
102  int getClosest ( double xBeam, double yBeam, double rc, double xc, double yc, double& xClosest, double& yClosest ) ;
103 
104  void updateToRadius ( double r ) ;
105  void updateToClosestApproach ( double xBeam, double yBeam ) ;
106  int phiRotate ( double deltaPhi ) ;
107 
108  inline virtual void startLoop ( ){ currentHit = firstHit ; } ;
109  inline virtual int done ( ) { return currentHit != 0 ; } ;
110  void Print ( int level ) ;
111 
112  void add ( Hit* thisHit, int way ) ;
113  void add ( Track* thisTrack ) ;
114  int buildTrack ( Hit* firstHit, Container* volume ) ;
115  void dEdx ( ) ;
116  void deleteCandidate ( ) ;
117  void fill ( ) ;
118  void fillPrimary ( double& xc, double& yc, double& rc,double xPar, double yPar ) ;
119  void fillSecondary ( double& xc, double& yc, double xPar, double yPar ) ;
120  int follow ( Container* volume, int way, int rowToStop ) ;
121  int followHitSelection ( Hit* baseHit, Hit* candidateHit ) ;
122  Track* getNextTrack ( ) { return nxatrk ; } ;
123  int mergePrimary ( TrackContainer* trackArea ) ;
124  void reset ( ) ;
125  Hit* seekNextHit ( Container* volume, Hit* baseHit, int nradiusSteps, int whichFunction ) ;
126  int segment ( Container* volume, int way ) ;
127  int segmentHitSelection ( Hit* baseHit, Hit* candidateHit ) ;
128 
129  //#define TRDEBUG 1
130 #ifdef TRDEBUG
131  void debugAsk ( ) ;
132  void debugDeleteCandidate ( ) ;
133  void debugFill ( ) ;
134  void debugFollowCandidate ( Hit* candidate_hit ) ;
135  void debugFollowSuccess ( double dxy, double dsz, double lchi2_xy,
136  double lchi2_sz, double chi2_min,
137  Hit* candidate_hit ) ;
138  void debugInVolume ( Hit* base_hit, Hit* current_hit ) ;
139  void debugNew ( ) ;
140 #endif
141 
142 
143  //private:
144  inline virtual void nextHit (){ currentHit = (currentHit)->nextTrackHit ; } ;
145 
146  } ;
147 } // end namepsace ftf
148 #endif
Definition: TrackUtil.h:51
Definition: TrackFindingParameters.h:15
Definition: Track.h:23
Definition: TrackUtil.h:58
Definition: ThreeDPoint.h:13
Definition: Hit.h:17