3 #include "TGeoMatrix.h"
5 #include "StFstHitMaker.h"
6 #include "StFstUtil/StFstCollection.h"
7 #include "StFstUtil/StFstCluster.h"
8 #include "StFstUtil/StFstClusterCollection.h"
10 #include "StFstHitCollection.h"
12 #include "St_base/StMessMgr.h"
14 #include "StEventTypes.h"
15 #include "StContainers.h"
17 #include "StEvent/StFstConsts.h"
19 #include "StFstDbMaker/StFstDb.h"
20 #include "tables/St_fstControl_Table.h"
25 StFstHitMaker::StFstHitMaker(
const char *name ) :
StMaker(name), mSensorTransforms(0)
29 Int_t StFstHitMaker::InitRun(Int_t runnumber)
39 LOG_ERROR <<
"InitRun : no fstDb" << endm;
61 LOG_ERROR <<
"Make() - No StEvent found in the chain. Cannot proceed" << endm;
69 LOG_WARN <<
"Make() - fstRawHitAndCluster dataset not found. No FST hits will be available for tracking" << endm;
75 if ( !fstCollectionPtr ) {
76 LOG_WARN <<
"Make() - StFstCollection not found. No FST hits will be available for tracking" << endm;
84 if (!fstHitCollection) {
86 eventPtr->setFstHitCollection(fstHitCollection);
87 LOG_DEBUG <<
"Make() - Added new StFstHitCollection to this StEvent" << endm;
90 unsigned char nClusteringType = -1;
92 for (
unsigned char wedgeIdx = 0; wedgeIdx < kFstNumWedges; ++wedgeIdx) {
97 if ( clusterCollectionPtr ) {
98 unsigned int numClusters = clusterCollectionPtr->getNumClusters();
99 LOG_DEBUG <<
"Make() - Number of clusters found in wedge " << (int)(wedgeIdx + 1) <<
": " << numClusters << endm;
101 unsigned short idTruth = 0;
102 unsigned char nRawHits = -1, nRawHitsR = -1, nRawHitsPhi = -1;
103 unsigned char disk = -1, wedge = -1, sensor = -1, apv = -1;
104 int meanRStrip = -1, meanPhiStrip = -1;
105 float charge = 0., chargeErr = 0.;
106 unsigned char maxTb = -1;
108 float phiInner = -999.9, phiOuter = -999.9;
110 for (std::vector< StFstCluster * >::iterator clusterIter = clusterCollectionPtr->getClusterVec().begin(); clusterIter != clusterCollectionPtr->getClusterVec().end(); ++clusterIter) {
111 idTruth = (*clusterIter)->getIdTruth();
112 key = (*clusterIter)->getKey();
113 disk = (*clusterIter)->getDisk();
114 wedge = (*clusterIter)->getWedge();
115 sensor = (*clusterIter)->getSensor();
116 apv = (*clusterIter)->getApv();
117 meanRStrip = (*clusterIter)->getMeanRStrip();
118 meanPhiStrip = (*clusterIter)->getMeanPhiStrip();
119 maxTb = (*clusterIter)->getMaxTimeBin();
120 charge = (*clusterIter)->getTotCharge();
121 chargeErr = (*clusterIter)->getTotChargeErr();
122 nRawHits = (*clusterIter)->getNRawHits();
123 nRawHitsR = (*clusterIter)->getNRawHitsR();
124 nRawHitsPhi = (*clusterIter)->getNRawHitsPhi();
125 nClusteringType = (*clusterIter)->getClusteringType();
127 StFstHit *newHit =
new StFstHit(disk, wedge, sensor, apv, charge, chargeErr, maxTb, meanRStrip, meanPhiStrip, nRawHits, nRawHitsR, nRawHitsPhi);
129 newHit->setIdTruth(idTruth);
135 moduleIdx = wedge-12;
137 moduleIdx = wedge-24;
139 if(disk == 1 || disk == 3)
141 phiInner = kFstphiStart[moduleIdx-1]*TMath::Pi()/6.0 + 0.5*kFstzDirct[moduleIdx-1]*kFstStripPitchPhi;
142 phiOuter = kFstphiStop[moduleIdx-1]*TMath::Pi()/6.0 - 0.5*kFstzDirct[moduleIdx-1]*kFstStripPitchPhi;
146 phiInner = kFstphiStop[moduleIdx-1]*TMath::Pi()/6.0 - 0.5*kFstzDirct[moduleIdx-1]*kFstStripPitchPhi;
147 phiOuter = kFstphiStart[moduleIdx-1]*TMath::Pi()/6.0 + 0.5*kFstzDirct[moduleIdx-1]*kFstStripPitchPhi;
149 double local[3] = {0};
150 if(meanRStrip < kFstNumRStripsPerWedge/2)
152 local[0] = kFstrStart[meanRStrip] + 0.5*kFstStripPitchR;
153 local[1] = phiInner + kFstzFilp[disk-1]*kFstzDirct[moduleIdx-1]*meanPhiStrip*kFstStripPitchPhi;
158 local[0] = kFstrStart[meanRStrip] + 0.5*kFstStripPitchR;
159 local[1] = phiOuter - kFstzFilp[disk-1]*kFstzDirct[moduleIdx-1]*meanPhiStrip*kFstStripPitchPhi - kFstzFilp[disk-1]*kFstzDirct[moduleIdx-1]*0.5*kFstStripGapPhi;
162 local[0] = kFstrStart[meanRStrip] + 0.5*kFstStripPitchR;
163 local[1] = phiOuter - kFstzFilp[disk-1]*kFstzDirct[moduleIdx-1]*meanPhiStrip*kFstStripPitchPhi + kFstzFilp[disk-1]*kFstzDirct[moduleIdx-1]*0.5*kFstStripGapPhi;
167 if(disk == 1) local[2] = 151.750;
168 else if(disk == 2) local[2] = 165.248;
169 else if(disk == 3) local[2] = 178.781;
170 newHit->setLocalPosition(local[0], local[1], local[2]);
172 fstHitCollection->addHit(newHit);
178 for (
int sensorIdx = 0; sensorIdx < kFstNumSensorsPerWedge; sensorIdx++) {
181 for (
int idx = 0; idx < (int) sensorHitCollection->hits().size(); idx++ ) {
182 StFstHit *newHit = sensorHitCollection->hits()[idx];
185 local[0] = newHit->localPosition(0);
186 local[1] = newHit->localPosition(1);
187 local[2] = newHit->localPosition(2);
191 int sensorId = 1000 + ((int)newHit->getWedge() - 1) * kFstNumSensorsPerWedge + (
int)newHit->getSensor();
192 TGeoHMatrix *geoMSensorOnGlobal = (TGeoHMatrix *)
mSensorTransforms->FindObject(Form(
"R%04i", sensorId));
193 geoMSensorOnGlobal->LocalToMaster(local, global);
195 global[0] = local[0]*cos(local[1]);
196 global[1] = local[0]*sin(local[1]);
197 global[2] = local[2];
200 newHit->setPosition(vecGlobal);
205 fstHitCollection->setClusteringType(nClusteringType);
THashList * mSensorTransforms
A list of TGeo transformations for each FST sensor.
virtual TObject * GetObject() const
The depricated method (left here for the sake of the backward compatibility)