5 #include "StFgtPointMaker.h"
6 #include "StEventTypes.h"
7 #include "StRoot/StEvent/StEvent.h"
8 #include "StRoot/StFgtDbMaker/StFgtDbMaker.h"
9 #include "StRoot/StFgtDbMaker/StFgtDb.h"
10 #include "StarClassLibrary/StThreeVectorF.hh"
11 #include "StTpcDb/StTpcDb.h"
12 #include "TGeoManager.h"
14 #include "StFgtSimplePointAlgo.h"
33 eventPtr = (
StEvent*)GetInputDS(
"StEvent");
36 LOG_ERROR <<
"Error getting pointer to StEvent from '" << ClassName() <<
"'" << endm;
43 fgtCollectionPtr=eventPtr->fgtCollection();
46 if( !fgtCollectionPtr) {
47 LOG_ERROR <<
"Error getting pointer to StFgtCollection from '" << ClassName() <<
"'" << endm;
56 ierr = mPointAlgoPtr->makePoints( *fgtCollectionPtr );
58 int npoint[kFgtNumDiscs][kFgtNumQuads]; memset(npoint,0,
sizeof(npoint));
60 StSPtrVecFgtPoint &point = pointCollectionPtr->getPointVec();
61 for(StSPtrVecFgtPointIterator it=point.begin(); it!=point.end(); it++) {
62 int idisc=(*it)->getDisc();
63 int iquad=(*it)->getQuad();
64 float phi = (*it)->getPositionPhi();
65 float r = (*it)->getPositionR();
67 mDb->getStarXYZ(idisc,iquad,r,phi,xyz);
69 double local[3]={0,0,0}, global[3]={0,0,0};
72 TGeoHMatrix globalMatrix = gStTpcDb->Tpc2GlobalMatrix();
74 globalMatrix.LocalToMaster(local,global);
75 gxyz.SetXYZ(global[0],global[1],global[2]);
79 printf(
"StFgtPointMaker::Make could not get gStTpcDb... global xyz is same as fgt local xyz\n");
86 (*it)->setPosition(sxyz);
87 (*it)->setPositionError(serr);
90 npoint[idisc][iquad]++;
94 printf(
"FgtPoint : ");
96 for(
int q=0; q<kFgtNumQuads; q++){
98 for(
int d=0; d<kFgtNumDiscs; d++) {
if(npoint[d][q]>0) n++;}
99 printf(
"Q%1d=%3d ",q,n);
102 printf(
" max=%d",max);
103 if(max<mSkipEvent) {ierr=
kStSKIP; printf(
" SKIPPING Event!"); }
107 StSPtrVecFgtPoint& pointVec = pointCollectionPtr->getPointVec();
111 float theta=2*atan(exp(-eta));
112 for(
short d=0; d<6; d++){
114 StSPtrVecFgtHit &clustVec = hitCollectionPtr->getHitVec();
115 float z=StFgtGeom::getDiscZ(d);
116 float x=z*tan(theta);
118 float r=sqrt(x*x+y*y);
120 printf(
"FakeData FGT eta=%6.3f phi=%6.3f z,x=%6.3f,%6.3f\n",eta,phi,z,x);
121 StFgtHit *phit =
new StFgtHit(d*2, 11,1050,d,quad,
'P',0,0.1,phi,0.1,z,0.1); clustVec.push_back(phit);
122 StFgtHit *rhit =
new StFgtHit(d*2+1,11,1000,d,quad,
'R',r,0.1,0 ,0.1,z,0.1); clustVec.push_back(rhit);
126 p->setPositionError(serr);
132 eventPtr->setTpcHitCollection(tpcHits);
135 for(
int ipad= 0;ipad< 8; ipad++){tpcr[ipad]=60.0 + 4.8*ipad;}
136 for(
int ipad= 8;ipad<13; ipad++){tpcr[ipad]=60.0 + 4.8*7 + 5.2*(ipad-8);}
137 for(
int ipad=13;ipad<45; ipad++){tpcr[ipad]=127.950 + 2.0*(ipad-13);}
138 for(
int ipad=0; ipad<45; ipad++){
142 float z=r/tan(theta);
144 printf(
"FakeData TPC eta=%6.3f phi=%6.3f z,x=%6.3f,%6.3f\n",eta,phi,z,x);
149 int hw = 1 + (sector<<4) + (row<<9);
161 Int_t StFgtPointMaker::Init()
166 if( !mPointAlgoPtr ){
167 LOG_WARN <<
"No fgt point algorithm specified" << endm;
170 AddObj(mPointAlgoPtr,
".data",0);
174 ierr = mPointAlgoPtr->Init();
178 LOG_FATAL <<
"StFgtDb not provided and error finding StFgtDbMaker" << endm;
181 mDb = fgtDbMkr->getDbTables();
183 LOG_FATAL <<
"StFgtDb not provided and error retrieving pointer from StFgtDbMaker '"
184 << fgtDbMkr->
GetName() << endm;
191 StFgtPointMaker::StFgtPointMaker(
const Char_t* name ) :
StMaker(name),mPointAlgoPtr(0),mSkipEvent(0),mFakeData(0)
196 StFgtPointMaker::~StFgtPointMaker()
200 LOG_INFO <<
"Cleaning up point Algo" << endm;
201 delete mPointAlgoPtr;
virtual void Clear(Option_t *opts="")
User defined functions.
virtual const char * GetName() const
special overload
Represents a point in the FGT.