ATLAS Offline Software
Loading...
Searching...
No Matches
IsoCloseByCaloDecorAlg.cxx
Go to the documentation of this file.
1
2/*
3 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
4*/
6
10
11namespace CP {
16
21
22 IsoCloseByCaloDecorAlg::IsoCloseByCaloDecorAlg(const std::string& name, ISvcLocator* svcLoc) : AthReentrantAlgorithm(name, svcLoc) {}
24 ATH_CHECK(m_primPartKey.initialize());
25 ATH_CHECK(m_closeByCorrTool.retrieve());
26 if (m_decorClust) {
27 for (const std::string& decor : IsolationCloseByCorrectionTool::caloDecors()) {
28 m_decorKeys.emplace_back(m_primPartKey.key() + "." + decor);
29 }
30 }
31 if (m_decorPflow) {
32 for (const std::string& decor : IsolationCloseByCorrectionTool::pflowDecors()) {
33 m_decorKeys.emplace_back(m_primPartKey.key() + "." + decor);
34 }
35 }
36
37 ATH_CHECK(m_decorKeys.initialize());
38 if (!m_decorClust && !m_decorPflow) {
39 ATH_MSG_FATAL("Nothing is done by me. It's bogous scheduling me");
40 return StatusCode::FAILURE;
41 }
42 return StatusCode::SUCCESS;
43 }
44
45 StatusCode IsoCloseByCaloDecorAlg::execute(const EventContext& ctx) const {
47 if (!readHandle.isValid()) {
48 ATH_MSG_FATAL("Failed to retrieve particle collection " << m_primPartKey.fullKey());
49 return StatusCode::FAILURE;
50 }
51
52 for (const xAOD::IParticle* part : *readHandle) {
53 float eta{0.f}, phi{0.f}, ene{0.f};
54 if (m_decorClust) {
55 m_closeByCorrTool->associateCluster(part, eta, phi, ene);
56 dec_assocCaloEta(*part) = eta;
57 dec_assocCaloPhi(*part) = phi;
58 dec_assocCaloEne(*part) = ene;
59 dec_assocCaloIsDec(*part) = true;
60 }
61 if (!m_decorPflow) continue;
62 m_closeByCorrTool->associateFlowElement(ctx, part, eta, phi, ene);
63 dec_assocPflowEta(*part) = eta;
64 dec_assocPflowPhi(*part) = phi;
65 dec_assocPflowEne(*part) = ene;
66 dec_assocPflowIsDec(*part) = true;
67 }
68 return StatusCode::SUCCESS;
69 }
70} // namespace CP
Scalar eta() const
pseudorapidity method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
Handle class for reading a decoration on an object.
Handle class for reading from StoreGate.
An algorithm that can be simultaneously executed in multiple threads.
Gaudi::Property< bool > m_decorClust
SG::WriteDecorHandleKeyArray< xAOD::IParticleContainer > m_decorKeys
StatusCode execute(const EventContext &ctx) const override
Gaudi::Property< bool > m_decorPflow
SG::ReadHandleKey< xAOD::IParticleContainer > m_primPartKey
Input containers to retrieve from the storegate.
IsoCloseByCaloDecorAlg(const std::string &name, ISvcLocator *svcLoc)
ToolHandle< CP::IIsolationCloseByCorrectionTool > m_closeByCorrTool
These tools shall be configured to pick up the same Inner detector tracks as for the isolation buildi...
static const caloDecorNames & caloDecors()
Returns an array with the calo cluster decoration names [0]-> eta, [1]->phi, [2]->energy....
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Class providing the definition of the 4-vector interface.
Select isolated Photons, Electrons and Muons.
static const FloatDecorator dec_assocCaloEne
static const FloatDecorator dec_assocPflowEta
static const FloatDecorator dec_assocCaloEta
static const FloatDecorator dec_assocCaloPhi
static const CharDecorator dec_assocCaloIsDec
static const FloatDecorator dec_assocPflowPhi
static const CharDecorator dec_assocPflowIsDec
static const FloatDecorator dec_assocPflowEne