ATLAS Offline Software
SystematicsSvc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 #ifndef SYSTEMATICS_HANDLES__SYSTEMATICS_SVC_H
9 #define SYSTEMATICS_HANDLES__SYSTEMATICS_SVC_H
10 
11 #include <AsgServices/AsgService.h>
16 #include <mutex>
17 #include <unordered_map>
18 
19 namespace CP
20 {
22 
23  class SystematicsSvc final : public asg::AsgService,
24  virtual public ISystematicsSvc
25  {
26  //
27  // public interface
28  //
29 
35  public:
36  SystematicsSvc (const std::string& name,
37  ISvcLocator* pSvcLocator);
38 
39 
40 
41  //
42  // inherited interface
43  //
44 
45  public:
46  virtual StatusCode initialize () override;
47  virtual StatusCode finalize () override;
48  virtual std::vector<CP::SystematicSet>
49  makeSystematicsVector () const override;
50  virtual StatusCode addSystematics (const CP::SystematicSet& recommended,
51  const CP::SystematicSet& affecting) const override;
52  virtual CP::SystematicSet
53  getObjectSystematics (const std::string& name) const override;
54  virtual StatusCode
55  setObjectSystematics (const std::string& name,
56  const CP::SystematicSet& systematics) const override;
57  virtual CP::SystematicSet
58  getDecorSystematics (const std::string& objectName,
59  const std::string& decorName) const override;
60  virtual StatusCode
61  setDecorSystematics (const std::string& objectName,
62  const std::string& decorName,
63  const CP::SystematicSet& systematics) const override;
64  virtual StatusCode
65  registerCopy (const std::string& fromName,
66  const std::string& toName) const override;
67  virtual std::string
68  getCopySource (const std::string& toName) const override;
69  virtual StatusCode
70  makeSystematicsName (std::string& result,
71  const std::string& name,
72  const CP::SystematicSet& sys) const override;
73 
74 
75 
76  //
77  // private interface
78  //
79 
81  private:
82  Gaudi::Property<std::vector<std::string>> m_systematicsList {this, "systematicsList", {}, "the list of systematics to run"};
83 
85  private:
86  Gaudi::Property<std::string> m_systematicsRegex {this, "systematicsRegex", "(.*)", "systematics filter regex"};
87 
94  private:
95  Gaudi::Property<float> m_sigmaRecommended {this, "sigmaRecommended", 0, "the sigma with which to run recommended systematics"};
96 
98  private:
99  Gaudi::Property<std::string> m_nominalSystematicsName {this, "nominalSystematicsName", "NOSYS", "the name to use for the nominal systematic (instead of the empty string)"};
100 
101 
103  private:
104  mutable SystematicSet m_affectingSystematics ATLAS_THREAD_SAFE;
105 
107  private:
108  mutable SystematicSet m_recommendedSystematics ATLAS_THREAD_SAFE;
109 
111  private:
112  mutable std::unordered_map<std::string,CP::SystematicSet> m_objectSystematics ATLAS_THREAD_SAFE;
113 
115  private:
116  mutable std::unordered_map<std::string,CP::SystematicSet> m_decorSystematics ATLAS_THREAD_SAFE;
117 
119  private:
120  mutable std::unordered_map<std::string,std::string> m_copies ATLAS_THREAD_SAFE;
121 
123  private:
125  };
126 }
127 
128 #endif
CP::SystematicsSvc::makeSystematicsName
virtual StatusCode makeSystematicsName(std::string &result, const std::string &name, const CP::SystematicSet &sys) const override
make the name for the given systematics
Definition: SystematicsSvc.cxx:232
CP::SystematicsSvc::finalize
virtual StatusCode finalize() override
Definition: SystematicsSvc.cxx:266
PropertyWrapper.h
get_generator_info.result
result
Definition: get_generator_info.py:21
AsgService.h
CP::ISystematicsSvc
the interface for the central systematics service
Definition: ISystematicsSvc.h:25
CP::SystematicsSvc::ATLAS_THREAD_SAFE
std::unordered_map< std::string, CP::SystematicSet > m_objectSystematics ATLAS_THREAD_SAFE
the list of per-object systematics
Definition: SystematicsSvc.h:112
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
CP::SystematicsSvc::getDecorSystematics
virtual CP::SystematicSet getDecorSystematics(const std::string &objectName, const std::string &decorName) const override
get the systematics for the given object in the event store
Definition: SystematicsSvc.cxx:160
CP::SystematicsSvc::m_systematicsMutex
std::mutex m_systematicsMutex
a mutex for accessing the above mutable members
Definition: SystematicsSvc.h:124
SystematicSet.h
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
CP::SystematicsSvc::SystematicsSvc
SystematicsSvc(const std::string &name, ISvcLocator *pSvcLocator)
standard constructor
Definition: SystematicsSvc.cxx:29
CP::SystematicsSvc::ATLAS_THREAD_SAFE
std::unordered_map< std::string, CP::SystematicSet > m_decorSystematics ATLAS_THREAD_SAFE
the list of per-object-and-decoration systematics
Definition: SystematicsSvc.h:116
CP::SystematicsSvc::setObjectSystematics
virtual StatusCode setObjectSystematics(const std::string &name, const CP::SystematicSet &systematics) const override
set the systematics for the given object in the event store
Definition: SystematicsSvc.cxx:140
CP::SystematicsSvc::ATLAS_THREAD_SAFE
SystematicSet m_recommendedSystematics ATLAS_THREAD_SAFE
the list of recommended systematics
Definition: SystematicsSvc.h:108
CP::SystematicsSvc::m_systematicsList
Gaudi::Property< std::vector< std::string > > m_systematicsList
the names of the systematics to request
Definition: SystematicsSvc.h:82
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
CP::SystematicsSvc::initialize
virtual StatusCode initialize() override
set up/tear down functions
Definition: SystematicsSvc.cxx:39
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
ISystematicsSvc.h
CP::SystematicsSvc::addSystematics
virtual StatusCode addSystematics(const CP::SystematicSet &recommended, const CP::SystematicSet &affecting) const override
register a set of recommended and affecting systematics
Definition: SystematicsSvc.cxx:105
CP::SystematicsSvc::getObjectSystematics
virtual CP::SystematicSet getObjectSystematics(const std::string &name) const override
get the systematics for the given object in the event store
Definition: SystematicsSvc.cxx:127
CP::SystematicsSvc::registerCopy
virtual StatusCode registerCopy(const std::string &fromName, const std::string &toName) const override
register a (shallow) copy from one object to the next
Definition: SystematicsSvc.cxx:203
asg::AsgService
Base class for the dual-use service implementation classes.
Definition: AsgService.h:43
CP::SystematicsSvc::m_sigmaRecommended
Gaudi::Property< float > m_sigmaRecommended
load all recommended systematics at the given number of sigmas
Definition: SystematicsSvc.h:95
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CP::SystematicsSvc::makeSystematicsVector
virtual std::vector< CP::SystematicSet > makeSystematicsVector() const override
get the list of systematics
Definition: SystematicsSvc.cxx:62
CP::SystematicsSvc::getCopySource
virtual std::string getCopySource(const std::string &toName) const override
get a source object name from which a target object has been copied
Definition: SystematicsSvc.cxx:219
CheckAppliedSFs.systematics
def systematics
Definition: CheckAppliedSFs.py:231
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
CP::SystematicsSvc::ATLAS_THREAD_SAFE
std::unordered_map< std::string, std::string > m_copies ATLAS_THREAD_SAFE
the map of registered copies
Definition: SystematicsSvc.h:120
CP::SystematicsSvc::ATLAS_THREAD_SAFE
SystematicSet m_affectingSystematics ATLAS_THREAD_SAFE
the list of affecting systematics
Definition: SystematicsSvc.h:104
CP::SystematicsSvc::m_nominalSystematicsName
Gaudi::Property< std::string > m_nominalSystematicsName
nominal systematics name
Definition: SystematicsSvc.h:99
CP::SystematicsSvc
the canonical implementation of ISystematicsSvc
Definition: SystematicsSvc.h:25
CP::SystematicsSvc::setDecorSystematics
virtual StatusCode setDecorSystematics(const std::string &objectName, const std::string &decorName, const CP::SystematicSet &systematics) const override
set the systematics for the given object in the event store
Definition: SystematicsSvc.cxx:181
checker_macros.h
Define macros for attributes used to control the static checker.
CP::SystematicsSvc::m_systematicsRegex
Gaudi::Property< std::string > m_systematicsRegex
the regular expression for filterinf systematics
Definition: SystematicsSvc.h:86