53 #include "StEventTypes.h"
54 #include "StDbUtilities/StGlobalCoordinate.hh"
55 #include "Sti/Base/Factory.h"
56 #include "Sti/StiHit.h"
58 #include "StPxlHitCollection.h"
61 #include "Sti/StiHitContainer.h"
62 #include "Sti/StiDetector.h"
63 #include "Sti/StiDetectorBuilder.h"
64 #include "Sti/StiTrackContainer.h"
65 #include "StiPixelHitLoader.h"
67 StiPixelHitLoader::StiPixelHitLoader()
77 StiPixelHitLoader::~StiPixelHitLoader()
80 void StiPixelHitLoader::loadHits(
StEvent* source,
82 Filter<StiHit> * hitFilter)
85 LOG_INFO <<
" -I- Started" << endl;
87 throw runtime_error(
"StiPixelHitLoader::loadHits(StEvent*) - FATAL - _detector==0");
89 throw runtime_error(
"StiPixelHitLoader::loadHits(StEvent*) - FATAL - _hitContainer==0");
93 LOG_ERROR <<
"StiPixelHitLoader::loadHits\tERROR:\tcol==0"
94 <<
"You must not have pixelFastSim in your chain"
95 <<
"will return with no action taken"<<endm;
103 if(! PxlHitCollection){cout<<
"No PXL hit collection"<<endl;
return;}
104 UInt_t numberOfSectors=PxlHitCollection->numberOfSectors();
105 for(UInt_t i=0;i<numberOfSectors;i++){
107 if(! PxlSectorHitCollection){cout<<
"No PXLSector hit collection"<<endl;
return;}
108 UInt_t numberOfLadders=PxlSectorHitCollection->numberOfLadders();
109 for(UInt_t j=0;j<numberOfLadders;j++){
111 if(! PxlLadderHitCollection){cout<<
"No PXLLadder hit collection"<<endl;
return;}
112 UInt_t numberOfSensors=PxlLadderHitCollection->numberOfSensors();
113 for(UInt_t l=0;l<numberOfSensors;l++){
115 StSPtrVecPxlHit& vec = PxlSensorHitCollection->hits();
117 LOG_DEBUG<<
"StiPixelHitLoader - collection size: "<<vec.size()<<endm;
119 for(
unsigned int j=0; j<vec.size(); j++) {
122 throw runtime_error(
"StiPixelHitLoader::loadHits(StEvent*) -E- NULL hit in container");
124 if (pxlH->detector()!=kPxlId)
continue;
131 LAD=(int)pxlH->sector()-1;
136 LAD=(((int)pxlH->sector()-1)*3 + (
int)pxlH->ladder()-1);
138 LOG_DEBUG <<
" layer : "<< LAY <<
" ladder : "<< LAD << endm;
139 LOG_DEBUG <<
"X/Y/Z : " << pxlH->position().x()<<
"/"<< pxlH->position().y()<<
"/"<<pxlH->position().z()<<endm;
140 LOG_DEBUG <<
"Xl/Yl/Zl : " << pxlH->localPosition(0)<<
"/"<< pxlH->localPosition(1)<<
"/"<<pxlH->localPosition(2)<<endm;
141 detector= _detector->getDetector(LAY,LAD);
144 throw runtime_error(
"StiPixelHitLoader::loadHits(StEvent*) -E- NULL detector pointer");
145 LOG_DEBUG <<
"add hit to detector:\t"<<detector->
getName()<<endm;
146 double angle = detector->getPlacement()->getNormalRefAngle();
147 double radius = detector->getPlacement()->getNormalRadius();
148 double zcenter = detector->getPlacement()->getZcenter();
149 double halfDepth = detector->getShape()->getHalfDepth();
150 double halfWidth = detector->getShape()->getHalfWidth();
151 double thick = detector->getShape()->getThickness();
152 LOG_DEBUG <<
" detector info " << *detector << endm;
153 LOG_DEBUG <<
" radius = "<< radius <<
" angle = " << angle <<
" zCenter = " << zcenter << endm;
154 LOG_DEBUG <<
" depth = " << halfDepth <<
" Width = " << halfWidth <<
" thickness= " << thick << endm;
155 LOG_DEBUG <<
" key 1 : " << detector->getKey(1) <<
" key 2 : " << detector->getKey(2) << endm;
158 if(!stiHit)
throw runtime_error(
"StiPixelHitLoader::loadHits(StEvent*) -E- stiHit==0");
162 pxlH->position().x(), pxlH->position().y(),
163 pxlH->position().z(), pxlH->charge());
165 _hitContainer->
add(stiHit);
166 LOG_DEBUG <<
" nHit = "<<nHit<<
" Sector = "<<pxlH->sector()<<
" Ladder = "<<pxlH->ladder()<<
" x = "<<pxlH->position().x()<<
" y = "<<pxlH->position().y()<<
" z = "<<pxlH->position().z()<<endm;
174 LOG_INFO <<
"StiPixelHitLoader:loadHits -I- Loaded "<<nHit<<
" pixel hits."<<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.