1 #ifndef TrackRecoTools_h
2 #define TrackRecoTools_h 1
8 #include <CLHEP/Vector/ThreeVector.h>
11 #include "marlin/Processor.h"
15 #include <EVENT/TrackerHit.h>
16 #include <EVENT/Track.h>
18 using namespace marlintpc;
22 static bool compareHit(
const std::pair<TrackerHit*, double> & pair1,
23 const std::pair<TrackerHit*, double> & pair2)
25 return pair1.second < pair2.second;
28 static double CalculateS(EVENT::Track* currentTrack, EVENT::TrackerHit * currentHit)
31 double pca_x = ( -1.0 * currentTrack->getD0() ) * std::sin(currentTrack->getPhi());
32 double pca_y = ( currentTrack->getD0() ) * std::cos(currentTrack->getPhi());
35 const double* HitPosition=currentHit->getPosition();
37 if(fabs(currentTrack->getOmega()) < 0.000000001)
40 static_cast<long double>(( HitPosition[0] - pca_x ) * ( HitPosition[0] - pca_x )
41 + ( HitPosition[1] - pca_y ) * ( HitPosition[1] - pca_y )));
44 if(( ( ( -1.25 * M_PI ) <= currentTrack->getPhi() ) && ( currentTrack->getPhi() <= ( -0.75 * M_PI ) ) )
45 || ( ( ( -0.25 * M_PI ) <= currentTrack->getPhi() ) && ( currentTrack->getPhi() <= ( 0.25 * M_PI ) ) )
46 || ( ( ( 0.75 * M_PI ) <= currentTrack->getPhi() ) && currentTrack->getPhi() <= ( 1.25 * M_PI ) ))
48 if(pca_x < HitPosition[0])
55 if(pca_y < HitPosition[1])
64 double r = 1. / currentTrack->getOmega();
67 xm = (r - currentTrack->getD0()) * sin(currentTrack->getPhi());
68 ym = -(r - currentTrack->getD0()) * cos(currentTrack->getPhi());
69 s = r * ( atan2(pca_y - ym , pca_x - xm)
71 atan2(HitPosition[1]- ym , HitPosition[0] - xm)
78 s_2 = s + fabs(2.*M_PI/currentTrack->getOmega());
82 s_2 = s - fabs(2.*M_PI/currentTrack->getOmega());
85 if(fabs(s_1) <= fabs(s_2)) s = s_1;