3 #include "StFstRawHit.h"
4 #include "St_base/StMessMgr.h"
6 #include "StEvent/StFstConsts.h"
10 if ( rawHit1 && rawHit2 )
17 StFstRawHit::StFstRawHit() :
StObject(), mChannelId(-1), mGeoId(-1), mCharge(), mChargeErr(), mMaxTimeBin(1),
20 std::fill_n(mCharge, kFstNumTimeBins, -999);
24 template<
typename Container>
25 StFstRawHit::StFstRawHit(
int channelId,
int geoId,
26 const Container &charges,
const Container &chargeErrs,
27 UChar_t maxTimeBin, UShort_t idTruth) :
29 mChannelId(channelId), mGeoId(geoId), mCharge(), mChargeErr(),
30 mMaxTimeBin(maxTimeBin), mIdTruth(idTruth)
32 std::copy(std::begin(charges), std::end(charges), mCharge);
33 std::copy(std::begin(chargeErrs), std::end(chargeErrs), mChargeErr);
38 mChannelId = rawHit.mChannelId;
39 mGeoId = rawHit.mGeoId;
40 mSeedhitflag = rawHit.mSeedhitflag;
41 for(
int itb=0; itb<kFstNumTimeBins; itb++){
42 mCharge[itb] = rawHit.mCharge[itb];
43 mChargeErr[itb] = rawHit.mChargeErr[itb];
45 mMaxTimeBin = rawHit.mMaxTimeBin;
46 mIdTruth = rawHit.mIdTruth;
47 mDefaultTimeBin = rawHit.mDefaultTimeBin;
53 unsigned char StFstRawHit::getMaxTimeBin()
const {
return mMaxTimeBin; };
54 unsigned char StFstRawHit::getDefaultTimeBin() {
return mDefaultTimeBin; };
59 return 1 + mGeoId / ((kFstNumInnerSensorsPerWedge * kFstNumStripsPerInnerSensor + kFstNumOuterSensorsPerWedge * kFstNumStripsPerOuterSensor) * kFstNumWedgePerDisk);
64 return 1 + mGeoId / (kFstNumInnerSensorsPerWedge * kFstNumStripsPerInnerSensor + kFstNumOuterSensorsPerWedge * kFstNumStripsPerOuterSensor);
69 int strip = mGeoId % (kFstNumInnerSensorsPerWedge * kFstNumStripsPerInnerSensor + kFstNumOuterSensorsPerWedge * kFstNumStripsPerOuterSensor);
70 return strip % kFstNumPhiSegPerWedge;
75 int strip = mGeoId % (kFstNumInnerSensorsPerWedge * kFstNumStripsPerInnerSensor + kFstNumOuterSensorsPerWedge * kFstNumStripsPerOuterSensor);
76 return strip / kFstNumPhiSegPerWedge;
81 return 1 + mChannelId / (kFstNumArmsPerRdo * kFstNumChanPerArm);
86 return (mChannelId % (kFstNumArmsPerRdo * kFstNumChanPerArm)) / kFstNumChanPerArm;
91 return ((mChannelId % (kFstNumArmsPerRdo * kFstNumChanPerArm)) % kFstNumChanPerArm) / kFstNumApvChannels;
96 int strip = mChannelId % (kFstNumInnerSensorsPerWedge * kFstNumStripsPerInnerSensor + kFstNumOuterSensorsPerWedge * kFstNumStripsPerOuterSensor);
97 if(strip < kFstNumStripsPerInnerSensor)
return strip/kFstNumStripsPerInnerSensor;
98 else return strip / kFstNumStripsPerOuterSensor - 1;
103 return ((mChannelId % (kFstNumArmsPerRdo * kFstNumChanPerArm)) % kFstNumChanPerArm) % kFstNumApvChannels;
106 float StFstRawHit::getCharge(
int tb )
const
108 return mCharge[ (tb < 0 || tb >= kFstNumTimeBins) ? mDefaultTimeBin : tb ];
111 float StFstRawHit::getChargeErr(
int tb )
const
113 return mChargeErr[ (tb < 0 || tb >= kFstNumTimeBins) ? mDefaultTimeBin : tb ];
117 void StFstRawHit::setChannelId(
int rChannelId)
119 mChannelId = rChannelId;
122 void StFstRawHit::setGeoId(
int rGeoId)
127 void StFstRawHit::setSeedhitflag(
int rSeedhitflag)
129 mSeedhitflag = rSeedhitflag;
132 void StFstRawHit::setDefaultTimeBin(
int tb )
134 mDefaultTimeBin = tb;
137 void StFstRawHit::setIdTruth(
unsigned short idTruth)
142 void StFstRawHit::setCharge(
float charge,
int tb )
144 mCharge[ (tb < 0 || tb >= kFstNumTimeBins) ? mDefaultTimeBin : tb ] = charge;
148 void StFstRawHit::setChargeErr(
float rChargeErr,
int tb)
150 mChargeErr[ (tb < 0 || tb >= kFstNumTimeBins) ? mDefaultTimeBin : tb ] = rChargeErr;
153 void StFstRawHit::setMaxTimeBin(
int tb)
155 mMaxTimeBin = ((tb < 0 || tb >= kFstNumTimeBins) ? mDefaultTimeBin : tb);
159 void StFstRawHit::Print(
int nTimeBins)
const
161 LOG_DEBUG <<
" elecId=" <<
getChannelId() <<
" Charge=(" ;
162 for(
int i=0; i<nTimeBins; i++)
163 LOG_DEBUG << getCharge(i) <<
" " ;
164 LOG_DEBUG <<
") ChargeErr=(" ;
166 for(
int i=0; i<nTimeBins; i++)
167 LOG_DEBUG << getChargeErr(i) <<
" " ;
168 LOG_DEBUG <<
") decode0: at disk=" << (short)
getDisk() <<
" wedge=" << (short)
getWedge() <<
" sensor=" << (short)
getSensor()
172 unsigned char StFstRawHit::mDefaultTimeBin = 2;
unsigned char getChannel() const
0-127
unsigned char getArm() const
0-2
unsigned char getSensor() const
0-2
unsigned char getRStrip() const
0-7
unsigned char getDisk() const
1-3
unsigned char getPhiStrip() const
0-127
int getGeoId() const
0-36863
unsigned char getApv() const
0-15
unsigned short getIdTruth() const
for embedding, 0 as background
int getChannelId() const
0-36863
unsigned char getRdo() const
1-6
int getSeedhitflag() const
0 or 1
unsigned char getWedge() const
1-36