ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Attributes | List of all members
eflowEEtaBinnedParameters Class Reference

Inherits from eflowEEtaBinBase. More...

#include <eflowEEtaBinnedParameters.h>

Inheritance diagram for eflowEEtaBinnedParameters:
Collaboration diagram for eflowEEtaBinnedParameters:

Public Member Functions

 eflowEEtaBinnedParameters ()=default
 
void initialise (const std::vector< double > &eBinBounds, const std::vector< double > &etaBinBounds, bool useAbsEta=true)
 
void setFudgeMean (int energyBin, int etaBin, eflowFirstIntENUM j1st, double fudgeMean)
 
void setFudgeStdDev (int energyBin, int etaBin, eflowFirstIntENUM j1st, double fudgeStdDev)
 
void setShapeParam (int energyBin, int etaBin, eflowFirstIntENUM j1st, eflowCaloENUM layer, int paramNumber, double shapeParam)
 
double getInterpolation (const eflowParameters **bin1, const eflowParameters **bin2, double e, double eta, bool useLegacyEnergyBinIndexing) const
 
eflowFirstIntENUM adjustLFI (double e, double eta, eflowFirstIntENUM j1st, bool useLegacyEnergyBinIndexing) const
 
bool binExists (double e, double eta) const
 

Static Public Member Functions

static double getErrorReturnValue ()
 

Protected Member Functions

int getNumEBins () const
 
int getNumEtaBins () const
 
int getEBinIndexLegacy (double e) const
 
int getEBinIndex (double e) const
 
int getEtaBinIndex (double eta) const
 

Static Protected Member Functions

static int getBinIndex (double x, const std::vector< double > &binBounds)
 

Protected Attributes

bool m_useAbsEta {true}
 
std::vector< double > m_eBinBounds
 
std::vector< double > m_etaBinBounds
 

Static Protected Attributes

static const double m_errorReturnValue = -999.0
 

Private Attributes

std::vector< std::vector< std::unique_ptr< eflowParameters > > > m_bins
 

Detailed Description

Inherits from eflowEEtaBinBase.

This class adds the infrastructure to store data and its set methods are used in e.g. eflowCellEOverPTool_mc12_JetETMiss. It also calculates an interpolation weight for moving between bins.

Definition at line 56 of file eflowEEtaBinnedParameters.h.

Constructor & Destructor Documentation

◆ eflowEEtaBinnedParameters()

eflowEEtaBinnedParameters::eflowEEtaBinnedParameters ( )
default

Member Function Documentation

◆ adjustLFI()

eflowFirstIntENUM eflowEEtaBinnedParameters::adjustLFI ( double  e,
double  eta,
eflowFirstIntENUM  j1st,
bool  useLegacyEnergyBinIndexing 
) const

Definition at line 109 of file eflowEEtaBinnedParameters.cxx.

110  {
111 
112 
113  int eBinIndex = 0;
114  if (useLegacyEnergyBinIndexing) {
115  eBinIndex = getEBinIndexLegacy(e);
116  } else {
117  eBinIndex = getEBinIndex(e);
118  }
119 
120  //hard code this check - needs to be rechecked if ever remake e/p tables
121  //if e.g track extrapolation slightly off can have inconsistent j1st and eta (e.g eta = 1.52, j1st = EMB2) and hence fudgeMean is zero
122  if (0 <= eBinIndex && eBinIndex <= 5) {
123  if (fabs(eta) < 1.5) {
128  }
129  if (fabs(eta) >= 1.6) {
134  }
135 
136  }
137 
138  if (0 == eBinIndex || 1 == eBinIndex) {
139  if (fabs(eta) >= 1.0 && fabs(eta) < 1.1) {
141  }
142  else if (fabs(eta) >= 1.2 && fabs(eta) < 1.3) {
144  }
145  else if (fabs(eta) >= 1.5 && fabs(eta) < 1.6) {
147  }
148 
149  } else if (2 == eBinIndex) {
150  if (fabs(eta) >= 1.5 && fabs(eta) < 1.6) {
152  }
153 
154  } else if (3 == eBinIndex) {
155  if (fabs(eta) >= 1.5 && fabs(eta) < 1.6) {
158  }
159 
160  } else if (4 == eBinIndex || 5 == eBinIndex) {
161  if (fabs(eta) >= 1.5 && fabs(eta) < 1.6) {
163  }
164  }
165 
166  return j1st;
167 }

