ATLAS Offline Software
Loading...
Searching...
No Matches
SysCopyHandle.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7
8#ifndef SYSTEMATICS_HANDLES__SYS_COPY_HANDLE_H
9#define SYSTEMATICS_HANDLES__SYS_COPY_HANDLE_H
10
22#include <functional>
23#include <string>
24#include <type_traits>
25#include <unordered_map>
26
27namespace CP
28{
33
62
63 template<typename T> class SysCopyHandle final
65 {
68 public:
69
82 template<typename T2>
83 SysCopyHandle (T2 *owner, const std::string& propertyName,
84 const std::string& propertyValue,
85 const std::string& propertyDescription);
86
87
94 template<typename T2>
95 SysCopyHandle (const std::string &inputName, const std::string &outputName, T2 *owner);
96
97
99 virtual bool empty () const noexcept override;
100
102 explicit operator bool () const noexcept;
103
105 virtual std::string getNamePattern () const override;
106
107
110 StatusCode initialize (SysListHandle& sysListHandle);
111 StatusCode initialize (SysListHandle& sysListHandle, SG::AllowEmptyEnum);
113
114
116 ::StatusCode getCopy (T*& object,
117 const CP::SystematicSet& sys,
118 const EventContext& ctx = Gaudi::Hive::currentContext()) const;
119
120
121
124 private:
125
127 virtual StatusCode
129 const CP::SystematicSet& fullAffecting,
130 const std::vector<CP::SystematicSet>& sysList) override;
131 virtual StatusCode
132 addDecorationDependency (const ISystematicsSvc& svc, const std::string& decoName, bool decoWrite) override;
133
134
135
138 private:
139
142
145
151
153 struct SysData
154 {
161 std::function<StatusCode(MsgStream&, T*&, const EventContext&)> getCopy;
162 };
163 std::unordered_map<CP::SystematicSet,SysData> m_sysData;
164
165
167 typedef std::decay<decltype(
168 *(std::declval<EL::AnaAlgorithm>().evtStore()))>::type StoreType;
169
176
184 std::function<StoreType*()> m_evtStoreGetter;
185
186#ifndef XAOD_STANDALONE
191 std::function<void(const DataObjID&, Gaudi::DataHandle::Mode)> m_addAlgDependency;
192#endif
193 };
194}
195
196#include "SysCopyHandle.icc"
197
198#endif
Property holding a SG store/key/clid from which a ReadHandle is made.
A property holding a SG store/key/clid from which a VarHandle is made.
#define private
a ISysHandleBase for a handle to a specific object/container
the interface for the central systematics service
virtual bool empty() const noexcept override
whether we have a name configured
virtual StatusCode addDecorationDependency(const ISystematicsSvc &svc, const std::string &decoName, bool decoWrite) override
add dependency information for the given decoration
SysCopyHandle(T2 *owner, const std::string &propertyName, const std::string &propertyValue, const std::string &propertyDescription)
Standard constructor.
std::unordered_map< CP::SystematicSet, SysData > m_sysData
virtual std::string getNamePattern() const override
get the name pattern before substitution
StatusCode initialize(SysListHandle &sysListHandle)
initialize this handle
SysCopyHandle(const std::string &inputName, const std::string &outputName, T2 *owner)
Construct directly without declaring properties.
std::string m_outputName
the (optional) name of the copy we create
StoreType * m_evtStore
the event store we use
::StatusCode getCopy(T *&object, const CP::SystematicSet &sys, const EventContext &ctx=Gaudi::Hive::currentContext()) const
retrieve the object for the given name
std::function< void(const DataObjID &, Gaudi::DataHandle::Mode)> m_addAlgDependency
a function to add a data dependency to the parent algorithm
std::function< StoreType *()> m_evtStoreGetter
the function to retrieve the event store
virtual CP::SystematicSet getInputAffecting(const ISystematicsSvc &svc) const override
std::decay< decltype(*(std::declval< EL::AnaAlgorithm >().evtStore()))>::type StoreType
the type of the event store we use
std::string m_inputName
the input name we use
std::string m_typeName
the (optional) type of the container
virtual StatusCode fillSystematics(const ISystematicsSvc &svc, const CP::SystematicSet &fullAffecting, const std::vector< CP::SystematicSet > &sysList) override
register and cache the systematics
a class managing the property to configure the list of systematics to process
Class to wrap a set of SystematicVariations.
base class to forward messages to another class
Select isolated Photons, Electrons and Muons.
=============================================================================
Forward declaration.
STL namespace.
the data held per-systematic (filled in initialize)
std::function< StatusCode(MsgStream &, T *&, const EventContext &)> getCopy
retrieve the (possibly copied) object for this systematic