ATLAS Offline Software
Loading...
Searching...
No Matches
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
7NAME: MissingEtCalo.cxx
8PACKAGE: offline/Reconstruction/MissingETEvent
9
10AUTHORS: P. Loch, S. Resconi
11CREATED: Oct 2004
12
13PURPOSE: Calculate ExMiss,EyMiss and Sumet in Calorimeter Regions
14********************************************************************/
18#include "CxxUtils/sincos.h"
19
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
42
43void 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
82 case CaloSampling::PreSamplerB:
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
94 case CaloSampling::PreSamplerE:
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
106 case CaloSampling::TileBar0:
107 case CaloSampling::TileBar1:
108 case CaloSampling::TileBar2:
109 case CaloSampling::TileExt0:
110 case CaloSampling::TileExt1:
111 case CaloSampling::TileExt2:
112 case CaloSampling::TileGap1:
113 case CaloSampling::TileGap2:
114 case CaloSampling::TileGap3:
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/*
140double 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
181void MissingEtCalo::setCalibType(const std::string& theCalibType)
182{
183
184 m_calibType=theCalibType;
185}
186
187
188void MissingEtCalo::setExCaloVec(std::vector<double>&& exCaloVec)
189{
190 assert (exCaloVec.size() == Size);
191 m_exCalo = std::move (exCaloVec);
192}
193
194
195void MissingEtCalo::setEyCaloVec(std::vector<double>&& eyCaloVec)
196{
197 assert (eyCaloVec.size() == Size);
198 m_eyCalo = std::move (eyCaloVec);
199}
200
201
203{
204 assert (etSumCaloVec.size() == Size);
205 m_etSumCalo = std::move (etSumCaloVec);
206}
207
208
209void 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
238const std::string& MissingEtCalo::calibType() const
239{
240
241 return m_calibType ;
242}
243
244
245const std::vector<double>&
247{
248 return m_exCalo;
249}
250
251
252const std::vector<double>&
254{
255 return m_eyCalo;
256}
257
258
259const std::vector<double>&
261{
262 return m_etSumCalo;
263}
264
265
266const 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.);
281}
282
283void 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}
static Double_t sc
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
virtual double phi() const override final
get phi (through CaloDetDescrElement)
Definition CaloCell.h:375
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition CaloCell.h:321
virtual double eta() const override final
get eta (through CaloDetDescrElement)
Definition CaloCell.h:382
virtual double et() const override final
get et
Definition CaloCell.h:423
CaloCell_ID::CaloSample getSampling() const
cell sampling
virtual void add(double theEx, double theEy, double theEt, double theEta, double weight)
void setEtSumCalo(CaloIndex aCalo, double theEtSum)
void addCalo(const CaloCell *aCell, double weight)
double etSumCalo(CaloIndex aCalo) const
std::vector< double > m_exCalo
const std::vector< unsigned int > & ncellCaloVec() const
std::vector< double > m_eyCalo
double exCalo(CaloIndex aCalo) const
void setCalibType(const std::string &theCalibType)
const std::vector< double > & exCaloVec() const
void setExCalo(CaloIndex aCalo, double theEx)
const std::string & calibType() const
void setEtSumCaloVec(std::vector< double > &&etSumCaloVec)
void setNCellCalo(CaloIndex aCalo, unsigned int theNCell)
CaloIndex getCaloIndex(CaloSampling::CaloSample aSample)
void setEyCaloVec(std::vector< double > &&exCaloVec)
std::vector< unsigned int > m_nCellsCalo
std::vector< double > m_etSumCalo
void Calc_Ecellxy(const CaloCell *cObj, double &ex, double &ey)
unsigned int ncellCalo(CaloIndex aCalo) const
const std::vector< double > & etSumCaloVec() const
void setNCellCaloVec(std::vector< unsigned int > &&ncellCaloVec)
const std::vector< double > & eyCaloVec() const
std::string m_calibType
void setExCaloVec(std::vector< double > &&exCaloVec)
virtual ~MissingEtCalo()
void setEyCalo(CaloIndex aCalo, double theEy)
double eyCalo(CaloIndex aCalo) const
Helper to simultaneously calculate sin and cos of the same angle.
Helper to simultaneously calculate sin and cos of the same angle.
Definition sincos.h:39