ATLAS Offline Software
Loading...
Searching...
No Matches
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
13
14#include <boost/container/static_vector.hpp>
15
16#include <utility>
17
18//
19// method implementations
20//
21
22namespace CP
23{
24
25 StatusCode OverlapRemovalAlg ::
26 initialize ()
27 {
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());
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};
69 {
70 ANA_CHECK (m_electronsHandle.getCopy (electrons, sys, ctx));
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));
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));
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));
93 addDecoration(taus, &m_tausSelectionHandle);
94 }
95 const xAOD::PhotonContainer *photons {nullptr};
97 {
98 ANA_CHECK (m_photonsHandle.getCopy (photons, sys, ctx));
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));
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ANA_MSG_ERROR(xmsg,...)
Macro printing error messages.
#define ANA_CHECK(EXP)
check whether the given expression was successful
static Double_t taus
SysWriteSelectionHandle m_tausSelectionHandle
SysCopyHandle< const xAOD::MuonContainer > m_muonsHandle
ToolHandle< ORUtils::IOverlapRemovalTool > m_overlapTool
The OR toolbox.
SysWriteSelectionHandle m_jetsSelectionHandle
SysCopyHandle< const xAOD::PhotonContainer > m_photonsHandle
Gaudi::Property< std::string > m_overlapRemovalDecoration
the tool output decoration for the overlap removal status
SysCopyHandle< const xAOD::JetContainer > m_fatJetsHandle
SysCopyHandle< const xAOD::ElectronContainer > m_electronsHandle
SysCopyHandle< const xAOD::JetContainer > m_jetsHandle
SysCopyHandle< const xAOD::TauJetContainer > m_tausHandle
SysWriteSelectionHandle m_photonsSelectionHandle
std::unique_ptr< const SG::Accessor< char > > m_overlapRemovalAccessor
the accessor for m_overlapRemovalDecoration
SysWriteSelectionHandle m_electronsSelectionHandle
the decoration for the overlap removal status
SysWriteSelectionHandle m_fatJetsSelectionHandle
SysListHandle m_systematicsList
the systematics list we run
SysWriteSelectionHandle m_muonsSelectionHandle
a data handle for writing systematically varied selection properties from objects
void handle(const Incident &inc)
receive the given incident
Class providing the definition of the 4-vector interface.
Select isolated Photons, Electrons and Muons.
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".
TauJetContainer_v3 TauJetContainer
Definition of the current "taujet container version".
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.