ATLAS Offline Software
Loading...
Searching...
No Matches
EGPhotonBDTToolWrapper.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
10#include "xAODEgamma/Photon.h"
12
13namespace DerivationFramework {
14
17{
18 ATH_CHECK(m_selectorTool.retrieve());
19
20 ATH_CHECK(m_ContainerName.initialize());
22
23 ATH_CHECK(m_decoratorPass.initialize());
24 ATH_CHECK(m_decoratorIsEM.initialize());
25
26 return StatusCode::SUCCESS;
27}
28
29StatusCode
30EGPhotonBDTToolWrapper::addBranches(const EventContext& ctx) const
31{
32 // retrieve container
34 if(!m_fudgedContainerName.empty()){
36 particles = std::move(fudged);
37 } else {
39 particles = std::move(photons);
40 }
41
42 // Decorators
45 };
48 };
49
50 for (const auto& photon : *particles) {
51 // compute the output of the selector with the fudged photon
52 asg::AcceptData theAccept(m_selectorTool->accept(ctx, photon));
53 // compute the is EM word
54 unsigned int isEM = 0;
55 ATH_CHECK(m_selectorTool->execute(ctx, photon, isEM));
56
57 // decorate the original object
58 const xAOD::IParticle* original = m_fudgedContainerName.empty() ?
59 photon : xAOD::getOriginalObject(*photon);
60 if (m_cut.empty()) {
61 decoratorPass(*original) = static_cast<bool>(theAccept) ? 1 : 0;
62 } else {
63 decoratorPass(*original) = theAccept.getCutResult(m_cut) ? 1 : 0;
64 }
65 decoratorIsEM(*original) = isEM;
66 }
67
68 return StatusCode::SUCCESS;
69}
70}
#define ATH_CHECK
Evaluate an expression and check for errors.
Handle class for reading from StoreGate.
Handle class for adding a decoration to an object.
SG::WriteDecorHandleKey< xAOD::EgammaContainer > m_decoratorPass
SG::ReadHandleKey< xAOD::EgammaContainer > m_ContainerName
ToolHandle< IAsgEGammaIsEMSelector > m_selectorTool
SG::WriteDecorHandleKey< xAOD::EgammaContainer > m_decoratorIsEM
virtual StatusCode initialize() override final
virtual StatusCode addBranches(const EventContext &ctx) const override final
SG::ReadHandleKey< xAOD::EgammaContainer > m_fudgedContainerName
Handle class for adding a decoration to an object.
bool getCutResult(std::string_view cutName) const
Get the result of a cut, based on the cut name (safer).
Definition AcceptData.h:99
Class providing the definition of the 4-vector interface.
THE reconstruction tool.
::StatusCode StatusCode
StatusCode definition for legacy code.
const IParticle * getOriginalObject(const IParticle &copy)
This function can be used to conveniently get a pointer back to the original object from which a copy...