47 #include "TpcMapUtilities.h"
48 #include "TpcHitUtilities.h"
49 #include "StEventTypes.h"
50 #include "StThreeVectorD.hh"
53 #include "StDbUtilities/StTpcCoordinateTransform.hh"
54 #include "StDbUtilities/StTpcLocalSectorCoordinate.hh"
55 #include "StDbUtilities/StTpcPadCoordinate.hh"
56 #include "StDbUtilities/StGlobalCoordinate.hh"
57 #include "StTpcDb/StTpcDb.h"
59 #ifndef ST_NO_NAMESPACES
64 TpcHitUtilities::TpcHitUtilities()
70 TpcHitUtilities::TpcHitUtilities(
StTrack* tck,
double magneticField)
75 m_BField = magneticField;
78 TpcHitUtilities::~TpcHitUtilities() {}
81 void TpcHitUtilities::clear()
89 void TpcHitUtilities::setTrack(
StTrack* tck)
95 void TpcHitUtilities::setBField(
double b)
101 const vector<StTpcHit*>& TpcHitUtilities::tpcHitVec()
const {
return m_tpcHitVec;}
104 void TpcHitUtilities::findHits()
106 StPtrVecHit vec = m_StTrack->detectorInfo()->hits(kTpcId);
107 StPtrVecHitIterator iter;
110 for (iter = vec.begin(); iter != vec.end(); iter++) {
112 hit =
dynamic_cast<StTpcHit*
>(*iter);
121 bool TpcHitUtilities::keepHit(
StTpcHit* tpcHit)
123 if (tpcHit->flag()==0) {
return true;}
131 int numSectors = gStTpcDb->Dimensions()->numberOfSectors();
132 double beta = (sector > 12) ?(numSectors-sector)*2.*M_PI/(
static_cast<double>(numSectors)/2.): sector*2.*M_PI/(
static_cast<double>(numSectors)/2.);
138 double TpcHitUtilities::dx(
StTpcHit* tpcHit)
142 mykey.sector = tpcHit->sector();
143 mykey.padrow = tpcHit->padrow();
145 const StThreeVectorD normal = m_SectorNormalMap[tpcHit->sector()];
146 double s_out = m_StTrack->geometry()->helix().
pathLength(padLoc.outsidePoint(), normal);
147 double s_in = m_StTrack->geometry()->helix().
pathLength(padLoc.insidePoint(), normal);
149 if (ds < 0.) {ds = -1.*ds;}
150 if (s_out==DBL_MAX || s_in==DBL_MAX) {ds = 0.;}
154 void TpcHitUtilities::buildMaps()
158 {
for (
int sector=1; sector<=24; sector++) {
159 m_SectorNormalMap[sector] = sectorNormal(sector);
164 {
for (
int sector=1; sector<=24; sector++) {
166 for (
int padrow=1; padrow<=45; padrow++) {
169 padlength = St_tpcPadConfigC::instance()->innerSectorPadLength(sector);}
171 padlength = St_tpcPadConfigC::instance()->outerSectorPadLength(sector);}
176 transformer(padCoord, lsMidCoord);
181 lsPos.y()+padlength/2.,
185 lsPos.y()-padlength/2.,
190 transformer(lsTopCoord, gTopCoord);
191 transformer(lsBotCoord, gBotCoord);
192 transformer(lsMidCoord, gMidCoord);
196 const StThreeVectorD gTopPosD(gTopPos.x(),gTopPos.y(),gTopPos.z());
197 const StThreeVectorD gMidPosD(gMidPos.x(),gMidPos.y(),gMidPos.z());
198 const StThreeVectorD gBotPosD(gBotPos.x(),gBotPos.y(),gBotPos.z());
203 myKey.sector = sector;
204 myKey.padrow = padrow;
205 m_PadrowMap.insert(padrowMapValType(myKey,padLocation));
211 cout<<
"Done Building Maps"<<endl;
map< HitMapQAKey, PadrowLocation, MapQAKeyLessThan > m_PadrowMap
Map of normal vectors to a sector.
pair< double, double > pathLength(double r) const
path length at given r (cylindrical r)
vector< StTpcHit * > m_tpcHitVec
Map of 3 points in each padrow.