00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef FTFBASETRACK
00012 #define FTFBASETRACK
00013
00014 #include "FtfBaseHit.h"
00015 #include "FtfPara.h"
00016
00017
00018 class FtfBaseTrack
00019 {
00020
00021 public:
00022 FtfBaseTrack ( ) ;
00023 virtual ~FtfBaseTrack(){};
00024 void *firstHit;
00025 void *lastHit ;
00026 void *currentHit ;
00027 int fitHelix ( ) ;
00028 int refitHelix ( int mode, int modEqual, int rowMin, int rowMax ) ;
00029 int fitCircle ( ) ;
00030 int fitLine ( ) ;
00031 FtfBaseHit* getCurrentHit ( ) { return (FtfBaseHit *)currentHit ; } ;
00032 FtfPara* getPara() { return (FtfPara *)para ; } ;
00033 int getErrorsCircleFit ( double a, double b, double r ) ;
00034
00035
00036 double arcLength ( double x1, double y1, double x2, double y2 ) ;
00037 Ftf3DHit closestApproach ( double xBeam, double yBeam ) ;
00038 Ftf3DHit extraRadius ( double r ) ;
00039 int extraRCyl ( double &r, double &phi, double &z,
00040 double &rc, double &xc, double &yc ) ;
00041 int intersectorZLine ( double a, double b,
00042 Ftf3DHit& cross1, Ftf3DHit& cross2 ) ;
00043 int intersectorZLine ( double a, double b, Ftf3DHit& cross ) ;
00044 int intersectorYCteLine ( double a, Ftf3DHit& cross ) ;
00045 Ftf3DHit getClosest ( double xBeam, double yBeam,
00046 double &rc, double &xc, double &yc ) ;
00047 int getClosest ( double xBeam, double yBeam,
00048 double rc, double xc, double yc,
00049 double &xClosest, double &yClosest ) ;
00050
00051 void updateToRadius ( double r ) ;
00052 void updateToClosestApproach ( double xBeam, double yBeam, double rMax=10000. ) ;
00053 int phiRotate ( double deltaPhi ) ;
00054
00055 Ftf3DHit extrapolate2PathLength(double pathlength);
00056 double getRadius();
00057 double getXCenter();
00058 double getYCenter();
00059 double pathLength(double Rx, double Ry, double Rz, double Nx, double Ny, double Nz );
00060
00061 inline virtual void startLoop( ){ currentHit = firstHit ; } ;
00062 virtual void nextHit ( ) = 0 ;
00063 inline virtual int done ( ) { return currentHit != 0 ; } ;
00064 void Print ( int level ) ;
00065
00066
00067 int id ;
00068 short flag ;
00069 char innerMostRow ;
00070 char outerMostRow ;
00071 short nHits ;
00072 short nDedx ;
00073 short q ;
00074 double chi2[2];
00075 double dedx;
00076 double pt ;
00077 double phi0;
00078 double psi ;
00079 double r0 ;
00080 double tanl;
00081 double z0 ;
00082 double length ;
00083 double dpt ;
00084 double dpsi;
00085 double dz0 ;
00086 double eta ;
00087 double dtanl ;
00088
00089 void *para ;
00090
00091 unsigned short CompressOver1(double,double);
00092 double DecompressOver1(unsigned short,double);
00093
00094 } ;
00095
00096 inline unsigned short FtfBaseTrack::CompressOver1(double v1,double v2) {
00097
00098 double intermed = v1/fabs(v2);
00099 return (intermed < 1 ? (unsigned short) (intermed*32768.) :
00100 (intermed > 1024. ? 65535 :
00101 32768 + (unsigned short) ((intermed - 1.)*32.)));
00102 }
00103 inline double FtfBaseTrack::DecompressOver1(unsigned short v1,double v2) {
00104 return fabs(v2)*(v1 <= 32768 ? ((double) v1)/32768. :
00105 ((double) (v1 - 32768))/32. + 1.);
00106 }
00107
00108
00109 #endif
00110