7 #include "StMcEvent/StMcEvent.hh"
8 #include "StEventTypes.h"
9 #include "StDbUtilities/StGlobalCoordinate.hh"
10 #include "Sti/StiHit.h"
11 #include "Sti/StiHitContainer.h"
12 #include "Sti/StiDetector.h"
13 #include "Sti/StiDetectorBuilder.h"
14 #include "Sti/StiTrackContainer.h"
15 #include "StiIst/StiIstDetectorBuilder.h"
16 #include "StiIstHitLoader.h"
17 #include "StMcEvent/StMcTrack.hh"
18 #include "StMcEvent/StMcIstHit.hh"
19 #include "StMcEvent/StMcIstHitCollection.hh"
20 #include "StMcEvent/StMcIstLayerHitCollection.hh"
21 #include "StIstHitCollection.h"
25 StiIstHitLoader::StiIstHitLoader() :
34 StiIstHitLoader::~StiIstHitLoader()
40 throw runtime_error(
"StiIstHitLoader::loadHits(StEvent*) - FATAL - _detector==0");
43 throw runtime_error(
"StiIstHitLoader::loadHits(StEvent*) - FATAL - _hitContainer==0");
49 LOG_WARN <<
"StiIstHitLoader::loadHits() - StIstHitCollection not found. "
50 "Check for istFastSim option in input chain. "
51 "IST hits will not be used in tracking" << endm;
55 int nIsthits = col->numberOfHits();
56 LOG_DEBUG <<
"StiIstHitLoader: IST Hits: " << nIsthits << endm;
59 for (
int ladderIdx = 0; ladderIdx <
kIstNumLadders; ++ladderIdx ) {
62 if (! ladderHitCollection) {
63 LOG_WARN <<
"No IST ladder hit collection" << endl;
70 if (! sensorHitCollection) {
71 cout <<
"No IST sensor hit collection" << endl;
75 StSPtrVecIstHit &vec = sensorHitCollection->hits();
76 LOG_DEBUG <<
"StiIstHitLoader - collection size: " << vec.size() <<
" on Ladder " << ladderIdx + 1 <<
" Sensor " << sensorIdx + 1 << endm;
78 for (
unsigned int j = 0; j < vec.size(); j++) {
82 throw runtime_error(
"StiIstHitLoader::loadHits(StEvent*) -E- NULL hit in container");
84 if (hit->detector() != kIstId)
continue;
86 LOG_DEBUG << *hit <<
"\n"
91 int sensorHalf = hit->localPosition(0) < 0 ? 1 : 2;
95 throw runtime_error(
"StiIstHitLoader::loadHits(StEvent*) -E- NULL detector pointer");
99 if (!stiHit)
throw runtime_error(
"StiIstHitLoader::loadHits(StEvent*) -E- stiHit==0");
103 stiHit->
setGlobal(detector, hit, hit->position().x(), hit->position().y(), hit->position().z(), hit->charge());
107 _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)
const int kIstNumLadders
24 IST Ladders
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.
const int kIstNumSensorsPerLadder
6 sensor per one IST Ladder