ATLAS Offline Software
Loading...
Searching...
No Matches
eflowEEtaBinBase.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5/********************************************************************
6
7NAME: eflowEEtaBinBase.cxx
8PACKAGE: offline/Reconstruction/eflowRec
9
10AUTHOR: R Duxfield
11CREATED: 17th May, 2006
12
13********************************************************************/
14
15#include <cmath>
17
18
20// eflowBaseEEtaBinSystem //
22
23const double eflowEEtaBinBase::m_errorReturnValue = -999.0;
24
26
27
28int eflowEEtaBinBase::getEBinIndex(double e) const {
29 int nEBins = getNumEBins();
30 for (int i = 0; i < (nEBins-1); i++) {
31 if (e > m_eBinBounds[i] && e < m_eBinBounds[i + 1]) return i;
32 }
33 //for the final bin we simply check if the track energy is greater than the lower bound
34 if ( !m_eBinBounds.empty() && e > m_eBinBounds.back() ) return nEBins-1;
35 return 0;
36}
37
39
40 int nEBins = getNumEBins();
41 int bin = 0;
42 for (int i = nEBins - 1; i > 0; i--) {
43 if (e > sqrt(m_eBinBounds[i - 1] * m_eBinBounds[i])) {
44 bin = i;
45 break;
46 }
47 }
48 return bin;
49
50}
51
53 if (m_useAbsEta) eta = fabs(eta);
54
55 /* If eta is outside bin range, return highest/lowest bin to avoid binning failures
56 * (in practice we always use absEta, so it can only be too high) */
57 if (eta > m_etaBinBounds.back()) {
58 return m_etaBinBounds.size()-2; // Yes, it's minus *two* --> we need to return the index of the *low* edge of the bin
59 }
60 if (eta < m_etaBinBounds[0]){
61 return 0;
62 }
63
65}
66
67int eflowEEtaBinBase::getBinIndex(double x, const std::vector<double>& binBounds) {
68 int nBins = binBounds.size() - 1;
69 int bin = -1;
70 for (int i = 0; i < nBins; i++) {
71 if (x >= binBounds[i] && x < binBounds[i+1]) {
72 bin = i;
73 break;
74 }
75 }
76 return bin;
77}
Scalar eta() const
pseudorapidity method
#define x
int getEBinIndexLegacy(double e) const
virtual ~eflowEEtaBinBase()
int getEtaBinIndex(double eta) const
static const double m_errorReturnValue
int getEBinIndex(double e) const
std::vector< double > m_etaBinBounds
int getNumEBins() const
static int getBinIndex(double x, const std::vector< double > &binBounds)
std::vector< double > m_eBinBounds