ATLAS Offline Software
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 
18 #include <string>
19 #include <tuple>
20 #include <unordered_map>
21 
22 class StatusCode;
23 
24 namespace CP
25 {
30 
59 
60  template<typename T> class SysCopyHandle final
62  {
63  //
64  // public interface
65  //
66 
81  public:
82  template<typename T2>
83  SysCopyHandle (T2 *owner, const std::string& propertyName,
84  const std::string& propertyValue,
85  const std::string& propertyDescription);
86 
95  template<typename T2>
96  SysCopyHandle (const std::string &inputName, const std::string &outputName, T2 *owner);
97 
98 
100  public:
101  virtual bool empty () const noexcept override;
102 
104  public:
105  explicit operator bool () const noexcept;
106 
108  public:
109  virtual std::string getNamePattern () const override;
110 
111 
114  public:
118 
119 
121  public:
122  ::StatusCode getCopy (T*& object,
124 
125 
126 
127  //
128  // inherited interface
129  //
130 
131  private:
133  virtual StatusCode
135  const CP::SystematicSet& fullAffecting,
136  const std::vector<CP::SystematicSet>& sysList) override;
137 
138 
139 
140  //
141  // private interface
142  //
143 
145  private:
146  std::string m_inputName;
147 
149  private:
150  std::string m_outputName;
151 
153  private:
154  std::unordered_map<CP::SystematicSet,std::tuple<std::string,std::string,std::string> > m_nameCache;
155 
156 
158  private:
159  typedef std::decay<decltype(
160  *(std::declval<EL::AnaAlgorithm>().evtStore()))>::type StoreType;
161 
163  private:
164  StoreType *m_evtStore = nullptr;
165 
173  private:
174  std::function<StoreType*()> m_evtStoreGetter;
175  };
176 }
177 
178 #include "SysCopyHandle.icc"
179 
180 #endif
CP::SysCopyHandle::m_evtStoreGetter
std::function< StoreType *()> m_evtStoreGetter
the function to retrieve the event store
Definition: SysCopyHandle.h:174
CP::SysCopyHandle::empty
virtual bool empty() const noexcept override
whether we have a name configured
CP::SysCopyHandle::m_nameCache
std::unordered_map< CP::SystematicSet, std::tuple< std::string, std::string, std::string > > m_nameCache
the cache of names we use
Definition: SysCopyHandle.h:154
CP::SysCopyHandle::fillSystematics
virtual StatusCode fillSystematics(const ISystematicsSvc &svc, const CP::SystematicSet &fullAffecting, const std::vector< CP::SystematicSet > &sysList) override
register and cache the systematics
CP::SysCopyHandle::m_outputName
std::string m_outputName
the (optional) name of the copy we create
Definition: SysCopyHandle.h:150
CP::SysListHandle
a class managing the property to configure the list of systematics to process
Definition: SysListHandle.h:33
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
CP::ISystematicsSvc
the interface for the central systematics service
Definition: ISystematicsSvc.h:25
asg::AsgMessagingForward
base class to forward messages to another class
Definition: AsgMessagingForward.h:29
SysListHandle.h
CP::SysCopyHandle::getCopy
::StatusCode getCopy(T *&object, const CP::SystematicSet &sys) const
retrieve the object for the given name
SystematicSet.h
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
AsgMessagingForward.h
CP::SysCopyHandle::getInputAffecting
virtual CP::SystematicSet getInputAffecting(const ISystematicsSvc &svc) const override
get the affecting systematics if this is an input handle
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
ISystematicsSvc.h
AnaAlgorithm.h
SG::AllowEmptyEnum
AllowEmptyEnum
Definition: StoreGate/StoreGate/VarHandleKey.h:29
CP::ISysHandleBase
a basic interface for all systematics handles
Definition: ISysHandleBase.h:28
CP::SysCopyHandle::SysCopyHandle
SysCopyHandle(T2 *owner, const std::string &propertyName, const std::string &propertyValue, const std::string &propertyDescription)
Standard constructor.
CP::SysCopyHandle< const DataVector >::StoreType
std::decay< decltype(*(std::declval< EL::AnaAlgorithm >).evtStore()))>::type StoreType
the type of the event store we use
Definition: SysCopyHandle.h:160
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
vector
Definition: MultiHisto.h:13
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
CP::SysCopyHandle::getNamePattern
virtual std::string getNamePattern() const override
get the name pattern before substitution
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
ISysHandleBase.h
lumiFormat.outputName
string outputName
Definition: lumiFormat.py:65
CP::SysCopyHandle::m_inputName
std::string m_inputName
the input name we use
Definition: SysCopyHandle.h:146
CP::SysCopyHandle
a systematics data handle that will either copy the input object or act like an update handle
Definition: SysCopyHandle.h:62
CP::SysCopyHandle::SysCopyHandle
SysCopyHandle(const std::string &inputName, const std::string &outputName, T2 *owner)
Construct directly without declaring properties.
CP::SysCopyHandle::m_evtStore
StoreType * m_evtStore
the event store we use
Definition: SysCopyHandle.h:164
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CP::SysCopyHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle)
initialize this handle
VarHandleKey.h
A property holding a SG store/key/clid from which a VarHandle is made.