102 #include "StTrackFitTraits.h"
103 #include "StParticleTypes.hh"
104 #include "StParticleTable.hh"
107 #if !defined(ST_NO_NAMESPACES)
114 static const
char rcsid[] = "$Id:
StTrackFitTraits.cxx,v 2.29 2015/05/13 17:06:14 ullrich Exp $";
119 mNumberOfFitPoints = 0x8000;
120 mNumberOfFitPointsTpc = 0;
121 mNumberOfFitPointsFtpcWest = 0;
122 mNumberOfFitPointsFtpcEast = 0;
123 mNumberOfFitPointsSvt = 0;
124 mNumberOfFitPointsSsd = 0;
125 mNumberOfFitPointsSst = 0;
126 mNumberOfFitPointsPxl = 0;
127 mNumberOfFitPointsIst = 0;
128 mPrimaryVertexUsedInFit =
false;
133 StTrackFitTraits::StTrackFitTraits(
unsigned short pid,
unsigned short nfp,
134 float chi[2],
float cov[15])
136 mPidHypothesis = pid;
137 mNumberOfFitPoints = 0x8000;
138 copy(chi, chi+2, mChi2);
139 mCovariantMatrix.Set(15, cov);
140 mNumberOfFitPointsTpc = 0;
141 mNumberOfFitPointsFtpcWest = 0;
142 mNumberOfFitPointsFtpcEast = 0;
143 mNumberOfFitPointsSvt = 0;
144 mNumberOfFitPointsSsd = 0;
145 mNumberOfFitPointsSst = 0;
146 mNumberOfFitPointsPxl = 0;
147 mNumberOfFitPointsIst = 0;
148 mPrimaryVertexUsedInFit =
false;
151 StTrackFitTraits::~StTrackFitTraits() {}
153 unsigned short StTrackFitTraits::numberOfFitPoints()
const
158 result = numberOfFitPoints(kTpcId) +
159 numberOfFitPoints(kFtpcWestId) +
160 numberOfFitPoints(kFtpcEastId) +
161 numberOfFitPoints(kSvtId) +
162 numberOfFitPoints(kSsdId) +
163 numberOfFitPoints(kSstId) +
164 numberOfFitPoints(kPxlId) +
165 numberOfFitPoints(kIstId);
166 if (mNumberOfFitPoints&0x8000) result += (mNumberOfFitPoints&0x7FFF);
167 if (mPrimaryVertexUsedInFit) result++;
168 return (
unsigned short)result;
171 unsigned short StTrackFitTraits::numberOfFitPoints(StDetectorId det)
const
176 if (mNumberOfFitPoints && (mNumberOfFitPoints<0x8000)) {
182 return mNumberOfFitPoints%1000;
185 return (mNumberOfFitPoints%10000)/1000;
188 return mNumberOfFitPoints/10000;
201 return mNumberOfFitPointsFtpcWest;
204 return mNumberOfFitPointsFtpcEast;
207 return mNumberOfFitPointsTpc;
210 return mNumberOfFitPointsSvt;
213 return mNumberOfFitPointsSsd;
216 return mNumberOfFitPointsSst;
219 return mNumberOfFitPointsPxl;
222 return mNumberOfFitPointsIst;
225 return (mNumberOfFitPoints&0x7FFF)
226 + mNumberOfFitPointsFtpcWest
227 + mNumberOfFitPointsFtpcEast
228 + mNumberOfFitPointsTpc
229 + mNumberOfFitPointsSvt
230 + mNumberOfFitPointsSsd
231 + mNumberOfFitPointsSst
232 + mNumberOfFitPointsPxl
233 + mNumberOfFitPointsIst;
240 return StParticleTable::instance()->findParticleByGeantId(mPidHypothesis);
243 double StTrackFitTraits::chi2(
unsigned int i)
const
251 StMatrixF StTrackFitTraits::covariantMatrix()
const
254 if (mCovariantMatrix.GetSize() == 15) {
255 #define mCovariantMatrix ((TArrayF&)mCovariantMatrix) //temporary HACK VP
256 m(1,1) = mCovariantMatrix[0];
257 m(1,2) = m(2,1) = mCovariantMatrix[1];
258 m(1,3) = m(3,1) = mCovariantMatrix[2];
259 m(1,4) = m(4,1) = mCovariantMatrix[3];
260 m(1,5) = m(5,1) = mCovariantMatrix[4];
261 m(2,2) = mCovariantMatrix[5];
262 m(2,3) = m(3,2) = mCovariantMatrix[6];
263 m(2,4) = m(4,2) = mCovariantMatrix[7];
264 m(2,5) = m(5,2) = mCovariantMatrix[8];
265 m(3,3) = mCovariantMatrix[9];
266 m(3,4) = m(4,3) = mCovariantMatrix[10];
267 m(3,5) = m(5,3) = mCovariantMatrix[11];
268 m(4,4) = mCovariantMatrix[12];
269 m(4,5) = m(5,4) = mCovariantMatrix[13];
270 m(5,5) = mCovariantMatrix[14];
271 #undef mCovariantMatrix //temporary HACK VP
276 bool StTrackFitTraits::primaryVertexUsedInFit()
const
277 {
return mPrimaryVertexUsedInFit;}
279 void StTrackFitTraits::clearCovariantMatrix() {mCovariantMatrix.Set(0);}
281 void StTrackFitTraits::setNumberOfFitPoints(
unsigned char val, StDetectorId det)
283 mNumberOfFitPoints|= 0x8000;
288 mNumberOfFitPointsFtpcWest = val;
291 mNumberOfFitPointsFtpcEast = val;
294 mNumberOfFitPointsTpc = val;
297 mNumberOfFitPointsSvt = val;
300 mNumberOfFitPointsSsd = val;
303 mNumberOfFitPointsSst = val;
306 mNumberOfFitPointsPxl = val;
309 mNumberOfFitPointsIst = val;
312 mNumberOfFitPoints += val; mNumberOfFitPoints|=0x8000;
317 void StTrackFitTraits::setPrimaryVertexUsedInFit(
bool val)
318 {mPrimaryVertexUsedInFit = val;}
320 void StTrackFitTraits::setPidHypothesis(
unsigned short val)
322 mPidHypothesis = val;
325 void StTrackFitTraits::setChi2(
float val,
unsigned int i)
327 if (i<2) mChi2[i] = val;
330 void StTrackFitTraits::setCovariantMatrix(
float val[15])
332 mCovariantMatrix.Set(15, val);
335 void StTrackFitTraits::Streamer(TBuffer &R__b)
339 if (R__b.IsReading()) {
341 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
343 Class()->ReadBuffer(R__b,
this, R__v, R__s, R__c);
346 StObject::Streamer(R__b);
348 R__b >> (
unsigned short&)mPidHypothesis;
349 R__b >> (
unsigned short&)mNumberOfFitPoints;
351 if (R__v==2 && gFile && gFile->GetVersion()%100000<30000)
352 { Int_t dumy; R__b >> dumy;}
354 R__b.ReadFastArray(mChi2,2);
355 mCovariantMatrix.Streamer(R__b);
358 Class()->WriteBuffer(R__b,
this);