◆ binExists()

bool eflowEEtaBinBase::binExists ( double  e,
double  eta 
) const
inlineinherited

Definition at line 32 of file eflowEEtaBinBase.h.

32 { return (getEBinIndex(e) >= 0 && getEtaBinIndex(eta) >= 0); }

◆ getBinIndex()

int eflowEEtaBinBase::getBinIndex ( double  x,
const std::vector< double > &  binBounds 
)
staticprotectedinherited

Definition at line 67 of file eflowEEtaBinBase.cxx.

67  {
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 }

◆ getEBinIndex()

int eflowEEtaBinBase::getEBinIndex ( double  e) const
protectedinherited

Definition at line 28 of file eflowEEtaBinBase.cxx.

28  {
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 ( e > m_eBinBounds.back() ) return nEBins-1;
35  return 0;
36 }

◆ getEBinIndexLegacy()

int eflowEEtaBinBase::getEBinIndexLegacy ( double  e) const
protectedinherited

Definition at line 38 of file eflowEEtaBinBase.cxx.

38  {
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 }

◆ getErrorReturnValue()

static double eflowEEtaBinBase::getErrorReturnValue ( )
inlinestaticinherited

Definition at line 34 of file eflowEEtaBinBase.h.

34 {return m_errorReturnValue;}

◆ getEtaBinIndex()

int eflowEEtaBinBase::getEtaBinIndex ( double  eta) const
protectedinherited

Definition at line 52 of file eflowEEtaBinBase.cxx.

52  {
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 }

◆ getInterpolation()

double eflowEEtaBinnedParameters::getInterpolation ( const eflowParameters **  bin1,
const eflowParameters **  bin2,
double  e,
double  eta,
bool  useLegacyEnergyBinIndexing 
) const

Definition at line 52 of file eflowEEtaBinnedParameters.cxx.

54  {
55  double weight;
56  int eBin = 0;
57  if (useLegacyEnergyBinIndexing) {
58  eBin = getEBinIndexLegacy(e);
59  } else {
60  eBin = getEBinIndex(e);
61  }
62  int etaBin = getEtaBinIndex(eta);
63 
64  /* Check for invalid bins */
65  if (eBin < 0 || etaBin < 0) {
66  *bin1 = nullptr;
67  *bin2 = nullptr;
68  weight = -1.0;
69  return weight;
70  }
71 
72  if ((0 == eBin && e <= m_eBinBounds[eBin]) ||
73  (eBin == getNumEBins() - 1 && e >= m_eBinBounds[getNumEBins() - 1])) {
74  /* If e is below the lowest (above the highest) pinpoint, just return the lowest (highest) bin; no interpolation in this case. */
75  *bin1 = m_bins[eBin][etaBin].get();
76  *bin2 = m_bins[eBin][etaBin].get();
77  weight = 1.0;
78  } else {
79  /* The "normal" case: interpolate between two energies */
80  int lowEBin = eBin;
81  int highEBin = eBin;
82 
83  if (e >= m_eBinBounds[eBin]) {
84  highEBin = eBin + 1;
85  } else {
86  lowEBin = eBin - 1;
87  }
88  auto outOfRange = [this](int bin)->bool{
89  return (bin<0) or (bin>=std::ssize(m_bins));
90  };
91 
92  if (outOfRange(lowEBin) or outOfRange(highEBin)){
93  throw std::out_of_range("Attempt to access element out of range in eflowEEtaBinnedParameters::getInterpolation");
94  }
95  *bin1 = m_bins[lowEBin][etaBin].get();
96  *bin2 = m_bins[highEBin][etaBin].get();
97 
98  double higherEBound = m_eBinBounds[highEBin];
99  double lowerEBound = m_eBinBounds[lowEBin];
100  //deals with e = 0 bin to avoid dividing by zero
101  if (lowerEBound < FLT_MIN) lowerEBound = FLT_MIN;
102 
103  weight = log(higherEBound / e) / log(higherEBound / lowerEBound);
104  }
105  return weight;
106 }

