ATLAS Offline Software
SysReadHandle.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 #ifndef SYSTEMATICS_HANDLES__SYS_READ_HANDLE_H
9 #define SYSTEMATICS_HANDLES__SYS_READ_HANDLE_H
10 
16 #include <string>
17 #include <type_traits>
18 #include <unordered_map>
19 
20 class StatusCode;
21 
22 namespace CP
23 {
24  class SysListHandle;
25  class SystematicSet;
26 
27 
29 
30  template<typename T> class SysReadHandle final
32  {
33  //
34  // public interface
35  //
36 
49  public:
50  template<typename T2>
51  SysReadHandle (T2 *owner, const std::string& propertyName,
52  const std::string& propertyValue,
53  const std::string& propertyDescription);
54 
56  template<typename T2>
57  SysReadHandle (const std::string &inputName, T2 *owner);
58 
60  public:
61  virtual bool empty () const noexcept override;
62 
64  public:
65  explicit operator bool () const noexcept;
66 
68  public:
69  virtual std::string getNamePattern () const override;
70 
71 
74  public:
78 
79 
81  public:
83 
84 
86  public:
87  ::StatusCode retrieve (const T*& object,
89 
93  public:
95 
96  //
97  // inherited interface
98  //
99 
100  private:
101  virtual CP::SystematicSet
103  virtual StatusCode
105  const CP::SystematicSet& fullAffecting,
106  const std::vector<CP::SystematicSet>& sysList) override;
107 
108 
109 
110  //
111  // private interface
112  //
113 
115  private:
116  std::string m_inputName;
117 
119  private:
120  std::unordered_map<CP::SystematicSet,std::string> m_inputNameCache;
121 
122 
124  private:
125  typedef std::decay<decltype(
126  *(std::declval<EL::AnaAlgorithm>().evtStore()))>::type StoreType;
127 
129  private:
130  StoreType *m_evtStore = nullptr;
131 
139  private:
140  std::function<StoreType*()> m_evtStoreGetter;
141  };
142 }
143 
144 #include "SysReadHandle.icc"
145 
146 #endif
CP::SysReadHandle::isValid
bool isValid(const CP::SystematicSet &sys) const
check if the object is available Note that this should only be used in special use cases and may be r...
CP::SysReadHandle::m_evtStore
StoreType * m_evtStore
the event store we use
Definition: SysReadHandle.h:130
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
SystematicSet.h
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
AsgMessagingForward.h
CP::SysReadHandle::retrieve
::StatusCode retrieve(const T *&object, const CP::SystematicSet &sys) const
retrieve the object for the given name
CP::SysReadHandle::m_evtStoreGetter
std::function< StoreType *()> m_evtStoreGetter
the function to retrieve the event store
Definition: SysReadHandle.h:140
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:562
CP::SysReadHandle
a data handle for reading systematics varied input data
Definition: SysReadHandle.h:32
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
AnaAlgorithm.h
SG::AllowEmptyEnum
AllowEmptyEnum
Definition: StoreGate/StoreGate/VarHandleKey.h:29
CP::SysReadHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle)
initialize this handle
CP::ISysHandleBase
a basic interface for all systematics handles
Definition: ISysHandleBase.h:28
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
vector
Definition: MultiHisto.h:13
CP::SysReadHandle::fillSystematics
virtual StatusCode fillSystematics(const ISystematicsSvc &svc, const CP::SystematicSet &fullAffecting, const std::vector< CP::SystematicSet > &sysList) override
register and cache the systematics
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::SysReadHandle::m_inputNameCache
std::unordered_map< CP::SystematicSet, std::string > m_inputNameCache
the cache of names we use
Definition: SysReadHandle.h:120
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
ISysHandleBase.h
CP::SysReadHandle< xAOD::JetContainer >::StoreType
std::decay< decltype(*(std::declval< EL::AnaAlgorithm >).evtStore()))>::type StoreType
the type of the event store we use
Definition: SysReadHandle.h:126
CP::SysReadHandle::SysReadHandle
SysReadHandle(const std::string &inputName, T2 *owner)
Direct constructor which doesn't declare a property.
CP::SysReadHandle::SysReadHandle
SysReadHandle(T2 *owner, const std::string &propertyName, const std::string &propertyValue, const std::string &propertyDescription)
Standard constructor.
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CP::SysReadHandle::getInputAffecting
virtual CP::SystematicSet getInputAffecting(const ISystematicsSvc &svc) const override
get the affecting systematics if this is an input handle
CP::SysReadHandle::getName
const std::string & getName(const CP::SystematicSet &sys) const
get the name we retrieve from the event store
CP::SysReadHandle::getNamePattern
virtual std::string getNamePattern() const override
get the name pattern before substitution
CP::SysReadHandle::m_inputName
std::string m_inputName
the input name we use
Definition: SysReadHandle.h:116
CP::SysReadHandle::empty
virtual bool empty() const noexcept override
whether we have a name configured
VarHandleKey.h
A property holding a SG store/key/clid from which a VarHandle is made.