7 #include "StFgtClusterMaker.h"
8 #include "StRoot/StEvent/StEvent.h"
9 #include "StRoot/StEvent/StFgtCollection.h"
10 #include "StFgtIClusterAlgo.h"
11 #include "StEvent/StFgtHit.h"
12 #include "StRoot/StFgtUtil/geometry/StFgtGeom.h"
13 #include "StFgtSeededClusterAlgo.h"
14 #include "StRoot/StFgtDbMaker/StFgtDbMaker.h"
15 #include "StRoot/StFgtDbMaker/StFgtDb.h"
23 StFgtClusterMaker::StFgtClusterMaker(
const Char_t* name ) :
StMaker(name),mClusterAlgoPtr(0), mDb(0)
28 StFgtClusterMaker::~StFgtClusterMaker()
39 eventPtr = (
StEvent*)GetInputDS(
"StEvent");
42 LOG_ERROR <<
"Error getting pointer to StEvent from '" << ClassName() <<
"'" << endm;
49 fgtCollectionPtr=eventPtr->fgtCollection();
52 if( !fgtCollectionPtr) {
53 LOG_ERROR <<
"Error getting pointer to StFgtCollection from '" << ClassName() <<
"'" << endm;
58 for( UInt_t discIdx=0; discIdx<fgtCollectionPtr->getNumDiscs(); ++discIdx ){
64 if( stripCollectionPtr && hitCollectionPtr ){
66 Int_t loc_ierr = mClusterAlgoPtr->
doClustering(*fgtCollectionPtr, *stripCollectionPtr, *hitCollectionPtr );
69 LOG_WARN <<
"StClusterMaker::Make(): clustering for disc " << discIdx <<
" returned " << loc_ierr <<endm;
75 for( StSPtrVecFgtHitIterator it=fgtCollectionPtr->getHitCollection(discIdx)->getHitVec().begin();it!=fgtCollectionPtr->getHitCollection(discIdx)->getHitVec().end();++it)
77 Int_t centralStripGeoId=(*it)->getCentralStripGeoId();
80 Double_t ordinate, lowerSpan, upperSpan;
86 StFgtGeom::getPhysicalCoordinate( centralStripGeoId, disc, quad, layer, ordinate, lowerSpan, upperSpan );
88 mR = (*it)->getPositionR();
90 mErrR = (*it)->getErrorR();
92 mPhi = 0.5*(upperSpan + lowerSpan);
93 mErrPhi = upperSpan - lowerSpan;
95 mPhi = (*it)->getPositionPhi();
96 mErrPhi = (*it)->getErrorPhi();
97 mR = 0.5*(upperSpan + lowerSpan);
98 mErrR = upperSpan - lowerSpan;
101 mPhi+=StFgtGeom::phiQuadXaxis(quad);
103 mPhi-=(2*TMath::Pi());
104 if(mPhi<((-1)*TMath::Pi()))
105 mPhi+=(2*TMath::Pi());
107 (*it)->setPositionR(mR);
108 (*it)->setErrorR(mErrR);
109 (*it)->setPositionPhi(mPhi);
110 (*it)->setErrorPhi(mErrPhi);
112 (*it)->setPositionZ(StFgtGeom::getDiscZ(disc));
113 (*it)->setErrorZ(0.2);
122 LOG_DEBUG <<
"End of fgt-clust-maker, print all strips & clusters: " << endm;
123 LOG_DEBUG <<
" fgtCollnumDisc=" << fgtCollectionPtr->getNumDiscs()<<
", tot strip=" <<fgtCollectionPtr->getNumStrips()<<
" totClust=" << fgtCollectionPtr->getNumHits() <<endm;
124 for(
int iDisc=0; iDisc <(int)fgtCollectionPtr->getNumDiscs(); iDisc++) {
126 LOG_DEBUG <<
" content: iDisc="<<iDisc<<
" # of : strips="<<fgtCollectionPtr->getNumStrips(iDisc) <<
" hits=" <<fgtCollectionPtr-> getNumHits( iDisc)<<endm;
130 StSPtrVecFgtStrip &stripVec = stripPtr->getStripVec();
132 for( StSPtrVecFgtStripIterator it=stripVec.begin();it!=stripVec.end();++it, ih++) {
134 Short_t discX, quadrantX, stripX; Char_t layerX;
135 StFgtGeom::decodeGeoId(((*it))->getGeoId(),discX,quadrantX, layerX, stripX);
136 int octX=1;
if (stripX<300) octX=0;
137 LOG_DEBUG <<
"iDisc="<<iDisc<<
" ih=" <<ih <<
" strip: geoId=" <<((*it))->getGeoId()<<
" ADC=" <<((*it))->getAdc()<<
" charge=" << ((*it))->getCharge()<<
" 1f decode0: strip=" <<stripX <<
" quad="<<quadrantX <<
" oct=" <<octX <<
" plane="<<layerX<<
" disc="<<discX<<endm;
142 StSPtrVecFgtHit &clustVec = clustPtr->getHitVec();
144 for( StSPtrVecFgtHitIterator it=clustVec.begin();it!=clustVec.end();++it, ih++) {
146 Short_t discX, quadrantX, stripX; Char_t layerX;
147 StFgtGeom::decodeGeoId(((*it))->getCentralStripGeoId(),discX,quadrantX, layerX, stripX);
148 int octX=1;
if (stripX<300) octX=0;
150 LOG_DEBUG <<
"iDisc="<<iDisc<<
" ih="<<ih<<
" clust quad="<<((*it))->getQuad()<<
", layer="<<((*it))->getLayer()<<
" totCharge="<<(*it)->charge()<<
" R/cm="<<(*it)->getPositionR() <<
" +/-"<<(*it)->getErrorR() <<
" Phi/rad="<<(*it)->getPositionPhi()<<
" +/- " << (*it)->getErrorPhi()<<
" Z/cm= " << (*it)->getPositionZ() <<
" +/- "<<(*it)->getErrorZ()<<
" centStripId=" << (*it)->getCentralStripGeoId() <<
"decode0: strip= " << stripX <<
" quad="<<quadrantX <<
" oct="<<octX <<
"plane="<< layerX<<
" disc=" <<discX <<endm;
163 mClusterAlgoPtr=algo;
167 Int_t StFgtClusterMaker::InitRun(Int_t runnumber)
170 if( !mClusterAlgoPtr ){
171 LOG_INFO <<
"No fgt cluster algorithm specified, using default seededAlgo" << endm;
177 LOG_INFO <<
"StFgtClusterMaker::InitRun for " << runnumber << endm;
179 LOG_INFO <<
"No fgtDb yet, trying to get a hold" << endm;
183 LOG_FATAL <<
"StFgtDb not provided and error finding StFgtDbMaker" << endm;
187 mDb = fgtDbMkr->getDbTables();
190 LOG_FATAL <<
"StFgtDb not provided and error retrieving pointer from StFgtDbMaker '"
191 << fgtDbMkr->
GetName() << endm;
194 LOG_INFO <<
"Got on hold on fgtDb, all OK" << endm;
199 mClusterAlgoPtr->setDb(mDb);
213 if( !mClusterAlgoPtr ){
214 LOG_INFO <<
"No fgt cluster algorithm specified, using default seededAlgo" << endm;
219 ierr = mClusterAlgoPtr->Init();
224 LOG_INFO <<
"StFgtClusterMaker::Init " << endm;
226 LOG_INFO <<
"No fgtDb yet, trying to get a hold" << endm;
230 LOG_FATAL <<
"StFgtDb not provided and error finding StFgtDbMaker" << endm;
234 mDb = fgtDbMkr->getDbTables();
237 LOG_FATAL <<
"StFgtDb not provided and error retrieving pointer from StFgtDbMaker '"
238 << fgtDbMkr->
GetName() << endm;
241 LOG_INFO <<
"Got on hold on fgtDb, all OK" << endm;
246 mClusterAlgoPtr->setDb(mDb);
254 cout <<
"cluster maker finish!" << endl;
256 if( mClusterAlgoPtr ){
257 ierr = mClusterAlgoPtr->Finish();
Int_t setClusterAlgo(StFgtIClusterAlgo *)
clear function is empty at the moment
virtual const char * GetName() const
special overload
virtual Int_t doClustering(const StFgtCollection &fgtCollection, StFgtStripCollection &, StFgtHitCollection &)=0
virtual Int_t Init()
Init function. Checks if there is a cluster algo and initializes the same.