◆ getNumEBins()

int eflowEEtaBinBase::getNumEBins ( ) const
inlineprotectedinherited

Definition at line 38 of file eflowEEtaBinBase.h.

38 { return m_eBinBounds.size(); }

◆ getNumEtaBins()

int eflowEEtaBinBase::getNumEtaBins ( ) const
inlineprotectedinherited

Definition at line 39 of file eflowEEtaBinBase.h.

39 { return m_etaBinBounds.size(); }

◆ initialise()

void eflowEEtaBinnedParameters::initialise ( const std::vector< double > &  eBinBounds,
const std::vector< double > &  etaBinBounds,
bool  useAbsEta = true 
)

Definition at line 33 of file eflowEEtaBinnedParameters.cxx.

33  {
34  m_useAbsEta = useAbsEta;
35  m_eBinBounds = eBinBounds;
36  m_etaBinBounds = etaBinBounds;
37 
38  /* Create all the bins */
39  int nEBins = getNumEBins();
40  int nEtaBins = getNumEtaBins()-1;
41  m_bins.reserve(nEBins);
42  for (int iEBin = 0; iEBin < nEBins; iEBin++) {
43  std::vector<std::unique_ptr<eflowParameters> > tempVector;
44  tempVector.reserve(nEtaBins);
45  for (int iEtaBin = 0; iEtaBin < nEtaBins; iEtaBin++) {
46  tempVector.push_back(std::make_unique<eflowParameters>());
47  }
48  m_bins.push_back(std::move(tempVector));
49  }
50 }

◆ setFudgeMean()

void eflowEEtaBinnedParameters::setFudgeMean ( int  energyBin,
int  etaBin,
eflowFirstIntENUM  j1st,
double  fudgeMean 
)
inline

Definition at line 63 of file eflowEEtaBinnedParameters.h.

63  {
64  if (m_bins[energyBin][etaBin]) {
65  eflowFirstIntParameters* j1stBin = m_bins[energyBin][etaBin]->getFirstIntBin(j1st);
66  if (j1stBin) j1stBin->setFudgeMean(fudgeMean);
67  }
68  }

◆ setFudgeStdDev()

void eflowEEtaBinnedParameters::setFudgeStdDev ( int  energyBin,
int  etaBin,
eflowFirstIntENUM  j1st,
double  fudgeStdDev 
)
inline

Definition at line 69 of file eflowEEtaBinnedParameters.h.

69  {
70  if (m_bins[energyBin][etaBin]) {
71  eflowFirstIntParameters* j1stBin = m_bins[energyBin][etaBin]->getFirstIntBin(j1st);
72  if (j1stBin) j1stBin->setFudgeStdDev(fudgeStdDev);
73  }
74  }

◆ setShapeParam()

void eflowEEtaBinnedParameters::setShapeParam ( int  energyBin,
int  etaBin,
eflowFirstIntENUM  j1st,
eflowCaloENUM  layer,
int  paramNumber,
double  shapeParam 
)
inline

Definition at line 75 of file eflowEEtaBinnedParameters.h.

76  {
77  if (m_bins[energyBin][etaBin]) {
78  eflowFirstIntParameters* j1stBin = m_bins[energyBin][etaBin]->getFirstIntBin(j1st);
79  if (j1stBin) j1stBin->setShapeParameter(layer, paramNumber, shapeParam);
80  }
81  }

Member Data Documentation

◆ m_bins

std::vector< std::vector<std::unique_ptr<eflowParameters> > > eflowEEtaBinnedParameters::m_bins
private

Definition at line 90 of file eflowEEtaBinnedParameters.h.

◆ m_eBinBounds

std::vector<double> eflowEEtaBinBase::m_eBinBounds
protectedinherited

Definition at line 49 of file eflowEEtaBinBase.h.

◆ m_errorReturnValue

const double eflowEEtaBinBase::m_errorReturnValue = -999.0
staticprotectedinherited

Definition at line 46 of file eflowEEtaBinBase.h.

◆ m_etaBinBounds

