8 #include "TDirectory.h"
10 #include "TObjString.h"
28 if(shift != 0)
fSysts.emplace(syst, shift);
35 for(
auto it: shifts)
if(it.second != 0)
fSysts.emplace(it.first, it.second);
52 if(shift != 0)
fSysts.emplace(syst, shift);
60 auto it =
fSysts.find(syst);
61 return (it ==
fSysts.end()) ? 0 : it->second;
79 if (it.first->ApplyPenalty())
88 for(
auto it:
fSysts) it.first->Shift(it.second, sr, weight);
94 if(
fSysts.empty())
return "nominal";
98 if(!ret.empty()) ret +=
",";
99 ret += it.first->ShortName() + TString::Format(
"=%+g", it.second).Data();
108 if(
fSysts.empty())
return "Nominal";
112 if(!ret.empty()) ret +=
", ";
113 ret += it.first->LatexName() + TString::Format(
" = %+g", it.second).Data();
122 std::vector<const ISyst*> ret;
123 for(
auto it:
fSysts) ret.push_back(it.first);
130 TDirectory* tmp = gDirectory;
133 TObjString(
"SystShifts").Write(
"type");
141 h.GetXaxis()->SetBinLabel(ibin, it.first->ShortName().c_str());
142 h.SetBinContent(ibin, it.second);
153 TObjString* tag = (TObjString*)dir->Get(
"type");
155 assert(tag->GetString() ==
"SystShifts");
157 auto ret = std::make_unique<SystShifts>();
159 TH1*
h = (TH1*)dir->Get(
"vals");
161 for(
int i = 1; i <= h->GetNbinsX(); ++i){
163 h->GetBinContent(i));
std::unordered_map< const ISyst *, double > fSysts
static int fgNextID
The next unused ID.
std::string ShortName() const
Brief description of component shifts, for printing to screen.
void SetShift(const ISyst *syst, double shift)
Shifts are 0=nominal, -1,+1 = 1 sigma shifts.
Simple record of shifts applied to systematic parameters.
static std::unique_ptr< SystShifts > LoadFrom(TDirectory *dir)
process_name opflashCryoW ana
T sqr(T x)
More efficient square function than pow(x,2)
Encapsulate code to systematically shift a caf::StandardRecord.
caf::Proxy< caf::SRSlice > SRSliceProxy
void Shift(caf::SRSliceProxy *slc, double &weight) const
static SystShifts RandomThrow(const std::vector< const ISyst * > &systs)
std::string LatexName() const
Long description of component shifts, for plot labels.
double GetShift(const ISyst *syst) const
static const ISyst * ShortNameToSyst(const std::string &s, bool allowFail=false)
then echo File list $list not found else cat $list while read file do echo $file sed s
void SaveTo(TDirectory *dir) const
std::vector< const ISyst * > ActiveSysts() const
double Penalty() const
Penalty term for chi-squared fits.