ATLAS Offline Software
SystematicVariation.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 #ifndef PATINTERFACES_SYSTEMATIC_VARIATION_H
9 #define PATINTERFACES_SYSTEMATIC_VARIATION_H
10 
11 // This module implements a class that manages the various
12 // representations of a single systematic variation. The interface
13 // provided in this module is intended for the general user. The
14 // module is considered to be in the pre-alpha stage.
15 
16 // The current implementation isn't particularly efficient, in fact it
17 // is terribly inefficient, as most of the accessors involve a lot of
18 // string operations. However, the current accessors should allow for
19 // more efficient implementations if needed. And this class is likely
20 // only to be used during job startup, meaning an inefficient
21 // implementation is likely to have little to no effect on overall job
22 // execution time. At the same time objects of this type are likely
23 // to be kept around for the entire runtime of the job, meaning the
24 // current small memory footprint should have advantages.
25 
26 
27 
28 #include <PATInterfaces/Global.h>
29 
30 #include <iosfwd>
31 #include <set>
32 #include <string>
33 
35 //bool operator < (const CP::SystematicVariation& a, const CP::SystematicVariation& b);
36 //bool operator == (const CP::SystematicVariation& a, const CP::SystematicVariation& b);
37 
38 
39 namespace CP
40 {
41 
42  // Pulling global ops into CP. Not ideal.
43  using ::operator<;
44  using ::operator==;
45 
47  {
48  //
49  // public interface
50  //
51 
54  public:
55  void testInvariant () const;
56 
57 
60  public:
62 
63 
67  public:
68  SystematicVariation (const std::string& val_name);
69  SystematicVariation (const std::string& val_basename,
70  const std::string& val_subvariation);
71  SystematicVariation (const std::string& val_basename,
72  float val_parameter);
73 
74 
78  public:
80 #ifndef __MAKECINT__
81 #ifndef __ROOTCLING__
82  SystematicVariation (const std::string& val_basename, CONTINUOUS_ARG);
83 #endif // not __ROOTCLING__
84 #endif // not __MAKECINT__
85 
86 
92  public:
93  static SystematicVariation
94  makeToyVariation (const std::string& basename,
95  unsigned toyIndex, float toyScale);
96 
97 
103  public:
104  static SystematicVariation
105  makeToyEnsemble (const std::string& basename);
106 
107 
113  public:
114  static SystematicVariation
115  makeContinuousEnsemble (const std::string& basename);
116 
117 
122  public:
123  static SystematicVariation makeContinuous (const std::string& basename);
124 
125 
126  // TODO: re-evaluate the usefulness of this constructor
137  public:
138  SystematicVariation (const std::set<CP::SystematicVariation>& systematics,
139  const std::string& val_basename);
140 
141 
148  public:
149  bool empty () const;
150 
151 
155  public:
156  const std::string& name () const;
157 
158 
163  public:
164  std::string basename () const;
165 
166 
174  public:
175  std::string subvariation () const;
176 
177 
182  public:
183  float parameter () const;
184 
185 
194  public:
195  std::pair<unsigned,float> getToyVariation () const;
196 
197 
203  public:
204  bool isToyEnsemble () const;
205 
206 
212  public:
213  bool isContinuousEnsemble () const;
214 
215 
224  public:
225  bool isEnsemble () const;
226 
227 
234  public:
235  bool ensembleContains (const SystematicVariation& sys) const;
236 
237 
243  public:
244  bool isToyVariation () const;
245 
246 
252  public:
253  bool isContinuousVariation () const;
254 
255 
256 
257 
258  //
259  // private interface
260  //
261 
263  private:
264  std::string m_name;
265  };
266 
267  std::ostream& operator << (std::ostream& str, const CP::SystematicVariation& obj);
268 }
269 
270 #endif
CP::SystematicVariation::SystematicVariation
SystematicVariation()
effects: standard default constructor guarantee: no-fail
Definition: SystematicVariation.cxx:167
CP::SystematicVariation::CONTINUOUS
@ CONTINUOUS
Definition: SystematicVariation.h:79
CP::SystematicVariation::makeToyVariation
static SystematicVariation makeToyVariation(const std::string &basename, unsigned toyIndex, float toyScale)
constructor for toy systematics
Definition: SystematicVariation.cxx:238
CP::SystematicVariation::basename
std::string basename() const
description: the base name, i.e.
Definition: SystematicVariation.cxx:312
CP::SystematicVariation::name
const std::string & name() const
description: the full systematics name, for use in strings, etc.
Definition: SystematicVariation.cxx:303
CP::SystematicVariation::ensembleContains
bool ensembleContains(const SystematicVariation &sys) const
whether this is an ensemble that contains the given systematic variation
Definition: SystematicVariation.cxx:423
CP::SystematicVariation
Definition: SystematicVariation.h:47
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
CP::SystematicVariation::isToyVariation
bool isToyVariation() const
whether this represents a toy variation
Definition: SystematicVariation.cxx:437
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
CP::SystematicVariation::isContinuousVariation
bool isContinuousVariation() const
whether this represents a continuous variation
Definition: SystematicVariation.cxx:446
CP::SystematicVariation::CONTINUOUS_ARG
CONTINUOUS_ARG
effects: constructor for indicating continuous systematics guarantee: strong failures: out of memory ...
Definition: SystematicVariation.h:79
CP::SystematicVariation::isEnsemble
bool isEnsemble() const
whether this represents any form of ensemble
Definition: SystematicVariation.cxx:414
Global.h
CP::SystematicVariation::testInvariant
void testInvariant() const
effects: test the invariant of this object guarantee: no-fail
Definition: SystematicVariation.cxx:159
CheckAppliedSFs.systematics
def systematics
Definition: CheckAppliedSFs.py:231
CP::SystematicVariation::makeContinuousEnsemble
static SystematicVariation makeContinuousEnsemble(const std::string &basename)
constructor for continuous systematics ensemble
Definition: SystematicVariation.cxx:250
CP::SystematicVariation::makeContinuous
static SystematicVariation makeContinuous(const std::string &basename)
Named constructor for continuous systematics.
Definition: SystematicVariation.cxx:266
CP::operator<<
std::ostream & operator<<(std::ostream &str, const CP::SystematicVariation &obj)
Definition: SystematicVariation.cxx:454
CP::SystematicVariation::getToyVariation
std::pair< unsigned, float > getToyVariation() const
unpack the toy variation
Definition: SystematicVariation.cxx:374
CP::SystematicVariation::empty
bool empty() const
returns: whether this is an empty systematic, i.e.
Definition: SystematicVariation.cxx:294
str
Definition: BTagTrackIpAccessor.cxx:11
python.PyAthena.obj
obj
Definition: PyAthena.py:132
CP::SystematicVariation::makeToyEnsemble
static SystematicVariation makeToyEnsemble(const std::string &basename)
constructor for toy systematics ensemble
Definition: SystematicVariation.cxx:258
CP::SystematicVariation::subvariation
std::string subvariation() const
description: the part of the name that indicates by how many sigmas we varied guarantee: strong failu...
Definition: SystematicVariation.cxx:326
CP::SystematicVariation::isToyEnsemble
bool isToyEnsemble() const
whether this represents a toy ensemble
Definition: SystematicVariation.cxx:396
CP::SystematicVariation::isContinuousEnsemble
bool isContinuousEnsemble() const
whether this represents a continuous ensemble
Definition: SystematicVariation.cxx:405
CP::SystematicVariation::m_name
std::string m_name
description: members directly corresponding to accessors
Definition: SystematicVariation.h:264
CP::SystematicVariation::parameter
float parameter() const
description: the numeric parameter contained in the subvariation(), or 0 if the subvariation can't be...
Definition: SystematicVariation.cxx:340