StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFgtHHTracking.cxx
1 /***************************************************************************
2  *
3  * $Id: StFgtHHTracking.cxx,v 1.3 2012/03/16 21:51:26 sgliske Exp $
4  * Author: S. Gliske, March 2012
5  *
6  ***************************************************************************
7  *
8  * Description: see header.
9  *
10  ***************************************************************************
11  *
12  * $Log: StFgtHHTracking.cxx,v $
13  * Revision 1.3 2012/03/16 21:51:26 sgliske
14  * update
15  *
16  * Revision 1.2 2012/03/14 22:22:40 sgliske
17  * update
18  *
19  * Revision 1.1 2012/03/07 15:38:04 sgliske
20  * creation
21  *
22  *
23  **************************************************************************/
24 
25 #include "StFgtHHTracking.h"
26 
27 #define DEBUG
28 
29 // constructor
30 StFgtHHTracking::StFgtHHTracking( const Char_t* name ) : StFgtTracking( name ), mBeamPos(0,0), mMinRad( 2500 ), mMaxRad( 55000 ) { /* */ };
31 
32 // note: (radius in cm) x (0.15 GeV/cm/c) = (pT in GeV/c)
33 // Default range of 2500-55000 cm = 3.75 to 87.5 GeV
34 
35 // deconstructor
36 StFgtHHTracking::~StFgtHHTracking(){ /* */ };
37 
38 void StFgtHHTracking::Clear( const Option_t *opt ){
39  mHelixVec.clear();
40 };
41 
42 // find the tracks
43 Int_t StFgtHHTracking::findTracks(){
44 
45  // Make triplets of points in the XY plane. One point is the XY of
46  // the beam pos. Also require that the beam pos point is not in
47  // the middle of the other two.
48 
49  StFgtTrPointVec::const_iterator iter1, iter2;
50 
51  Float_t beamNorm2 = mBeamPos.Mod2();
52 
53  for( Int_t disc1 = 0; disc1 < kFgtNumDiscs-1; ++disc1 ){
54  StFgtTrPointVec &pointVec1 = mPointVecPerDisc[ disc1 ];
55 
56  for( iter1 = pointVec1.begin(); iter1 != pointVec1.end(); ++iter1 ){
57  TVector2 delta1 = (iter1->pos.XYvector() - mBeamPos);
58 
59  // parameters for the line equidistance from this point and the beamXY
60  Float_t m1 = - delta1.X() / delta1.Y();
61  Float_t b1 = ( iter1->pos.Perp2() - beamNorm2 ) / delta1.Y() * 0.5;
62 
63  // #ifdef DEBUG
64  // LOG_INFO << "Pts "
65  // << "( " << mBeamPos.X() << ", " << mBeamPos.Y() << ") "
66  // << "( " << iter1->pos.X() << ", " << iter1->pos.Y() << ") "
67  // << "make the line y = " << m1 << " x + " << b1 << endm;
68  // #endif
69 
70  for( Int_t disc2 = disc1+1; disc2 < kFgtNumDiscs; ++disc2 ){
71  StFgtTrPointVec &pointVec2 = mPointVecPerDisc[ disc2 ];
72 
73  for( iter2 = pointVec2.begin(); iter2 != pointVec2.end(); ++iter2 ){
74  TVector2 delta2 = (iter2->pos.XYvector() - mBeamPos);
75 
76  // parameters for the line equidistance from this point and the beamXY
77  Float_t m2 = - delta2.X() / delta2.Y();
78  Float_t b2 = ( iter2->pos.Perp2() - beamNorm2 ) / delta2.Y() * 0.5;
79 
80  // #ifdef DEBUG
81  // LOG_INFO << "Pts "
82  // << "( " << mBeamPos.X() << ", " << mBeamPos.Y() << ") "
83  // << "( " << iter2->pos.X() << ", " << iter2->pos.Y() << ") "
84  // << "make the line y = " << m2 << " x + " << b2 << endm;
85  // #endif
86 
87  // x0, y0 of helix at intersection of two lines
88  Float_t x0 = - ( b2 - b1 )/( m2 - m1 );
89  Float_t y0 = m1*x0 + b1;
90  Float_t r = (mBeamPos - TVector2( x0, y0 )).Mod();
91 
92  // #ifdef DEBUG
93  // LOG_INFO << "Hits " << iter1->ptIdx << ", " << iter2->ptIdx << ' '
94  // << "Pts "
95  // << "( " << mBeamPos.X() << ", " << mBeamPos.Y() << ") "
96  // << "( " << iter1->pos.X() << ", " << iter1->pos.Y() << ") "
97  // << "( " << iter2->pos.X() << ", " << iter2->pos.Y() << ") "
98  // << " make helix at "
99  // << "( " << x0 << ", " << y0 << ") and r = " << r << endm;
100  // #endif
101  if( r > mMinRad && r < mMaxRad )
102  mHelixVec.push_back( StFgtHHelix( iter1->ptIdx, iter2->ptIdx, x0, y0, r ) );
103  };
104  };
105  };
106  };
107 
108 #ifdef DEBUG
109  if( !mHelixVec.empty() ){
110  LOG_INFO << GetEventNumber() << " mPointsTot = " << mPointsTot << endm;
111  LOG_INFO << GetEventNumber() << " have " << mHelixVec.size() << " points in the Hough space" << endm;
112 
113  StFgtHHelixVec::iterator helixIter;
114  for( helixIter = mHelixVec.begin(); helixIter != mHelixVec.end(); ++helixIter ){
115  LOG_INFO << helixIter->idx1 << ' ' << helixIter->idx2 << ' ' << atan2( helixIter->y0, helixIter->x0 ) << ' ' << helixIter->r << endm;
116  };
117  };
118 #endif
119 
120  return kStOk;
121 };
122 
123 ClassImp( StFgtHHTracking );
124 
125 /*
126  Float_t phi1 = std::atan2( iter1->pos.Y() - y0, iter1->pos.X() - x0 );
127  Float_t phi2 = std::atan2( iter1->pos.Y() - y0, iter1->pos.X() - x0 );
128 
129  Float_t zslope = ( StFgtGeom::getDiscZ( disc2 ) - StFgtGeom::getDiscZ( disc1 ) ) / ( phi2 - phi1 );
130  Float zb = StFgtGeom::getDiscZ( disc2 ) - zslope*phi2;
131 */
Definition: Stypes.h:41