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 
22 }
23 
24 uint16_t* HcalHistogramDigi::getArray(int capid) {
25  int offset = (capid % 4) * BINS_PER_HISTOGRAM;
26  return &(bins_[offset]);
27 }
28 
29 std::ostream& operator<<(std::ostream& s, const HcalHistogramDigi& digi) {
30  s << digi.id() << std::endl;
31  for (int i = 0; i < HcalHistogramDigi::BINS_PER_HISTOGRAM; i++) {
32  s << ' ' << std::setw(2) << i;
33  for (int capid = 0; capid < 4; capid++)
34  s << std::setw(6) << digi.get(capid, i) << " ";
35  s << std::endl;
36  }
37  return s;
38 }
std::ostream & operator<<(std::ostream &s, const HcalHistogramDigi &digi)
uint16_t get(int capid, int bin) const
get the contents of the specified bin for the specified capid (0-3)
const HcalDetId & id() const
static const int BINS_PER_HISTOGRAM
uint16_t bins_[BINS_PER_HISTOGRAM *4]
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