ATLAS Offline Software
SysWriteDecorHandle.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_WRITE_DECOR_HANDLE_H
9 #define SYSTEMATICS_HANDLES__SYS_WRITE_DECOR_HANDLE_H
10 
19 #include <string>
20 #include <type_traits>
21 #include <unordered_map>
22 
23 class StatusCode;
24 
25 namespace CP
26 {
27  class SystematicSet;
28 
31  constexpr float invalidScaleFactor () {return -1;}
32 
35  constexpr float invalidEfficiency () {return -1;}
36 
37 
39 
40  template<typename T> class SysWriteDecorHandle final
42  {
43  //
44  // public interface
45  //
46 
59  public:
60  template<typename T2>
61  SysWriteDecorHandle (T2 *owner, const std::string& propertyName,
62  const std::string& propertyValue,
63  const std::string& propertyDescription);
64 
66  template<typename T2>
67  SysWriteDecorHandle (const std::string& decorName, T2 *owner);
68 
70  public:
71  virtual bool empty () const noexcept override;
72 
74  public:
75  explicit operator bool () const noexcept;
76 
81  private:
82  virtual std::string getNamePattern () const override;
83 
84 
87  public:
88  StatusCode initialize (SysListHandle& sysListHandle, const ISysHandleBase& objectHandle);
91 
92 
94  public:
96 
97 
99  public:
100  void set (const SG::AuxElement& object, const T& value,
102 
103 
104 
105  //
106  // inherited interface
107  //
108 
109  private:
110  virtual CP::SystematicSet
112  virtual StatusCode
114  const CP::SystematicSet& fullAffecting,
115  const std::vector<CP::SystematicSet>& sysList) override;
116 
117 
118 
119  //
120  // private interface
121  //
122 
124  private:
125  std::string m_decorName;
126 
128  private:
130 
132  private:
133  std::unordered_map<CP::SystematicSet,std::tuple<std::string,SG::AuxElement::Decorator<T> > > m_dataCache;
134 
136  private:
137  const auto&
138  getData (const CP::SystematicSet& sys) const;
139  };
140 
141  template <typename T>
143 }
144 
145 #include "SysWriteDecorHandle.icc"
146 
147 #endif
CP::SysWriteDecorHandle::fillSystematics
virtual StatusCode fillSystematics(const ISystematicsSvc &svc, const CP::SystematicSet &fullAffecting, const std::vector< CP::SystematicSet > &sysList) override
register and cache the systematics
CP::SysWriteDecorHandle::set
void set(const SG::AuxElement &object, const T &value, const CP::SystematicSet &sys) const
set the object decoration for the given systematic
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::SysWriteDecorHandle::getNamePattern
virtual std::string getNamePattern() const override
get the name pattern before substitution
SysListHandle.h
CP::SysWriteDecorHandle::getInputAffecting
virtual CP::SystematicSet getInputAffecting(const ISystematicsSvc &svc) const override
get the affecting systematics if this is an input handle
SystematicSet.h
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
AsgMessagingForward.h
athena.value
value
Definition: athena.py:124
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
CP::SysWriteDecorHandle::m_dataCache
std::unordered_map< CP::SystematicSet, std::tuple< std::string, SG::AuxElement::Decorator< T > > > m_dataCache
the cache of names we use
Definition: SysWriteDecorHandle.h:133
CP::SysWriteDecorHandle::m_decorName
std::string m_decorName
the input name we use
Definition: SysWriteDecorHandle.h:125
CP::SysWriteDecorHandle::SysWriteDecorHandle
SysWriteDecorHandle(T2 *owner, const std::string &propertyName, const std::string &propertyValue, const std::string &propertyDescription)
Standard constructor.
CP::invalidScaleFactor
constexpr float invalidScaleFactor()
the decoration value to use if there is no valid scale factor decoration
Definition: SysWriteDecorHandle.h:31
SysHandleArray.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::SysWriteDecorHandle::SysWriteDecorHandle
SysWriteDecorHandle(const std::string &decorName, T2 *owner)
Construct the handle directly without declaring a property.
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
vector
Definition: MultiHisto.h:13
CP::SysWriteDecorHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize this handle
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
CP::SysWriteDecorHandle::empty
virtual bool empty() const noexcept override
whether we have a name configured
ISysHandleBase.h
SysWriteDecorHandle.icc
CP::SysWriteDecorHandle::getName
const std::string & getName(const CP::SystematicSet &sys) const
get the name we retrieve from the event store
CP::SysWriteDecorHandle::m_objectHandle
const ISysHandleBase * m_objectHandle
the object handle we use
Definition: SysWriteDecorHandle.h:129
CP::SysHandleArray
Vector-like class for systematic handles which interact with decorations.
Definition: SysHandleArray.h:26
CP::SysWriteDecorHandle
a data handle for reading systematics varied input data
Definition: SysWriteDecorHandle.h:42
CP::SysWriteDecorHandle::getData
const auto & getData(const CP::SystematicSet &sys) const
get the data for the given systematics
CP::invalidEfficiency
constexpr float invalidEfficiency()
the decoration value to use if there is no valid efficiency decoration
Definition: SysWriteDecorHandle.h:35
AuxElement.h
Base class for elements of a container that can have aux data.
VarHandleKey.h
A property holding a SG store/key/clid from which a VarHandle is made.