5 #include "StIstRawHit.h"
6 #include "St_base/StMessMgr.h"
8 using namespace StIstConsts;
13 if ( rawHit1 && rawHit2 )
20 StIstRawHit::StIstRawHit() :
StObject(), mChannelId(-1), mGeoId(-1), mCharge(), mChargeErr(), mMaxTimeBin(3),
23 std::fill_n(mCharge, kIstNumTimeBins, -999);
27 template<
typename Container>
28 StIstRawHit::StIstRawHit(
int channelId,
int geoId,
29 const Container &charges,
const Container &chargeErrs,
30 UChar_t maxTimeBin, UShort_t idTruth) :
32 mChannelId(channelId), mGeoId(geoId), mCharge(), mChargeErr(),
33 mMaxTimeBin(maxTimeBin), mIdTruth(idTruth)
35 std::copy(std::begin(charges), std::end(charges), mCharge);
36 std::copy(std::begin(chargeErrs), std::end(chargeErrs),
mChargeErr);
42 unsigned char StIstRawHit::getMaxTimeBin()
const {
return mMaxTimeBin; };
43 unsigned char StIstRawHit::getDefaultTimeBin() {
return mDefaultTimeBin;};
70 return 1 + mChannelId / (kIstNumArmsPerRdo * kIstNumChanPerArm);
75 return (mChannelId % (kIstNumArmsPerRdo * kIstNumChanPerArm)) / kIstNumChanPerArm;
80 return ((mChannelId % (kIstNumArmsPerRdo * kIstNumChanPerArm)) % kIstNumChanPerArm) / kIstNumApvChannels;
85 return ((mChannelId % (kIstNumArmsPerRdo * kIstNumChanPerArm)) % kIstNumChanPerArm) % kIstNumApvChannels;
88 float StIstRawHit::getCharge(
int tb )
const
90 return mCharge[ (tb < 0 || tb >= kIstNumTimeBins) ? mDefaultTimeBin : tb ];
93 float StIstRawHit::getChargeErr(
int tb )
const
95 return mChargeErr[ (tb < 0 || tb >= kIstNumTimeBins) ? mDefaultTimeBin : tb ];
99 void StIstRawHit::setChannelId(
int rChannelId)
101 mChannelId = rChannelId;
104 void StIstRawHit::setGeoId(
int rGeoId)
109 void StIstRawHit::setDefaultTimeBin(
int tb )
111 mDefaultTimeBin = tb;
114 void StIstRawHit::setIdTruth(
unsigned short idTruth)
119 void StIstRawHit::setCharge(
float charge,
int tb )
121 mCharge[ (tb < 0 || tb >= kIstNumTimeBins) ? mDefaultTimeBin : tb ] = charge;
125 void StIstRawHit::setChargeErr(
float rChargeErr,
int tb)
127 mChargeErr[ (tb < 0 || tb >= kIstNumTimeBins) ? mDefaultTimeBin : tb ] = rChargeErr;
130 void StIstRawHit::setMaxTimeBin(
int tb)
132 mMaxTimeBin = ((tb < 0 || tb >= kIstNumTimeBins) ? mDefaultTimeBin : tb);
136 void StIstRawHit::Print(
int nTimeBins)
const
138 LOG_DEBUG <<
" elecId=" <<
getChannelId() <<
" Charge=(" ;
139 for(
int i=0; i<nTimeBins; i++)
140 LOG_DEBUG << getCharge(i) <<
" " ;
141 LOG_DEBUG <<
") ChargeErr=(" ;
143 for(
int i=0; i<nTimeBins; i++)
144 LOG_DEBUG << getChargeErr(i) <<
" " ;
145 LOG_DEBUG <<
") decode0: at ladder=" << (short)
getLadder() <<
" sensor=" << (short)
getSensor()
146 <<
" column=" << (short)
getColumn() <<
" row=" << (short)
getRow() << endm;
149 unsigned char StIstRawHit::mDefaultTimeBin = 2;
const int kIstNumPadsPerSensor
768 pads in each sensor
unsigned char getLadder() const
1-24
unsigned char getArm() const
0-5
unsigned char getColumn() const
1-12
unsigned char getRow() const
1-64
int getGeoId() const
1-110592
unsigned char getApv() const
0-23
int getChannelId() const
0-110591
Float_t mChargeErr
charge uncertainty
unsigned short getIdTruth() const
for embedding, 0 as background
unsigned char getRdo() const
1-6
const int kIstNumSensorsPerLadder
6 sensor per one IST Ladder
unsigned char getChannel() const
0-127
unsigned char getSensor() const
1-6
const int kIstNumRowsPerSensor
64 rows in r-phi direction per each sensor