106 #include "StTrackNode.h"
107 #include "StTrackDetectorInfo.h"
109 static const char rcsid[] =
"$Id: StHit.cxx,v 2.28 2016/02/25 17:07:14 ullrich Exp $";
116 mHardwarePosition = 0;
119 mFlag = mFitFlag = 0;
120 mIdTruth = mQuality = 0;
128 unsigned int hp,
float q,
unsigned char c,
int idTruth,
unsigned short quality,
unsigned short id)
129 :
StMeasuredPoint(p),mHardwarePosition(hp),mPositionError(e),mCharge(q),
130 mId(id),mIdTruth(idTruth),mQuality(quality),mFitFlag(0),mTrackRefCount(c),mFlag(0),mNextHit(0)
138 int StHit::operator==(
const StHit& h)
const
140 return h.mPosition == mPosition &&
141 h.mPositionError == h.mPositionError &&
142 h.mCharge == mCharge &&
143 h.mHardwarePosition == mHardwarePosition &&
145 h.mIdTruth == mIdTruth &&
146 h.mQuality == mQuality &&
148 h.mNextHit == mNextHit;
152 int StHit::operator!=(
const StHit& h)
const
154 return !(*
this == h);
158 void StHit::setCharge(
float val) { mCharge = val; }
161 void StHit::setTrackReferenceCount(
unsigned char val) { mTrackRefCount = val; }
164 void StHit::setFitFlag(
unsigned char val) { mFitFlag = val; }
167 void StHit::setHardwarePosition(
unsigned int val) { mHardwarePosition = val; }
170 void StHit::setPositionError(
const StThreeVectorF& e) { mPositionError = e; }
173 float StHit::charge()
const {
return mCharge; }
176 unsigned int StHit::flag()
const {
return static_cast<unsigned int>(mFlag); }
179 int StHit::usedInFit()
const {
return static_cast<int>(mFitFlag); }
182 unsigned int StHit::trackReferenceCount()
const {
return static_cast<unsigned int>(mTrackRefCount); }
185 StThreeVectorF StHit::positionError()
const {
return mPositionError; }
192 m(1,1) = mPositionError.x()*mPositionError.x();
193 m(2,2) = mPositionError.y()*mPositionError.y();
194 m(3,3) = mPositionError.z()*mPositionError.z();
200 void StHit::setIdTruth(
int idtru,
int qatru)
202 if (qatru==0) qatru = (idtru>>16);
203 idtru = idtru&((1<<16)-1);
205 mQuality = (UShort_t) qatru;
209 int StHit::idTruth()
const
215 ostream& operator<<(ostream& os,
const StHit& v)
218 if (v.charge() > 1) os << Form(
" q(ADC) %6.1f", v.charge());
219 else os << Form(
" q(keV) %6.2f", 1e6*v.charge());
220 os << Form(
" idT %5i qa %3i fl%3i us %1i",v.idTruth(), v.qaTruth(), v.flag(), v.usedInFit());
225 void StHit::Print(Option_t *option)
const {cout << *
this << endl;}