5 #include "TDirectory.h"
6 #include "TObjString.h"
20 for(
unsigned int n = 0;
n <
fExpts.size(); ++
n){
27 ret +=
fExpts[
n]->ChiSq(osc, syst);
35 const ISyst* prim = it.first;
36 const ISyst* sec = it.second;
45 ret +=
fExpts[
n]->ChiSq(osc, localShifts);
54 const std::vector<std::pair<const ISyst*, const ISyst*>>& corrs)
57 std::map<const ISyst*, const ISyst*> already;
59 assert(it.first != it.second);
62 if (!it.second)
continue;
63 if(already.find(it.second) == already.end()){
64 already[it.second] = it.first;
67 std::cout <<
"MultiExperimentSBN::SetSystCorrelations(): Warning!\n"
68 <<
"In experiment " << idx <<
" both "
69 << already[it.second]->ShortName() <<
" and "
70 << it.first->ShortName()
71 <<
" are configured to map to " << it.second->ShortName()
72 <<
". That's probably not what you want." << std::endl;
87 std::cerr <<
"Warning in MultiExperimentSBN: 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;
90 TDirectory* tmp =
dir;
93 TObjString(
"MultiExperimentSBN").Write(
"type");
95 for(
unsigned int i = 0; i <
fExpts.size(); ++i){
96 fExpts[i]->SaveTo(dir->mkdir(TString::Format(
"expt%d", i)));
105 TObjString* ptag = (TObjString*)dir->Get(
"type");
107 assert(ptag->GetString() ==
"MultiExperimentSBN");
109 std::vector<const IExperiment*> expts;
111 for(
int i = 0; ; ++i){
112 TDirectory* subdir = dir->GetDirectory(TString::Format(
"expt%d", i));
118 assert(!expts.empty());
static std::unique_ptr< MultiExperimentSBN > LoadFrom(TDirectory *dir)
void SetShift(const ISyst *syst, double shift)
Shifts are 0=nominal, -1,+1 = 1 sigma shifts.
BEGIN_PROLOG could also be cerr
MultiExperimentSBN(std::vector< const IExperiment * > expts={}, std::vector< int > exptnames={})
std::vector< std::vector< std::pair< const ISyst *, const ISyst * > > > fSystCorrelations
Simple record of shifts applied to systematic parameters.
process_name opflashCryoW ana
Encapsulate code to systematically shift a caf::StandardRecord.
virtual double ChiSq(osc::IOscCalcAdjustable *osc, const SystShifts &syst=SystShifts::Nominal()) const override
virtual void SaveTo(TDirectory *dir) const override
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
std::vector< const IExperiment * > fExpts
void SetSystCorrelations(int idx, const std::vector< std::pair< const ISyst *, const ISyst * >> &corrs)
double GetShift(const ISyst *syst) const
std::vector< int > fExptNames
const std::vector< double > kBLs
bool empty(FixedBins< T, C > const &) noexcept
std::unique_ptr< IExperiment > LoadFrom< IExperiment >(TDirectory *dir)
BEGIN_PROLOG could also be cout