139 #include "StEventTypes.h"
140 #include "StDbUtilities/StGlobalCoordinate.hh"
141 #include "Sti/Base/Factory.h"
142 #include "Sti/StiHit.h"
143 #include "StPxlHitCollection.h"
144 #include "StPxlHit.h"
145 #include "Sti/StiHitContainer.h"
146 #include "Sti/StiDetector.h"
147 #include "Sti/StiDetectorBuilder.h"
148 #include "Sti/StiTrackContainer.h"
149 #include "StiPxl/StiPxlDetectorBuilder.h"
150 #include "StiPxlHitLoader.h"
151 #include "StPxlUtil/StPxlConstants.h"
154 StiPxlHitLoader::StiPxlHitLoader()
168 throw runtime_error(
"StiPxlHitLoader::loadHits(StEvent*) - FATAL - _detector==0");
171 throw runtime_error(
"StiPxlHitLoader::loadHits(StEvent*) - FATAL - _hitContainer==0");
175 if (!pxlHitCollection) {
176 LOG_WARN <<
"StiPxlHitLoader::loadHits() - StPxlHitCollection not found. "
177 "Check for StPxlSimMaker or StPxlHitMaker options in input chain. "
178 "PXL hits will not be used in tracking" << endm;
183 UInt_t numberOfSectors = pxlHitCollection->numberOfSectors();
185 for (UInt_t i = 0; i < numberOfSectors; i++)
188 if ( !pxlSectorHitCollection ) {cout <<
"No PXLSector hit collection" << endl;
return;}
190 UInt_t numberOfLadders = pxlSectorHitCollection->numberOfLadders();
192 for (UInt_t j = 0; j < numberOfLadders; j++)
195 if ( !pxlLadderHitCollection ) {cout <<
"No PXLLadder hit collection" << endl;
return;}
197 UInt_t numberOfSensors = pxlLadderHitCollection->numberOfSensors();
199 for (UInt_t l = 0; l < numberOfSensors; l++)
202 StSPtrVecPxlHit &pxlHits = PxlSensorHitCollection->hits();
204 LOG_DEBUG <<
"StiPxlHitLoader::loadHits() - Collection size: " << pxlHits.size() << endm;
206 for (
unsigned int iPxlHit = 0; iPxlHit < pxlHits.size(); iPxlHit++)
208 StPxlHit *pxlHit = pxlHits[iPxlHit];
211 throw runtime_error(
"StiPxlHitLoader::loadHits(StEvent*) -E- NULL hit in container");
213 if (pxlHit->detector() != kPxlId)
continue;
215 LOG_DEBUG <<
"StiPxlHitLoader::loadHits() - \n"
221 int sensorHalf = pxlHit->localPosition(0) < 0 ? 1 : 2;
225 throw runtime_error(
"StiPxlHitLoader::loadHits(StEvent*) -E- NULL detector pointer");
229 if (!stiHit)
throw runtime_error(
"StiPxlHitLoader::loadHits(StEvent*) -E- stiHit==0");
234 pxlHit->position().x(), pxlHit->position().y(),
235 pxlHit->position().z(), pxlHit->charge());
239 _hitContainer->
add(stiHit);
virtual void add(StiHit *)
void setGlobal(const StiDetector *detector, const StMeasuredPoint *stHit, Float_t x, Float_t y, Float_t z, Float_t energy)
virtual Abstract * getInstance()=0
Get a pointer to instance of objects served by this factory.
void setMaxTimes(int set)
Set the number of times used.