ATLAS Offline Software
Loading...
Searching...
No Matches
PFClusterWidthDecorator.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include "CaloEvent/CaloCluster.h"
8
9PFClusterWidthDecorator::PFClusterWidthDecorator(const std::string& name, ISvcLocator* pSvcLocator) :
10 AthReentrantAlgorithm(name, pSvcLocator)
11{}
12
16 return StatusCode::SUCCESS;
17}
18
19StatusCode PFClusterWidthDecorator::execute(const EventContext &ctx) const {
20
22 if (!clusterContainerWidthEta.isValid()) {
23 ATH_MSG_WARNING("Invalid cluster container with name " << m_clusterContainerWidthEtaKey.key());
24 return StatusCode::SUCCESS;
25 }
26
28 if (!clusterContainerWidthPhi.isValid()) {
29 ATH_MSG_WARNING("Invalid cluster container with name " << m_clusterContainerWidthPhiKey.key());
30 return StatusCode::SUCCESS;
31 }
32
33 for (const auto *const thisCluster : *clusterContainerWidthEta) {
34 const CaloClusterCellLink* theCellLinks = thisCluster->getCellLinks();
35 if (!theCellLinks) {
36 ATH_MSG_WARNING("No cell links found for cluster");
37 continue;
38 }
39
40 std::vector<double> eta,phi;
41 size_t ncells = theCellLinks->size();
42 eta.reserve(ncells);
43 phi.reserve(ncells);
44 for (CaloClusterCellLink::const_iterator it=theCellLinks->begin(); it!=theCellLinks->end(); ++it){
45 const CaloCell* cell = *it;
46 eta.push_back(cell->eta());
47 phi.push_back(cell->phi());
48 }
49
50 PFClusterWidth width = m_clusterWidthCalculator.getPFClusterCoordinateWidth(eta, phi, thisCluster->eta(), thisCluster->phi(), ncells);
51 clusterContainerWidthEta(*thisCluster) = width.etaVariance;
52 clusterContainerWidthPhi(*thisCluster) = width.phiVariance;
53
54 }
55
56 return StatusCode::SUCCESS;
57}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
const double width
An algorithm that can be simultaneously executed in multiple threads.
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
PFClusterWidthCalculator m_clusterWidthCalculator
PFClusterWidthDecorator(const std::string &name, ISvcLocator *pSvcLocator)
SG::WriteDecorHandleKey< xAOD::CaloClusterContainer > m_clusterContainerWidthEtaKey
SG::WriteDecorHandleKey< xAOD::CaloClusterContainer > m_clusterContainerWidthPhiKey
StatusCode execute(const EventContext &ctx) const override
Handle class for adding a decoration to an object.