ATLAS Offline Software
Loading...
Searching...
No Matches
egammaLargeClusterCellRecoveryTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7// Calo includes
9#include "CaloDetDescr/CaloDetDescrElement.h"
16
17// xAOD includes
19#include <GaudiKernel/ThreadLocalContext.h>
20
21
23 const std::string& name,
24 const IInterface* parent)
25 : AthAlgTool(type, name, parent) {
26 declareInterface<IegammaLargeClusterCellRecoveryTool>(this);
27}
28
30 ATH_MSG_DEBUG("Initializing egammaLargeClusterCellRecoveryTool");
31
32 if (!m_caloFillRectangularTool.empty()) {
34 }
35
36 return StatusCode::SUCCESS;
37}
38
40 const CaloDetDescrManager* cmgr,
41 const CaloCellContainer* cell_container,
42 Info& info) const {
43 ATH_MSG_DEBUG("Executing egammaLargeClusterRecoveryTool");
44
45 if (cluster->et() < m_centEtThr) {
46 ATH_MSG_DEBUG("Cluster Et below threshold for large cluster recovery: " << cluster->et());
47 return StatusCode::SUCCESS;
48 }
49
50 if (!cluster->inBarrel() && !cluster->inEndcap()) {
51 ATH_MSG_DEBUG("Cluster not in EMB or EMEC, skipping large cluster recovery.");
52 return StatusCode::SUCCESS;
53 }
54
55 // Check if cluster is in barrel or endcap
56 bool in_barrel = egammaEnergyPositionAllSamples::inBarrel(*cluster, 2);
57 CaloSampling::CaloSample sam = CaloSampling::EMB2;
58 if (!in_barrel) {
59 sam = CaloSampling::EME2;
60 }
61
62 // (eta, phi) of the cluster in the 2nd sampling
63 auto eta = cluster->etaSample(sam);
64 auto phi = cluster->phiSample(sam);
65
66 if ((eta == 0. && phi == 0.) || std::abs(eta) > 100) {
67 ATH_MSG_WARNING("Weird input cluster, eta = " << eta
68 << " phi = " << phi);
69 return StatusCode::SUCCESS;
70 }
71
72 // Here decode_sample will overwrite these variables
73 bool barrel = false;
75 int sampling_or_module = 0;
76
78 subcalo, barrel, sampling_or_module, (CaloCell_ID::CaloSample)sam);
79
80 // Get the corresponding granularities with CaloDetDescrElement
81 const CaloDetDescrElement *dde = cmgr->get_element(
82 CaloCell_ID::LAREM, sampling_or_module, barrel, eta, phi);
83
84 // If the object does not exist then return
85 if (!dde) {
86 ATH_MSG_WARNING("Weird input cluster eta = " << eta
87 << " phi = " << phi);
88 ATH_MSG_WARNING("No detetector element for seeding");
89 return StatusCode::SUCCESS;
90 }
91
92 // Local granularity
93 auto deta = dde->deta();
94 auto dphi = dde->dphi();
95
96 // Search the hottest cell around the (eta,phi).
97 // (eta,phi) are defined as etaSample() and phiSample().
98 // Around this position a hot cell is searched for in a window
99 // (m_neta*m_deta,m_nphi*m_dphi), by default (m_neta,m_nphi)=(7,7)
101 StatusCode sc =
102 calc.fill(*cmgr, cell_container, cluster->etaSample(sam),
103 cluster->phiSample(sam), m_neta * deta, m_nphi * dphi,
105
106 if (sc.isFailure()) {
107 ATH_MSG_WARNING("CaloLayerCalculator failed to fill");
108 return StatusCode::SUCCESS;
109 }
110 double etamax = calc.etarmax();
111 double phimax = calc.phirmax();
112
113 // Create 7x11 cluster with hottest cell as seed
114 std::unique_ptr<xAOD::CaloCluster> largeCluster =
116 etamax,
117 phimax,
119
120 // Fill rectangular cluster
121 if (!m_caloFillRectangularTool->execute(Gaudi::Hive::currentContext(), largeCluster.get()).isSuccess()) {
122 ATH_MSG_WARNING("CaloFillRectangularCluster tool failed");
123 return StatusCode::SUCCESS;
124 }
125
126 // Check that 7x11 cluster has cells
127 if (largeCluster->size() == 0) {
128 ATH_MSG_WARNING("Large cluster has no cells");
129 return StatusCode::SUCCESS;
130 }
131
133 // Iterate through cells and store in info
134 for (const CaloCell* cell : *largeCluster) {
135 info.cells711.push_back(cell);
136 }
137
138 return StatusCode::SUCCESS;
139}
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)
#define ATH_MSG_DEBUG(x)
Definition of CaloDetDescrManager.
Calculate total energy, position, etc. for a given layer of a cluster.
static Double_t sc
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Container class for CaloCell.
CaloCell_Base_ID::SUBCALO SUBCALO
Definition CaloCell_ID.h:50
CaloSampling::CaloSample CaloSample
Definition CaloCell_ID.h:53
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
static std::unique_ptr< xAOD::CaloCluster > makeCluster(const CaloCellContainer *cellCont)
Creates a valid CaloCluster with a private Aux-Store and CellLink container.
This class groups all DetDescr information related to a CaloCell.
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
static void decode_sample(CaloCell_ID::SUBCALO &subCalo, bool &barrel, int &sampling_or_module, CaloCell_ID::CaloSample sample)
translate between the 2 ways to label a sub-detector:
This class provides the client interface for accessing the detector description information common to...
egammaLargeClusterCellRecoveryTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
ToolHandle< CaloClusterProcessor > m_caloFillRectangularTool
Tool to fill rectangular 7x11 cluster.
virtual StatusCode initialize() override
Initialize method.
virtual StatusCode execute(const xAOD::CaloCluster *cluster, const CaloDetDescrManager *cmgr, const CaloCellContainer *cell_container, Info &info) const override final
Method to recover large clusters.
float phiSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
bool inBarrel() const
Returns true if at least one clustered cell in the barrel.
bool inEndcap() const
Returns true if at least one clustered cell in the endcap.
float etaSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
bool inBarrel(const xAOD::CaloCluster &cluster, int is)
return boolean to know if we are in barrel/end-cap
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.