ATLAS Offline Software
TrigHisto.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 //---------------------------------------------------------------
8 
9 TrigHisto::TrigHisto(void): m_nbins_x(0),
10  m_underflowBin_x(0),
11  m_overflowBin_x(0),
12  m_min_x(0.),
13  m_max_x(0.),
14  m_binSize_x(0.) {
15 }
16 
17 //---------------------------------------------------------------
18 
20 }
21 
22 //---------------------------------------------------------------
23 
24 void TrigHisto::clear(void) {
25  m_itr = m_contents.begin();
26  m_itr_end = m_contents.end();
27  for(; m_itr != m_itr_end; ++m_itr) (*m_itr) = 0.;
28 }
29 
30 //---------------------------------------------------------------
31 
32 // Require histogram sizes such that it might be called by TrigHisto2D too.
33 unsigned int TrigHisto::findBin(unsigned int nbins,
34  float h_min,
35  float h_max,
36  float binSize,
37  float value) const {
38  unsigned int ibin = 0;
39 
40  if(value < h_min) { // Underflow
41  ibin = 0;
42  }
43  else if( !(value < h_max)) { // Overflow (catches NaN)
44  ibin = nbins+1;
45  }
46  else {
47  while(value > (ibin*binSize+h_min) && ibin <= nbins) { // None under/overflow from 1 to nbins
48  ibin++;
49  }
50  }
51 
52  return ibin;
53 }
54 
55 //---------------------------------------------------------------
athena.value
value
Definition: athena.py:122
TrigHisto::m_itr_end
std::vector< float >::iterator m_itr_end
Definition: TrigHisto.h:73
TrigHisto::TrigHisto
TrigHisto(void)
Definition: TrigHisto.cxx:9
TrigHisto::m_contents
std::vector< float > m_contents
Definition: TrigHisto.h:71
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
TrigHisto::m_itr
std::vector< float >::iterator m_itr
Definition: TrigHisto.h:72
TrigHisto.h
TrigHisto::clear
void clear(void)
Zero all histogram bins.
Definition: TrigHisto.cxx:24
TrigHisto::~TrigHisto
virtual ~TrigHisto(void)
Definition: TrigHisto.cxx:19
TrigHisto::findBin
unsigned int findBin(unsigned int nbins, float h_min, float h_max, float binSize, float value) const
Definition: TrigHisto.cxx:33