std::vector<double> eflowEEtaBinBase::m_etaBinBounds
protectedinherited

Definition at line 50 of file eflowEEtaBinBase.h.

◆ m_useAbsEta

bool eflowEEtaBinBase::m_useAbsEta {true}
protectedinherited

Definition at line 48 of file eflowEEtaBinBase.h.


The documentation for this class was generated from the following files:
eflowEEtaBinBase::m_eBinBounds
std::vector< double > m_eBinBounds
Definition: eflowEEtaBinBase.h:49
TCS::KFMET::nEtaBins
constexpr unsigned nEtaBins
Definition: KalmanMETCorrectionConstants.h:18
eflowEEtaBinBase::getBinIndex
static int getBinIndex(double x, const std::vector< double > &binBounds)
Definition: eflowEEtaBinBase.cxx:67
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
eflowFirstIntParameters::setShapeParameter
void setShapeParameter(eflowCaloENUM layer, int paramNumber, double shapeParam)
Definition: eflowFirstIntParameters.h:48
eflowFirstIntRegions::EMB3
@ EMB3
Definition: eflowCaloRegions.h:59
eflowFirstIntRegions::EME3
@ EME3
Definition: eflowCaloRegions.h:60
bin
Definition: BinsDiffFromStripMedian.h:43
eflowFirstIntRegions::EMB1
@ EMB1
Definition: eflowCaloRegions.h:59
x
#define x
eflowEEtaBinBase::getEBinIndexLegacy
int getEBinIndexLegacy(double e) const
Definition: eflowEEtaBinBase.cxx:38
eflowEEtaBinBase::m_useAbsEta
bool m_useAbsEta
Definition: eflowEEtaBinBase.h:48
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
eflowEEtaBinBase::getEBinIndex
int getEBinIndex(double e) const
Definition: eflowEEtaBinBase.cxx:28
eflowFirstIntRegions::Tile
@ Tile
Definition: eflowCaloRegions.h:62
xAOD::etaBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin
Definition: L2StandAloneMuon_v1.cxx:148
lumiFormat.i
int i
Definition: lumiFormat.py:92
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
eflowEEtaBinBase::getEtaBinIndex
int getEtaBinIndex(double eta) const
Definition: eflowEEtaBinBase.cxx:52
bin2
Definition: KillBinsByStrip.h:34
eflowFirstIntRegions::HEC
@ HEC
Definition: eflowCaloRegions.h:61
dumpTgcDigiJitter.nBins
list nBins
Definition: dumpTgcDigiJitter.py:29
eflowFirstIntRegions::EME2
@ EME2
Definition: eflowCaloRegions.h:60
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:83
eflowEEtaBinBase::getNumEBins
int getNumEBins() const
Definition: eflowEEtaBinBase.h:38
eflowEEtaBinBase::m_errorReturnValue
static const double m_errorReturnValue
Definition: eflowEEtaBinBase.h:46
eflowFirstInt::setFudgeMean
void setFudgeMean(double fudgeMean)
Definition: eflowFirstInt.h:42
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
dqt_zlumi_pandas.bin1
bin1
Definition: dqt_zlumi_pandas.py:329
eflowFirstIntRegions::EMB2
@ EMB2
Definition: eflowCaloRegions.h:59
eflowEEtaBinnedParameters::m_bins
std::vector< std::vector< std::unique_ptr< eflowParameters > > > m_bins
Definition: eflowEEtaBinnedParameters.h:90
eflowFirstIntRegions::EME1
@ EME1
Definition: eflowCaloRegions.h:60
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
eflowFirstInt::setFudgeStdDev
void setFudgeStdDev(double fudgeStdDev)
Definition: eflowFirstInt.h:43
eflowEEtaBinBase::m_etaBinBounds
std::vector< double > m_etaBinBounds
Definition: eflowEEtaBinBase.h:50
eflowFirstIntParameters
Extends eflowFirstInt to include parameters of the fits to radial shower profiles.
Definition: eflowFirstIntParameters.h:28
eflowEEtaBinBase::getNumEtaBins
int getNumEtaBins() const
Definition: eflowEEtaBinBase.h:39