5 #include "TDirectory.h"
6 #include "TObjString.h"
17 for(
unsigned int n = 0;
n <
fExpts.size(); ++
n){
21 ret +=
fExpts[
n]->ChiSq(osc, syst);
29 const ISyst* prim = it.first;
30 const ISyst* sec = it.second;
39 ret +=
fExpts[
n]->ChiSq(osc, localShifts);
48 const std::vector<std::pair<const ISyst*, const ISyst*>>& corrs)
51 std::map<const ISyst*, const ISyst*> already;
53 assert(it.first != it.second);
56 if (!it.second)
continue;
57 if(already.find(it.second) == already.end()){
58 already[it.second] = it.first;
61 std::cout <<
"MultiExperiment::SetSystCorrelations(): Warning!\n"
62 <<
"In experiment " << idx <<
" both "
63 << already[it.second]->ShortName() <<
" and "
64 << it.first->ShortName()
65 <<
" are configured to map to " << it.second->ShortName()
66 <<
". That's probably not what you want." << std::endl;
81 std::cerr <<
"Warning in MultiExperiment: systematic correlations are set and will not be serialized by this call to SaveTo(). You will have to re-set them once you load the experiment back in." << std::endl;
84 TDirectory* tmp =
dir;
87 TObjString(
"MultiExperiment").Write(
"type");
89 for(
unsigned int i = 0; i <
fExpts.size(); ++i){
90 fExpts[i]->SaveTo(dir->mkdir(TString::Format(
"expt%d", i)));
99 TObjString* ptag = (TObjString*)dir->Get(
"type");
101 assert(ptag->GetString() ==
"MultiExperiment");
103 std::vector<const IExperiment*> expts;
105 for(
int i = 0; ; ++i){
106 TDirectory* subdir = dir->GetDirectory(TString::Format(
"expt%d", i));
112 assert(!expts.empty());
std::vector< const IExperiment * > fExpts
void SetShift(const ISyst *syst, double shift)
Shifts are 0=nominal, -1,+1 = 1 sigma shifts.
BEGIN_PROLOG could also be cerr
Simple record of shifts applied to systematic parameters.
process_name opflashCryoW ana
static std::unique_ptr< MultiExperiment > LoadFrom(TDirectory *dir)
Encapsulate code to systematically shift a caf::StandardRecord.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
std::vector< std::vector< std::pair< const ISyst *, const ISyst * > > > fSystCorrelations
double GetShift(const ISyst *syst) const
virtual void SaveTo(TDirectory *dir) const override
bool empty(FixedBins< T, C > const &) noexcept
std::unique_ptr< IExperiment > LoadFrom< IExperiment >(TDirectory *dir)
BEGIN_PROLOG could also be cout
MultiExperiment(std::vector< const IExperiment * > expts={})
void SetSystCorrelations(int idx, const std::vector< std::pair< const ISyst *, const ISyst * >> &corrs)
virtual double ChiSq(osc::IOscCalcAdjustable *osc, const SystShifts &syst=SystShifts::Nominal()) const override