ATLAS Offline Software
SysWriteHandle.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_WRITE_HANDLE_H
9 #define SYSTEMATICS_HANDLES__SYS_WRITE_HANDLE_H
10 
17 #include <memory>
18 #include <string>
19 #include <unordered_map>
20 
21 class StatusCode;
22 
23 namespace CP
24 {
25  class SystematicSet;
26 
28 
29  template<typename T,typename Aux = void> class SysWriteHandle final
31  {
32  //
33  // public interface
34  //
35 
48  public:
49  template<typename T2>
50  SysWriteHandle (T2 *owner, const std::string& propertyName,
51  const std::string& propertyValue,
52  const std::string& propertyDescription);
53 
55  template <typename T2>
56  SysWriteHandle (const std::string &outputName, T2 *owner);
57 
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  template<typename X = Aux,typename = std::enable_if_t<std::is_same_v<X,void>>>
88  ::StatusCode record (std::unique_ptr<T> object,
90 
91 
93  public:
94  template<typename X = Aux,typename = std::enable_if_t<!std::is_same_v<X,void>>>
95  ::StatusCode record (std::unique_ptr<T> object,
96  std::unique_ptr<Aux> aux,
98 
99 
100 
101  //
102  // inherited interface
103  //
104 
105  private:
106  virtual CP::SystematicSet
108  virtual StatusCode
110  const CP::SystematicSet& fullAffecting,
111  const std::vector<CP::SystematicSet>& sysList) override;
112 
113 
114 
115  //
116  // private interface
117  //
118 
120  private:
121  std::string m_outputName;
122 
124  private:
125  std::unordered_map<CP::SystematicSet,std::string> m_outputNameCache;
126 
127 
129  private:
130  typedef std::decay<decltype(
131  *(std::declval<EL::AnaAlgorithm>().evtStore()))>::type StoreType;
132 
134  private:
135  StoreType *m_evtStore = nullptr;
136 
144  private:
145  std::function<StoreType*()> m_evtStoreGetter;
146  };
147 }
148 
149 #include "SysWriteHandle.icc"
150 
151 #endif
CP::SysWriteHandle::fillSystematics
virtual StatusCode fillSystematics(const ISystematicsSvc &svc, const CP::SystematicSet &fullAffecting, const std::vector< CP::SystematicSet > &sysList) override
register and cache the systematics
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
CP::SysWriteHandle
a data handle for writing systematics varied input data
Definition: SysWriteHandle.h:31
SysListHandle.h
CP::SysWriteHandle::getNamePattern
virtual std::string getNamePattern() const override
get the name pattern before substitution
SystematicSet.h
taskman.template
dictionary template
Definition: taskman.py:317
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
AsgMessagingForward.h
CP::SysWriteHandle::getName
const std::string & getName(const CP::SystematicSet &sys) const
get the name we record to the event store
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:562
CP::SysWriteHandle::m_outputName
std::string m_outputName
the output name we use
Definition: SysWriteHandle.h:121
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
CP::SysWriteHandle::SysWriteHandle
SysWriteHandle(T2 *owner, const std::string &propertyName, const std::string &propertyValue, const std::string &propertyDescription)
Standard constructor.
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
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::SysWriteHandle::m_evtStore
StoreType * m_evtStore
the event store we use
Definition: SysWriteHandle.h:135
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
vector
Definition: MultiHisto.h:13
CP::SysWriteHandle< ConstDataVector< xAOD::MuonContainer > >::StoreType
std::decay< decltype(*(std::declval< EL::AnaAlgorithm >).evtStore()))>::type StoreType
the type of the event store we use
Definition: SysWriteHandle.h:131
CP::SysWriteHandle::m_outputNameCache
std::unordered_map< CP::SystematicSet, std::string > m_outputNameCache
the cache of names we use
Definition: SysWriteHandle.h:125
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::SysWriteHandle::m_evtStoreGetter
std::function< StoreType *()> m_evtStoreGetter
the function to retrieve the event store
Definition: SysWriteHandle.h:145
CP::SysWriteHandle::getInputAffecting
virtual CP::SystematicSet getInputAffecting(const ISystematicsSvc &svc) const override
get the affecting systematics if this is an input handle
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
CP::SysWriteHandle::SysWriteHandle
SysWriteHandle(const std::string &outputName, T2 *owner)
Direct constructor which doesn't declare a property.
ISysHandleBase.h
python.Dumpers.typename
def typename(t)
Definition: Dumpers.py:194
lumiFormat.outputName
string outputName
Definition: lumiFormat.py:71
CP::SysWriteHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle)
initialize this handle
CP::SysWriteHandle::empty
virtual bool empty() const noexcept override
whether we have a name configured
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CP::SysWriteHandle::record
::StatusCode record(std::unique_ptr< T > object, const CP::SystematicSet &sys) const
record the object for the given systematic
VarHandleKey.h
A property holding a SG store/key/clid from which a VarHandle is made.