7 #include "StMcEvent/StMcEvent.hh"
8 #include "StEventTypes.h"
9 #include "StDbUtilities/StGlobalCoordinate.hh"
10 #include "Sti/Base/Factory.h"
11 #include "Sti/StiHit.h"
12 #include "Sti/StiHitContainer.h"
13 #include "Sti/StiDetector.h"
14 #include "Sti/StiDetectorBuilder.h"
16 #include "Sti/StiTrackContainer.h"
17 #include "StiIstHitLoader.h"
18 #include "StMcEvent/StMcTrack.hh"
19 #include "StMcEvent/StMcIstHit.hh"
20 #include "StMcEvent/StMcIstHitCollection.hh"
21 #include "StMcEvent/StMcIstLayerHitCollection.hh"
22 #include "StBFChain.h"
27 StiIstHitLoader::StiIstHitLoader()
37 StiIstHitLoader::~StiIstHitLoader()
40 void StiIstHitLoader::loadHits(
StEvent* source,
42 Filter<StiHit> * hitFilter)
46 LOG_INFO <<
"StiIstHitLoader::loadHits(StEvent*) -I- Started" << endm;
48 throw runtime_error(
"StiIstHitLoader::loadHits(StEvent*) - FATAL - _detector==0");
50 throw runtime_error(
"StiIstHitLoader::loadHits(StEvent*) - FATAL - _hitContainer==0");
55 LOG_INFO <<
"StiIstHitLoader::loadHits\tERROR:\tcol==0"<<endm;
56 LOG_INFO <<
"You must not have pixelFastSim in your chain"<<endm;
57 LOG_INFO <<
"will return with no action taken"<<endm;
60 StSPtrVecRnDHit& vec = col->hits();
62 LOG_DEBUG <<
"StiIstHitLoader: RnD Hits: "<<vec.size()<<endm;
64 for(
unsigned int j=0; j<vec.size(); j++) {
70 if (hit->detector()!=kIstId)
continue;
75 int layer = hit->layer();
76 int ladder = hit->ladder();
77 int wafer = hit->wafer();
78 LOG_DEBUG<<
"StiIstHitLoader: hit has ladder: "<<ladder<<
"; wafer: "<<wafer<<endm;
79 LOG_DEBUG<<
"StiIstHitLoader: hit volume id: "<<hit->volumeId()<<endm;
83 detector=_detector->getDetector(layer,ladder);
84 if (!detector) cout <<
"no detector found for hit:\t"<<*hit<<endl;
86 cout <<
"StiIstHitLoader: add hit to detector:\t"<<detector->
getName()<<endl;
89 if(!stiHit)
throw runtime_error(
"StiIstHitLoader::loadHits(StEvent*) -E- stiHit==0");
91 LOG_DEBUG<<
"StiIstHitLoader: hit has position ("<<hit->position().x()<<
","<<hit->position().y()<<
","<<hit->position().z()<<
")"<<endm;
92 stiHit->
setGlobal(detector, hit, hit->position().x(),hit->position().y(),hit->position().z(),hit->charge());
93 _hitContainer->
add( stiHit );
97 LOG_INFO <<
"StiIstHitLoader::loadHits(StEvent*) -I- Done" << endm;
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.
const string & getName() const
Get the name of the object.