00001
00002
00003
00004
00005
00006
00007
00008 #include <stdio.h>
00009 #include <stdlib.h>
00010 #include <math.h>
00011
00012 #ifndef TRG_VERSION
00013 #define TRG_VERSION 0x32
00014 #endif
00015
00016 #include "daqFormats.h"
00017 #include "FtfTrack.h"
00018
00019 #include "gl3Hit.h"
00020
00021 #ifndef GL3TRACK
00022 #define GL3TRACK
00023
00024
00025 class gl3Track: public FtfBaseTrack {
00026 private:
00027 gl3Track* getNextTrack ( ) { return (gl3Track *)nextTrack ; } ;
00028 public:
00029 void* nextTrack ;
00030 int sector ;
00031 float dca;
00032
00033 inline virtual void nextHit ()
00034 { currentHit = ((gl3Hit *)currentHit)->nextHit ; } ;
00035
00036 int addTrack ( gl3Track* ) ;
00037 void dropHits ( int rest, int rowMin, int rowMax ) ;
00038 gl3Track* merge ( FtfContainer *trackArea ) ;
00039 void Print ( int level ) ;
00040
00041 void setDca(Ftf3DHit vertex);
00042
00044
00045
00046 float getRealEta ( ) {
00047 float theta = atan2(1.,(double)tanl);
00048 float rEta = -1. * log (tan(theta/2.)) ;
00049 return rEta ;
00050 }
00052
00053
00054 void print ( ) {
00055 float gl3ToDeg = 180./acos(-1.);
00056 printf ( "pt %f tanl %f psi %f r0 %f z0 %f phi0 %f nHits %d\n",
00057 pt, tanl, psi, r0, z0, phi0*gl3ToDeg, nHits ) ;
00058 }
00060
00061
00062 void set ( short sectorIn, local_track* trk ) {
00063
00064 nHits = trk->nHits ;
00065 nDedx = trk->ndedx ;
00066 chi2[0] = float(trk->xy_chisq)/10. ;
00067 chi2[1] = float(trk->sz_chisq)/10. ;
00068 dedx = trk->dedx ;
00069 pt = fabs(trk->pt) ;
00070 psi = trk->psi ;
00071 tanl = trk->tanl ;
00072 eta = getRealEta();
00073 z0 = trk->z0 ;
00074 length = trk->trackLength ;
00075 innerMostRow= trk->innerMostRow ;
00076 outerMostRow= trk->outerMostRow ;
00077 r0 = trk->r0 ;
00078 q = (short )(trk->pt/fabs(trk->pt)) ;
00079 phi0 = trk->phi0 ;
00080 dpt = float(trk->dpt)/32768. * pt ;
00081 dpsi = DecompressOver1(trk->dpsi,psi);
00082 dtanl = DecompressOver1(trk->dtanl,tanl)/64.;
00083 dz0 = float(trk->dz0)/1024. ;
00084 nextTrack = 0 ;
00085 firstHit = 0 ;
00086 lastHit = 0 ;
00087
00088 dca = -1;
00089
00090
00091
00092 if ( dpt == 0 ) dpt = 1.e-5 * pt ;
00093 if ( dpsi == 0 ) dpsi = 1.e-5 ;
00094 if ( dtanl == 0 ) dtanl = 1.e-5 ;
00095 if ( dz0 == 0 ) dz0 = 1.e-3 ;
00096
00097 }
00099
00100
00101 void set ( FtfTrack* trk ) {
00102 id = abs(trk->id) ;
00103 printf ( "set %d\n", id ) ;
00104 nHits = trk->nHits;
00105 chi2[0] = trk->chi2[0] ;
00106 chi2[1] = trk->chi2[1] ;
00107 dedx = trk->dedx ;
00108 pt = fabs(trk->pt) ;
00109 psi = trk->psi ;
00110 tanl = trk->tanl ;
00111 z0 = trk->z0 ;
00112 length = trk->length ;
00113 r0 = trk->r0 ;
00114 phi0 = trk->phi0 ;
00115 q = trk->q ;
00116 dtanl = dpsi = dpt = 0. ;
00117
00118 dca = -1;
00119 }
00120 };
00121
00122 #endif