CMS 3D CMS Logo

HcalHistogramDigi.cc
Go to the documentation of this file.
2 #include <iomanip>
3 
5  for (int i=0; i<BINS_PER_HISTOGRAM*4; i++)
6  bins_[i]=0;
7 }
8 
10  for (int i=0; i<BINS_PER_HISTOGRAM*4; i++)
11  bins_[i]=0;
12 }
13 
14 uint16_t HcalHistogramDigi::get(int capid, int bin) const {
15  return bins_[(capid%4)*BINS_PER_HISTOGRAM+(bin%BINS_PER_HISTOGRAM)];
16 }
17 
19  return (int)(bins_[(bin%BINS_PER_HISTOGRAM)])+
21  (int)(bins_[BINS_PER_HISTOGRAM*2+(bin%BINS_PER_HISTOGRAM)])+
22  (int)(bins_[BINS_PER_HISTOGRAM*3+(bin%BINS_PER_HISTOGRAM)]);
23 }
24 
25 uint16_t* HcalHistogramDigi::getArray(int capid) {
26  int offset=(capid%4)*BINS_PER_HISTOGRAM;
27  return &(bins_[offset]);
28 }
29 
30 std::ostream& operator<<(std::ostream& s, const HcalHistogramDigi& digi) {
31  s << digi.id() << std::endl;
32  for (int i=0; i<HcalHistogramDigi::BINS_PER_HISTOGRAM; i++) {
33  s << ' ' << std::setw(2) << i;
34  for (int capid=0; capid<4; capid++)
35  s << std::setw(6) << digi.get(capid,i) << " ";
36  s << std::endl;
37  }
38  return s;
39 }
std::ostream & operator<<(std::ostream &s, const HcalHistogramDigi &digi)
static const int BINS_PER_HISTOGRAM
uint16_t bins_[BINS_PER_HISTOGRAM *4]
const HcalDetId & id() const
bin
set the eta bin as selection string.
uint16_t get(int capid, int bin) const
get the contents of the specified bin for the specified capid (0-3)
uint16_t * getArray(int capid)
get the array for the specified capid
int getSum(int bin) const
get the contents of the specified bin summed over capids