ATLAS Offline Software
Loading...
Searching...
No Matches
eflowRecCluster.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5/*
6 * eflowRecCluster.h
7 *
8 * Created on: 30.09.2013
9 * Author: tlodd
10 */
11
12#ifndef EFLOWRECCLUSTER_H_
13#define EFLOWRECCLUSTER_H_
14
15#include <cassert>
16#include <vector>
17#include <utility>
18
19#include "CxxUtils/fpcompare.h"
20
21#include "AthLinks/ElementLink.h"
22
25
30
40{
41public:
43 const ElementLink<xAOD::CaloClusterContainer>& clusElementLink,
44 xAOD::CaloClusterContainer& newClusContainer);
45 eflowRecCluster(const eflowRecCluster& originalEflowRecCluster);
46 eflowRecCluster& operator=(const eflowRecCluster& originalEflowRecCluster) = delete;
48
50 const xAOD::CaloCluster* getCluster() const{ return m_cluster; }
51
52
53
62
64
65 double getSumExpectedEnergy();
67 bool isEOverPFail(bool consistencySigmaCut, bool useGoldenMode);
68
70 {
71 m_trackMatches.push_back(trackMatch);
72 }
73 const std::vector<eflowTrackClusterLink*>& getTrackMatches() const
74 {
75 return m_trackMatches;
76 }
78 int getNTracks() const { return m_trackMatches.size(); }
79 int getClusterId() const { return m_clusterId; }
80 void setClusterId(int clusterId) { m_clusterId = clusterId; }
81 void setCellsWeight(std::map<IdentifierHash, double> &&cellsWeight)
82 {
83 m_cellsWeightMap = std::move(cellsWeight);
84 }
85 const std::map<IdentifierHash, double>& getCellsWeight() const
86 {
87 return m_cellsWeightMap;
88 }
89
90 int getClusterType() const { return m_calorimeterType; }
91 bool isTouchable() const { return m_isTouchable; }
92
93private:
94 void setClusterType();
106
113
114
115 /* for EM mode, LC weight for cells are retrieved before doing any
116 * subtraction; they will be used after subtraction */
117 std::map<IdentifierHash, double> m_cellsWeightMap;
118
119 std::unique_ptr<eflowMatchCluster> m_matchCluster;
120 std::vector<eflowTrackClusterLink*> m_trackMatches;
121
122public:
124 {
125 public:
127 {
128 return CxxUtils::fpcompare::greater(a->getCluster()->pt(),
129 b->getCluster()->pt());
130 }
131 };
132};
133
140{
141public:
143 : m_efRecCluster(efRecCluster)
144 , m_cellEta{}
145 , m_cellPhi{}
146 , m_clusterEne(m_efRecCluster->getCluster()->e())
147 , m_clusterEta(m_efRecCluster->getCluster()->eta())
148 , m_clusterPhi(m_efRecCluster->getCluster()->phi())
149 , m_clusterEtaMean(0.0)
150 , m_clusterPhiMean(0.0)
153 , m_calVariance(false)
154 {
155 assert(m_efRecCluster);
156 }
158
161
162 virtual double e() const { return m_clusterEne; }
163 virtual double eta() const { return m_clusterEta; }
164 virtual double phi() const { return m_clusterPhi; }
165 virtual double etaMean() const { return m_clusterEtaMean; }
166 virtual double phiMean() const { return m_clusterPhiMean; }
167 virtual double etaVariance() const { return m_clusterEtaVariance; }
168 virtual double phiVariance() const { return m_clusterPhiVariance; }
169 virtual bool calVarianceStatus() const { return m_calVariance; }
170 //
171 virtual void etaMean(double clusterEtaMean)
172 {
173 m_clusterEtaMean = clusterEtaMean;
174 }
175 virtual void phiMean(double clusterPhiMean)
176 {
177 m_clusterPhiMean = clusterPhiMean;
178 }
179 virtual void etaVariance(double clusterEtaVariance)
180 {
181 m_clusterEtaVariance = clusterEtaVariance;
182 }
183 virtual void phiVariance(double clusterPhiVariance)
184 {
185 m_clusterPhiVariance = clusterPhiVariance;
186 }
187 virtual void setCalVarianceStatus() { m_calVariance = true; }
188
189 virtual unsigned int nCells() const
190 {
191 if (m_efRecCluster) {
192 const xAOD::CaloCluster* thisCluster = std::as_const(*m_efRecCluster).getCluster();
193 if (thisCluster)
194 return thisCluster->size();
195 // Logically if we have no valid pointer to xAOD::CaloCluster, we have no
196 // link to any CaloCells
197 else {
198 std::cerr
199 << "eflowMatchCluster ERROR: No valid link to xAOD::CaloCluster"
200 << std::endl;
201 return 0;
202 }
203 }
204 // Logically if we have no valid pointer to eflowRecCluster, we have no link
205 // to any CaloCells
206 else {
207 std::cerr << "eflowMatchCluster ERROR: No valid link to eflowRecCluster"
208 << std::endl;
209 return 0;
210 }
211 }
212 virtual const std::vector<double>& cellEta() const
213 {
214 if (!m_cellEta.isValid()) {
216 }
217 return *(m_cellEta.ptr());
218 }
219 virtual const std::vector<double>& cellPhi() const
220 {
221 if (!m_cellPhi.isValid()) {
223 }
224 return *(m_cellPhi.ptr());
225 }
226
227private:
228 void initCellPositions() const
229 {
230 std::vector<double> tmp_cellEta;
231 std::vector<double> tmp_cellPhi;
232 if (m_efRecCluster) {
233 const xAOD::CaloCluster* thisCluster = std::as_const(*m_efRecCluster).getCluster();
234 if (thisCluster) {
235 const CaloClusterCellLink* theCellLink = thisCluster->getCellLinks();
236 CaloClusterCellLink::const_iterator itCell = theCellLink->begin();
237 CaloClusterCellLink::const_iterator endCell = theCellLink->end();
238
239 for (; itCell != endCell; ++itCell) {
240 const CaloCell* thisCell = *itCell;
241 tmp_cellEta.push_back(thisCell->eta());
242 tmp_cellPhi.push_back(thisCell->phi());
243 }
244 } else {
245 std::cerr
246 << "eflowMatchCluster ERROR: No valid link to xAOD::CaloCluster"
247 << std::endl;
248 }
249 } else {
250 std::cerr << "eflowMatchCluster ERROR: No valid link to eflowRecCluster"
251 << std::endl;
252 }
253 m_cellEta.set(std::move(tmp_cellEta));
254 m_cellPhi.set(std::move(tmp_cellPhi));
255 }
256
268};
269
272
273class eflowRecClusterContainer : public DataVector<eflowRecCluster>
274
275{
276
277public:
278 void print(){};
279};
280
282#endif /* EFLOWRECCLUSTER_H_ */
Cached value with atomic update.
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
An STL vector of pointers that by default owns its pointed-to elements.
static Double_t a
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
virtual double eta() const override final
get eta (through CaloDetDescrElement)
Definition CaloCell.h:382
Cached value with atomic update.
Definition CachedValue.h:55
DataVector(SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES)
This class, which inherits from the pure virtual ICluster, stores a pointer to an eflowRecCluster.
CxxUtils::CachedValue< std::vector< double > > m_cellEta
virtual double e() const
virtual double eta() const
void initCellPositions() const
virtual double phiMean() const
virtual ~eflowMatchCluster()
virtual void setCalVarianceStatus()
virtual const std::vector< double > & cellEta() const
virtual unsigned int nCells() const
eflowRecCluster * getEfRecCluster()
virtual void phiMean(double clusterPhiMean)
virtual double phi() const
CxxUtils::CachedValue< std::vector< double > > m_cellPhi
virtual double etaMean() const
virtual double etaVariance() const
const eflowRecCluster * getEfRecCluster() const
eflowMatchCluster(eflowRecCluster *efRecCluster)
virtual const std::vector< double > & cellPhi() const
virtual void etaVariance(double clusterEtaVariance)
virtual void phiVariance(double clusterPhiVariance)
virtual double phiVariance() const
eflowRecCluster * m_efRecCluster
virtual bool calVarianceStatus() const
virtual void etaMean(double clusterEtaMean)
bool operator()(const eflowRecCluster *a, const eflowRecCluster *b)
This class extends the information about a xAOD::CaloCluster.
eflowRecCluster & operator=(const eflowRecCluster &originalEflowRecCluster)=delete
ElementLink< xAOD::CaloClusterContainer > m_originalClusElementLink
eflowRecCluster(const ElementLink< xAOD::CaloClusterContainer > &clusElementLink, xAOD::CaloClusterContainer &newClusContainer)
std::unique_ptr< eflowMatchCluster > m_matchCluster
bool isEOverPFail(bool consistencySigmaCut, bool useGoldenMode)
double getVarianceOfSumExpectedEnergy()
bool isTouchable() const
void addTrackMatch(eflowTrackClusterLink *trackMatch)
const xAOD::CaloCluster * getCluster() const
int getClusterId() const
void setClusterId(int clusterId)
ElementLink< xAOD::CaloClusterContainer > getOriginalClusElementLink() const
virtual ~eflowRecCluster()
eflowMatchCluster * getMatchCluster() const
xAOD::CaloCluster * getCluster()
ElementLink< xAOD::CaloClusterContainer > getClusElementLink() const
int getClusterType() const
Specifies if we have a cluster mainly in ECAL, HCAL or FCAL.
CalorimeterType
ENUM that defines calorimeter regions as ECAL, HCAL or FCAL.
std::map< IdentifierHash, double > m_cellsWeightMap
std::vector< eflowTrackClusterLink * > m_trackMatches
double getSumExpectedEnergy()
xAOD::CaloCluster * m_cluster
ElementLink< xAOD::CaloClusterContainer > m_clusElementLink
const std::vector< eflowTrackClusterLink * > & getTrackMatches() const
int getNTracks() const
void setCellsWeight(std::map< IdentifierHash, double > &&cellsWeight)
const std::map< IdentifierHash, double > & getCellsWeight() const
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
size_t size() const
size method (forwarded from CaloClusterCellLink obj)
Workaround x86 precision issues for FP inequality comparisons.
bool greater(double a, double b)
Compare two FP numbers, working around x87 precision issues.
Definition fpcompare.h:140
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.