28 #include "StFgtTracking.h"
30 #include "StRoot/StFgtUtil/StFgtConsts.h"
31 #include "StRoot/StFgtUtil/geometry/StFgtGeom.h"
33 #include "StRoot/StEvent/StEvent.h"
34 #include "StRoot/StEvent/StFgtCollection.h"
35 #include "StRoot/StEvent/StFgtHitCollection.h"
36 #include "StRoot/StEvent/StFgtHit.h"
38 #include "StRoot/StMuDSTMaker/COMMON/StMuDst.h"
39 #include "StRoot/StMuDSTMaker/COMMON/StMuFgtStrip.h"
40 #include "StRoot/StMuDSTMaker/COMMON/StMuFgtCluster.h"
46 Int_t StFgtTrPoint::lastIdx = -1;
49 StFgtTracking::StFgtTracking(
const Char_t* name ) :
StMaker( name ) { };
52 StFgtTracking::~StFgtTracking(){ };
54 Int_t StFgtTracking::Init(){
55 StFgtTracking::Clear();
62 StFgtTracking::Clear();
64 Int_t ierr = computePointsFromStEvent();
67 ierr = computePointsFromMuDst();
70 LOG_ERROR <<
"No valid input" << endm;
75 LOG_INFO <<
"mPointsTot = " << mPointsTot << endm;
78 if( !ierr && mPointsTot )
86 Int_t StFgtTracking::computePointsFromStEvent(){
93 eventPtr = (
StEvent*)GetInputDS(
"StEvent");
96 fgtCollectionPtr = eventPtr->fgtCollection();
98 if( fgtCollectionPtr ){
103 for( Int_t disc = 0; disc < kFgtNumDiscs; ++disc ){
104 fgtHitColPtr = fgtCollectionPtr->getHitCollection( disc );
107 const StSPtrVecFgtHit& hitVec = fgtHitColPtr->getHitVec();
108 StSPtrVecFgtHitConstIterator hitIter;
111 for( hitIter = hitVec.begin(); hitIter != hitVec.end(); ++hitIter, ++idx )
112 addClus( idx, (*hitIter)->getCentralStripGeoId(), (*hitIter)->getPositionR(), (*hitIter)->getPositionPhi() );
121 Int_t StFgtTracking::computePointsFromMuDst(){
128 TClonesArray *fgtClusters = muDst->
fgtArray( muFgtClusters );
134 Int_t nClusters = fgtClusters->GetEntriesFast();
136 LOG_INFO <<
"Number of clusters " << nClusters << endm;
139 for( Int_t i = 0; i < nClusters; ++i ){
142 addClus( i, clus->getCentralStripGeoId(), clus->getR(), clus->getPhi() );
150 void StFgtTracking::addClus( Int_t clusIdx, Int_t geoId, Float_t rPos, Float_t pPos ){
151 Short_t disc, quad, strip;
153 StFgtGeom::decodeGeoId( geoId, disc, quad, layer, strip );
156 LOG_INFO <<
"Clus " << clusIdx <<
" at " << StFgtGeom::encodeGeoName( disc, quad, layer, strip ) << endm;
159 Int_t octIdx = (quad*2 + ( StFgtGeom::getOctant( layer, strip ) ==
'S' ))*kFgtNumDiscs + disc;
162 mRclusVecPerOctDisc[ octIdx ].push_back(
StFgtTrClus( clusIdx, rPos ) );
164 mPclusVecPerOctDisc[ octIdx ].push_back(
StFgtTrClus( clusIdx, pPos ) );
167 Int_t StFgtTracking::makePoints(){
168 for( Int_t disc = 0; disc < kFgtNumDiscs; ++disc ){
169 Double_t discZ = StFgtGeom::getDiscZ( disc );
171 StFgtTrPointVec &pointVec = mPointVecPerDisc[disc];
173 for( Int_t oct = 0; oct < kFgtNumOctantsPerDisc; ++oct ){
174 Int_t octIdx = oct*kFgtNumDiscs + disc;
176 StFgtTrClusVec &rClusVec = mRclusVecPerOctDisc[octIdx];
177 StFgtTrClusVec &pClusVec = mPclusVecPerOctDisc[octIdx];
179 if( !rClusVec.empty() && !pClusVec.empty() ){
180 StFgtTrClusVec::iterator rClusIter = rClusVec.begin();
181 StFgtTrClusVec::iterator pClusIter = pClusVec.begin();
183 for( rClusVec.begin(); rClusIter != rClusVec.end(); ++rClusIter )
184 for( pClusIter = pClusVec.begin(); pClusIter != pClusVec.end(); ++pClusIter )
185 pointVec.push_back(
StFgtTrPoint( *rClusIter, *pClusIter, discZ ) );
189 if( rClusVec.size() || pClusVec.size() ){
190 LOG_INFO <<
"oct " << disc+1 << (Char_t)(oct/2+
'A') <<
"." << ( oct%2 ?
'S' :
'L' )
191 <<
" r/phi clusters? " << rClusVec.size() <<
' ' << pClusVec.size() <<
" points per disc " << pointVec.size() << endm;
196 mPointsTot += pointVec.size();
199 if( pointVec.size() ){
200 LOG_INFO <<
"Disc " << disc+1 <<
" contributes " << pointVec.size() <<
" new points, for a total of " << mPointsTot <<
" clusters" << endm;
206 for( Int_t disc = 0; disc < kFgtNumDiscs; ++disc ){
207 StFgtTrPointVec &pointVec = mPointVecPerDisc[disc];
208 for( UInt_t i=0; i<pointVec.size(); ++i ){
209 LOG_INFO <<
"Disc " << disc+1 <<
" point " << pointVec[i].trIdx <<
" ( " << pointVec[i].rIdx <<
", " << pointVec[i].pIdx <<
" )"
210 <<
" ( " << pointVec[i].pos.X() <<
", " << pointVec[i].pos.Y() <<
" )" << endm;
219 void StFgtTracking::Clear(
const Option_t *opt ){
221 StFgtTrPoint::lastIdx = -1;
223 for( Int_t discOct = 0; discOct < kFgtNumDiscs*kFgtNumOctantsPerDisc; ++discOct ){
224 mRclusVecPerOctDisc[discOct].clear();
225 mPclusVecPerOctDisc[discOct].clear();
227 for( Int_t disc = 0; disc < kFgtNumDiscs; ++disc )
228 mPointVecPerDisc[disc].clear();
static TClonesArray * fgtArray(int type)
returns pointer to the n-th TClonesArray from the fgt arrays