ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
DerivationFramework
DerivationFrameworkEGamma
src
EGPhotonBDTToolDecorator.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
DerivationFrameworkEGamma/EGPhotonBDTToolDecorator.h
"
6
#include "
StoreGate/ReadHandle.h
"
7
#include "
StoreGate/WriteDecorHandle.h
"
8
#include "
PATCore/AcceptData.h
"
9
#include "
xAODEgamma/Electron.h
"
10
#include "
xAODEgamma/Photon.h
"
11
#include "
xAODBase/IParticleHelpers.h
"
12
13
namespace
DerivationFramework
{
14
15
StatusCode
16
EGPhotonBDTToolDecorator::initialize
()
17
{
18
ATH_CHECK
(
m_observableTool
.retrieve());
19
20
ATH_CHECK
(
m_ContainerName
.initialize());
21
ATH_CHECK
(
m_fudgedContainerName
.initialize(!
m_fudgedContainerName
.empty()));
22
23
ATH_CHECK
(
m_decoratorScore
.initialize());
24
25
return
StatusCode::SUCCESS;
26
}
27
28
StatusCode
29
EGPhotonBDTToolDecorator::addBranches
(
const
EventContext& ctx)
const
30
{
31
// retrieve container
32
SG::ReadHandle<xAOD::EgammaContainer>
particles;
33
if
(!
m_fudgedContainerName
.empty()){
34
SG::ReadHandle<xAOD::EgammaContainer>
fudged{
m_fudgedContainerName
, ctx };
35
particles = std::move(fudged);
36
}
else
{
37
SG::ReadHandle<xAOD::EgammaContainer>
photons{
m_ContainerName
, ctx };
38
particles = std::move(photons);
39
}
40
41
// Decorators
42
SG::WriteDecorHandle<xAOD::EgammaContainer, float>
decoratorScore{
43
m_decoratorScore
, ctx
44
};
45
46
for
(
const
auto
& photon : *particles) {
47
// compute the BDT score with the fudged photon
48
const
float
score =
m_observableTool
->evaluate(photon);
49
50
// decorate the original object
51
const
xAOD::IParticle
* original =
m_fudgedContainerName
.empty() ?
52
photon :
xAOD::getOriginalObject
(*photon);
53
decoratorScore(*original) = score;
54
}
55
56
return
StatusCode::SUCCESS;
57
}
58
}
AcceptData.h
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
EGPhotonBDTToolDecorator.h
Electron.h
Photon.h
IParticleHelpers.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteDecorHandle.h
Handle class for adding a decoration to an object.
DerivationFramework::EGPhotonBDTToolDecorator::addBranches
virtual StatusCode addBranches(const EventContext &ctx) const override final
Definition
EGPhotonBDTToolDecorator.cxx:29
DerivationFramework::EGPhotonBDTToolDecorator::m_fudgedContainerName
SG::ReadHandleKey< xAOD::EgammaContainer > m_fudgedContainerName
Definition
EGPhotonBDTToolDecorator.h:38
DerivationFramework::EGPhotonBDTToolDecorator::initialize
virtual StatusCode initialize() override final
Definition
EGPhotonBDTToolDecorator.cxx:16
DerivationFramework::EGPhotonBDTToolDecorator::m_ContainerName
SG::ReadHandleKey< xAOD::EgammaContainer > m_ContainerName
Definition
EGPhotonBDTToolDecorator.h:36
DerivationFramework::EGPhotonBDTToolDecorator::m_observableTool
ToolHandle< IPhotonObservableTool > m_observableTool
Definition
EGPhotonBDTToolDecorator.h:34
DerivationFramework::EGPhotonBDTToolDecorator::m_decoratorScore
SG::WriteDecorHandleKey< xAOD::EgammaContainer > m_decoratorScore
Definition
EGPhotonBDTToolDecorator.h:41
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition
StoreGate/StoreGate/WriteDecorHandle.h:100
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition
Event/xAOD/xAODBase/xAODBase/IParticle.h:41
DerivationFramework
THE reconstruction tool.
Definition
CascadeTools.h:16
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::getOriginalObject
const IParticle * getOriginalObject(const IParticle ©)
This function can be used to conveniently get a pointer back to the original object from which a copy...
Definition
IParticleHelpers.cxx:140
Generated on
for ATLAS Offline Software by
1.17.0