ATLAS Offline Software
MissingEtCalo.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /********************************************************************
6 
7 NAME: MissingEtCalo.cxx
8 PACKAGE: offline/Reconstruction/MissingETEvent
9 
10 AUTHORS: P. Loch, S. Resconi
11 CREATED: Oct 2004
12 
13 PURPOSE: Calculate ExMiss,EyMiss and Sumet in Calorimeter Regions
14 ********************************************************************/
18 #include "CxxUtils/sincos.h"
19 
21 {
22  this->setup();
23 }
24 
26  : MissingET(MissingET::Calo,aRegion)
27 {
28  this->setup();
29 }
30 
32  MissingEtRegions* aRegion)
33  : MissingET(aSource,aRegion)
34 {
35  this->setup();
36 }
37 
39 {
40  this->setup();
41 }
42 
43 void MissingEtCalo::addCalo(const CaloCell* aCell, double weight)
44 {
45  //For efficiency don't call Calc_Ecellxy directly here but put the
46  //calculations directly:
47  double etc = aCell->et();
48  CxxUtils::sincos sc(aCell->phi());
49  double exc = etc * sc.cs;
50  double eyc = etc * sc.sn;
51  double etac = aCell->eta();
52 
53  // update the global sums and eta regions
54  this->add(exc, eyc, etc, etac, weight);
55 
56  // get the calo sample from each cell
57  CaloSampling::CaloSample aSample = aCell->caloDDE()->getSampling();
58  CaloIndex theIndex = this->getCaloIndex(aSample);
59 
60  // calorimeter sums
61  if ( theIndex != NotValid )
62  {
63  m_exCalo[(size_t)theIndex] -= weight * exc;
64  m_eyCalo[(size_t)theIndex] -= weight * eyc;
65  m_etSumCalo[(size_t)theIndex] += weight * etc;
66  ++(m_nCellsCalo[(size_t)theIndex]);
67  }
68 }
69 
71 {
72 
73  // The CaloIndex identifies the calorimeters used in Atrecon and as such
74  // users will be able to seemlessly use the Athena values in their analysis.
75  // 7 calos : PS Barrel, EM Barrel, PS EndCap, EM EndCap, Tile, HEC, FCAL
76 
77  CaloIndex theIndex = NotValid;
78  switch ( aSample )
79  {
80 
81  // PS Barrel
83  theIndex = PEMB;
84  break;
85 
86  // EM Barrel
87  case CaloSampling::EMB1:
88  case CaloSampling::EMB2:
89  case CaloSampling::EMB3:
90  theIndex = EMB;
91  break;
92 
93  // PS EndCap
95  theIndex = PEMEC;
96  break;
97 
98  // EM EndCap
99  case CaloSampling::EME1:
100  case CaloSampling::EME2:
101  case CaloSampling::EME3:
102  theIndex = EME;
103  break;
104 
105  // Tile
115  theIndex = TILE;
116  break;
117 
118  // HEC
119  case CaloSampling::HEC0:
120  case CaloSampling::HEC1:
121  case CaloSampling::HEC2:
122  case CaloSampling::HEC3:
123  theIndex = HEC;
124  break;
125 
126  // FCAL
127  case CaloSampling::FCAL0:
128  case CaloSampling::FCAL1:
129  case CaloSampling::FCAL2:
130  theIndex = FCAL;
131  break;
132 
133  default:
134  break;
135  }
136  return theIndex;
137 }
138 
139 /*
140 double MissingEtCalo::getExEta(MissingEtRegions::EtaRegion aRegion) const
141 {
142  const theRegionSums = this->getRegion();
143  return ( theRegionSums != 0 )
144  ? theRegionSums(aRegion)
145  : 0.;
146 }
147 
148 */
149 
150 //set methods
151 
153  double theEx)
154 {
155  if ( theCalo < Size ) m_exCalo[(size_t)theCalo] = theEx;
156 }
157 
158 
160  double theEy)
161 {
162  if ( theCalo < Size ) m_eyCalo[(size_t)theCalo] = theEy;
163 }
164 
165 
167  double theEtSum)
168 {
169  if ( theCalo < Size ) m_etSumCalo[(size_t)theCalo] = theEtSum;
170 
171 }
172 
173 
175  unsigned int theNCell)
176 {
177  if ( theCalo < Size ) m_nCellsCalo[(size_t)theCalo] = theNCell;
178 
179 }
180 
181 void MissingEtCalo::setCalibType(const std::string& theCalibType)
182 {
183 
184  m_calibType=theCalibType;
185 }
186 
187 
188 void MissingEtCalo::setExCaloVec(std::vector<double>&& exCaloVec)
189 {
190  assert (exCaloVec.size() == Size);
191  m_exCalo = std::move (exCaloVec);
192 }
193 
194 
195 void MissingEtCalo::setEyCaloVec(std::vector<double>&& eyCaloVec)
196 {
197  assert (eyCaloVec.size() == Size);
198  m_eyCalo = std::move (eyCaloVec);
199 }
200 
201 
202 void MissingEtCalo::setEtSumCaloVec(std::vector<double>&& etSumCaloVec)
203 {
204  assert (etSumCaloVec.size() == Size);
205  m_etSumCalo = std::move (etSumCaloVec);
206 }
207 
208 
209 void MissingEtCalo::setNCellCaloVec(std::vector<unsigned int>&& ncellCaloVec)
210 {
211  assert (ncellCaloVec.size() == Size);
212  m_nCellsCalo = std::move (ncellCaloVec);
213 }
214 
215 
216 // get methods
217 
219 {
220  return m_exCalo[theCalo] ;
221 }
222 
224 {
225  return m_eyCalo[theCalo] ;
226 }
227 
229 {
230  return m_etSumCalo[theCalo] ;
231 }
232 
234 {
235  return m_nCellsCalo[theCalo] ;
236 }
237 
238 const std::string& MissingEtCalo::calibType() const
239 {
240 
241  return m_calibType ;
242 }
243 
244 
245 const std::vector<double>&
247 {
248  return m_exCalo;
249 }
250 
251 
252 const std::vector<double>&
254 {
255  return m_eyCalo;
256 }
257 
258 
259 const std::vector<double>&
261 {
262  return m_etSumCalo;
263 }
264 
265 
266 const std::vector<unsigned int>&
268 {
269  return m_nCellsCalo;
270 }
271 
272 
274 {
275  // initialize data members
276 
277  m_exCalo.resize(MissingEtCalo::Size,0.);
278  m_eyCalo.resize(MissingEtCalo::Size,0.);
279  m_etSumCalo.resize(MissingEtCalo::Size,0.);
281 }
282 
283 void MissingEtCalo::Calc_Ecellxy(const CaloCell* cObj, double &ex, double &ey)
284 {
285  //function to calculate x and y component of cell energy
286 
287  CxxUtils::sincos sc(cObj->phi());
288  //Done the following way to avoid a temporary et_cell variable:
289  ex = cObj->et();
290  ey = ex * sc.sn;
291  ex *= sc.cs;
292 }
MissingEtCalo::getCaloIndex
CaloIndex getCaloIndex(CaloSampling::CaloSample aSample)
Definition: MissingEtCalo.cxx:70
MissingEtRegions
Definition: MissingEtRegions.h:22
MissingEtCalo::setCalibType
void setCalibType(const std::string &theCalibType)
Definition: MissingEtCalo.cxx:181
CaloCell_ID_FCS::TileExt2
@ TileExt2
Definition: FastCaloSim_CaloCell_ID.h:39
MissingET.h
CaloCell::phi
virtual double phi() const override final
get phi (through CaloDetDescrElement)
Definition: CaloCell.h:359
Calo
Definition: CaloTrackingGeometryBuilder.h:15
constants.EMB1
int EMB1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:53
MissingEtCalo::PEMB
@ PEMB
Definition: MissingEtCalo.h:50
MissingEtCalo::CaloIndex
CaloIndex
Definition: MissingEtCalo.h:40
MissingEtCalo::setNCellCaloVec
void setNCellCaloVec(std::vector< unsigned int > &&ncellCaloVec)
Definition: MissingEtCalo.cxx:209
MissingEtCalo::addCalo
void addCalo(const CaloCell *aCell, double weight)
Definition: MissingEtCalo.cxx:43
CaloCell_ID_FCS::TileExt0
@ TileExt0
Definition: FastCaloSim_CaloCell_ID.h:37
CaloCell_ID_FCS::TileBar1
@ TileBar1
Definition: FastCaloSim_CaloCell_ID.h:32
MissingEtCalo::setNCellCalo
void setNCellCalo(CaloIndex aCalo, unsigned int theNCell)
Definition: MissingEtCalo.cxx:174
MissingET::Source
Source
Definition: Reconstruction/MissingETEvent/MissingETEvent/MissingET.h:38
MissingEtCalo::HEC
@ HEC
Definition: MissingEtCalo.h:55
CaloCell_ID_FCS::FCAL1
@ FCAL1
Definition: FastCaloSim_CaloCell_ID.h:41
sincos.h
Helper to simultaneously calculate sin and cos of the same angle.
MissingEtCalo::setEtSumCalo
void setEtSumCalo(CaloIndex aCalo, double theEtSum)
Definition: MissingEtCalo.cxx:166
MissingEtCalo::ncellCaloVec
const std::vector< unsigned int > & ncellCaloVec() const
Definition: MissingEtCalo.cxx:267
MissingEtCalo::m_eyCalo
std::vector< double > m_eyCalo
Definition: MissingEtCalo.h:93
CaloCell_ID_FCS::HEC2
@ HEC2
Definition: FastCaloSim_CaloCell_ID.h:29
MissingEtCalo::m_calibType
std::string m_calibType
Definition: MissingEtCalo.h:97
MissingEtCalo::exCaloVec
const std::vector< double > & exCaloVec() const
Definition: MissingEtCalo.cxx:246
CaloCell_ID_FCS::TileGap3
@ TileGap3
Definition: FastCaloSim_CaloCell_ID.h:36
MissingEtCalo::ncellCalo
unsigned int ncellCalo(CaloIndex aCalo) const
Definition: MissingEtCalo.cxx:233
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
MissingEtCalo::FCAL
@ FCAL
Definition: MissingEtCalo.h:56
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
MissingEtCalo::etSumCalo
double etSumCalo(CaloIndex aCalo) const
Definition: MissingEtCalo.cxx:228
MissingEtCalo::setEyCaloVec
void setEyCaloVec(std::vector< double > &&exCaloVec)
Definition: MissingEtCalo.cxx:195
CaloCell_ID_FCS::HEC1
@ HEC1
Definition: FastCaloSim_CaloCell_ID.h:28
constants.EMB2
int EMB2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:54
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CaloCell_ID_FCS::TileBar0
@ TileBar0
Definition: FastCaloSim_CaloCell_ID.h:31
MissingEtCalo::exCalo
double exCalo(CaloIndex aCalo) const
Definition: MissingEtCalo.cxx:218
CaloCell_ID_FCS::TileGap2
@ TileGap2
Definition: FastCaloSim_CaloCell_ID.h:35
CaloCell::caloDDE
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition: CaloCell.h:305
MissingEtCalo::setExCalo
void setExCalo(CaloIndex aCalo, double theEx)
Definition: MissingEtCalo.cxx:152
MissingEtCalo::eyCaloVec
const std::vector< double > & eyCaloVec() const
Definition: MissingEtCalo.cxx:253
MissingEtCalo::Calc_Ecellxy
void Calc_Ecellxy(const CaloCell *cObj, double &ex, double &ey)
Definition: MissingEtCalo.cxx:283
MissingEtCalo::calibType
const std::string & calibType() const
Definition: MissingEtCalo.cxx:238
MissingEtCalo.h
CaloCell::et
virtual double et() const override final
get et
Definition: CaloCell.h:407
constants.EME1
int EME1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:55
MissingEtCalo::EMB
@ EMB
Definition: MissingEtCalo.h:51
MissingEtCalo::Size
@ Size
Definition: MissingEtCalo.h:57
CaloCell_ID_FCS::TileGap1
@ TileGap1
Definition: FastCaloSim_CaloCell_ID.h:34
MissingEtCalo::setEyCalo
void setEyCalo(CaloIndex aCalo, double theEy)
Definition: MissingEtCalo.cxx:159
MissingEtCalo::setEtSumCaloVec
void setEtSumCaloVec(std::vector< double > &&etSumCaloVec)
Definition: MissingEtCalo.cxx:202
MissingEtCalo::m_etSumCalo
std::vector< double > m_etSumCalo
Definition: MissingEtCalo.h:94
CaloCell_ID_FCS::TileExt1
@ TileExt1
Definition: FastCaloSim_CaloCell_ID.h:38
CaloCell_ID_FCS::EME3
@ EME3
Definition: FastCaloSim_CaloCell_ID.h:26
MissingEtCalo::setup
void setup()
Definition: MissingEtCalo.cxx:273
MissingEtRegions.h
MissingET::add
virtual void add(double theEx, double theEy, double theEt, double theEta, double weight)
Definition: MissingET.cxx:127
CaloCell_ID_FCS::HEC0
@ HEC0
Definition: FastCaloSim_CaloCell_ID.h:27
MissingEtCalo::etSumCaloVec
const std::vector< double > & etSumCaloVec() const
Definition: MissingEtCalo.cxx:260
MissingEtCalo::MissingEtCalo
MissingEtCalo()
Definition: MissingEtCalo.cxx:20
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
CaloDetDescrElement::getSampling
CaloCell_ID::CaloSample getSampling() const
cell sampling
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:395
CaloCell_ID_FCS::PreSamplerE
@ PreSamplerE
Definition: FastCaloSim_CaloCell_ID.h:23
CaloCell_ID_FCS::PreSamplerB
@ PreSamplerB
Definition: FastCaloSim_CaloCell_ID.h:19
MissingEtCalo::eyCalo
double eyCalo(CaloIndex aCalo) const
Definition: MissingEtCalo.cxx:223
MissingET
Definition: Reconstruction/MissingETEvent/MissingETEvent/MissingET.h:23
MissingEtCalo::PEMEC
@ PEMEC
Definition: MissingEtCalo.h:52
CxxUtils::sincos
Helper to simultaneously calculate sin and cos of the same angle.
Definition: sincos.h:76
MissingEtCalo::~MissingEtCalo
virtual ~MissingEtCalo()
Definition: MissingEtCalo.cxx:38
CaloCell_ID_FCS::FCAL2
@ FCAL2
Definition: FastCaloSim_CaloCell_ID.h:42
MissingEtCalo::NotValid
@ NotValid
Definition: MissingEtCalo.h:58
MissingEtCalo::EME
@ EME
Definition: MissingEtCalo.h:53
CaloCell_ID_FCS::HEC3
@ HEC3
Definition: FastCaloSim_CaloCell_ID.h:30
MissingEtCalo::m_exCalo
std::vector< double > m_exCalo
Definition: MissingEtCalo.h:92
CaloCell_ID_FCS::FCAL0
@ FCAL0
Definition: FastCaloSim_CaloCell_ID.h:40
CaloCell_ID_FCS::EMB3
@ EMB3
Definition: FastCaloSim_CaloCell_ID.h:22
MissingEtCalo::setExCaloVec
void setExCaloVec(std::vector< double > &&exCaloVec)
Definition: MissingEtCalo.cxx:188
MissingEtCalo::m_nCellsCalo
std::vector< unsigned int > m_nCellsCalo
Definition: MissingEtCalo.h:95
CaloCell_ID_FCS::TileBar2
@ TileBar2
Definition: FastCaloSim_CaloCell_ID.h:33
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56
CaloCell::eta
virtual double eta() const override final
get eta (through CaloDetDescrElement)
Definition: CaloCell.h:366
MissingEtCalo::TILE
@ TILE
Definition: MissingEtCalo.h:54