ATLAS Offline Software
Loading...
Searching...
No Matches
TrigHisto.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7
8
9
10//---------------------------------------------------------------
11
12void TrigHisto::clear(void) {
13 for (auto& v : m_contents) {
14 v = 0.f;
15 }
16}
17
18//---------------------------------------------------------------
19
20// Require histogram sizes such that it might be called by TrigHisto2D too.
21unsigned int TrigHisto::findBin(unsigned int nbins,
22 float h_min,
23 float h_max,
24 float binSize,
25 float value) const {
26 unsigned int ibin = 0;
27
28 if(value < h_min) { // Underflow
29 ibin = 0;
30 }
31 else if( !(value < h_max)) { // Overflow (catches NaN)
32 ibin = nbins+1;
33 }
34 else {
35 while(value > (ibin*binSize+h_min) && ibin <= nbins) { // None under/overflow from 1 to nbins
36 ibin++;
37 }
38 }
39
40 return ibin;
41}
42
unsigned int findBin(unsigned int nbins, float h_min, float h_max, float binSize, float value) const
Definition TrigHisto.cxx:21
void clear(void)
Zero all histogram bins.
Definition TrigHisto.cxx:12
std::vector< float > m_contents
Definition TrigHisto.h:74