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