48 #include "StEmcRawHit.h"
49 #include "StEmcUtil/geometry/StEmcGeom.h"
51 static const char rcsid[] =
"$Id: StEmcRawHit.cxx,v 2.11 2013/01/15 23:21:05 fisyak Exp $";
64 StEmcRawHit::StEmcRawHit(StDetectorId d,
unsigned int m,
unsigned int e,
unsigned int s,
unsigned int a)
71 StEmcRawHit::StEmcRawHit(StDetectorId d,
unsigned int m,
unsigned int e,
unsigned int s,
unsigned int a,
float ene)
84 StEmcRawHit::~StEmcRawHit() {}
87 StEmcRawHit::bits(
unsigned int bit,
unsigned int nbits)
const
89 return (mId>>bit) & ~(~0UL<<nbits);
93 StEmcRawHit::setCalibrationType(
unsigned int t){
101 StEmcRawHit::setId(StDetectorId d,
unsigned int m,
unsigned int e,
unsigned int s)
103 mId =
static_cast<unsigned int>(d - kBarrelEmcTowerId) << 20;
110 StEmcRawHit::calibrationType()
const {
return bits(24, 8);}
113 StEmcRawHit::detector()
const
115 return static_cast<StDetectorId
>(bits(20, 4)+kBarrelEmcTowerId);
119 StEmcRawHit::module()
const {
return bits(13, 7);}
122 StEmcRawHit::eta()
const {
return bits( 4, 9);}
125 StEmcRawHit::softId(
int det)
const
127 mGeom = StEmcGeom::instance(det);
128 if(mGeom==0)
return 0;
130 int id=0, m=0, e=0, s=0;
132 mGeom->getId(m, e, s,
id);
136 void StEmcRawHit::modEtaSub(
int &m,
int &e,
int &s)
const
144 StEmcRawHit::sub()
const {
147 case kBarrelSmdEtaStripId:
148 case kEndcapSmdUStripId:
149 case kEndcapSmdVStripId:
159 StEmcRawHit::adc()
const {
return mAdc;}
162 StEmcRawHit::energy()
const {
return mEnergy;}
165 StEmcRawHit::setAdc(
const unsigned int adc) {mAdc=adc;}
168 StEmcRawHit::setEnergy(
const float energy) {mEnergy=energy;}
170 ostream& operator<<(ostream& os,
const StEmcRawHit& v) {
171 os << Form(
"EmcRawHit d/m %3i/%3i eta/sub %3i/%3i adc/enery %4i/%f",v.detector(),v.module(), v.eta(), v.sub(), v.adc(), v.energy());
172 if (v.detector() == kBarrelEmcTowerId || v.detector() == kEndcapEmcTowerId) {
173 if (v.energy() <= 0.0) os <<
" Junk";
174 else if (v.energy() <= 0.1) os <<
" Noise";
175 else if (v.energy() <= 0.5) os <<
" MIP";
176 else if (v.energy() <= 1.0) os <<
" Hadron?";
177 else if (v.energy() <= 4.0) os <<
" electron";
178 else if (v.energy() <= 10.0) os <<
" Tower";
179 else if (v.energy() <= 20.0) os <<
" W";
180 else if (v.energy() <=100.0) os <<
" Z";
185 void StEmcRawHit::Print(Option_t *option)
const {cout << *
this << endl;}