72 #include "StDetectorId.h"
73 #include "StTrackDetectorInfo.h"
76 #include "StThreeVectorD.hh"
79 static const
char rcsid[] = "$Id:
StTrackDetectorInfo.cxx,v 2.19 2016/02/24 22:02:11 ullrich Exp $";
82 mNumberOfPointsTpc(0),
83 mNumberOfPointsFtpcWest(0),
84 mNumberOfPointsFtpcEast(0),
85 mNumberOfPointsSvt(0),
86 mNumberOfPointsSsd(0),
87 mNumberOfPointsOth(0),
88 mNumberOfPointsIst(0),
92 StTrackDetectorInfo::~StTrackDetectorInfo() { }
95 StTrackDetectorInfo::firstPoint()
const {
return mFirstPoint; }
98 StTrackDetectorInfo::lastPoint()
const {
return mLastPoint; }
101 StTrackDetectorInfo::numberOfPoints()
const
103 if (mNumberOfPoints) {
104 return (numberOfPoints(kTpcId) +
105 numberOfPoints(kSvtId) +
106 numberOfPoints(kSsdId));
109 return (numberOfPoints(kTpcId) +
110 numberOfPoints(kFtpcWestId) +
111 numberOfPoints(kFtpcEastId) +
112 numberOfPoints(kSvtId) +
113 numberOfPoints(kSsdId) +
114 numberOfPoints(kIstId) +
115 numberOfPoints(kPxlId));
120 StTrackDetectorInfo::numberOfPoints(StDetectorId det)
const
122 if (mNumberOfPoints) {
128 return mNumberOfPoints%1000;
131 return (mNumberOfPoints%10000)/1000;
135 return mNumberOfPoints/10000;
144 return mNumberOfPointsFtpcWest;
147 return mNumberOfPointsFtpcEast;
150 return mNumberOfPointsTpc;
153 return mNumberOfPointsSvt;
157 return mNumberOfPointsSsd;
160 return mNumberOfPointsIst;
163 return mNumberOfPointsPxl;
166 return mNumberOfPointsOth;
172 StTrackDetectorInfo::numberOfReferencedPoints()
const
174 return static_cast<unsigned short>(mHits.size());
178 StTrackDetectorInfo::numberOfReferencedPoints(StDetectorId
id)
const
180 unsigned short count = 0;
181 for (StPtrVecHitConstIterator iter=mHits.begin(); iter != mHits.end(); iter++)
182 if ((*iter)->detector() == id) count++;
187 StTrackDetectorInfo::hits(
StHitFilter& filter)
const
190 for (StPtrVecHitConstIterator iter=mHits.begin(); iter != mHits.end(); iter++)
191 if (filter(*iter)) vec.push_back(*iter);
196 StTrackDetectorInfo::hits(StDetectorId
id)
const
199 for (StPtrVecHitConstIterator iter=mHits.begin(); iter != mHits.end(); iter++)
200 if ((*iter)->detector() == id) vec.push_back(*iter);
205 StTrackDetectorInfo::hits() {
return mHits; }
208 StTrackDetectorInfo::hits()
const {
return mHits; }
223 StTrackDetectorInfo::setNumberOfPoints(
unsigned short val)
225 mNumberOfPoints = val;
229 StTrackDetectorInfo::setNumberOfPoints(
unsigned char val, StDetectorId det)
234 mNumberOfPointsFtpcWest = val;
237 mNumberOfPointsFtpcEast = val;
240 mNumberOfPointsTpc = val;
243 mNumberOfPointsSvt = val;
247 mNumberOfPointsSsd = val;
250 mNumberOfPointsIst = val;
252 mNumberOfPointsPxl = val;
254 mNumberOfPointsOth+= val;
261 StTrackDetectorInfo::addHit(
StHit*
hit,
bool increaseRefCounter)
264 mHits.push_back(hit);
265 if (increaseRefCounter) hit->setTrackReferenceCount(hit->trackReferenceCount()+1);
270 StTrackDetectorInfo::removeHit(
StHit*& hit)
273 for (StPtrVecHitIterator iter=mHits.begin(); iter != mHits.end(); iter++) {
274 if (*iter == hit) mHits.erase(iter);
275 int i = hit->trackReferenceCount();
276 hit->setTrackReferenceCount(i > 0 ? i-1 : 0);
279 int StTrackDetectorInfo::bad()
const
283 ierr = mFirstPoint.bad();
284 if(ierr)
return 1+100*ierr;
285 ierr = mLastPoint.bad();
286 if(ierr)
return 2+100*ierr;
287 if (fabs(mFirstPoint.z())>kStarMaxTrackRangeZ)
return 21;
288 if (fabs(mLastPoint.z ())>kStarMaxTrackRangeZ)
return 22;
289 if (mFirstPoint.perp () >kStarMaxTrackRangeR)
return 31;
290 if (mLastPoint.perp () >kStarMaxTrackRangeR)
return 32;