StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
FtfBaseTrack.h
1 //:>----------------------------------------------------------------------
2 //: FILE: FtfBaseTrack.h
3 //: HISTORY:
4 //: 28jan2000 start writting changes
5 //: innerMostRow and outerMostRow added
6 //: 9mar2000 ppy tracklength moved to FtfBaseTrack
7 //: 17mar2000 ppy add methods to extrapolate tracks
8 //: 19apr2000 cs ppy add nDedx for dEdx calculations
9 //: 10aug2000 ppy remove bField, to be kept in one place only (in FtfPara para)
10 //:>----------------------------------------------------------------------
11 #ifndef FTFBASETRACK
12 #define FTFBASETRACK
13 #include "Stl3Util/ftf/FtfGeneral.h"
14 #include "Stl3Util/ftf/FtfBaseHit.h"
15 #include "Stl3Util/ftf/FtfPara.h"
16 
17 class FtfBaseTrack
18 {
19 
20  public:
21  FtfBaseTrack ( ) ;
22  virtual ~FtfBaseTrack(){};
23  void *firstHit;// First hit belonging to track
24  void *lastHit ;// Last hit belonging to track
25  void *currentHit ;
26  int fitHelix ( ) ;
27  int refitHelix ( int mode, int modEqual, int rowMin, int rowMax ) ;
28  int fitCircle ( ) ;
29  int fitLine ( ) ;
30  FtfBaseHit* getCurrentHit ( ) { return (FtfBaseHit *)currentHit ; } ;
31  FtfPara* getPara() { return (FtfPara *)para ; } ;
32  int getErrorsCircleFit ( double a, double b, double r ) ;
33 
34 
35  double arcLength ( double x1, double y1, double x2, double y2 ) ;
36  Ftf3DHit closestApproach ( double xBeam, double yBeam ) ;
37  Ftf3DHit extraRadius ( double r ) ;
38  int extraRCyl ( double &r, double &phi, double &z,
39  double &rc, double &xc, double &yc ) ;
40  int intersectorZLine ( double a, double b,
41  Ftf3DHit& cross1, Ftf3DHit& cross2 ) ;
42  int intersectorZLine ( double a, double b, Ftf3DHit& cross ) ;
43  int intersectorYCteLine ( double a, Ftf3DHit& cross ) ;
44  Ftf3DHit getClosest ( double xBeam, double yBeam,
45  double &rc, double &xc, double &yc ) ;
46  int getClosest ( double xBeam, double yBeam,
47  double rc, double xc, double yc,
48  double &xClosest, double &yClosest ) ;
49 
50  void updateToRadius ( double r ) ;
51  void updateToClosestApproach ( double xBeam, double yBeam, double rMax=10000 ) ;
52  int phiRotate ( double deltaPhi ) ;
53  // JB
54  Ftf3DHit extrapolate2PathLength(double pathlength);
55  double getRadius();
56  double getXCenter();
57  double getYCenter();
58 
59  virtual void startLoop( );
60  virtual void nextHit ( ) = 0 ;
61  virtual int done ( );
62  void Print ( int level ) ;
63 
64 
65  int id ; // primary key
66  short flag ; // Primaries flag=1, Secondaries flag=0
67  char innerMostRow ;
68  char outerMostRow ;
69  short nHits ; // Number of points assigned to that track
70  short nDedx ; // Number of points used for dEdx
71  short q ; // charge
72  double chi2[2]; // chi squared of the momentum fit
73  double dedx; // dE/dx information
74  double pt ; // pt (transverse momentum) at (r,phi,z)
75  double phi0; // azimuthal angle of point where parameters are given
76  double psi ; // azimuthal angle of the momentum at (r,..
77  double r0 ; // r (in cyl. coord.) for point where parameters given
78  double tanl; // tg of the dip angle at (r,phi,z)
79  double z0 ; // z coordinate of point where parameters are given
80  double length ;
81  double dpt ;
82  double dpsi;
83  double dz0 ;
84  double eta ;
85  double dtanl ;
86 
87  void *para ; // Parameters pointer
88 
89  unsigned short CompressOver1(double,double);
90  double DecompressOver1(unsigned short,double);
91 
92 } ;
93 
94 inline unsigned short FtfBaseTrack::CompressOver1(double v1,double v2) {
95  // drop 10 bits of precision for 1 < v1/|v2| < 1024 (upper limit)
96  double intermed = v1/fabs(v2);
97  return (intermed < 1 ? (unsigned short) (intermed*32768.) :
98  (intermed > 1024. ? 65535 :
99  32768 + (unsigned short) ((intermed - 1.)*32.)));
100 }
101 inline double FtfBaseTrack::DecompressOver1(unsigned short v1,double v2) {
102  return fabs(v2)*(v1 <= 32768 ? ((double) v1)/32768. :
103  ((double) (v1 - 32768))/32. + 1.);
104 }
105 
106 
107 #endif
108