16 #include "TLegendEntry.h" 17 #include "TObjString.h" 30 using std::unique_ptr;
31 using std::make_unique;
34 using std::ostringstream;
35 using std::runtime_error;
46 const Cut* FDCut,
const Cut* NDCut,
const Cut* numuCut,
55 *FDCut, *NDCut, *numuCut,
58 pred = genExtrap.
Generate(*loadersND, *loaders, *shiftMC).release();
60 pred = genExtrap.
Generate(*loaders, *shiftMC).release();
65 pred = genFD.
Generate(*loaders, *shiftMC).release();
70 pred = genND.
Generate(*loaders, *shiftMC).release();
99 else assert(
false and
"Selection not recognised!");
104 sign).
ToTH1(sample.GetPOT());
117 return ret.
ToTH1(sample.GetPOT());
127 vector<TString>
in = {
"0",
"1",
"2",
"3",
"4",
"5",
128 "6",
"7",
"8",
"9",
"_",
"#",
" ",
".",
"-",
"(",
")"};
129 vector<TString>
out = {
"zero",
"one",
"two",
"three",
"four",
"five",
130 "six",
"seven",
"eight",
"nine",
"",
"",
"",
"",
"XX",
"",
""};
131 for(
size_t i = 0;
i < in.size(); ++
i)
157 os <<
" " << showpos <<
fSigma <<
": " 158 <<
fShift.first <<
" (signal), " 159 <<
fShift.second <<
" (background)" 166 TDirectory*
tmp = gDirectory;
169 TObjString(
"SystMakerShiftSigma").Write(
"type");
174 sigma.Write(
"sigma");
180 shiftSig->Write(
"shiftSig");
182 shiftBkg->Write(
"shiftBkg");
186 shiftRatSig->Write(
"shiftRatSig");
188 shiftRatBkg->Write(
"shiftRatBkg");
204 TObjString*
tag = (TObjString*)dir->Get(
"type");
206 assert(tag->GetString() ==
"SystMakerShiftSigma");
208 TObjString* name = (TObjString*)dir->Get(
"name");;
213 tag = (TObjString*)dir->Get(
"pred/type");
215 if (tag->GetString() ==
"NDPredictionSterile")
217 else if (tag->GetString() ==
"FDPredictionSterile")
219 else if (tag->GetString() ==
"PredictionSterile")
221 else assert(
false &&
"Prediction type not recognised!");
223 TH1* shiftSig = (TH1*)dir->Get(
"shiftSig");
224 TH1* shiftBkg = (TH1*)dir->Get(
"shiftBkg");
225 if (shiftSig and shiftBkg)
227 TH1* shiftRatSig = (TH1*)dir->Get(
"shiftRatSig");
228 TH1* shiftRatBkg = (TH1*)dir->Get(
"shiftRatBkg");
229 if (shiftRatSig and shiftRatBkg)
235 return systMakerShiftSigma;
250 if (sigma.second)
delete sigma.second;
257 for (
const auto& sigma :
fSigmas)
258 sigmas.push_back(sigma.first);
265 for (
const auto& sigma :
fSigmas)
266 sigma.second->PrintSigma(os);
283 TCanvas*
canv =
new TCanvas(
"canv",
"", 800, 800);
284 TPad* padSpecSigTotal =
new TPad(
"padSpecSigTotal",
"", 0., 0.375, 1., 1.);
285 TPad* padRatioSigTotal =
new TPad(
"padRatioSigTotal",
"", 0., 0., 1., 0.375);
286 TLegend*
leg =
new TLegend(0.5, 0.5, 0.88, 0.88);
287 map<int, TLegendEntry*> legEntries;
290 TH1* hNom = (TH1*)nominal->Clone(
"hNom");
291 for (
size_t bin = 1;
bin <= size_t(hNom->GetNbinsX()); ++
bin)
292 hNom->SetBinContent(
bin, hNom->GetBinContent(
bin)/hNom->GetBinWidth(
bin));
293 hNom->GetYaxis()->SetTitle(
"Events / GeV");
294 hNom->SetLineStyle(kSolid);
295 hNom->SetLineColor(kBlack);
296 hNom->SetLineWidth(2);
297 padSpecSigTotal->cd();
301 TH1* nomRatio = (TH1*)nominal->Clone(
"nomRatio");
302 nomRatio->GetYaxis()->SetTitle(
"Shifted / Nominal");
303 for (Int_t
bin = 0;
bin <= nomRatio->GetNbinsX(); ++
bin)
304 nomRatio->SetBinContent(
bin, 1.);
305 padRatioSigTotal->cd();
306 nomRatio->Draw(
"hist");
307 legEntries[0] =
new TLegendEntry(nominal,
"Nominal",
"l");
308 double ymaxRatio = 0;
312 for (map<int, SystMakerShiftSigma*>::const_iterator sigma =
fSigmas.begin(); sigma !=
fSigmas.end(); ++
sigma, ++
it) {
313 if (sigma->second->fSigma == 0)
316 TH1* sigmaSig = (TH1*)sigma->second->fShiftedSpectrum.first->Clone();
317 for (
size_t bin = 1;
bin <= size_t(sigmaSig->GetNbinsX()); ++
bin)
318 sigmaSig->SetBinContent(
bin, sigmaSig->GetBinContent(
bin)/sigmaSig->GetBinWidth(
bin));
319 sigmaSig->GetYaxis()->SetTitle(
"Events / GeV");
320 sigmaSig->SetLineStyle(kDashed);
321 sigmaSig->SetLineColor(
abs(sigma->second->fSigma)+1);
322 sigmaSig->SetLineWidth(2);
323 padSpecSigTotal->cd();
324 sigmaSig->DrawClone(
"hist same");
325 TH1* sigmaRatioSig = (TH1*)sigmaSig->Clone(
"sigmaRatioSig");
326 sigmaRatioSig->Divide(hNom);
327 sigmaRatioSig->SetBinContent(0, 1);
328 for (
size_t i = 1;
i <= (size_t)sigmaRatioSig->GetNbinsX(); ++
i) {
329 double val = sigmaRatioSig->GetBinContent(
i);
331 sigmaRatioSig->SetBinContent(
i, 1);
334 if (
fabs(val-1) > ymaxRatio)
335 ymaxRatio =
fabs(val-1);
337 padRatioSigTotal->cd();
338 sigmaRatioSig->DrawClone(
"hist same");
339 legEntries[
abs(sigma->second->fSigma)]
340 =
new TLegendEntry(sigmaSig->Clone(), Form(
"+/-%d#sigma", sigma->second->fSigma),
"l");
344 for (
const auto& legEntry : legEntries)
345 leg->AddEntry(legEntry.second->GetObject(),
346 legEntry.second->GetLabel(),
347 legEntry.second->GetOption());
348 padSpecSigTotal->cd();
351 nomRatio->SetMinimum(1-(1.1*ymaxRatio));
352 nomRatio->SetMaximum(1+(1.1*ymaxRatio));
357 padSpecSigTotal->Draw();
358 padRatioSigTotal->Draw();
368 TCanvas*
canv =
new TCanvas(
"canv",
"", 800, 800);
369 TPad* padSpecBkgTotal =
new TPad(
"padSpecBkgTotal",
"", 0., 0.375, 1., 1.);
370 TPad* padRatioBkgTotal =
new TPad(
"padRatioBkgTotal",
"", 0., 0., 1., 0.375);
371 TLegend*
leg =
new TLegend(0.5, 0.5, 0.88, 0.88);
372 map<int, TLegendEntry*> legEntries;
375 TH1* hNom = (TH1*)nominal->Clone(
"hNom");
376 for (
size_t bin = 1;
bin <= size_t(hNom->GetNbinsX()); ++
bin)
377 hNom->SetBinContent(
bin, hNom->GetBinContent(
bin)/hNom->GetBinWidth(
bin));
378 hNom->GetYaxis()->SetTitle(
"Events / GeV");
379 nominal->SetLineStyle(kSolid);
380 nominal->SetLineColor(kBlack);
381 nominal->SetLineWidth(2);
382 padSpecBkgTotal->cd();
383 nominal->Draw(
"hist");
386 TH1* nomRatio = (TH1*)nominal->Clone(
"nomRatio");
387 nomRatio->GetYaxis()->SetTitle(
"Shifted / Nominal");
388 for (Int_t
bin = 0;
bin <= nomRatio->GetNbinsX(); ++
bin)
389 nomRatio->SetBinContent(
bin, 1.);
390 padRatioBkgTotal->cd();
391 nomRatio->Draw(
"hist");
392 legEntries[0] =
new TLegendEntry(nominal,
"Nominal",
"l");
393 double ymaxRatio = 0;
397 for (map<int, SystMakerShiftSigma*>::const_iterator sigma =
fSigmas.begin();
399 if (sigma->second->fSigma == 0)
402 TH1* sigmaBkg = (TH1*)sigma->second->fShiftedSpectrum.second->Clone();
403 for (
size_t bin = 1;
bin <= size_t(sigmaBkg->GetNbinsX()); ++
bin)
404 sigmaBkg->SetBinContent(
bin, sigmaBkg->GetBinContent(
bin)/sigmaBkg->GetBinWidth(
bin));
405 sigmaBkg->GetYaxis()->SetTitle(
"Events / GeV");
406 sigmaBkg->SetLineStyle(kDashed);
407 sigmaBkg->SetLineColor(
abs(sigma->second->fSigma)+1);
408 sigmaBkg->SetLineWidth(2);
409 padSpecBkgTotal->cd();
410 sigmaBkg->DrawClone(
"hist same");
411 TH1* sigmaRatioBkg = (TH1*)sigmaBkg->Clone(
"sigmaRatioBkg");
412 sigmaRatioBkg->Divide(hNom);
413 sigmaRatioBkg->SetBinContent(0, 1);
414 for (
size_t i = 1;
i <= (size_t)sigmaRatioBkg->GetNbinsX(); ++
i) {
415 double val = sigmaRatioBkg->GetBinContent(
i);
417 sigmaRatioBkg->SetBinContent(
i, 1);
420 if (
fabs(val-1) > ymaxRatio)
421 ymaxRatio =
fabs(val-1);
423 padRatioBkgTotal->cd();
424 sigmaRatioBkg->DrawClone(
"hist same");
425 legEntries[
abs(sigma->second->fSigma)]
426 =
new TLegendEntry(sigmaBkg->Clone(), Form(
"+/-%d#sigma",
427 sigma->second->fSigma),
"l");
431 for (
const auto& legEntry : legEntries)
432 leg->AddEntry(legEntry.second->GetObject(),
433 legEntry.second->GetLabel(),
434 legEntry.second->GetOption());
435 padSpecBkgTotal->cd();
438 nomRatio->SetMinimum(1-(1.1*ymaxRatio));
439 nomRatio->SetMaximum(1+(1.1*ymaxRatio));
444 padSpecBkgTotal->Draw();
445 padRatioBkgTotal->Draw();
455 string dirSigShift = Form(
"Signal/Shifts/%s",
fName.c_str());
456 string dirBkgShift = Form(
"Background/Shifts/%s",
fName.c_str());
457 string dirSigShift_sigmas = dirSigShift+
"/Sigmas/";
458 string dirBkgShiftSigmas = dirBkgShift+
"/Sigmas/";
459 outDir->mkdir(dirSigShift.c_str());
460 outDir->mkdir(dirBkgShift.c_str());
461 outDir->mkdir(dirSigShift_sigmas.c_str());
462 outDir->mkdir(dirBkgShiftSigmas.c_str());
465 TCanvas*
canv =
new TCanvas(
"canv",
"", 800, 800);
466 TPad* padSpecSig =
new TPad(
"padSpecSig",
"", 0., 0.375, 1., 1.);
467 TPad* padRatioSig =
new TPad(
"padRatioSig",
"", 0., 0., 1., 0.375);
468 TPad* padSpec_bg =
new TPad(
"padSpec_bg",
"", 0., 0.375, 1., 1.);
469 TPad* padRatio_bg =
new TPad(
"padRatio_bg",
"", 0., 0., 1., 0.375);
470 TPad* padSpecSigTotal =
new TPad(
"padSpecSigTotal",
"", 0., 0.375, 1., 1.);
471 TPad* padRatioSigTotal =
new TPad(
"padRatioSigTotal",
"", 0., 0., 1., 0.375);
472 TPad* padSpecBkgTotal =
new TPad(
"padSpecBkgTotal",
"", 0., 0.375, 1., 1.);
473 TPad* padRatioBkgTotal =
new TPad(
"padRatioBkgTotal",
"", 0., 0., 1., 0.375);
474 TLegend*
leg =
new TLegend(0.5, 0.5, 0.88, 0.88);
475 map<int, TLegendEntry*> legEntries;
479 TH1* nomSig = (TH1*)nominal.first->Clone(
"nomSig");
480 for (
size_t bin = 1;
bin <= size_t(nomSig->GetNbinsX()); ++
bin)
481 nomSig->SetBinContent(
bin, nomSig->GetBinContent(
bin)/nomSig->GetBinWidth(
bin));
482 nomSig->GetYaxis()->SetTitle(
"Events / GeV");
483 nomSig->SetLineStyle(kSolid);
484 nomSig->SetLineColor(kBlack);
485 nomSig->SetLineWidth(2);
486 padSpecSigTotal->cd();
487 nomSig->Draw(
"hist");
489 TH1* nomBkg = (TH1*)nominal.second->Clone(
"nomBkg");
490 for (
size_t bin = 1;
bin <= size_t(nomBkg->GetNbinsX()); ++
bin)
491 nomBkg->SetBinContent(
bin, nomBkg->GetBinContent(
bin)/nomBkg->GetBinWidth(
bin));
492 nomBkg->GetYaxis()->SetTitle(
"Events / GeV");
493 nomBkg->SetLineStyle(kSolid);
494 nomBkg->SetLineColor(kBlack);
495 nomBkg->SetLineWidth(2);
496 padSpecBkgTotal->cd();
497 nomBkg->Draw(
"hist");
499 TH1* nomRatio = (TH1*)nomSig->Clone(
"nomRatio");
500 nomRatio->GetYaxis()->SetTitle(
"Shifted / Nominal");
501 for (Int_t
bin = 1;
bin <= nomRatio->GetNbinsX(); ++
bin)
502 nomRatio->SetBinContent(
bin, 1.);
503 padRatioSigTotal->cd();
504 nomRatio->Draw(
"hist");
505 padRatioBkgTotal->cd();
506 nomRatio->Draw(
"hist");
507 legEntries[0] =
new TLegendEntry(nomSig,
"Nominal",
"l");
511 for (map<int, SystMakerShiftSigma*>::const_iterator sigma =
fSigmas.begin(); sigma !=
fSigmas.end(); ++
sigma, ++
it) {
512 if (sigma->second->fSigma == 0)
516 TH1* sigmaSig = (TH1*)sigma->second->fShiftedSpectrum.first->Clone();
517 for (
size_t bin = 1;
bin <= size_t(sigmaSig->GetNbinsX()); ++
bin)
518 sigmaSig->SetBinContent(
bin, sigmaSig->GetBinContent(
bin)/sigmaSig->GetBinWidth(
bin));
519 sigmaSig->GetYaxis()->SetTitle(
"Events / GeV");
520 sigmaSig->SetLineStyle(kDashed);
521 sigmaSig->SetLineColor(
abs(sigma->second->fSigma)+1);
522 sigmaSig->SetLineWidth(2);
523 padSpecSigTotal->cd();
524 sigmaSig->DrawClone(
"hist same");
525 TH1* sigmaRatioSig = (TH1*)sigmaSig->Clone(
"sigmaRatioSig");
526 sigmaRatioSig->Divide(nomSig);
527 padRatioSigTotal->cd();
528 sigmaRatioSig->DrawClone(
"hist same");
530 TH1* sigmaBkg = (TH1*)sigma->second->fShiftedSpectrum.second->Clone();
531 for (
size_t bin = 1;
bin <= size_t(sigmaBkg->GetNbinsX()); ++
bin)
532 sigmaBkg->SetBinContent(
bin, sigmaBkg->GetBinContent(
bin)/sigmaBkg->GetBinWidth(
bin));
533 sigmaBkg->GetYaxis()->SetTitle(
"Events / GeV");
534 sigmaBkg->SetLineStyle(kDashed);
535 sigmaBkg->SetLineColor(
abs(sigma->second->fSigma)+1);
536 sigmaBkg->SetLineWidth(2);
537 padSpecBkgTotal->cd();
538 sigmaBkg->DrawClone(
"hist same");
539 TH1* sigmaRatioBkg = (TH1*)sigmaBkg->Clone(
"sigmaRatioBkg");
540 sigmaRatioBkg->Divide(nomBkg);
541 padRatioBkgTotal->cd();
542 sigmaRatioBkg->DrawClone(
"hist same");
543 legEntries[
abs(sigma->second->fSigma)]
544 =
new TLegendEntry(sigmaSig->Clone(), Form(
"+/-%d#sigma", sigma->second->fSigma),
"l");
549 nomSig->Draw(
"hist");
550 sigmaSig->SetLineColor(
kRed);
551 sigmaSig->Draw(
"hist same");
553 padRatioSig->Clear();
554 nomRatio->Draw(
"hist");
555 sigmaRatioSig->SetLineColor(
kRed);
556 sigmaRatioSig->Draw(
"hist same");
559 padSpecSig->DrawClone();
560 padRatioSig->DrawClone();
561 outDir->cd(dirSigShift_sigmas.c_str());
562 canv->Write(Form(
"%s%dSigma",
fName.c_str(), sigma->second->fSigma));
566 nomBkg->Draw(
"hist");
567 sigmaBkg->SetLineColor(
kRed);
568 sigmaBkg->Draw(
"hist same");
570 padRatio_bg->Clear();
571 nomRatio->Draw(
"hist");
572 sigmaRatioBkg->SetLineColor(
kRed);
573 sigmaRatioBkg->Draw(
"hist same");
576 padSpec_bg->DrawClone();
577 padRatio_bg->DrawClone();
578 outDir->cd(dirBkgShiftSigmas.c_str());
579 canv->Write(Form(
"%s%dSigma",
fName.c_str(), sigma->second->fSigma));
584 for (
const auto& legEntry : legEntries)
585 leg->AddEntry(legEntry.second->GetObject(),
586 legEntry.second->GetLabel(),
587 legEntry.second->GetOption());
588 padSpecSigTotal->cd();
590 padSpecBkgTotal->cd();
597 padSpecSigTotal->Draw();
598 padRatioSigTotal->Draw();
599 outDir->cd(dirSigShift.c_str());
600 canv->Write(Form(
"%sSigAllSigmas",
fName.c_str()));
604 padSpecBkgTotal->Draw();
605 padRatioBkgTotal->Draw();
606 outDir->cd(dirBkgShift.c_str());
607 canv->Write(Form(
"%sBgAllSigmas",
fName.c_str()));
620 table <<
"\\newcommand{\\" << name <<
"}\n";
621 table <<
"{\\centerline{\n";
622 table <<
"\\begin{tabular}{ l | r r r | r r }\n";
623 table <<
" & Nom.&(+)&(-)&\\%(+)&\\%(-) \\\\ \\hline\n";
628 if (find(sigmas.begin(), sigmas.end(), 1) == sigmas.end())
629 assert(
false and
"+1 shift required to call WriteTable()!");
630 bool useDown = find(sigmas.begin(), sigmas.end(), -1) != sigmas.end();
633 double sigNom = 0, bkgNom = 0;
634 size_t nbins = nominal.first->GetNbinsX();
636 sigNom += nominal.first->GetBinContent(
it);
637 bkgNom += nominal.second->GetBinContent(
it);
641 double sigUp = sigNom, bkgUp = bkgNom, sigDown = 0, bkgDown = 0;
649 - nominal.first->GetBinContent(
it);
651 - nominal.first->GetBinContent(
it);
653 - nominal.second->GetBinContent(
it);
656 - nominal.first->GetBinContent(
it);
658 - nominal.second->GetBinContent(
it);
663 table <<
"Signal & " << sigNom <<
" & " << sigUp <<
" & ";
664 if (useDown) table << sigDown;
666 table <<
" & " << 100*((sigUp/sigNom)-1) <<
" & ";
667 if (useDown) table << 100*((sigDown/sigNom)-1);
670 table <<
"Background & " << bkgNom <<
" & " << bkgUp <<
" & ";
671 if (useDown) table << bkgDown;
673 table <<
" & " << 100*((bkgUp/bkgNom)-1) <<
" & ";
674 if (useDown) table << 100*((bkgDown/bkgNom)-1);
676 table <<
" \\\\\n\\end{tabular}\n}}\n";
685 cout <<
"Error: attempting to retrieve " << sigma <<
" sigma shift from " 686 <<
fName <<
"; does not exist. Aborting..." <<
endl;
696 TH1* hShiftSig =
GetSpectrum(sigma.second->fPrediction,
true, sample, calc);
697 TH1* hShiftBg =
GetSpectrum(sigma.second->fPrediction,
false, sample, calc);
698 TH1* hShiftRatioSig = (TH1*)hShiftSig->Clone(
"shiftRatSig");
699 hShiftRatioSig->Divide(nominal_spectrum.first);
700 TH1* hShiftRatioBg = (TH1*)hShiftBg->Clone(
"shiftRatBkg");
701 hShiftRatioBg->Divide(nominal_spectrum.second);
702 double shiftSig =
abs(hShiftSig->Integral() - nominal_spectrum.first->Integral()) /
703 nominal_spectrum.first->Integral();
704 double shiftBg =
abs(hShiftBg->Integral() - nominal_spectrum.second->Integral()) /
705 nominal_spectrum.second->Integral();
706 sigma.second->fShiftedSpectrum =
make_pair(hShiftSig, hShiftBg);
707 sigma.second->fShiftedRatio =
make_pair(hShiftRatioSig, hShiftRatioBg);
708 sigma.second->fShift =
make_pair(shiftSig, shiftBg);
717 const Cut* FDCut,
const Cut* NDCut,
const Cut* numuCut,
723 assert(
false and
"Base class version of MakePredictions should never be called!");
731 TDirectory*
tmp = gDirectory;
734 TObjString(
"SystMakerShift").Write(
"type");
739 const char* sigmaDir =
"Sigmas";
740 dir->mkdir(sigmaDir);
741 for (
const auto& sigma :
fSigmas) {
742 const char* sigmaSubdir = Form(
"%s/Sigma%d", sigmaDir, sigma.second->fSigma);
743 dir->mkdir(sigmaSubdir);
744 sigma.second->SaveTo(dir->GetDirectory(sigmaSubdir));
757 TObjString*
tag = (TObjString*)dir->Get(
"type");
759 assert(tag->GetString() ==
"SystMakerShift");
761 TObjString* name = (TObjString*)dir->Get(
"name");;
762 TObjString*
label = (TObjString*)dir->Get(
"label");;
763 unique_ptr<SystMakerShift> systMakerShift
764 = make_unique<SystMakerShift>(name->GetString().Data(), label->GetString().Data());
766 map<int, SystMakerShiftSigma*> sigmas;
767 TIter
next(dir->GetDirectory(
"Sigmas")->GetListOfKeys());
769 while ((key = (TKey*)
next())) {
774 systMakerShift->fSigmas = sigmas;
776 return systMakerShift;
791 this->
AddSigma(loaders, loaders, sigma);
820 for (
const int sigma : {-1,1}) {
823 fLoaders[
sigma] = pair<Loaders*, Loaders*>(loadersND, loaders_fd);
835 const Cut* FDCut,
const Cut* NDCut,
const Cut* numuCut,
844 FDCut, NDCut, numuCut,
847 fLoaders[sigma.second->fSigma].second,
848 fLoaders[sigma.second->fSigma].first);
879 for (
const auto& sigma : {-1,1}) {
891 const Cut* FDCut,
const Cut* NDCut,
const Cut* numuCut,
895 sigma.second->fPrediction =
GetPrediction(predType, axis, numuAxis, FDCut,
919 const Cut* FDCut,
const Cut* NDCut,
const Cut* numuCut,
923 sigma.second->fPrediction =
GetPrediction(predType, axis, numuAxis, FDCut,
924 NDCut, numuCut, &
kNoShift,
fSysts[sigma.second->fSigma], weight, loaders);
933 fSampleName(sampleName),
941 fNominalPred(nullptr) {
950 if (shift.second)
delete shift.second;
959 if (!
fShifts.count(shift_name)) {
960 cout <<
"Error: requested shift " << shift_name <<
" does not exist. Aborting..." <<
endl;
971 cout <<
"Error: sigma " << sigma <<
" does not exist. Aborting..." <<
endl;
982 pair<double, double> totalShift = this->
GetTotalShift(sigma);
983 return signal ? totalShift.first : totalShift.second;
991 map<int, vector<string> > shifts_sigmas;
992 for (
const auto& shift :
fShifts) {
993 vector<int> shiftSigmas = shift.second->GetSigmas();
994 for (
const auto& shiftSigma : shiftSigmas)
995 shifts_sigmas[shiftSigma].push_back(shift.second->GetName());
998 for (
const auto& shiftSigmas : shifts_sigmas)
999 if (shiftSigmas.second.size() == fShifts.size())
1000 sigmas.push_back(shiftSigmas.first);
1011 <<
"Systematic " <<
fLabel <<
" has total shift:" <<
endl 1014 os <<
endl <<
"Individual shifts:" <<
endl;
1015 for (
const auto& shift :
fShifts)
1016 shift.second->PrintShift(os);
1033 TH1* nomSig = (TH1*)
fSpectra[0].first->Clone();
1034 for (
size_t bin = 1;
bin <= size_t(nomSig->GetNbinsX()); ++
bin)
1035 nomSig->SetBinContent(
bin, nomSig->GetBinContent(
bin)/nomSig->GetBinWidth(
bin));
1036 nomSig->GetYaxis()->SetTitle(
"Events / GeV");
1037 nomSig->SetLineColor(kBlack);
1038 nomSig->SetLineStyle(kSolid);
1039 nomSig->SetLineWidth(2);
1040 TH1* nomRatio = (TH1*)nomSig->Clone();
1041 nomRatio->GetYaxis()->SetTitle(
"Shifted / Nominal");
1042 for (
size_t bin = 0;
bin <= (size_t)nomRatio->GetNbinsX(); ++
bin)
1043 nomRatio->SetBinContent(
bin, 1.);
1046 TCanvas*
canv =
new TCanvas(
"canvSig",
"", 800, 800);
1047 TPad* padSpec =
new TPad(
"padSpecSig",
"", 0., 0.375, 1., 1. );
1048 TPad* padRatio =
new TPad(
"padRatioSig",
"", 0., 0., 1., 0.375);
1049 map<int, TLegendEntry*> legEntrySigma;
1051 nomSig->Draw(
"hist");
1053 nomRatio->Draw(
"hist");
1054 legEntrySigma[0] =
new TLegendEntry(nomSig,
"Nominal",
"l");
1055 double ymaxRatio = 0;
1058 for (
const auto& sigma : this->
GetSigmas()) {
1063 TH1* sigmaSig = (TH1*)
fSpectra[sigma].first->Clone();
1064 for (
size_t bin = 1;
bin <= size_t(sigmaSig->GetNbinsX()); ++
bin)
1065 sigmaSig->SetBinContent(
bin, sigmaSig->GetBinContent(
bin)/sigmaSig->GetBinWidth(
bin));
1066 sigmaSig->GetYaxis()->SetTitle(
"Events / GeV");
1067 double hmax = nomSig->GetMaximum() > sigmaSig->GetMaximum() ?
1068 nomSig->GetMaximum() : sigmaSig->GetMaximum();
1069 nomSig->SetMaximum(1.1*hmax);
1070 sigmaSig->SetLineColor(
abs(sigma)+1);
1071 sigmaSig->SetLineStyle(kDashed);
1072 sigmaSig->SetLineWidth(2);
1074 sigmaSig->Draw(
"hist same");
1075 if (!legEntrySigma.count(
abs(sigma)))
1076 legEntrySigma[
abs(sigma)] =
new TLegendEntry(sigmaSig, Form(
"+/-%d #sigma",
abs(sigma)),
"l");
1079 TH1* ratioSig = (TH1*)sigmaSig->Clone();
1080 ratioSig->Divide(nomSig);
1081 ratioSig->SetBinContent(0, 1);
1082 for (
size_t i = 1;
i <= (size_t)ratioSig->GetNbinsX(); ++
i) {
1083 double val = ratioSig->GetBinContent(
i);
1085 ratioSig->SetBinContent(
i, 1);
1088 if (
fabs(1-val) > ymaxRatio)
1089 ymaxRatio =
fabs(1-val);
1092 ratioSig->Draw(
"hist same");
1094 TLegend* legSigma =
new TLegend(0.5, 0.5, 0.88, 0.88);
1095 for (
const auto& legEntry : legEntrySigma)
1096 legSigma->AddEntry(legEntry.second->GetObject(),
1097 legEntry.second->GetLabel(),
1098 legEntry.second->GetOption());
1100 legSigma->Draw(
"same");
1102 nomRatio->SetMinimum(1-(1.1*ymaxRatio));
1103 nomRatio->SetMaximum(1+(1.1*ymaxRatio));
1120 for (
size_t bin = 1;
bin <= size_t(nomBkg->GetNbinsX()); ++
bin)
1121 nomBkg->SetBinContent(
bin, nomBkg->GetBinContent(
bin)/nomBkg->GetBinWidth(
bin));
1122 nomBkg->GetYaxis()->SetTitle(
"Events / GeV");
1123 nomBkg->SetLineColor(kBlack);
1124 nomBkg->SetLineStyle(kSolid);
1125 nomBkg->SetLineWidth(2);
1126 TH1* nomRatio = (TH1*)nomBkg->Clone();
1127 nomRatio->GetYaxis()->SetTitle(
"Shifted / Nominal");
1128 for (
size_t bin = 0;
bin <= (size_t)nomRatio->GetNbinsX(); ++
bin)
1129 nomRatio->SetBinContent(
bin, 1.);
1132 TCanvas*
canv =
new TCanvas(
"canvBkg",
"", 800, 800);
1133 TPad* padSpec =
new TPad(
"padSpecBkg",
"", 0., 0.375, 1., 1. );
1134 TPad* padRatio =
new TPad(
"padRatio_bkg",
"", 0., 0., 1., 0.375);
1135 map<int, TLegendEntry*> legEntrySigma;
1137 nomBkg->Draw(
"hist");
1139 nomRatio->Draw(
"hist");
1140 legEntrySigma[0] =
new TLegendEntry(nomBkg,
"Nominal",
"l");
1141 double ymaxRatio = 0;
1144 for (
const auto& sigma : this->
GetSigmas()) {
1150 for (
size_t bin = 1;
bin <= size_t(sigmaBkg->GetNbinsX()); ++
bin)
1151 sigmaBkg->SetBinContent(
bin, sigmaBkg->GetBinContent(
bin)/sigmaBkg->GetBinWidth(
bin));
1152 sigmaBkg->GetYaxis()->SetTitle(
"Events / GeV");
1153 double hmax = nomBkg->GetMaximum() > sigmaBkg->GetMaximum() ?
1154 nomBkg->GetMaximum() : sigmaBkg->GetMaximum();
1155 nomBkg->SetMaximum(1.1*hmax);
1156 sigmaBkg->SetLineColor(
abs(sigma)+1);
1157 sigmaBkg->SetLineStyle(kDashed);
1158 sigmaBkg->SetLineWidth(2);
1160 sigmaBkg->Draw(
"hist same");
1161 if (!legEntrySigma.count(
abs(sigma)))
1162 legEntrySigma[
abs(sigma)] =
new TLegendEntry(sigmaBkg, Form(
"+/-%d #sigma",
abs(sigma)),
"l");
1165 TH1* ratioBkg = (TH1*)sigmaBkg->Clone();
1166 ratioBkg->Divide(nomBkg);
1167 ratioBkg->SetBinContent(0, 1);
1168 for (
size_t i = 1;
i <= (size_t)ratioBkg->GetNbinsX(); ++
i) {
1169 double val = ratioBkg->GetBinContent(
i);
1171 ratioBkg->SetBinContent(
i, 1);
1174 if (
fabs(1-val) > ymaxRatio)
1175 ymaxRatio =
fabs(1-val);
1178 ratioBkg->Draw(
"hist same");
1180 TLegend* legSigma =
new TLegend(0.5, 0.5, 0.88, 0.88);
1181 for (
const auto& legEntry : legEntrySigma)
1182 legSigma->AddEntry(legEntry.second->GetObject(),
1183 legEntry.second->GetLabel(),
1184 legEntry.second->GetOption());
1186 legSigma->Draw(
"same");
1188 nomRatio->SetMinimum(1-(1.1*ymaxRatio));
1189 nomRatio->SetMaximum(1+(1.1*ymaxRatio));
1204 string dirTop =
fName;
1205 string dirSignal = dirTop+
"/Signal/";
1206 string dirBackground = dirTop+
"/Background/";
1207 string dirSigShifts = dirSignal+
"/Shifts/";
1208 string dirBkgShifts = dirBackground+
"/Shifts/";
1209 outDir->mkdir(dirTop.c_str());
1210 outDir->mkdir(dirSignal.c_str());
1211 outDir->mkdir(dirBackground.c_str());
1212 outDir->mkdir(dirSigShifts.c_str());
1213 outDir->mkdir(dirBkgShifts.c_str());
1217 outDir->cd(dirSignal.c_str());
1218 canvSig->Write(
"TotalShiftSig");
1219 outDir->cd(dirBackground.c_str());
1220 canvBkg->Write(
"TotalShiftBg");
1225 for (
const auto& shift :
fShifts)
1226 shift.second->DrawShift(outDir->GetDirectory(dirTop.c_str()),
fSpectra[0]);
1238 ostringstream
table;
1240 table <<
"\\newcommand{\\" << name <<
"}\n";
1241 table <<
"{\\centerline{\n";
1242 table <<
"\\begin{tabular}{ l | r r r | r r }\n";
1243 table <<
" & Nom.&(+)&(-)&\\%(+)&\\%(-) \\\\ \\hline\n";
1247 if (find(sigmas.begin(), sigmas.end(), 1) == sigmas.end())
1248 assert(
false and
"+1 sigma shift required to call WriteTable()!");
1249 bool useDown = find(sigmas.begin(), sigmas.end(), -1) != sigmas.end();
1252 double sigNom = 0, bkgNom = 0;
1255 sigNom +=
fSpectra[0].first->GetBinContent(
it);
1256 bkgNom +=
fSpectra[0].second->GetBinContent(
it);
1260 double sigUp = sigNom, bkgUp = bkgNom, sigDown = 0, bkgDown = 0;
1268 sigUp += shift.second->GetShiftedSpectrum(1).first->GetBinContent(
it)
1270 bkgUp += shift.second->GetShiftedSpectrum(1).second->GetBinContent(
it)
1273 sigDown += shift.second->GetShiftedSpectrum(-1).first->GetBinContent(
it)
1275 bkgDown += shift.second->GetShiftedSpectrum(-1).second->GetBinContent(
it)
1282 table <<
"Signal & " << sigNom <<
" & " << sigUp <<
" & ";
1283 if (useDown) table << sigDown;
1284 else table <<
"N/A";
1285 table <<
" & " << 100*((sigUp/sigNom)-1) <<
" & ";
1286 if (useDown) table << 100*((sigDown/sigNom)-1);
1287 else table <<
"N/A";
1289 table <<
"Background & " << bkgNom <<
" & " << bkgUp <<
" & ";
1290 if (useDown) table << bkgDown;
1291 else table <<
"N/A";
1292 table <<
" & " << 100*((bkgUp/bkgNom)-1) <<
" & ";
1293 if (useDown) table << 100*((bkgDown/bkgNom)-1);
1294 else table <<
"N/A";
1295 table <<
" \\\\\n\\end{tabular}\n}}\n";
1311 for (
const auto& shift :
fShifts) {
1312 shift.second->MakePredictions(predType,
1327 for (
const auto& shift :
fShifts) {
1328 shift.second->ProcessShift(
fSpectra[0], sample, calc);
1330 fShifts[shift.first] = systShift;
1337 for (
const auto& sigma : sigmas) {
1338 vector<double> evtDiffSig(nbins, 0.), evtDiffBg(nbins, 0.);
1339 TH1* shiftSig = (TH1*)
fSpectra[0].first->Clone(
"shiftSig");
1341 double totShiftSig = 0., totShiftBkg = 0.;
1343 double valSig = 0., valBkg = 0.;
1345 if (fShifts.size() > 1) {
1346 for (
auto& shift : fShifts) {
1347 double binShiftSig = shift.second->GetShiftedSpectrum(sigma).first->GetBinContent(
bin) -
1349 double binShiftBkg = shift.second->GetShiftedSpectrum(sigma).second->GetBinContent(
bin) -
1351 valSig +=
pow(binShiftSig,2);
1352 valBkg +=
pow(binShiftBkg,2);
1354 double sign = sigma > 0 ? 1.0 : -1.0;
1355 shiftSig->SetBinContent(
bin,
fSpectra[0].first->GetBinContent(
bin) + (sign *
sqrt(valSig)));
1360 valSig = fShifts.begin()->second->GetShiftedSpectrum(sigma).first->GetBinContent(
bin)
1362 valBkg = fShifts.begin()->second->GetShiftedSpectrum(sigma).second->GetBinContent(
bin)
1364 shiftSig->SetBinContent(
bin, fShifts.begin()->second->GetShiftedSpectrum(sigma).first->GetBinContent(
bin));
1365 shiftBkg->SetBinContent(
bin, fShifts.begin()->second->GetShiftedSpectrum(sigma).second->GetBinContent(
bin));
1367 totShiftSig += valSig;
1368 totShiftBkg += valBkg;
1404 cout <<
"There are no spectra owned by this SystMaker!" 1405 <<
" Did you forget to call Go()?" <<
endl;
1410 map<int, pair<TH1*, TH1*>> shifts;
1411 for (
const auto& sigma :
fSpectra) {
1412 TH1* sigRatio = (TH1*)sigma.second.first->Clone(Form(
"SigRatioSigma%d", sigma.first));
1413 TH1* bkgRatio = (TH1*)sigma.second.second->Clone(Form(
"BgRatioSigma%d", sigma.first));
1417 for (
int i = 1;
i <= sigRatio->GetNbinsX(); ++
i) {
1419 double num = sigRatio->GetBinContent(
i);
1420 double den = fSpectra.at(0).first->GetBinContent(
i);
1421 double val = (num+eps)/(den+eps);
1427 sigRatio->SetBinContent(
i, val);
1428 num = bkgRatio->GetBinContent(
i);
1429 den = fSpectra.at(0).second->GetBinContent(
i);
1430 val = (num+eps)/(den+eps);
1431 bkgRatio->SetBinContent(
i, val);
1439 shifts[sigma.first] =
make_pair(sigRatio, bkgRatio);
1452 TDirectory*
tmp = gDirectory;
1455 TObjString(
"SystMaker").Write(
"type");
1463 const char* shifts_dir =
"Shifts";
1464 dir->mkdir(
"Shifts");
1465 for (
const auto& shift :
fShifts) {
1466 const char* shiftSubdir = Form(
"%s/%s", shifts_dir, shift.first.c_str());
1467 dir->mkdir(shiftSubdir);
1468 shift.second->SaveTo(dir->GetDirectory(shiftSubdir));
1481 TObjString*
tag = (TObjString*)dir->Get(
"type");
1483 assert(tag->GetString() ==
"SystMaker");
1485 TObjString* name = (TObjString*)dir->Get(
"name");
1488 TObjString*
label = (TObjString*)dir->Get(
"label");
1491 TObjString* sampleName = (TObjString*)dir->Get(
"samplename");
1494 unique_ptr<SystMaker> systMaker
1495 = make_unique<SystMaker>(name->GetString().Data(),
1496 label->GetString().Data(), sampleName->GetString().Data());
1499 tag = (TObjString*)dir->Get(
"nompred/type");
1501 if (tag->GetString() ==
"NDPredictionSterile")
1503 else if (tag->GetString() ==
"FDPredictionSterile")
1505 else if (tag->GetString() ==
"PredictionSterile")
1507 else assert(
false &&
"Prediction type not recognised!");
1510 map<string, SystMakerShift*> shifts;
1512 TIter shift_next(dir->GetDirectory(
"Shifts")->GetListOfKeys());
1514 while ((shift_key = (TKey*)shift_next())) {
1516 shift_key->GetName()))).
release();
1517 shifts[shift->
GetName()] = shift;
1519 systMaker->fShifts = shifts;
1521 return move(systMaker);
1529 fPredType(predType),
1536 fLightLoaders(nullptr),
1541 if (find(supportedPredTypes.begin(), supportedPredTypes.end(), predType) == supportedPredTypes.end()) {
1542 cout <<
"SystematicsMaker error: Unsupported prediction type. Aborting..." <<
endl;
1551 if (systMaker.second)
delete systMaker.second;
1561 systNames.push_back(syst.first);
1570 vector<NuISyst*>
systs;
1573 systs.push_back(syst);
1585 if (syst->
GetName().find(
"LightLevel") != string::npos)
1596 syst.second->PrintSyst(os);
1603 syst.second->DrawSyst(outDir);
1612 syst.second->ProcessSyst(
fSample, calc);
1613 fSystMakers[syst.first] = syst.second;
1625 const Cut* numuCut) {
1646 map<string, SystMaker*> systMakers;
1647 for (
const auto& systMaker : systMakers) {
1657 TDirectory*
tmp = gDirectory;
1660 TObjString(
"SystematicsMaker").Write(
"type");
1679 predtype[0] = predType;
1680 predtype.Write(
"predtype");
1682 TDirectory* systMakersDir = dir->mkdir(
"SystMakers");
1684 systMaker.second->SaveTo(systMakersDir->mkdir(systMaker.first.c_str()));
1697 TObjString*
tag = (TObjString*)dir->Get(
"type");
1699 assert(tag->GetString() ==
"SystematicsMaker");
1701 TObjString* tsName = (TObjString*)dir->Get(
"name");
1703 string name(tsName->GetString().Data());
1707 switch (static_cast<int>(
std::round(predtype[0]))) {
1719 unique_ptr<SystematicsMaker> systsMaker = make_unique<SystematicsMaker>(
name, predType);
1721 map<string, SystMaker*> systMakers;
1722 TIter
next(dir->GetDirectory(
"SystMakers")->GetListOfKeys());
1724 while ((key = (TKey*)
next())) {
1727 systMakers[systMaker->
GetName()] = systMaker;
1730 systsMaker->fSystMakers = systMakers;
1732 return move(systsMaker);
void SetAxes(const HistAxis *axis, const HistAxis *numuAxis=nullptr)
void SaveTo(TDirectory *dir, bool separate=false) const
static SystMakerShiftSigma * LoadFrom(TDirectory *dir)
std::string WriteTable(std::string name)
Write a table with up & down shifts for this systematic.
static std::unique_ptr< FDPredictionSterile > LoadFrom(TDirectory *dir, const std::string &name)
Cuts and Vars for the 2020 FD DiF Study.
std::map< int, std::pair< double, double > > fTotalShifts
virtual Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const =0
void SetNominalLoaders(Loaders *loaders)
fvar< T > fabs(const fvar< T > &x)
std::map< int, const Var * > fWeights
std::map< std::string, SystMakerShift * > fShifts
static std::unique_ptr< SystMakerShift > LoadFrom(TDirectory *dir)
LoadFrom implementation for SystMakerShift.
void SaveTo(TDirectory *dir) const
const HistAxis * fNuMuAxis
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
std::unique_ptr< IPrediction > Generate(Loaders &loaders, const SystShifts &shiftMC=kNoShift) const override
virtual void MakePredictions(SystPredType predType, const HistAxis *axis, const HistAxis *numuAxis, const Cut *fd_cut, const Cut *nd_cut, const Cut *numu_cut, const Var *weight, Loaders *loaders)
Base class implementation of MakePredictions, which just throws an error.
std::unique_ptr< IPrediction > Generate(Loaders &loaders, const SystShifts &shiftMC=kNoShift) const override
void PrintSysts(std::ostream &os=std::cout)
Simple record of shifts applied to systematic parameters.
IPrediction * fNominalPred
SystMakerWeightShift(std::string name, std::string label)
SystMakerWeightShift constructor.
std::pair< TH1 *, TH1 * > fShiftedRatio
Collection of SpectrumLoaders for many configurations.
std::pair< TH1 *, TH1 * > GetShiftedSpectrum(int sigma)
std::vector< std::string > GetSystematicsNames()
Get the names of all attached systematics.
std::vector< int > GetSigmas()
Get the sigmas for a given systematic shift.
SystMaker(std::string name, std::string label, std::string sample_name="")
SystMaker constructor.
void PrintSyst(std::ostream &os=std::cout)
Print the total shifts for each shift owned by this syst maker.
void PrintShift(std::ostream &os=std::cout)
static std::unique_ptr< PredictionSterile > LoadFrom(TDirectory *dir, const std::string &name)
~SystMakerWeightShift()
SystMakerWeightShift constructor.
virtual ~SystMakerShift()
Default destructor.
void AddSigma(Loaders *loaders, int sigma)
Add sigma for loader shift with the same ND and FD loader.
SystMakerLoaderShift(std::string name, std::string label)
SystMakerLoaderShift constructor.
virtual void SaveTo(TDirectory *dir, const std::string &name) const
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
SystMakerShift * GetShift(std::string shift_name)
Get the shift for a given name.
~SystMaker()
SystMaker destructor.
Generates extrapolated NC predictions using ProportionalDecomp.
fvar< T > round(const fvar< T > &x)
TH1 * GetSpectrum(IPrediction *pred, bool signal, const Sample sample, IOscCalc *calc)
void Add(SystematicsMaker *systMaker, bool overwrite)
function to add another SystematicsMaker to this one
_IOscCalc< double > IOscCalc
Representation of a spectrum in any variable, with associated POT.
void AddShift(SystMakerShift *shift)
Add SystMakerShift to this syst maker.
std::map< int, SystMakerShiftSigma * > fSigmas
void AddSigma(SystShifts *syst, int sigma)
Add sigma for syst shift.
void SetCuts(const Cut *fd_cut, const Cut *nd_cut, const Cut *numu_cut=nullptr)
void SetAxes(const HistAxis *axis, const HistAxis *numuAxis=nullptr)
std::map< int, std::pair< Loaders *, Loaders * > > fLoaders
Charged-current interactions.
TCanvas * DrawBkg()
Make plots of all the shifted spectra and ratios for this systmaker.
std::vector< NuISyst * > MakeISysts()
Make ISyst objects for each attached systematic and return them.
void MakePredictions(SystPredType predType)
Make predictions for all the SystMakerShift objects owned by this syst maker.
static std::unique_ptr< NDPredictionSterile > LoadFrom(TDirectory *dir, const std::string &name)
void SetNominalLoaders(Loaders *loader, Loaders *loader_light=nullptr)
static std::unique_ptr< SystMaker > LoadFrom(TDirectory *dir)
LoadFrom implementation for SystMaker.
void DrawSyst(TDirectory *outDir)
Make plots of all the shifted spectra and ratios for this systmaker.
virtual void MakePredictions(SystPredType predType, const HistAxis *axis, const HistAxis *numuAxis, const Cut *fd_cut, const Cut *nd_cut, const Cut *numu_cut, const Var *weight, Loaders *loaders) override
Make shifted prediction for systematic shift derived from alternate MC loader.
void AddSigma(const Var *weight, int sigma)
Add sigma for weight shift.
void SaveTo(TDirectory *dir) const
SaveTo implementation for SystMaker.
void SetCuts(const Cut *fd_cut, const Cut *nd_cut, const Cut *numu_cut=nullptr)
virtual void MakePredictions(SystPredType predType, const HistAxis *axis, const HistAxis *numuAxis, const Cut *fd_cut, const Cut *nd_cut, const Cut *numu_cut, const Var *weight, Loaders *loaders) override
Make shifted prediction for systematic shift derived from SystShift.
void DrawSysts(TDirectory *outDir)
virtual void MakePredictions(SystPredType predType, const HistAxis *axis, const HistAxis *numuAxis, const Cut *fd_cut, const Cut *nd_cut, const Cut *numu_cut, const Var *weight, Loaders *loaders) override
Make shifted prediction for systematic shift derived from CAFAna weight.
void AddSystematic(SystMaker *syst)
IPrediction * fPrediction
void AddOnOff(Loaders *loaders)
Add on/off for loader shift.
std::string WriteTable(std::pair< TH1 *, TH1 * > nominal, std::string name)
void PrintSigma(std::ostream &os=std::cout)
Print the sigmas for a given shift.
std::vector< int > GetSigmas()
const HistAxis * fNuMuAxis
void ProcessSyst(const covmx::Sample sample, osc::IOscCalc *calc)
~SystematicsMaker()
SystematicsMaker destructor.
std::pair< double, double > fShift
const SystShifts kNoShift
std::map< std::string, SystMaker * > fSystMakers
void ProcessShift(std::pair< TH1 *, TH1 * > &nominal_spectrum, const covmx::Sample sample, osc::IOscCalc *calc)
TString MakeLatexCommandName(TString mystring)
std::pair< TH1 *, TH1 * > fShiftedSpectrum
~SystMakerShiftSigma()
SystMakerShiftSigma destructor.
std::map< std::string, std::string > systNames
TCanvas * DrawSig()
Make plots of all the shifted spectra and ratios for this systmaker.
TCanvas * DrawSig(TH1 *nominal)
void DrawShift(TDirectory *outDir, std::pair< TH1 *, TH1 * > &nominal)
void SaveTo(TDirectory *dir) const
SaveTo implementation for SystMakerShift.
TCanvas * DrawBkg(TH1 *nominal)
void Go(const covmx::Sample sample, osc::IOscCalc *calc)
Neutral-current interactions.
void SetNominalWeight(const Var *weight)
assert(nhit_max >=nhit_nbins)
string shortName
THUMBNAIL BLOCK: We need to make a thumbnail for each.
Both neutrinos and antineutrinos.
Standard interface to all prediction techniques.
std::unique_ptr< IPrediction > Generate(Loaders &loaders, const SystShifts &shiftMC=kNoShift) const override
IPrediction * GetPrediction(SystPredType predType, const HistAxis *axis, const HistAxis *numuAxis, const Cut *FDCut, const Cut *NDCut, const Cut *numuCut, const SystShifts *shiftData, const SystShifts *shiftMC, const Var *weight, Loaders *loaders, Loaders *loadersND)
void SetNominalWeight(const Var *weight)
std::map< int, std::pair< double, double > > GetTotalShift()
SystematicsMaker(std::string name, SystPredType predType)
SystematicsMaker constructor.
void AddOnOff(const Var *weight)
Add on/off for weight shift.
SystMakerSystShift(std::string name, std::string label)
SystMakerSystShift constructor.
std::map< int, std::pair< TH1 *, TH1 * > > fSpectra
All neutrinos, any flavor.
Prevent histograms being added to the current directory.
Generates Near Detector predictions.
NuISyst * MakeISyst(covmx::Sample sample)
Function to make ISyst for this SystMaker.
SystMakerShift(std::string name, std::string label)
static std::unique_ptr< SystematicsMaker > LoadFrom(TDirectory *dir)
std::map< int, SystShifts * > fSysts
const covmx::Sample NullSample(covmx::Selection::kNoSel, covmx::Polarity::kNoPol, covmx::Detector::kNoDet)