33 #include "StBTofHeader.h"
34 #include "PhysicalConstants.h"
40 for(
int i=0; i<MAXFIBER; i++) {
42 mFiberTriggerWord[i] = 0;
45 for(
int i=0; i<2; i++) mVpdHitPattern[i] = 0;
46 for(
int i=0; i<MAXVPDVZ; i++) mVpdVz[i] = -999.;
50 for(
int i=0; i<2; i++)
51 for(
int j=0; j<MAXVPD; j++)
61 mEarliestVpdEHit = 99999.;
62 mEarliestVpdWHit = 99999.;
63 mClosestVpdEHit = 99999.;
64 mClosestVpdWHit = 99999.;
65 mLatestVpdEHit = -99999.;
66 mLatestVpdWHit = -99999.;
69 StBTofHeader::~StBTofHeader() {}
72 StBTofHeader::fiberHeader(
int fiberId)
const {
return mFiberHeader[fiberId]; }
75 StBTofHeader::fiberTriggerWord(
int fiberId)
const {
return mFiberTriggerWord[fiberId]; }
78 StBTofHeader::vpdHitPattern(StBeamDirection eastwest)
const
80 return mVpdHitPattern[eastwest];
84 StBTofHeader::numberOfVpdHits(StBeamDirection eastwest)
const
86 unsigned short nHit = 0;
87 for(
int i=0; i<MAXVPD; i++) {
89 if (isVpdHit(eastwest, tubeId)) nHit++;
95 StBTofHeader::isVpdHit(StBeamDirection eastwest,
int tubeId)
const
97 return ( (mVpdHitPattern[eastwest])>>(tubeId-1) ) & 0x1;
101 StBTofHeader::vpdVz(
int rank)
const
107 StBTofHeader::tStart()
const {
return mTStart; }
110 StBTofHeader::tStartError()
const {
return mTStartErr; }
113 StBTofHeader::tDiff()
const {
return mTDiff; }
116 StBTofHeader::vpdTime(StBeamDirection eastwest,
int tubeId)
const
118 return mVpdTime[eastwest][tubeId-1];
122 StBTofHeader::triggerTime(
int fiberId)
const {
return mTriggerTime[fiberId]; }
125 StBTofHeader::nTzero()
const {
return mNTzero; }
128 StBTofHeader::nTzeroCan()
const {
return mNTzeroCan; }
131 StBTofHeader::tCanFirst()
const {
return mTCanFirst; }
134 StBTofHeader::tCanLast()
const {
return mTCanLast; }
137 StBTofHeader::vpdEHits()
const {
return mVpdEHits; }
140 StBTofHeader::vpdWHits()
const {
return mVpdWHits; }
143 StBTofHeader::vpdEGoodHits()
const {
return mVpdEGoodHits; }
146 StBTofHeader::vpdWGoodHits()
const {
return mVpdWGoodHits; }
149 StBTofHeader::earliestVpdEHit()
const {
return mEarliestVpdEHit; }
152 StBTofHeader::earliestVpdWHit()
const {
return mEarliestVpdWHit; }
155 StBTofHeader::closestVpdEHit()
const {
return mClosestVpdEHit; }
158 StBTofHeader::closestVpdWHit()
const {
return mClosestVpdWHit; }
161 StBTofHeader::latestVpdEHit()
const {
return mLatestVpdEHit; }
164 StBTofHeader::latestVpdWHit()
const {
return mLatestVpdWHit; }
167 StBTofHeader::setFiberHeader(
int fiberId,
short val)
169 mFiberHeader[fiberId] = val;
173 StBTofHeader::setFiberTriggerWord(
int fiberId,
unsigned int val)
175 mFiberTriggerWord[fiberId] = val;
179 StBTofHeader::setVpdHit(StBeamDirection eastwest,
int tubeId)
181 mVpdHitPattern[eastwest] |= 0x1 << (tubeId-1);
185 StBTofHeader::removeVpdHit(StBeamDirection eastwest,
int tubeId)
187 mVpdHitPattern[eastwest] &= ( 0x7ffff - (0x1 << (tubeId-1)) );
191 StBTofHeader::setVpdHitPattern(StBeamDirection eastwest,
unsigned int val)
193 mVpdHitPattern[eastwest] = val;
197 StBTofHeader::setVpdVz(
float vz,
int rank)
203 StBTofHeader::setTStart(
double t) { mTStart = t; }
206 StBTofHeader::setTStartError(
double t_err) { mTStartErr = t_err; }
209 StBTofHeader::setTDiff(
double tdiff) { mTDiff = tdiff; }
212 StBTofHeader::setVpdTime(StBeamDirection eastwest,
int tubeId,
double t)
214 mVpdTime[eastwest][tubeId-1] = t;
218 StBTofHeader::setTriggerTime(
unsigned int tdc,
int fiberId) { mTriggerTime[fiberId] = tdc; }
221 StBTofHeader::setNTzero(
short n) { mNTzero = n; }
224 StBTofHeader::setNTzeroCan(
short nCan) { mNTzeroCan = nCan; }
227 StBTofHeader::setTCanFirst(
double tFirst) { mTCanFirst = tFirst; }
230 StBTofHeader::setTCanLast(
double tLast) { mTCanLast = tLast; }
233 StBTofHeader::setVpdEHits(
short vpdEHits) { mVpdEHits = vpdEHits; }
236 StBTofHeader::setVpdWHits(
short vpdWHits) { mVpdWHits = vpdWHits; }
239 StBTofHeader::setVpdEGoodHits(
short vpdEGoodHits) { mVpdEGoodHits = vpdEGoodHits; }
242 StBTofHeader::setVpdWGoodHits(
short vpdWGoodHits) { mVpdWGoodHits = vpdWGoodHits; }
245 StBTofHeader::setEarliestVpdEHit(
double earliestVpdEHit) { mEarliestVpdEHit = earliestVpdEHit; }
248 StBTofHeader::setEarliestVpdWHit(
double earliestVpdWHit) { mEarliestVpdWHit = earliestVpdWHit; }
251 StBTofHeader::setClosestVpdEHit(
double closestVpdEHit) { mClosestVpdEHit = closestVpdEHit; }
254 StBTofHeader::setClosestVpdWHit(
double closestVpdWHit) { mClosestVpdWHit = closestVpdWHit; }
257 StBTofHeader::setLatestVpdEHit(
double latestVpdEHit) { mLatestVpdEHit = latestVpdEHit; }
260 StBTofHeader::setLatestVpdWHit(
double latestVpdWHit) { mLatestVpdWHit = latestVpdWHit; }