ATLAS Offline Software
CaloEMFrac.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // $Id: CaloEMFrac.cxx,v 1.2 2007-10-26 01:47:23 ssnyder Exp $
13 
14 
19  : m_nBinEta(0),
20  m_nBinLogEClus(0),
21  m_nBinLogEDens(0),
22  m_nBinLogDepth(0),
23  m_MinEta(0),
24  m_MinLogEClus(0),
25  m_MinLogEDens(0),
26  m_MinLogDepth(0),
27  m_MaxEta(0),
28  m_MaxLogEClus(0),
29  m_MaxLogEDens(0),
30  m_MaxLogDepth(0)
31 {
32 }
33 
34 
51  int nBinEta,
52  float MinEta,
53  float MaxEta,
54  int nBinLogEClus,
55  float MinLogEClus,
56  float MaxLogEClus,
57  int nBinLogEDens,
58  float MinLogEDens,
59  float MaxLogEDens,
60  int nBinLogDepth,
61  float MinLogDepth,
62  float MaxLogDepth
63  ) : m_nBinEta (nBinEta),
64  m_nBinLogEClus (nBinLogEClus),
65  m_nBinLogEDens (nBinLogEDens),
66  m_nBinLogDepth (nBinLogDepth),
67  m_MinEta (MinEta),
68  m_MinLogEClus (MinLogEClus),
69  m_MinLogEDens (MinLogEDens),
70  m_MinLogDepth (MinLogDepth),
71  m_MaxEta (MaxEta),
72  m_MaxLogEClus (MaxLogEClus),
73  m_MaxLogEDens (MaxLogEDens),
74  m_MaxLogDepth (MaxLogDepth)
75 {
76 }
77 
78 
89 const struct CaloEMFrac::EMFracData *
91  float logEClus,
92  float logEDens,
93  float logDepth) const
94 {
95  int iBin = getBin(eta,logEClus,logEDens,logDepth);
96  if ( iBin > -1 && iBin < (int)m_data.size() )
97  return (& m_data[iBin]);
98  else
99  return nullptr;
100 }
101 
102 
103 
116  float logEClus,
117  float logEDens,
118  float logDepth,
119  const struct EMFracData & theData)
120 {
121  const int iEtaLogEClus = getEtaLogEClusBin(eta, logEClus);
122  if ( iEtaLogEClus > -1 ) {
123  const int iFilledEntries = m_data.size()/(m_nBinLogEDens*m_nBinLogDepth);
124  if ( iEtaLogEClus >= iFilledEntries )
125  m_data.resize((iFilledEntries+1)*(m_nBinLogEDens*m_nBinLogDepth));
126  const int iBin = getBin(eta,logEClus,logEDens,logDepth);
127  if ( iBin > -1 ) {
128  m_data[iBin] = theData;
129  }
130  }
131 }
132 
133 
140 int CaloEMFrac::getEtaLogEClusBin(float eta, float logEClus) const
141 {
142  int iEta,iLogEClus;
143 
145  if ( iEta >= 0 && iEta < m_nBinEta ) {
146  iLogEClus = (int)((logEClus-m_MinLogEClus)/(m_MaxLogEClus-m_MinLogEClus)*m_nBinLogEClus);
147  if ( iLogEClus >= 0 && iLogEClus < m_nBinLogEClus ) {
148  return (iEta*m_nBinLogEClus+iLogEClus);
149  }
150  }
151  return (-1);
152 
153 }
154 
155 
165  float logEClus,
166  float logEDens,
167  float logDepth) const
168 {
169  int iLogEDens,iLogDepth;
170 
171  const int iEtaLogEClus = getEtaLogEClusBin(eta, logEClus);
172  if ( iEtaLogEClus > -1 ) {
173  iLogEDens = (int)((logEDens-m_MinLogEDens)/(m_MaxLogEDens-m_MinLogEDens)*m_nBinLogEDens);
174  if ( iLogEDens >= 0 && iLogEDens < m_nBinLogEDens ) {
175  iLogDepth = (int)((logDepth-m_MinLogDepth)/(m_MaxLogDepth-m_MinLogDepth)*m_nBinLogDepth);
176  if ( iLogDepth >= 0 && iLogDepth < m_nBinLogDepth ) {
177  return (iLogDepth + m_nBinLogDepth *
178  (iLogEDens + m_nBinLogEDens *
179  iEtaLogEClus));
180  }
181  }
182  }
183  return -1;
184 }
185 
186 
CaloEMFrac::m_MinLogEClus
float m_MinLogEClus
Minimum log10(cluster energy) for the first bin.
Definition: CaloEMFrac.h:172
CaloEMFrac::m_MaxLogEClus
float m_MaxLogEClus
Maximum log10(cluster energy) for the last bin.
Definition: CaloEMFrac.h:181
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
CaloEMFrac::m_nBinLogEClus
int m_nBinLogEClus
Number of log10(cluster energy) bins.
Definition: CaloEMFrac.h:163
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
CaloEMFrac::EMFracData
Per-bin data.
Definition: CaloEMFrac.h:42
CaloEMFrac::m_MaxLogEDens
float m_MaxLogEDens
Maximum log10(cluster energy density) for the last bin.
Definition: CaloEMFrac.h:183
CaloEMFrac::m_MinEta
float m_MinEta
Minimum eta for the first bin.
Definition: CaloEMFrac.h:170
CaloEMFrac::getEtaLogEClusBin
int getEtaLogEClusBin(float eta, float logEClus) const
Find the eta/logEClus bin number.
Definition: CaloEMFrac.cxx:140
CaloEMFrac::m_nBinLogEDens
int m_nBinLogEDens
Number of log10(cluster energy density) bins.
Definition: CaloEMFrac.h:165
CaloEMFrac::m_MinLogEDens
float m_MinLogEDens
Minimum log10(cluster energy density) for the first bin.
Definition: CaloEMFrac.h:174
CaloEMFrac::getEMFracData
const struct EMFracData * getEMFracData(float eta, float logEClus, float logEDens, float logDepth) const
Return EM fraction data for one bin.
Definition: CaloEMFrac.cxx:90
CaloEMFrac::m_MaxEta
float m_MaxEta
Maximum eta for the last bin.
Definition: CaloEMFrac.h:179
CaloEMFrac::setEMFracData
void setEMFracData(float eta, float logEClus, float logEDens, float logDepth, const struct EMFracData &theData)
Set EM fraction data for one bin.
Definition: CaloEMFrac.cxx:115
CaloEMFrac::m_MaxLogDepth
float m_MaxLogDepth
Maximum log10(cluster depth) for the last bin.
Definition: CaloEMFrac.h:185
CaloEMFrac::m_nBinLogDepth
int m_nBinLogDepth
Number of log10(cluster depth) bins.
Definition: CaloEMFrac.h:167
CaloEMFrac::CaloEMFrac
CaloEMFrac()
Default Constructor.
Definition: CaloEMFrac.cxx:18
CaloEMFrac::getBin
int getBin(float eta, float logEClus, float logEDens, float logDepth) const
Find a bin number.
Definition: CaloEMFrac.cxx:164
CaloEMFrac.h
Hold binned EM fraction data.
CaloEMFrac::m_nBinEta
int m_nBinEta
Number of eta bins.
Definition: CaloEMFrac.h:161
CaloEMFrac::m_data
std::vector< struct EMFracData > m_data
The table.
Definition: CaloEMFrac.h:190
xAOD::iEta
setScale setgFexType iEta
Definition: gFexJetRoI_v1.cxx:74
CaloEMFrac::m_MinLogDepth
float m_MinLogDepth
Minimum log10(cluster depth) for the first bin.
Definition: CaloEMFrac.h:176