23 #include "StFgtLHHTracking.h"
24 #include "StRoot/StFgtUtil/geometry/StFgtGeom.h"
29 StFgtLHHTracking::StFgtLHHTracking(
const Char_t* name ) :
StFgtTracking( name ){ };
32 StFgtLHHTracking::~StFgtLHHTracking(){ };
34 void StFgtLHHTracking::Clear(
const Option_t *opt ){
35 for( Int_t discIdx = 0; discIdx < kFgtNumDiscPairs; ++discIdx )
36 mLineVec[discIdx].clear();
40 Int_t StFgtLHHTracking::findTracks(){
44 StFgtTrPointVec::const_iterator iter1, iter2;
47 for( Int_t disc1 = 0, discIdx = 0; disc1 < kFgtNumDiscs-1; ++disc1 ){
48 StFgtTrPointVec &pointVec1 = mPointVecPerDisc[ disc1 ];
50 for( Int_t disc2 = disc1+1; disc2 < kFgtNumDiscs; ++disc2, ++discIdx ){
51 StFgtTrPointVec &pointVec2 = mPointVecPerDisc[ disc2 ];
54 for( iter1 = pointVec1.begin(); iter1 != pointVec1.end(); ++iter1, ++idxIter1 ){
56 for( iter2 = pointVec2.begin(); iter2 != pointVec2.end(); ++iter2, ++idxIter2 ){
58 Float_t deltaZ = (iter1->pos.Z() - iter2->pos.Z());
61 Float_t mx = (iter1->pos.X() - iter2->pos.X()) / deltaZ;
62 Float_t my = (iter1->pos.Y() - iter2->pos.Y()) / deltaZ;
63 Float_t bx = mx*iter1->pos.Z() - iter1->pos.X();
64 Float_t by = my*iter1->pos.Z() - iter1->pos.Y();
66 mLineVec[discIdx].push_back(
StFgtLHHLine( idxIter1, idxIter2, disc1, disc2, mx, my, bx, by ) );
75 LOG_INFO << GetEventNumber() <<
" mPointsTot = " << mPointsTot << endm;
76 LOG_INFO << GetEventNumber() <<
" have " << nLines <<
" points in the Hough space" << endm;
78 StFgtLHHLineVec::iterator lineIter;
80 for( Int_t disc1 = 0, discIdx = 0; disc1 < kFgtNumDiscs-1; ++disc1 ){
81 for( Int_t disc2 = disc1+1; disc2 < kFgtNumDiscs; ++disc2, ++discIdx ){
82 for( lineIter = mLineVec[discIdx].begin(); lineIter != mLineVec[discIdx].end(); ++lineIter ){
83 LOG_INFO << lineIter->pointIdx1 <<
' ' << lineIter->pointIdx2 <<
' '
84 << lineIter->discIdx1 <<
' ' << lineIter->discIdx2 <<
' '
85 << lineIter->mx <<
' ' << lineIter->bx <<
' '
86 << lineIter->my <<
' ' << lineIter->by <<
' '
87 << lineIter->vertZ << endm;
96 StFgtLHHLineVec::iterator lineIter1;
97 StFgtLHHLineVec::iterator lineIter2;
99 Float_t minDist = 1e10;
100 for( Int_t discIdx1 = 0; discIdx1 < kFgtNumDiscPairs; ++discIdx1 ){
101 for( Int_t discIdx2 = discIdx1+1; discIdx2 < kFgtNumDiscPairs; ++discIdx2 ){
102 for( lineIter1 = mLineVec[discIdx1].begin(); lineIter1 != mLineVec[discIdx1].end(); ++lineIter1 ){
103 for( lineIter2 = mLineVec[discIdx2].begin(); lineIter2 != mLineVec[discIdx2].end(); ++lineIter2 ){
104 Float_t dist = distanceSqBetween( *lineIter1, *lineIter2 );
108 LOG_INFO <<
"dist between ( " << lineIter1->pointIdx1 <<
' ' << lineIter1->pointIdx2 <<
' '
109 << lineIter1->discIdx1 <<
' ' << lineIter1->discIdx2 <<
" ) "
110 <<
"( " << lineIter2->pointIdx1 <<
' ' << lineIter2->pointIdx2 <<
' '
111 << lineIter2->discIdx1 <<
' ' << lineIter2->discIdx2 <<
" ) "
112 << dist <<
' ' << minDist << endm;
118 LOG_INFO << GetEventNumber() <<
" min dist is " << minDist << endm;
131 Float_t dx = line1.bx - line1.bx;
132 Float_t dy = line1.by - line1.by;
133 Float_t d2 = dx*dx + dy*dy;
135 static Float_t z = StFgtGeom::getDiscZ( kFgtNumDiscs-1 );
136 dx = line1.mx*z + line1.bx - line2.mx*z - line1.bx;
137 dy = line1.my*z + line1.by - line2.my*z - line1.by;
143 Float_t StFgtLHHTracking::distanceSqLineToPoint(
const StFgtLHHLine& line,
const TVector3& pointPos )
const {
144 Float_t numerator = line.mx*(pointPos.X()-line.bx) + line.my*(pointPos.Y()-line.by) + pointPos.Z();
145 Float_t denominator = line.mx*line.mx + line.my*line.my + 1;
146 Float_t z = numerator / denominator;
147 TVector3 linePos( line.mx*z + line.bx, line.my*z + line.by, z );
148 return (linePos - pointPos).Mag2();