All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SystShifts.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 #include <map>
6 #include <memory>
7 #include <string>
8 #include <unordered_map>
9 #include <vector>
10 
11 class TDirectory;
12 
13 namespace ana
14 {
15  /// Simple record of shifts applied to systematic parameters
16  class SystShifts
17  {
18  public:
19  SystShifts();
20  SystShifts(const ISyst* syst, double shift);
21  SystShifts(const std::map<const ISyst*, double>& shifts);
22 
23  static SystShifts Nominal(){return SystShifts();}
24  static SystShifts RandomThrow(const std::vector<const ISyst*>& systs);
25 
26  bool IsNominal() const {return fSysts.empty();}
27 
28  /// Shifts are 0=nominal, -1,+1 = 1 sigma shifts
29  void SetShift(const ISyst* syst, double shift);
30  double GetShift(const ISyst* syst) const;
31  void ResetToNominal();
32 
33  /// Penalty term for chi-squared fits
34  double Penalty() const;
35 
36  void Shift(caf::SRSliceProxy* slc, double& weight) const;
37 
38  /// Brief description of component shifts, for printing to screen
39  std::string ShortName() const;
40  /// Long description of component shifts, for plot labels
41  std::string LatexName() const;
42 
43  /// SystShifts with the same set of systs should have the same ID
44  int ID() const {return fID;}
45 
46  std::vector<const ISyst*> ActiveSysts() const;
47 
48 
49  void SaveTo(TDirectory* dir) const;
50  static std::unique_ptr<SystShifts> LoadFrom(TDirectory* dir);
51 
52 
53  protected:
54  std::unordered_map<const ISyst*, double> fSysts;
55 
56  int fID;
57  /// The next unused ID
58  static int fgNextID;
59  };
60 
62 }
std::unordered_map< const ISyst *, double > fSysts
Definition: SystShifts.h:54
static int fgNextID
The next unused ID.
Definition: SystShifts.h:58
std::string ShortName() const
Brief description of component shifts, for printing to screen.
Definition: SystShifts.cxx:92
void SetShift(const ISyst *syst, double shift)
Shifts are 0=nominal, -1,+1 = 1 sigma shifts.
Definition: SystShifts.cxx:47
bool IsNominal() const
Definition: SystShifts.h:26
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:16
static std::unique_ptr< SystShifts > LoadFrom(TDirectory *dir)
Definition: SystShifts.cxx:151
process_name opflashCryoW ana
static SystShifts Nominal()
Definition: SystShifts.h:23
shift
Definition: fcl_checks.sh:26
Encapsulate code to systematically shift a caf::StandardRecord.
Definition: ISyst.h:14
caf::Proxy< caf::SRSlice > SRSliceProxy
Definition: EpilogFwd.h:2
void Shift(caf::SRSliceProxy *slc, double &weight) const
Definition: SystShifts.cxx:86
static SystShifts RandomThrow(const std::vector< const ISyst * > &systs)
Definition: SystShifts.cxx:39
int ID() const
SystShifts with the same set of systs should have the same ID.
Definition: SystShifts.h:44
std::string LatexName() const
Long description of component shifts, for plot labels.
Definition: SystShifts.cxx:106
double GetShift(const ISyst *syst) const
Definition: SystShifts.cxx:56
const SystShifts kNoShift
Definition: SystShifts.h:61
tuple dir
Definition: dropbox.py:28
void ResetToNominal()
Definition: SystShifts.cxx:65
void SaveTo(TDirectory *dir) const
Definition: SystShifts.cxx:128
std::vector< const ISyst * > ActiveSysts() const
Definition: SystShifts.cxx:120
double Penalty() const
Penalty term for chi-squared fits.
Definition: SystShifts.cxx:73