ATLAS Offline Software
Loading...
Searching...
No Matches
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 $
10
11
13
14
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
89const 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
140int CaloEMFrac::getEtaLogEClusBin(float eta, float logEClus) const
141{
142 int iEta,iLogEClus;
143
144 iEta = (int)((eta-m_MinEta)/(m_MaxEta-m_MinEta)*m_nBinEta);
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
Scalar eta() const
pseudorapidity method
Hold binned EM fraction data.
float m_MaxLogDepth
Maximum log10(cluster depth) for the last bin.
Definition CaloEMFrac.h:185
float m_MinLogEClus
Minimum log10(cluster energy) for the first bin.
Definition CaloEMFrac.h:172
float m_MinLogEDens
Minimum log10(cluster energy density) for the first bin.
Definition CaloEMFrac.h:174
int m_nBinLogDepth
Number of log10(cluster depth) bins.
Definition CaloEMFrac.h:167
float m_MaxLogEDens
Maximum log10(cluster energy density) for the last bin.
Definition CaloEMFrac.h:183
float m_MaxLogEClus
Maximum log10(cluster energy) for the last bin.
Definition CaloEMFrac.h:181
int getBin(float eta, float logEClus, float logEDens, float logDepth) const
Find a bin number.
void setEMFracData(float eta, float logEClus, float logEDens, float logDepth, const struct EMFracData &theData)
Set EM fraction data for one bin.
std::vector< struct EMFracData > m_data
The table.
Definition CaloEMFrac.h:190
int m_nBinLogEDens
Number of log10(cluster energy density) bins.
Definition CaloEMFrac.h:165
float m_MaxEta
Maximum eta for the last bin.
Definition CaloEMFrac.h:179
float m_MinLogDepth
Minimum log10(cluster depth) for the first bin.
Definition CaloEMFrac.h:176
int m_nBinEta
Number of eta bins.
Definition CaloEMFrac.h:161
CaloEMFrac()
Default Constructor.
int getEtaLogEClusBin(float eta, float logEClus) const
Find the eta/logEClus bin number.
float m_MinEta
Minimum eta for the first bin.
Definition CaloEMFrac.h:170
int m_nBinLogEClus
Number of log10(cluster energy) bins.
Definition CaloEMFrac.h:163
const struct EMFracData * getEMFracData(float eta, float logEClus, float logEDens, float logDepth) const
Return EM fraction data for one bin.