ATLAS Offline Software
SystObjectUnioniserAlg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 
4  SystObjectUnioniserAlg:
5  This alg takes a set of systematic variation containers which have
6  been filtered, then using the links set by SystObjectLinkerAlg
7  constructs new containers holding the objects that are in any
8  of the filtered variation containers.
9 
10  This is templated to support recording the union containers as
11  the concrete type, not least because xAOD::IParticleContainer has
12  no CollectionProxy to support writing with AsgxAODNTupleMakerAlg.
13 
14 */
15 
17 
18 
19 // Always protect against multiple includes!
20 #ifndef CP_SYSTUNIONISERALG
21 #define CP_SYSTUNIONISERALG
22 
23 #include <vector>
24 #include <unordered_map>
25 #include <utility>
26 #include <memory>
27 
34 #ifdef XAOD_STANDALONE
36 #endif
37 
41 #include <xAODJet/Jet.h>
42 #include <xAODJet/JetContainer.h>
43 #include <xAODEgamma/Electron.h>
45 #include <xAODEgamma/Photon.h>
47 #include <xAODMuon/Muon.h>
48 #include <xAODMuon/MuonContainer.h>
49 #include <xAODTau/TauJet.h>
51 #include <xAODTau/DiTauJet.h>
53 
54 class EventContext;
55 
56 namespace CP
57 {
59 
60  // We need separate template parameters for the object type
61  // and container, as DataVector<xAOD::Blah_v1> does not have
62  // a classID, where BlahContainer does.
63  template<class T, class C>
65  {
67 public:
69 
72  StatusCode initialize() override;
74  StatusCode execute(const EventContext& ctx) const override;
76 
77 private:
78 
79  // Members for configurable properties
80 
83 
86  m_inputHandle{ this, "input", "", "Container to read" };
87 
90  m_outputHandle{this, "output", "", "Collection holding all objects passing any systematic"};
91 
93  Gaudi::Property<std::string> m_syst_decor_pattern
94  { this, "systVarLink_template", "systVarLink_%SYS%", "Pattern to be substituted with systematics names"};
95 
97  std::unordered_map<size_t,SG::AuxElement::ConstAccessor<iplink_t> >
99  };
100 
101  // Define the following classes concretely for source code configuration.
108 
109  // Trivial subclassing for more convenient python configuration
110  // Otherwise genConf creates a horribly mangled templated name
111  // even if typedef'ed
113  {
114  public:
115  SystJetUnioniserAlg(const std::string &name,ISvcLocator *pSvcLocator)
116  : SystObjectUnioniserAlg<xAOD::Jet,xAOD::JetContainer>(name, pSvcLocator) {};
117  };
118 
120  {
121  public:
122  SystElectronUnioniserAlg(const std::string &name,ISvcLocator *pSvcLocator)
124  };
125 
127  {
128  public:
129  SystPhotonUnioniserAlg(const std::string &name,ISvcLocator *pSvcLocator)
131  };
132 
134  {
135  public:
136  SystMuonUnioniserAlg(const std::string &name,ISvcLocator *pSvcLocator)
137  : SystObjectUnioniserAlg<xAOD::Muon,xAOD::MuonContainer>(name, pSvcLocator) {};
138  };
139 
141  {
142  public:
143  SystTauUnioniserAlg(const std::string &name,ISvcLocator *pSvcLocator)
145  };
146 
148  {
149  public:
150  SystDiTauUnioniserAlg(const std::string &name,ISvcLocator *pSvcLocator)
152  };
153 
154 }
155 
157 
158 #endif
CP::SystObjectUnioniserAlg::m_systematicsList
CP::SysListHandle m_systematicsList
We use default finalize() – this is for cleanup, and we don't do any.
Definition: SystObjectUnioniserAlg.h:82
Jet.h
PropertyWrapper.h
CP::SystObjectUnioniserAlg::m_syst_decor_pattern
Gaudi::Property< std::string > m_syst_decor_pattern
The systematics link decoration name template.
Definition: SystObjectUnioniserAlg.h:94
CP::SysListHandle
a class managing the property to configure the list of systematics to process
Definition: SysListHandle.h:33
CP::SystObjectUnioniserAlg::execute
StatusCode execute(const EventContext &ctx) const override
Execute method, for actions to be taken in the event loop.
CP::SysWriteHandle
a data handle for writing systematics varied input data
Definition: SysWriteHandle.h:31
Muon.h
ConstDataVector.h
DataVector adapter that acts like it holds const pointers.
SysListHandle.h
SystematicSet.h
CP::SystObjectUnioniserAlg
Definition: SystObjectUnioniserAlg.h:65
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
DiTauJetContainer.h
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
CP::SysReadHandle< C >
CP::SystDiTauUnioniserAlg
Definition: SystObjectUnioniserAlg.h:148
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
SysReadHandle.h
SysWriteHandle.h
SystObjectUnioniserAlg.icc
CP::SystPhotonUnioniserAlg::SystPhotonUnioniserAlg
SystPhotonUnioniserAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: SystObjectUnioniserAlg.h:129
ElectronContainer.h
CP::SystJetUnioniserAlg
Definition: SystObjectUnioniserAlg.h:113
CP::SystMuonUnioniserAlg
Definition: SystObjectUnioniserAlg.h:134
Photon.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
IParticleContainer.h
xAOD::TauJet_v3
Class describing a tau jet.
Definition: TauJet_v3.h:41
CP::SystPhotonUnioniserAlg
Definition: SystObjectUnioniserAlg.h:127
CP::SystTauUnioniserAlg
Definition: SystObjectUnioniserAlg.h:141
TauJetContainer.h
CP::SystDiTauUnioniserAlg::SystDiTauUnioniserAlg
SystDiTauUnioniserAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: SystObjectUnioniserAlg.h:150
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
DiTauJet.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
EL::AnaReentrantAlgorithm::AnaReentrantAlgorithm
AnaReentrantAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
Definition: AnaReentrantAlgorithm.cxx:29
ISysHandleBase.h
xAOD::Electron_v1
Definition: Electron_v1.h:34
EL::AnaReentrantAlgorithm
the base class for EventLoop reentrant algorithms
Definition: AnaReentrantAlgorithm.h:51
MuonContainer.h
CP::SystElectronUnioniserAlg::SystElectronUnioniserAlg
SystElectronUnioniserAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: SystObjectUnioniserAlg.h:122
CP::SystObjectUnioniserAlg::initialize
StatusCode initialize() override
Initialisation method, for setting up tools and other persistent configs.
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
JetContainer.h
xAOD::Photon_v1
Definition: Photon_v1.h:37
AnaReentrantAlgorithm.h
CP::SystTauUnioniserAlg::SystTauUnioniserAlg
SystTauUnioniserAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: SystObjectUnioniserAlg.h:143
CP::SystObjectUnioniserAlg::m_syst_link_acc
std::unordered_map< size_t, SG::AuxElement::ConstAccessor< iplink_t > > m_syst_link_acc
Build a map of syst hash to ConstAccessors to read the systematics links.
Definition: SystObjectUnioniserAlg.h:98
TauJet.h
xAOD::DiTauJet_v1
Definition: DiTauJet_v1.h:31
CP::SystObjectUnioniserAlg::m_inputHandle
CP::SysReadHandle< C > m_inputHandle
Setup syst-aware input container handles.
Definition: SystObjectUnioniserAlg.h:86
CP::SystObjectUnioniserAlg::m_outputHandle
CP::SysWriteHandle< ConstDataVector< C > > m_outputHandle
Setup syst-aware output container handles, templated to generate appropriate type.
Definition: SystObjectUnioniserAlg.h:90
Electron.h
CP::SystJetUnioniserAlg::SystJetUnioniserAlg
SystJetUnioniserAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: SystObjectUnioniserAlg.h:115
CP::iplink_t
ElementLink< xAOD::IParticleContainer > iplink_t
Definition: SystObjectUnioniserAlg.h:58
CP::SystMuonUnioniserAlg::SystMuonUnioniserAlg
SystMuonUnioniserAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: SystObjectUnioniserAlg.h:136
PhotonContainer.h
CP::SystElectronUnioniserAlg
Definition: SystObjectUnioniserAlg.h:120