5 #include "TGeoMatrix.h"
7 #include "StIstHitMaker.h"
8 #include "StIstUtil/StIstCollection.h"
9 #include "StIstUtil/StIstCluster.h"
10 #include "StIstUtil/StIstClusterCollection.h"
12 #include "StIstHitCollection.h"
14 #include "St_base/StMessMgr.h"
16 #include "StEventTypes.h"
17 #include "StContainers.h"
19 #include "StIstUtil/StIstConsts.h"
21 #include "StIstDbMaker/StIstDb.h"
22 #include "tables/St_istControl_Table.h"
27 StIstHitMaker::StIstHitMaker(
const char *name ) :
StMaker(name), mSensorTransforms(0)
32 Int_t StIstHitMaker::InitRun(Int_t runnumber)
42 LOG_ERROR <<
"InitRun : no istDb" << endm;
64 LOG_ERROR <<
"Make() - No StEvent found in the chain. Cannot proceed" << endm;
72 LOG_WARN <<
"Make() - istRawHitAndCluster dataset not found. No IST hits will be available for tracking" << endm;
78 if ( !istCollectionPtr ) {
79 LOG_WARN <<
"Make() - StIstCollection not found. No IST hits will be available for tracking" << endm;
87 if (!istHitCollection) {
89 eventPtr->setIstHitCollection(istHitCollection);
90 LOG_DEBUG <<
"Make() - Added new StIstHitCollection to this StEvent" << endm;
93 unsigned char nClusteringType = -1;
95 for (
unsigned char ladderIdx = 0; ladderIdx <
kIstNumLadders; ++ladderIdx) {
100 if ( clusterCollectionPtr ) {
101 unsigned int numClusters = clusterCollectionPtr->getNumClusters();
102 LOG_DEBUG <<
"Make() - Number of clusters found in ladder " << (int)(ladderIdx + 1) <<
": " << numClusters << endm;
104 unsigned short idTruth = 0;
105 unsigned char nRawHits = -1, nRawHitsZ = -1, nRawHitsRPhi = -1;
106 unsigned char ladder = -1, sensor = -1;
107 float meanRow = 0., meanColumn = 0., charge = 0., chargeErr = 0.;
108 unsigned char maxTb = -1;
111 for (std::vector< StIstCluster * >::iterator clusterIter = clusterCollectionPtr->getClusterVec().begin(); clusterIter != clusterCollectionPtr->getClusterVec().end(); ++clusterIter) {
112 idTruth = (*clusterIter)->getIdTruth();
113 key = (*clusterIter)->getKey();
114 ladder = (*clusterIter)->getLadder();
115 sensor = (*clusterIter)->getSensor();
116 meanRow = (*clusterIter)->getMeanRow();
117 meanColumn = (*clusterIter)->getMeanColumn();
118 maxTb = (*clusterIter)->getMaxTimeBin();
119 charge = (*clusterIter)->getTotCharge();
120 chargeErr = (*clusterIter)->getTotChargeErr();
121 nRawHits = (*clusterIter)->getNRawHits();
122 nRawHitsZ = (*clusterIter)->getNRawHitsZ();
123 nRawHitsRPhi = (*clusterIter)->getNRawHitsRPhi();
124 nClusteringType = (*clusterIter)->getClusteringType();
126 StIstHit *newHit =
new StIstHit(ladder, sensor, charge, chargeErr, maxTb, nRawHits, nRawHitsZ, nRawHitsRPhi);
128 newHit->setIdTruth(idTruth);
131 local[0] = 0.5 * kIstSensorActiveSizeRPhi - (meanRow - 0.5) * kIstPadPitchRow;
133 local[2] = (meanColumn - 0.5) * kIstPadPitchColumn - 0.5 * kIstSensorActiveSizeZ;
134 newHit->setLocalPosition(local[0], local[1], local[2]);
136 istHitCollection->addHit(newHit);
146 for (
int idx = 0; idx < (int) sensorHitCollection->hits().size(); idx++ ) {
147 StIstHit *newHit = sensorHitCollection->hits()[idx];
150 local[0] = newHit->localPosition(0);
151 local[1] = newHit->localPosition(1);
152 local[2] = newHit->localPosition(2);
154 int sensorId = 1000 + ((int)newHit->getLadder() - 1) * kIstNumSensorsPerLadder + (
int)newHit->getSensor();
155 TGeoHMatrix *geoMSensorOnGlobal = (TGeoHMatrix *)
mSensorTransforms->FindObject(Form(
"R%04i", sensorId));
156 geoMSensorOnGlobal->LocalToMaster(local, global);
158 newHit->setPosition(vecGlobal);
163 istHitCollection->setClusteringType(nClusteringType);
const int kIstNumLadders
24 IST Ladders
THashList * mSensorTransforms
A list of TGeo transformations for each IST sensor.
const int kIstNumSensorsPerLadder
6 sensor per one IST Ladder
virtual TObject * GetObject() const
The depricated method (left here for the sake of the backward compatibility)