ATLAS Offline Software
SysReadHandleArray.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_ARRAY_H
9 #define SYSTEMATICS_HANDLES__SYS_READ_HANDLE_ARRAY_H
10 
15 #include <boost/functional/hash.hpp>
16 #include <string>
17 #include <type_traits>
18 #include <unordered_map>
19 
20 class StatusCode;
21 
22 namespace CP
23 {
24  class SystematicSet;
25 
27 
28  template<typename T> class SysReadHandleArray final
30  {
31  //
32  // public interface
33  //
34 
36  public:
37  template<typename T2>
38  SysReadHandleArray (T2 *owner, const std::string& propertyName,
39  const std::string& propertyDescription);
40 
41 
43  public:
45 
46 
48  public:
49  std::size_t size () const noexcept;
50 
51 
53  public:
55  std::size_t index) const;
56 
57 
59  public:
60  ::StatusCode retrieve (const T*& object,
62  std::size_t index) const;
63 
64 
65 
66  //
67  // inherited interface
68  //
69 
70  public:
71  virtual std::string getInputAffecting () const override;
72 
73 
74 
75  //
76  // private interface
77  //
78 
80  private:
81  std::string m_propertyName;
82 
84  private:
85  bool m_isInitialized {false};
86 
87 
89  private:
90  std::vector<std::string> m_inputName;
91 
93  private:
94  std::vector<std::string> m_affectingRegex;
95 
97  private:
98  mutable std::unordered_map<std::pair<CP::SystematicSet,std::size_t>,std::string,boost::hash<std::pair<CP::SystematicSet,std::size_t>>> m_inputNameCache;
99 
100 
102  private:
103  typedef std::decay<decltype(
104  *(std::declval<EL::AnaAlgorithm>().evtStore()))>::type StoreType;
105 
107  private:
108  mutable StoreType *m_evtStore = nullptr;
109 
117  private:
118  std::function<StoreType*()> m_evtStoreGetter;
119  };
120 }
121 
122 #include "SysReadHandleArray.icc"
123 
124 #endif
asg::AsgMessagingForward
base class to forward messages to another class
Definition: AsgMessagingForward.h:29
CP::SysReadHandleArray::SysReadHandleArray
SysReadHandleArray(T2 *owner, const std::string &propertyName, const std::string &propertyDescription)
standard constructor
index
Definition: index.py:1
SysReadHandleArray.icc
SystematicSet.h
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
CP::SysReadHandleArray::m_evtStore
StoreType * m_evtStore
the event store we use
Definition: SysReadHandleArray.h:108
AsgMessagingForward.h
CP::SysReadHandleArray
a data handle for reading systematics varied input data
Definition: SysReadHandleArray.h:30
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:562
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
CP::SysReadHandleArray::StoreType
std::decay< decltype(*(std::declval< EL::AnaAlgorithm >).evtStore()))>::type StoreType
the type of the event store we use
Definition: SysReadHandleArray.h:104
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
AnaAlgorithm.h
CP::ISysHandleBase
a basic interface for all systematics handles
Definition: ISysHandleBase.h:28
CP::SysReadHandleArray::m_inputName
std::vector< std::string > m_inputName
the input name we use
Definition: SysReadHandleArray.h:90
CP::SysReadHandleArray::m_affectingRegex
std::vector< std::string > m_affectingRegex
the regular expression for affecting systematics
Definition: SysReadHandleArray.h:94
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CP::SysReadHandleArray::m_inputNameCache
std::unordered_map< std::pair< CP::SystematicSet, std::size_t >, std::string, boost::hash< std::pair< CP::SystematicSet, std::size_t > > > m_inputNameCache
the cache of names we use
Definition: SysReadHandleArray.h:98
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
CP::SysReadHandleArray::initialize
StatusCode initialize()
initialize this data handle
ISysHandleBase.h
CP::SysReadHandleArray::retrieve
::StatusCode retrieve(const T *&object, const CP::SystematicSet &sys, std::size_t index) const
retrieve the object for the given name
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CP::SysReadHandleArray::m_isInitialized
bool m_isInitialized
whether we have been initialized
Definition: SysReadHandleArray.h:85
CP::SysReadHandleArray::size
std::size_t size() const noexcept
the number of read objects configured
CP::SysReadHandleArray::m_evtStoreGetter
std::function< StoreType *()> m_evtStoreGetter
the function to retrieve the event store
Definition: SysReadHandleArray.h:118
CP::SysReadHandleArray::m_propertyName
std::string m_propertyName
the name of the property we configured
Definition: SysReadHandleArray.h:81
CP::SysReadHandleArray::getInputAffecting
virtual std::string getInputAffecting() const override
CP::SysReadHandleArray::getName
const std::string & getName(const CP::SystematicSet &sys, std::size_t index) const
get the name we retrieve from the event store