ATLAS Offline Software
Loading...
Searching...
No Matches
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
12 m_min_x(0.),
13 m_max_x(0.),
14 m_binSize_x(0.) {
15}
16
17//---------------------------------------------------------------
18
21
22//---------------------------------------------------------------
23
24void 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.
33unsigned 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//---------------------------------------------------------------
TrigHisto(void)
Definition TrigHisto.cxx:9
unsigned int m_nbins_x
Definition TrigHisto.h:76
unsigned int m_underflowBin_x
Definition TrigHisto.h:77
unsigned int m_overflowBin_x
Definition TrigHisto.h:78
float m_binSize_x
Definition TrigHisto.h:81
unsigned int findBin(unsigned int nbins, float h_min, float h_max, float binSize, float value) const
Definition TrigHisto.cxx:33
float m_min_x
Definition TrigHisto.h:79
void clear(void)
Zero all histogram bins.
Definition TrigHisto.cxx:24
std::vector< float >::iterator m_itr
Definition TrigHisto.h:72
std::vector< float >::iterator m_itr_end
Definition TrigHisto.h:73
virtual ~TrigHisto(void)
Definition TrigHisto.cxx:19
float m_max_x
Definition TrigHisto.h:80
std::vector< float > m_contents
Definition TrigHisto.h:71