ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
AsgAnalysisAlgorithms
Root
OverlapRemovalAlg.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
8
//
9
// includes
10
//
11
12
#include <
AsgAnalysisAlgorithms/OverlapRemovalAlg.h
>
13
14
#include <boost/container/static_vector.hpp>
15
16
#include <utility>
17
18
//
19
// method implementations
20
//
21
22
namespace
CP
23
{
24
25
StatusCode OverlapRemovalAlg ::
26
initialize ()
27
{
28
if
(
m_overlapRemovalDecoration
.empty())
29
{
30
ANA_MSG_ERROR
(
"no overlap removal decoration name set"
);
31
return
StatusCode::FAILURE;
32
}
33
34
m_overlapRemovalAccessor
= std::make_unique<SG::Accessor<char> > (
m_overlapRemovalDecoration
);
35
36
ANA_CHECK
(
m_overlapTool
.retrieve());
37
ANA_CHECK
(
m_electronsHandle
.initialize (
m_systematicsList
,
SG::AllowEmpty
));
38
ANA_CHECK
(
m_electronsSelectionHandle
.initialize (
m_systematicsList
,
m_electronsHandle
,
SG::AllowEmpty
));
39
ANA_CHECK
(
m_muonsHandle
.initialize (
m_systematicsList
,
SG::AllowEmpty
));
40
ANA_CHECK
(
m_muonsSelectionHandle
.initialize (
m_systematicsList
,
m_muonsHandle
,
SG::AllowEmpty
));
41
ANA_CHECK
(
m_jetsHandle
.initialize (
m_systematicsList
,
SG::AllowEmpty
));
42
ANA_CHECK
(
m_jetsSelectionHandle
.initialize (
m_systematicsList
,
m_jetsHandle
,
SG::AllowEmpty
));
43
ANA_CHECK
(
m_tausHandle
.initialize (
m_systematicsList
,
SG::AllowEmpty
));
44
ANA_CHECK
(
m_tausSelectionHandle
.initialize (
m_systematicsList
,
m_tausHandle
,
SG::AllowEmpty
));
45
ANA_CHECK
(
m_photonsHandle
.initialize (
m_systematicsList
,
SG::AllowEmpty
));
46
ANA_CHECK
(
m_photonsSelectionHandle
.initialize (
m_systematicsList
,
m_photonsHandle
,
SG::AllowEmpty
));
47
ANA_CHECK
(
m_fatJetsHandle
.initialize (
m_systematicsList
,
SG::AllowEmpty
));
48
ANA_CHECK
(
m_fatJetsSelectionHandle
.initialize (
m_systematicsList
,
m_fatJetsHandle
,
SG::AllowEmpty
));
49
ANA_CHECK
(
m_systematicsList
.initialize());
50
return
StatusCode::SUCCESS;
51
}
52
53
54
55
StatusCode OverlapRemovalAlg ::
56
execute (
const
EventContext& ctx)
57
{
58
for
(
const
auto
& sys :
m_systematicsList
.systematicsVector())
59
{
60
// capacity is the number of object types handled below (electrons, muons, jets, taus, photons, fat jets)
61
boost::container::static_vector<std::pair<const xAOD::IParticleContainer *, const SysWriteSelectionHandle *>, 6> decorations;
62
auto
addDecoration = [&] (
const
xAOD::IParticleContainer
*container,
const
SysWriteSelectionHandle
*
handle
)
63
{
64
decorations.push_back ({container,
handle
});
65
};
66
67
const
xAOD::ElectronContainer
*electrons {
nullptr
};
68
if
(
m_electronsHandle
)
69
{
70
ANA_CHECK
(
m_electronsHandle
.getCopy (electrons, sys, ctx));
71
if
(
m_electronsSelectionHandle
)
72
addDecoration(electrons, &
m_electronsSelectionHandle
);
73
}
74
const
xAOD::MuonContainer
*muons {
nullptr
};
75
if
(
m_muonsHandle
)
76
{
77
ANA_CHECK
(
m_muonsHandle
.getCopy (muons, sys, ctx));
78
if
(
m_muonsSelectionHandle
)
79
addDecoration(muons, &
m_muonsSelectionHandle
);
80
}
81
const
xAOD::JetContainer
*jets {
nullptr
};
82
if
(
m_jetsHandle
)
83
{
84
ANA_CHECK
(
m_jetsHandle
.getCopy (jets, sys, ctx));
85
if
(
m_jetsSelectionHandle
)
86
addDecoration(jets, &
m_jetsSelectionHandle
);
87
}
88
const
xAOD::TauJetContainer
*
taus
{
nullptr
};
89
if
(
m_tausHandle
)
90
{
91
ANA_CHECK
(
m_tausHandle
.getCopy (
taus
, sys, ctx));
92
if
(
m_tausSelectionHandle
)
93
addDecoration(
taus
, &
m_tausSelectionHandle
);
94
}
95
const
xAOD::PhotonContainer
*photons {
nullptr
};
96
if
(
m_photonsHandle
)
97
{
98
ANA_CHECK
(
m_photonsHandle
.getCopy (photons, sys, ctx));
99
if
(
m_photonsSelectionHandle
)
100
addDecoration(photons, &
m_photonsSelectionHandle
);
101
}
102
const
xAOD::JetContainer
*fatJets {
nullptr
};
103
if
(
m_fatJetsHandle
)
104
{
105
ANA_CHECK
(
m_fatJetsHandle
.getCopy (fatJets, sys, ctx));
106
if
(
m_fatJetsSelectionHandle
)
107
addDecoration(fatJets, &
m_fatJetsSelectionHandle
);
108
}
109
110
ATH_CHECK
(
m_overlapTool
->removeOverlaps (electrons, muons, jets,
taus
,
111
photons, fatJets));
112
113
// Re-decorate if needed
114
for
(
const
auto
& [container,
handle
] : decorations)
115
{
116
for
(
const
xAOD::IParticle
*particle : *container)
117
{
118
handle
->setBool
119
(*particle, (*
m_overlapRemovalAccessor
) (*particle), sys);
120
}
121
}
122
}
123
124
return
StatusCode::SUCCESS;
125
}
126
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg,...)
Macro printing error messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:295
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:325
taus
static Double_t taus
Definition
LArPhysWaveHECTool.cxx:37
OverlapRemovalAlg.h
CP::OverlapRemovalAlg::m_tausSelectionHandle
SysWriteSelectionHandle m_tausSelectionHandle
Definition
OverlapRemovalAlg.h:68
CP::OverlapRemovalAlg::m_muonsHandle
SysCopyHandle< const xAOD::MuonContainer > m_muonsHandle
Definition
OverlapRemovalAlg.h:49
CP::OverlapRemovalAlg::m_overlapTool
ToolHandle< ORUtils::IOverlapRemovalTool > m_overlapTool
The OR toolbox.
Definition
OverlapRemovalAlg.h:40
CP::OverlapRemovalAlg::m_jetsSelectionHandle
SysWriteSelectionHandle m_jetsSelectionHandle
Definition
OverlapRemovalAlg.h:66
CP::OverlapRemovalAlg::m_photonsHandle
SysCopyHandle< const xAOD::PhotonContainer > m_photonsHandle
Definition
OverlapRemovalAlg.h:55
CP::OverlapRemovalAlg::m_overlapRemovalDecoration
Gaudi::Property< std::string > m_overlapRemovalDecoration
the tool output decoration for the overlap removal status
Definition
OverlapRemovalAlg.h:77
CP::OverlapRemovalAlg::m_fatJetsHandle
SysCopyHandle< const xAOD::JetContainer > m_fatJetsHandle
Definition
OverlapRemovalAlg.h:57
CP::OverlapRemovalAlg::m_electronsHandle
SysCopyHandle< const xAOD::ElectronContainer > m_electronsHandle
Definition
OverlapRemovalAlg.h:47
CP::OverlapRemovalAlg::m_jetsHandle
SysCopyHandle< const xAOD::JetContainer > m_jetsHandle
Definition
OverlapRemovalAlg.h:51
CP::OverlapRemovalAlg::m_tausHandle
SysCopyHandle< const xAOD::TauJetContainer > m_tausHandle
Definition
OverlapRemovalAlg.h:53
CP::OverlapRemovalAlg::m_photonsSelectionHandle
SysWriteSelectionHandle m_photonsSelectionHandle
Definition
OverlapRemovalAlg.h:70
CP::OverlapRemovalAlg::m_overlapRemovalAccessor
std::unique_ptr< const SG::Accessor< char > > m_overlapRemovalAccessor
the accessor for m_overlapRemovalDecoration
Definition
OverlapRemovalAlg.h:81
CP::OverlapRemovalAlg::m_electronsSelectionHandle
SysWriteSelectionHandle m_electronsSelectionHandle
the decoration for the overlap removal status
Definition
OverlapRemovalAlg.h:62
CP::OverlapRemovalAlg::m_fatJetsSelectionHandle
SysWriteSelectionHandle m_fatJetsSelectionHandle
Definition
OverlapRemovalAlg.h:72
CP::OverlapRemovalAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition
OverlapRemovalAlg.h:44
CP::OverlapRemovalAlg::m_muonsSelectionHandle
SysWriteSelectionHandle m_muonsSelectionHandle
Definition
OverlapRemovalAlg.h:64
CP::SysWriteSelectionHandle
a data handle for writing systematically varied selection properties from objects
Definition
SysWriteSelectionHandle.h:32
EL::AnaAlgorithm::handle
void handle(const Incident &inc)
receive the given incident
Definition
AnaAlgorithm.cxx:524
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition
Event/xAOD/xAODBase/xAODBase/IParticle.h:41
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:29
xAOD::PhotonContainer
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
Definition
Event/xAOD/xAODEgamma/xAODEgamma/PhotonContainer.h:17
xAOD::ElectronContainer
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
Definition
Event/xAOD/xAODEgamma/xAODEgamma/ElectronContainer.h:17
xAOD::JetContainer
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Definition
JetContainer.h:17
xAOD::TauJetContainer
TauJetContainer_v3 TauJetContainer
Definition of the current "taujet container version".
Definition
TauJetContainer.h:17
xAOD::MuonContainer
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
Definition
Event/xAOD/xAODMuon/xAODMuon/MuonContainer.h:14
xAOD::IParticleContainer
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
Definition
xAOD/xAODBase/xAODBase/IParticleContainer.h:32
Generated on
for ATLAS Offline Software by
1.17.0