92 #include "TDirectory.h" 118 sprintf(pot,
"%d", i);
120 if(withE20) { potStr +=
" x 10^{20} POT"; }
130 double dropE20 = pot/1e20;
131 int i = (
int)dropE20;
132 if(dropE20 > (
double)i + 0.5) { ++
i; }
141 for(
int i = 0,
n = nom->GetNbinsX();
i <=
n; ++
i) {
142 nom->SetBinError(
i,
sqrt(nom->GetBinError(
i)));
151 for(
int i = 0,
n = nom->GetNbinsX();
i <=
n; ++
i) {
152 nom->SetBinError(
i, 0.);
166 for(
int i = 0,
n = nom->GetNbinsX();
i <=
n; ++
i) {
167 error =
std::abs(up->GetBinContent(
i) - nom->GetBinContent(
i));
168 double error_sq = error*
error;
169 double err_prev =
std::abs(nom->GetBinError(
i));
171 nom->SetBinError(
i,
std::max(err_prev, error_sq));
174 nom->SetBinError(
i, err_prev + error_sq);
192 for(
int i = 0,
n = nom->GetNbinsX();
i <=
n; ++
i) {
194 std::abs(nom->GetBinContent(
i) - down->GetBinContent(
i)));
195 double error_sq = error*
error;
196 double err_prev =
std::abs(nom->GetBinError(
i));
198 nom->SetBinError(
i,
std::max(err_prev, error_sq));
201 nom->SetBinError(
i, err_prev + error_sq);
274 std::map<std::string, IDecomp*> * nominal,
277 TDirectory*
tmp = gDirectory;
278 TDirectory* keyDir = gDirectory;
282 TIter nextkey(dir->GetListOfKeys());
292 while((key = (TKey*)nextkey())) {
294 if(oldkey && !strcmp(oldkey->GetName(), key->GetName())) {
continue; }
295 if(key->ReadObj()->IsFolder()) {
296 keyDir = (TDirectory*)key->ReadObj();
303 std::vector<std::string>
tokens;
305 while(pos != std::string::npos) {
308 if(pos != std::string::npos) {
318 if(cafanaType.compare(tokens[0]) != 0) {
continue; }
320 sampleLabel = tokens[1];
321 if(tokens.size() > 2) {
322 systLabel = tokens[2];
323 sigma = std::stoi(tokens[3]);
340 std::map<std::string, PredictionNoExtrap*> * nominal,
343 TDirectory*
tmp = gDirectory;
344 TDirectory* keyDir = gDirectory;
347 TIter nextkey(dir->GetListOfKeys());
357 while((key = (TKey*)nextkey())) {
358 if(oldkey && !strcmp(oldkey->GetName(), key->GetName())) {
continue; }
359 if(key->ReadObj()->IsFolder()) {
360 keyDir = (TDirectory*)key->ReadObj();
367 std::vector<std::string>
tokens;
369 while(pos != std::string::npos) {
372 if(pos != std::string::npos) {
381 if(cafanaType.compare(tokens[0]) != 0) {
continue; }
383 sampleLabel = tokens[1];
384 if(tokens.size() > 2) {
385 systLabel = tokens[2];
386 sigma = std::stoi(tokens[3]);
403 std::map<std::string, PredictionSterile*> * nominal,
406 TDirectory*
tmp = gDirectory;
407 TDirectory* keyDir = gDirectory;
410 TIter nextkey(dir->GetListOfKeys());
420 while((key = (TKey*)nextkey())) {
421 if(oldkey && !strcmp(oldkey->GetName(), key->GetName())) {
continue; }
422 if(key->ReadObj()->IsFolder()) {
423 keyDir = (TDirectory*)key->ReadObj();
430 std::vector<std::string>
tokens;
432 while(pos != std::string::npos) {
435 if(pos != std::string::npos) {
444 if(cafanaType.compare(tokens[0]) != 0) {
continue; }
446 sampleLabel = tokens[1];
447 if(tokens.size() > 2) {
448 systLabel = tokens[2];
449 sigma = std::stoi(tokens[3]);
470 " Error for " + strs.
fSystL +
" Systematic";
471 std::string fullTitle =
";" + xlabel +
";" + ylabel;
476 std::string fullTitleRat =
";" + xlabel +
";" + ylabelRat;
483 TH1* hCVF = hp.at(0);
484 TH1* hCV = (TH1*)h->Clone();
485 map< int,float > cv_events_in_bins;
486 map<int, vector<float> > univ_events_in_bins;
487 unsigned int count = 0;
490 if(count!= hp.size()){
492 int nbinsx = curhist->GetNbinsX();
494 univ_events_in_bins[
i].push_back(curhist->GetBinContent(
i));
497 else if(count== hp.size()){
498 int nbinsx = hCV->GetNbinsX();
500 cv_events_in_bins[
i] = hCV->GetBinContent(
i);
506 TH1* hUp = (TH1*)hCVF->Clone(
"hUp");
507 TH1* hLow = (TH1*)hCVF->Clone(
"hLow");
509 for(
auto&
it: univ_events_in_bins){
510 double cv_val = hCVF->GetBinContent(
it.first);
512 for(
unsigned int iuniv=0;iuniv<hp.size();iuniv++){
513 err +=
pow(
it.second[iuniv] - cv_val,2);
515 err /= double(hp.size());
517 hUp->SetBinContent(binIt, cv_val+err);
518 hLow->SetBinContent(binIt,cv_val-err);
523 TH1* hRat = (TH1*)h->Clone();
525 TH1* hUpRat=(TH1*)hUp->Clone();
526 TH1* hLowRat=(TH1*)hLow->Clone();
527 int nBins = h->GetNbinsX();
528 double percent_diff = 100. *
std::abs(hUp->Integral(1, nBins) - h->Integral(1, nBins))/
529 h->Integral(1, nBins);
530 double percent_diff1 = 100. *
std::abs(hLow->Integral(1, nBins) - h->Integral(1, nBins))/
531 h->Integral(1, nBins);
533 fprintf(text,
"Up %s %s %.2s: +/-%6.4f%%\n",
536 fprintf(text,
"Low %s %s %.2s: +/-%6.4f%%\n",
541 for(
int i = 0;
i <= nBins+1; ++
i) {
542 hRat->SetBinContent(
i, 1.);
547 double maxval = h->GetBinContent(h->GetMaximumBin());
548 maxval =
std::max(maxval, hUp->GetBinContent(hUp->GetMaximumBin()));
550 double minval = h->GetBinContent(h->GetMinimumBin());
551 minval =
std::min(minval, hLow->GetBinContent(hLow->GetMinimumBin()));
553 if(maxval < minval) {
std::swap(maxval, minval); }
555 double maxvalRat = hRat->GetBinContent(hRat->GetMaximumBin());
556 maxvalRat =
std::max(maxvalRat, hUpRat->GetBinContent(hUpRat->GetMaximumBin()));
558 double minvalRat = hLowRat->GetBinContent(hLowRat->GetMinimumBin());
560 if(hUpRat->GetBinContent(
i) > 0.) {
561 minvalRat =
std::min(minvalRat, hLowRat->GetBinContent(
i));
566 minvalRat = 1 -
std::abs(maxvalRat - 1.);
567 maxvalRat = 1 +
std::abs(maxvalRat - 1.);
570 minvalRat = 1 -
std::abs(1. - minvalRat);
571 maxvalRat = 1 +
std::abs(1. - minvalRat);
575 h->SetLineColor(kBlack);
576 h->SetMaximum(1.1*maxval);
578 h->SetTitle(fullTitle.c_str());
581 hLow->SetLineColor(
kRed);
582 hLow->SetLineStyle(2);
583 hLow->SetMaximum(1.1*maxval);
585 hLow->SetTitle(fullTitle.c_str());
588 hUp->SetLineColor(
kGreen+2);
589 hUp->SetLineStyle(2);
590 hUp->SetMaximum(1.1*maxval);
592 hUp->SetTitle(fullTitle.c_str());
596 hRat->SetLineColor(kBlack);
597 hRat->SetMaximum(1.1*maxvalRat);
598 hRat->SetMinimum(0.9*minvalRat);
599 hRat->SetTitle(fullTitleRat.c_str());
602 hUpRat->SetLineColor(
kGreen+2);
603 hUpRat->SetLineStyle(2);
604 hUpRat->SetMaximum(1.1*maxvalRat);
605 hUpRat->SetMinimum(0.9*minvalRat);
608 hLowRat->SetLineColor(
kRed);
609 hLowRat->SetLineStyle(2);
610 hLowRat->SetMaximum(1.1*maxvalRat);
611 hLowRat->SetMinimum(0.9*minvalRat);
616 double xL = 0.6, xR = 0.85;
617 double yB = 0.6, yT = 0.85;
618 TLegend*
leg =
new TLegend(xL, yB, xR, yT);
619 leg->AddEntry(h,
"Nominal",
"l");
620 leg->AddEntry(hUp,
"Shifted Up 34%",
"l");
621 leg->AddEntry(hLow,
"Shifted down 34%",
"l");
624 TCanvas*
c =
new TCanvas(name.c_str(), title.c_str(), 800, 800);
625 TPad* pSpecs =
new TPad(
"pSpecs",
"", 0., 0.375, 1., 1.);
626 TPad* pRatio =
new TPad(
"pRatio",
"", 0., 0., 1., 0.375);
632 hUp->Draw(
"hist same");
633 hLow->Draw(
"hist same");
641 hUpRat->Draw(
"hist same");
642 hLowRat->Draw(
"hist same");
646 out->WriteTObject(c);
662 void PlotSyst(TH1*
h, TH1* hp1, TH1* hm1, TH1* hp2, TH1* hm2,
668 " Error for " + strs.
fSystL +
" Systematic";
669 std::string fullTitle =
";" + xlabel +
";" + ylabel;
674 std::string fullTitleRat =
";" + xlabel +
";" + ylabelRat;
676 TH1* hRat = (TH1*)h->Clone();
677 TH1* hp1Rat = (TH1*)hp1->Clone();
678 TH1* hm1Rat = (TH1*)hm1->Clone();
679 TH1* hp2Rat = (TH1*)hp2->Clone();
680 TH1* hm2Rat = (TH1*)hm2->Clone();
682 int nBins = h->GetNbinsX();
683 double nom_evts = h->Integral(1, nBins);
684 double evts_diff = 0.;
685 double percent_diff = 100.;
686 double percent_diff_p = 100.;
687 double percent_diff_m = 100.;
688 for(
int i = 0;
i <= nBins+1; ++
i) {
689 hRat->SetBinContent(
i, 1.);
691 if(
i != 0 &&
i != nBins+1) {
693 std::abs(hm1->GetBinContent(
i) - h->GetBinContent(
i)));
696 percent_diff *= (evts_diff/nom_evts);
697 percent_diff_p *= ((hp1->Integral(1, nBins) - nom_evts)/nom_evts);
698 percent_diff_m *= ((nom_evts - hm1->Integral(1, nBins))/nom_evts);
700 fprintf(text,
"%s %.2s %.2s: +/-%6.4f%%, +%6.4f%%, -%6.4f%%\n",
702 percent_diff, percent_diff_p, percent_diff_m);
709 double maxval = h->GetBinContent(h->GetMaximumBin());
710 maxval =
std::max(maxval, hp1->GetBinContent(hp1->GetMaximumBin()));
711 maxval =
std::max(maxval, hm1->GetBinContent(hm1->GetMaximumBin()));
712 maxval =
std::max(maxval, hp2->GetBinContent(hp2->GetMaximumBin()));
713 maxval =
std::max(maxval, hm2->GetBinContent(hm2->GetMaximumBin()));
715 double minval = h->GetBinContent(h->GetMinimumBin());
716 minval =
std::min(minval, hp1->GetBinContent(hp1->GetMinimumBin()));
717 minval =
std::min(minval, hm1->GetBinContent(hm1->GetMinimumBin()));
718 minval =
std::min(minval, hp2->GetBinContent(hp2->GetMinimumBin()));
719 minval =
std::min(minval, hm2->GetBinContent(hm2->GetMinimumBin()));
721 if(maxval < minval) {
std::swap(maxval, minval); }
723 double maxvalRat = hRat->GetBinContent(hRat->GetMaximumBin());
724 maxvalRat =
std::max(maxvalRat, hp1Rat->GetBinContent(hp1Rat->GetMaximumBin()));
725 maxvalRat =
std::max(maxvalRat, hm1Rat->GetBinContent(hm1Rat->GetMaximumBin()));
726 maxvalRat =
std::max(maxvalRat, hp2Rat->GetBinContent(hp2Rat->GetMaximumBin()));
727 maxvalRat =
std::max(maxvalRat, hm2Rat->GetBinContent(hm2Rat->GetMaximumBin()));
729 double minvalRat = hRat->GetBinContent(hRat->GetMinimumBin());
731 if(hp1Rat->GetBinContent(
i) > 0.) {
732 minvalRat =
std::min(minvalRat, hp1Rat->GetBinContent(
i));
734 if(hm1Rat->GetBinContent(
i) > 0.) {
735 minvalRat =
std::min(minvalRat, hm1Rat->GetBinContent(
i));
737 if(hp2Rat->GetBinContent(
i) > 0.) {
738 minvalRat =
std::min(minvalRat, hp2Rat->GetBinContent(
i));
740 if(hm2Rat->GetBinContent(
i) > 0.) {
741 minvalRat =
std::min(minvalRat, hm2Rat->GetBinContent(
i));
746 minvalRat = 1 -
std::abs(maxvalRat - 1.);
747 maxvalRat = 1 +
std::abs(maxvalRat - 1.);
750 minvalRat = 1 -
std::abs(1. - minvalRat);
751 maxvalRat = 1 +
std::abs(1. - minvalRat);
755 h->SetLineColor(kBlack);
756 h->SetMaximum(1.1*maxval);
758 h->SetTitle(fullTitle.c_str());
761 hp1->SetLineColor(
kRed);
762 hp1->SetLineStyle(2);
763 hp1->SetMaximum(1.1*maxval);
765 hp1->SetTitle(fullTitle.c_str());
768 hm1->SetLineColor(
kRed);
769 hm1->SetLineStyle(2);
770 hm1->SetMaximum(1.1*maxval);
772 hm1->SetTitle(fullTitle.c_str());
775 hp2->SetLineColor(
kBlue);
776 hp2->SetLineStyle(2);
777 hp2->SetMaximum(1.1*maxval);
779 hp2->SetTitle(fullTitle.c_str());
782 hm2->SetLineColor(
kBlue);
783 hm2->SetLineStyle(2);
784 hm2->SetMaximum(1.1*maxval);
786 hm2->SetTitle(fullTitle.c_str());
789 hRat->SetLineColor(kBlack);
790 hRat->SetMaximum(1.1*maxvalRat);
791 hRat->SetMinimum(0.9*minvalRat);
792 hRat->SetTitle(fullTitleRat.c_str());
795 hp1Rat->SetLineColor(
kRed);
796 hp1Rat->SetLineStyle(2);
797 hp1Rat->SetMaximum(1.1*maxvalRat);
798 hp1Rat->SetMinimum(0.9*minvalRat);
799 hp1Rat->SetTitle(fullTitleRat.c_str());
802 hm1Rat->SetLineColor(
kRed);
803 hm1Rat->SetLineStyle(2);
804 hm1Rat->SetMaximum(1.1*maxvalRat);
805 hm1Rat->SetMinimum(0.9*minvalRat);
806 hm1Rat->SetTitle(fullTitleRat.c_str());
809 hp2Rat->SetLineColor(
kBlue);
810 hp2Rat->SetLineStyle(2);
811 hp2Rat->SetMaximum(1.1*maxvalRat);
812 hp2Rat->SetMinimum(0.9*minvalRat);
813 hp2Rat->SetTitle(fullTitleRat.c_str());
816 hm2Rat->SetLineColor(
kBlue);
817 hm2Rat->SetLineStyle(2);
818 hm2Rat->SetMaximum(1.1*maxvalRat);
819 hm2Rat->SetMinimum(0.9*minvalRat);
820 hm2Rat->SetTitle(fullTitleRat.c_str());
822 double xL = 0.6, xR = 0.85;
823 double yB = 0.6, yT = 0.85;
824 TLegend*
leg =
new TLegend(xL, yB, xR, yT);
825 leg->AddEntry(h,
"Nominal",
"l");
826 leg->AddEntry(hp1,
"+/- 1 #sigma",
"l");
827 leg->AddEntry(hp2,
"+/- 2 #sigma",
"l");
829 TCanvas*
c =
new TCanvas(name.c_str(), title.c_str(), 800, 800);
830 TPad* pSpecs =
new TPad(
"pSpecs",
"", 0., 0.375, 1., 1.);
831 TPad* pRatio =
new TPad(
"pRatio",
"", 0., 0., 1., 0.375);
837 hp2->Draw(
"hist same");
838 hm2->Draw(
"hist same");
839 hp1->Draw(
"hist same");
840 hm1->Draw(
"hist same");
846 hp2Rat->Draw(
"hist same");
847 hm2Rat->Draw(
"hist same");
848 hp1Rat->Draw(
"hist same");
849 hm1Rat->Draw(
"hist same");
852 out->WriteTObject(c);
861 double POT,
bool NC,
bool use_max)
864 std::vector<TH1*> hp;
865 for(
auto shift: shifts){
866 TH1* hp1 =(NC ?
GetNC(shift, POT) :
GetBG(shift, POT));
880 double POT,
bool NC,
bool use_max)
882 std::vector<TH1*> hp;
884 for(
auto shift: shifts){
885 TH1* hp1=(NC ?
GetNC(shift, POT) :
GetBG(shift, POT));
900 double POT,
bool NC,
bool use_max)
902 std::vector<TH1*> hp;
903 for(
auto shift: shifts){
904 TH1* hp1 =(NC ?
GetNC(shift, POT) :
GetBG(shift, POT));
915 void PlotSyst(TH1* nom, std::map<int, IDecomp*> shifts,
917 double POT,
bool NC,
bool use_max)
919 TH1* hp1 = (NC ?
GetNC(shifts[+1], POT) :
GetBG(shifts[+1], POT));
920 TH1* hm1 = (NC ?
GetNC(shifts[-1], POT) :
GetBG(shifts[-1], POT));
921 TH1* hp2 = (NC ?
GetNC(shifts[+2], POT) :
GetBG(shifts[+2], POT));
922 TH1* hm2 = (NC ?
GetNC(shifts[-2], POT) :
GetBG(shifts[-2], POT));
925 PlotSyst(nom, hp1, hm1, hp2, hm2, out, text, strs);
933 void PlotSyst(TH1* nom, std::map<int, PredictionNoExtrap*> shifts,
935 double POT,
bool NC,
bool use_max)
937 TH1* hp1 = (NC ?
GetNC(shifts[+1], POT) :
GetBG(shifts[+1], POT));
938 TH1* hm1 = (NC ?
GetNC(shifts[-1], POT) :
GetBG(shifts[-1], POT));
939 TH1* hp2 = (NC ?
GetNC(shifts[+2], POT) :
GetBG(shifts[+2], POT));
940 TH1* hm2 = (NC ?
GetNC(shifts[-2], POT) :
GetBG(shifts[-2], POT));
943 PlotSyst(nom, hp1, hm1, hp2, hm2, out, text, strs);
951 void PlotSyst(TH1* nom, std::map<int, PredictionSterile*> shifts,
953 double POT,
bool NC,
bool use_max)
955 TH1* hp1 = (NC ?
GetNC(shifts[+1], POT) :
GetBG(shifts[+1], POT));
956 TH1* hm1 = (NC ?
GetNC(shifts[-1], POT) :
GetBG(shifts[-1], POT));
957 TH1* hp2 = (NC ?
GetNC(shifts[+2], POT) :
GetBG(shifts[+2], POT));
958 TH1* hm2 = (NC ?
GetNC(shifts[-2], POT) :
GetBG(shifts[-2], POT));
961 PlotSyst(nom, hp1, hm1, hp2, hm2, out, text, strs);
976 " Error Band for All " + strs.
fSystType +
" Systematics";
977 std::string fullTitle =
";" + xlabel +
";" + ylabel;
982 std::string fullTitleRat =
";" + xlabel +
";" + ylabelRat;
984 int nBins = h->GetNbinsX();
986 double nom_evts = h->Integral(1, nBins);
987 double evts_diff = 0.;
988 double percent_diff = 100.;
990 maxval =
std::max(maxval, h->GetBinContent(
i) + h->GetBinError(
i));
991 evts_diff +=
std::abs(h->GetBinError(
i));
993 percent_diff *= (evts_diff/nom_evts);
995 fprintf(text,
"\nAll systs %.2s %.2s: +/-%6.4f%%\n",
1001 h->SetMaximum(1.1*maxval);
1003 h->SetTitle(fullTitle.c_str());
1005 TH1* hErr = (TH1*)h->Clone();
1008 hErr->SetMaximum(1.1*maxval);
1009 hErr->SetMinimum(0);
1011 double maxvalRat = 1.;
1012 TH1* hRat = (TH1*)h->Clone();
1013 TH1* hUpp = (TH1*)h->Clone();
1014 TH1* hDwn = (TH1*)h->Clone();
1015 for(
int i = 1,
n = hRat->GetNbinsX();
i <=
n; ++
i) {
1016 double binVal = hRat->GetBinContent(
i);
1017 double errVal = hRat->GetBinError(
i);
1023 hRat->SetBinContent(
i, 1);
1024 hUpp->SetBinContent(
i, (binVal + errVal)/binVal);
1025 hDwn->SetBinContent(
i, (binVal - errVal)/binVal);
1027 double diff = (binVal + errVal)/binVal;
1028 if(diff > maxvalRat) {
1032 double minvalRat = 1. - (maxvalRat-1.);
1035 hRat->SetLineColor(kBlack);
1036 hRat->SetMaximum(1.05*maxvalRat);
1037 hRat->SetMinimum(0.95*minvalRat);
1038 hRat->SetTitle(fullTitleRat.c_str());
1041 hUpp->SetLineColor(
kRed);
1042 hUpp->SetLineStyle(2);
1043 hUpp->SetMaximum(1.05*maxvalRat);
1044 hUpp->SetMinimum(0.95*minvalRat);
1045 hUpp->SetTitle(fullTitleRat.c_str());
1048 hDwn->SetLineColor(
kRed);
1049 hDwn->SetLineStyle(2);
1050 hDwn->SetMaximum(1.05*maxvalRat);
1051 hDwn->SetMinimum(0.95*minvalRat);
1052 hDwn->SetTitle(fullTitleRat.c_str());
1054 TCanvas*
c =
new TCanvas(name.c_str(), title.c_str(), 800, 800);
1055 TPad* pSpecs =
new TPad(
"pSpecs",
"", 0., 0.375, 1., 1.);
1056 TPad* pRatio =
new TPad(
"pRatio",
"", 0., 0., 1., 0.375);
1062 h->Draw(
"hist same");
1067 hUpp->Draw(
"hist same");
1068 hDwn->Draw(
"hist same");
1071 out->WriteTObject(c);
1079 std::map<std::string, IDecomp*> decomps_nominal,
1081 std::map<std::string, PredictionNoExtrap*> predsNE_nominal,
1083 std::map<std::string, PredictionSterile*> predsSt_nominal,
1087 std::map<std::string, TDirectory*> savedirs;
1091 for(
const auto&
decomp : decomps_nominal) {
1092 dir =
"decomp" + sep +
decomp.first;
1093 savedirs[
dir] = out->mkdir(dir.c_str());
1094 decomp.second->SaveTo(savedirs[dir]);
1097 for(
const auto& sample : decomps_shifted) {
1098 for(
const auto& shiftlabel : sample.second) {
1099 for(
const auto&
decomp : shiftlabel.second) {
1100 dir =
"decomp" + sep + sample.first +
1101 sep + shiftlabel.first + sep +
1103 savedirs[
dir] = out->mkdir(dir.c_str());
1104 decomp.second->SaveTo(savedirs[dir]);
1109 for(
const auto&
pred : predsNE_nominal) {
1110 dir =
"predNE" + sep +
pred.first;
1111 savedirs[
dir] = out->mkdir(dir.c_str());
1112 pred.second->SaveTo(savedirs[dir]);
1115 for(
const auto& sample : predsNE_shifted) {
1116 for(
const auto& shiftlabel : sample.second) {
1117 for(
const auto&
pred : shiftlabel.second) {
1118 dir =
"predNE" + sep + sample.first +
1119 sep + shiftlabel.first + sep +
1121 savedirs[
dir] = out->mkdir(dir.c_str());
1122 pred.second->SaveTo(savedirs[dir]);
1127 for(
const auto&
pred : predsSt_nominal) {
1128 dir =
"predSt" + sep +
pred.first;
1129 savedirs[
dir] = out->mkdir(dir.c_str());
1130 pred.second->SaveTo(savedirs[dir]);
1133 for(
const auto& sample : predsSt_shifted) {
1134 for(
const auto& shiftlabel : sample.second) {
1135 for(
const auto&
pred : shiftlabel.second) {
1136 dir =
"predSt" + sep + sample.first +
1137 sep + shiftlabel.first + sep +
1139 savedirs[
dir] = out->mkdir(dir.c_str());
1140 pred.second->SaveTo(savedirs[dir]);
T max(const caf::Proxy< T > &a, T b)
Cuts and Vars for the 2020 FD DiF Study.
virtual Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const =0
void PlotMultiSyst(TH1 *h, std::vector< TH1 * > hp, TDirectory *out, FILE *text, strings strs)
Plot multiple systematics.
virtual Spectrum AntiNueComponent() const =0
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.
virtual Spectrum NumuComponent() const =0
void SqrtError(TH1 *nom)
Set the errors of the input histogram to be their square roots.
void SaveMaps(TDirectory *out, std::map< std::string, IDecomp * > decomps_nominal, std::map< std::string, std::map< std::string, std::map< int, IDecomp * > > > decomps_shifted, std::map< std::string, PredictionNoExtrap * > predsNE_nominal, std::map< std::string, std::map< std::string, std::map< int, PredictionNoExtrap * > > > predsNE_shifted, std::map< std::string, PredictionSterile * > predsSt_nominal, std::map< std::string, std::map< std::string, std::map< int, PredictionSterile * > > > predsSt_shifted)
Save all of the objects in the input maps to the out directory/file.
static std::unique_ptr< PredictionSterile > LoadFrom(TDirectory *dir, const std::string &name)
void PlotSyst(TH1 *h, TH1 *hp1, TH1 *hm1, TH1 *hp2, TH1 *hm2, TDirectory *out, FILE *text, strings strs)
void ZeroError(TH1 *nom)
Set the errors of the input histogram to 0.
void CenterTitles(TH1 *histo)
osc::IOscCalcAdjustable * DefaultOscCalc()
Create a new calculator with default assumptions for all parameters.
Representation of a spectrum in any variable, with associated POT.
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
TH1 * GetNC(IDecomp *specs, double POT)
Charged-current interactions.
void AddErrorInQuadrature(TH1 *nom, TH1 *up, bool use_max)
Optimized version of OscCalcPMNS.
void InitializeSystText(FILE *text, strings strs)
Print some initial text about a systematic – the systematic type and sample.
virtual Spectrum AntiNumuComponent() const =0
std::string StringFromInt(int i, bool withE20)
Helper function that takes an integer and turns it into a string.
std::vector< double > POT
void PlotSystBand(TH1 *h, TDirectory *out, FILE *text, strings strs)
virtual Spectrum NCTotalComponent() const
Standard interface to all decomposition techniques.
Neutral-current interactions.
Both neutrinos and antineutrinos.
Standard interface to all prediction techniques.
void LoadMaps(TDirectory *dir, std::map< std::string, IDecomp * > *nominal, std::map< std::string, std::map< std::string, std::map< int, IDecomp * > > > *shifted)
const Color_t kTotalMCColor
T min(const caf::Proxy< T > &a, T b)
All neutrinos, any flavor.
std::unique_ptr< IDecomp > LoadFrom< IDecomp >(TDirectory *dir, const std::string &label)
TH1 * GetBG(IDecomp *specs, double POT)
std::string StringFromDouble(double pot)
virtual Spectrum NueComponent() const =0
A helper structure to contain a group of string for plotting.