35 #include "StFgt2PointCosmicTrackAlgo.h"
36 #include "StRoot/StFgtUtil/geometry/StFgtGeom.h"
37 #include "StRoot/StEvent/StFgtCollection.h"
38 #include "StRoot/StEvent/StFgtPoint.h"
41 StFgt2PointCosmicTrackAlgo::StFgt2PointCosmicTrackAlgo():mIsInitialized(0) {
46 Int_t StFgt2PointCosmicTrackAlgo::Init() {
52 Int_t StFgt2PointCosmicTrackAlgo::makeCosmicTracks(
StFgtPointCollection& points, StFgtCosmicTrackVec& tracks, Int_t eventCounter) {
55 Float_t x_0=0, y_0=0, trackX_0=0, trackY_0=0;
56 Float_t a=1, b=1, trackA=1, trackB=1;
57 Float_t dX=0, dY=0, dR=0, trackdX=0, trackdY=0, trackdR=99999, hitX=0, hitY=0;
58 Bool_t isTrack=
false, isTrueTrack=
false;
59 Float_t XoS=0, YoS=0, ZoS=0, OoS=0,
60 XXoS=0, YYoS=0, ZZoS=0, ZXoS=0, ZYoS=0,
62 Int_t quad0Id, quad1Id, quad2Id;
63 Float_t x0,y0,z0,r0,phi0,x1,y1,z1,r1,phi1,x2,y2,z2,r2,phi2;
65 const StSPtrVecFgtPoint &pointVec = points.getPointVec();
66 StSPtrVecFgtPointConstIterator pointIter0, pointIter1, pointIter2;
68 for( pointIter0 = pointVec.begin(); pointIter0 != pointVec.end(); ++pointIter0 ) {
69 quad0Id = (*pointIter0)->getDisc();
70 r0 = (*pointIter0)->getPositionR();
71 phi0 = (*pointIter0)->getPositionPhi();
72 x0 = r0*cos(phi0+.2618);
73 y0 = r0*sin(phi0+.2618);
76 for( pointIter1 = pointVec.begin(); pointIter1 != pointVec.end(); ++pointIter1) {
77 quad1Id = (*pointIter1)->getDisc();
78 r1 = (*pointIter1)->getPositionR();
79 phi1 = (*pointIter1)->getPositionPhi();
80 x1 = r1*cos(phi1+.2618);
81 y1 = r1*sin(phi1+.2618);
84 for( pointIter2 = pointVec.begin(); pointIter2 != pointVec.end(); ++pointIter2) {
85 quad2Id = (*pointIter2)->getDisc();
86 r2 = (*pointIter2)->getPositionR();
87 phi2 = (*pointIter2)->getPositionPhi();
88 x2 = r2*cos(phi2+.2618);
89 y2 = r2*sin(phi2+.2618);
92 XoS = (x0+x1+x2)/sigma;
93 YoS = (y0+y1+y2)/sigma;
94 ZoS = (z0+z1+z2)/sigma;
96 XXoS = (x0*x0+x1*x1+x2*x2)/sigma;
97 YYoS = (y0*y0+y1*y1+y2*y2)/sigma;
98 ZZoS = (z0*z0+z1*z1+z2*z2)/sigma;
99 ZXoS = (x0*z0+x1*z1+x2*z2)/sigma;
100 ZYoS = (y0*z0+y1*z1+y2*z2)/sigma;
103 Float_t denominator = ZZoS*OoS-ZoS*ZoS;
104 if(denominator != 0) {
105 a = (ZXoS*OoS-XoS*ZoS)/denominator;
106 x_0 = (ZZoS*XoS-ZXoS*ZoS)/denominator;
107 b = (ZYoS*OoS-YoS*ZoS)/denominator;
108 y_0 = (ZZoS*YoS-ZYoS*ZoS)/denominator;
114 dR=sqrt(dX*dX + dY*dY);
143 tracks.push_back(
StFgtCosmicTrack (eventCounter, trackA, trackB, trackX_0, trackY_0, trackdX, trackdY, trackdR, hitX, hitY, isTrueTrack) );