6 #include "StEventTypes.h"
7 #include "StDbUtilities/StTpcCoordinateTransform.hh"
8 #include "StDbUtilities/StTpcLocalSectorCoordinate.hh"
9 #include "StDbUtilities/StGlobalCoordinate.hh"
10 #include "StTpcDb/StTpcDb.h"
11 #include "Sti/Base/Factory.h"
12 #include "Sti/StiHit.h"
13 #include "Sti/StiHitContainer.h"
14 #include "Sti/StiDetector.h"
15 #include "Sti/StiDetectorBuilder.h"
16 #include "StiTpcHitLoader.h"
17 #include "Sti/StiHitTest.h"
18 #include "Sti/StiKalmanTrackNode.h"
19 #include "StiTpc/StiTpcDetectorBuilder.h"
20 #include "RTS/src/DAQ_TPX/tpxFCF_flags.h"
21 #include "StDetectorDbMaker/St_tpcPadConfigC.h"
24 _minRow(1), _maxRow(100), _minSector(1), _maxSector(24) {}
30 _minRow(1), _maxRow(100), _minSector(1), _maxSector(24) {}
32 void StiTpcHitLoader::loadHits(
StEvent* source,
34 Filter<StiHit> * hitFilter)
36 static Int_t debug = 0;
39 assert(_hitContainer);
42 UInt_t noHitsLoaded = 0;
43 for (UInt_t sector=_minSector-1; sector<_maxSector; sector++) {
46 cout <<
"StiTpcHitLoader::loadHits(StEvent* source) -W- no hits for sector:"<<sector<<endl;
49 Float_t driftvel = 1e-6*gStTpcDb->DriftVelocity(sector+1);
51 _maxRow = St_tpcPadConfigC::instance()->numberOfRows(sector+1);
53 for (UInt_t row=_minRow-1; row<_maxRow; row++) {
57 int stiSector, stiRow;
58 std::tie(stiSector, stiRow) = StiTpcDetectorBuilder::toStiLayer(sector+1, row+1);
61 if (!padrowHits)
break;
62 const StSPtrVecTpcHit& hitvec = padrowHits->hits();
63 StiDetector * detector = _detector->getDetector(stiRow,stiSector);
64 if (!detector)
throw runtime_error(
"StiTpcHitLoader::loadHits(StEvent*) -E- Detector element not found");
68 if (StiKalmanTrackNode::IsLaser() &&
hit->flag())
continue;
69 if (
hit->flag() & FCF_CHOPPED ||
hit->flag() & FCF_SANITY)
continue;
70 if (
hit->pad() > 182 ||
hit->timeBucket() > 511)
continue;
75 hitTest.add(
hit->position().x(),
hit->position().y(),
hit->position().z());
76 if (
hit->sector() <= 12) stiHit->setVz( driftvel);
77 else stiHit->setVz(-driftvel);
78 _hitContainer->
add( stiHit );
81 cout <<
"add hit S/R =" << sector <<
"/" << row <<
" to detector " << *detector << endl;
84 if (hitTest.width()>0.1) {
85 printf(
"**** TPC hits too wide (%g) sector=%d row%d\n"
86 ,hitTest.width(),sector,row);
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.