89 #include "TDirectory.h" 102 #include "CAFAna/Core/Binning.h" 103 #include "CAFAna/Core/Cut.h" 116 #include "Utilities/func/MathUtil.h" 124 std::vector<std::string>
flavors{
"All",
"NC",
"NuMu",
"NuE",
"Cos"};
144 TLatex *
tex =
new TLatex();
146 tex->SetTextFont(42);
147 tex->SetTextSize(0.037);
148 tex->SetTextAlign(11);
150 std::string potStr = sPOT +
" #times 10^{20} POT-equiv.";
152 tex->DrawLatex(x, y,
"#Deltam^{2}_{32} = 2.44x10^{-3} eV^{2}");
153 tex->DrawLatex(x, y - 0.055,
"#theta_{13} = 8.5#circ, ^{}#theta_{23} = 45#circ");
154 tex->DrawLatex(x, y - 0.110, potStr.c_str());
167 double axLen = h->GetXaxis()->GetXmax() - h->GetXaxis()->GetXmin();
168 double ayTop = h->GetMaximum();
169 double delta = axLen/20.;
170 if(!left) { delta *= -1.; }
171 TLine*
line =
new TLine(cut, 0, cut, ayTop);
172 TArrow* arrow =
new TArrow(cut, ayTop*0.95,
173 cut + delta, ayTop*0.95,
175 line->SetLineColor(
kRed);
176 line->SetLineStyle(2);
177 line->SetLineWidth(3);
180 arrow->SetFillColor(
kRed);
181 arrow->SetFillStyle(1001);
182 arrow->SetLineColor(
kRed);
183 arrow->SetLineWidth(3);
194 h->SetLineColor(col);
199 h->SetMaximum(max*1.05);
200 if(ndiv) { h->GetXaxis()->SetNdivisions(ndiv); }
201 h->SetTitle(title.c_str());
209 leg->SetBorderSize(0);
210 leg->SetFillColor(kWhite);
211 leg->SetFillStyle(0);
212 leg->SetFillStyle(0);
213 leg->SetTextFont(42);
214 leg->SetTextSize(0.037);
220 double POT,
double potEquiv,
224 sprintf(pot,
"%4.2f", potEquiv);
226 std::string potStr = spot +
" #times 10^{20} POT-equiv.";
227 std::string NDpotStr = spot +
" #times 10^{20} POT";
231 TH1* hAll = spectra[0].
ToTH1(POT);
232 TH1* hNC = spectra[1].
ToTH1(POT);
233 TH1* hNumu = spectra[2].
ToTH1(POT);
234 TH1* hNue = spectra[3].
ToTH1(POT);
235 TH1* hNutau = spectra[4].
ToTH1(POT);
236 TH1* hCos = spectra[5].
ToTH1(POT);
238 TH1* hData = (dataspec ? dataspec->
ToTH1(dataspec->
POT()) :
nullptr);
244 if(name.find(
"PTP") != std::string::npos) { xLabel =
"p_{T}/p"; }
245 if(name.find(
"CVN") != std::string::npos) { xLabel =
"CVN NC Classifier"; }
246 std::string yLabel = (det.compare(
"ND") == 0 ?
"10^{3} Events":
"Events");
247 if(det.compare(
"FD") == 0){
248 if(name.find(
"CalE") != std::string::npos ||
249 name.find(
"ECal") != std::string::npos) { yLabel +=
" / 0.25 GeV"; }
252 if(det.compare(
"ND") == 0){
253 if(name.find(
"CalE") != std::string::npos ||
254 name.find(
"ECal") != std::string::npos) { yLabel +=
" / 0.25 GeV / "+NDpotStr; }
256 yLabel +=
" / "+NDpotStr;
259 std::string histTitle =
";" + xLabel +
";" + yLabel;
262 fprintf(textOFS,
"Event numbers at the %2.2s for %s %.2fe20 POT-equiv.:\n", det.c_str(), name.c_str(), potEquiv);
263 if(hData) { fprintf(textOFS,
"%12.12s, ",
"Data"); }
264 else { fprintf(textOFS,
"%14.14s",
""); }
265 fprintf(textOFS,
"%12.12s, %12.12s, %12.12s, %12.12s, %12.12s, %12.12s\n",
266 "All",
"NC (3 Flav)",
"Numu",
"Nue",
"Cosmic",
"FOM");
269 double nAll = hAll ->Integral();
270 double nNC3F = hNC ->Integral();
271 double nNumu = hNumu->Integral();
272 double nNue = hNue ->Integral();
273 double nCos = hCos ->Integral();
274 double fom = nNC3F/
sqrt(nAll);
276 double nData = hData->Integral(1, hData->GetNbinsX());
277 fprintf(textOFS,
"%10E, ", nData);
280 fprintf(textOFS,
"%14.14s",
"");
282 fprintf(textOFS,
"%10E, %10E, %10E, %10E, %10E, %10E\n\n",
283 nAll, nNC3F, nNumu, nNue, nCos, fom);
289 TH1* hCosStack = (TH1*)hCos->Clone();
292 TH1* hNumuStack = (TH1*)hCosStack->Clone();
293 hNumuStack->Add(hNumu);
296 TH1* hNueStack = (TH1*)hNumuStack->Clone();
297 hNueStack->Add(hNue);
300 TH1* hNCStack = (TH1*)hNueStack->Clone();
304 double maxval = hAll->GetBinContent(hAll->GetMaximumBin());
305 for(
int i = 1,
n = hNC->GetNbinsX();
i <=
n; ++
i) {
310 double data_value = hData->GetBinContent(
i);
311 double data_error =
sqrt(data_value);
313 maxval =
std::max(maxval, data_value + data_error);
318 if(det.compare(
"ND") == 0) {
319 double ndScale = 1./1000.;
320 hAll ->Scale(ndScale);
321 hNC ->Scale(ndScale);
322 hNue ->Scale(ndScale);
323 hNumu->Scale(ndScale);
324 hNCStack ->Scale(ndScale);
325 hNueStack ->Scale(ndScale);
326 hNumuStack->Scale(ndScale);
328 if(hData) { hData->Scale(ndScale); }
336 SetHistOptions(hCos, maxval, histTitle, ndiv, kCosmicBackgroundColor,
false);
338 if(hData) {
SetHistOptions(hData, maxval, histTitle, ndiv, kBlack,
false); }
340 if(name.find(
"CosBDT") != std::string::npos) {
341 hAll ->GetXaxis()->SetRangeUser(0.31, 0.7);
342 hNC ->GetXaxis()->SetRangeUser(0.31, 0.7);
343 hNumu->GetXaxis()->SetRangeUser(0.31, 0.7);
344 hNue ->GetXaxis()->SetRangeUser(0.31, 0.7);
345 hCos ->GetXaxis()->SetRangeUser(0.31, 0.7);
346 hNCStack ->GetXaxis()->SetRangeUser(0.31, 0.7);
347 hNueStack ->GetXaxis()->SetRangeUser(0.31, 0.7);
348 hNumuStack->GetXaxis()->SetRangeUser(0.31, 0.7);
349 hCosStack ->GetXaxis()->SetRangeUser(0.31, 0.7);
350 if(hData) { hData->GetXaxis()->SetRangeUser(0.31, 0.7); }
353 if(hData) { hData->SetMarkerStyle(kFullCircle); }
359 SetHistOptions(hCosStack, maxval, histTitle, ndiv, kCosmicBackgroundColor,
true);
361 std::string dataleg = ( (det.compare(
"ND") == 0) ?
"ND Data" :
"FD Data" );
364 TCanvas*
c =
new TCanvas(fullname.c_str(), fullname.c_str(), 800, 500);
365 gPad->SetFillStyle(0);
369 TLegend*
leg =
new TLegend(xL,
yB,
xR,
yT);
371 if(hData) { leg->AddEntry(hData, dataleg.c_str(),
"lp"); }
372 leg->AddEntry(hAll,
"Total Prediction",
"l");
373 leg->AddEntry(hNC,
"NC 3 Flavor Prediction",
"l");
374 leg->AddEntry(hNue,
"#nu_{e} CC Background",
"l");
375 leg->AddEntry(hNumu,
"#nu_{#mu} CC Background",
"l");
376 if(det.compare(
"FD") == 0) {
377 leg->AddEntry(hCos,
"Cosmic Background",
"l");
379 leg->SetY1(leg->GetY2() - leg->GetNRows()*0.05);
383 hNumu->Draw(
"hist same");
384 if(det.compare(
"FD") == 0) { hCos->Draw(
"hist same"); }
385 hAll ->Draw(
"hist same");
386 hNC ->Draw(
"hist same");
387 if(hData) { hData->Draw(
"same"); }
398 rootOut->WriteTObject(c);
402 TCanvas* cStack =
new TCanvas(fullname.c_str(), fullname.c_str(), 800, 500);
403 gPad->SetFillStyle(0);
405 TLegend* legStack =
new TLegend(xL,
yB,
xR,
yT);
407 if(hData) { legStack->AddEntry(hData, dataleg.c_str(),
"lp"); }
408 legStack->AddEntry(hNCStack,
"NC 3 Flavor Prediction",
"f");
409 legStack->AddEntry(hNueStack,
"#nu_{e} CC Background",
"f");
410 legStack->AddEntry(hNumuStack,
"#nu_{#mu} CC Background",
"f");
411 if(det.compare(
"FD") == 0) {
412 legStack->AddEntry(hCosStack,
"Cosmic Background",
"f");
414 legStack->SetY1(legStack->GetY2() - legStack->GetNRows()*0.05);
417 hNCStack ->Draw(
"hist");
418 hNueStack ->Draw(
"hist same");
419 hNumuStack->Draw(
"hist same");
420 if(det.compare(
"FD") == 0) { hCosStack->Draw(
"hist same"); }
421 if(hData) { hData->Draw(
"same"); }
430 rootOut->WriteTObject(cStack);
453 double realPOT = (double)POT*1e20;
457 sprintf(potBuff,
"%d", POT);
462 TH1* hAll = spectra[0].
ToTH1(realPOT);
463 TH1* hNC = spectra[1].
ToTH1(realPOT);
464 TH1* hNumu = spectra[2].
ToTH1(realPOT);
465 TH1* hNue = spectra[3].
ToTH1(realPOT);
471 std::string yLabel = (det.compare(
"ND") == 0 ?
"10^{3} Events" :
"Event");
472 std::string histTitle =
";" + xLabel +
";" + yLabel;
474 if(option.find(
"label") != std::string::npos) {
475 fprintf(textOFS,
" %12.12s, %12.12s, %8.8s, %12.12s, %12.12s, %12.12s, %12.12s\n",
476 "NC",
"All",
"Numu",
"Nue",
"Cosmic",
"Purity",
"FOM");
479 double nNC = hNC ->Integral();
480 double nAll = hAll->Integral();
481 double nNumu = hNumu->Integral();
482 double nNue = hNue ->Integral();
483 double nCos = hCos->Integral();
484 double fom = nNC/
sqrt(nAll);
485 fprintf(textOFS,
"%2.2s -- %10E, %10E, %10E, %10E, %10E, %.6f, %10E\n",
486 det.c_str(), nNC, nAll, nNumu, nNue, nCos, nNC/nAll, fom);
490 TH1* hCosStack = (TH1*)hCos->Clone();
493 TH1* hNumuStack = (TH1*)hCosStack->Clone();
494 hNumuStack->Add(hNumu);
497 TH1* hNueStack = (TH1*)hNumuStack->Clone();
498 hNueStack->Add(hNue);
501 TH1* hNCStack = (TH1*)hNueStack->Clone();
506 double maxvalstack = 0.;
507 for(
int i = 1,
n = hNC->GetNbinsX();
i <=
n; ++
i) {
512 maxvalstack =
std::max(maxvalstack, hNCStack->GetBinContent(
i) +
error);
515 if(det.compare(
"ND") == 0) {
516 double ndScale = 1./1000.;
517 hAll ->Scale(ndScale);
518 hNC ->Scale(ndScale);
519 hNumu->Scale(ndScale);
520 hNue ->Scale(ndScale);
521 hCos ->Scale(ndScale);
522 hNCStack ->Scale(ndScale);
523 hNueStack ->Scale(ndScale);
524 hNumuStack->Scale(ndScale);
526 maxvalstack *= ndScale;
529 if(option.find(
"logy") != std::string::npos) {
530 maxval = maxval*2/1.05;
531 maxvalstack = maxvalstack*2/1.05;
539 SetHistOptions(hCos, maxval, histTitle, -404, kCosmicBackgroundColor,
false);
545 SetHistOptions(hCosStack, maxval, histTitle, -404, kCosmicBackgroundColor,
true);
547 if(option.find(
"logy") != std::string::npos) {
548 hAll ->SetMinimum(0.001);
549 hNC ->SetMinimum(0.001);
550 hNumu->SetMinimum(0.001);
551 hNue ->SetMinimum(0.001);
552 hCos ->SetMinimum(0.001);
553 hNCStack ->SetMinimum(0.001);
554 hNumuStack->SetMinimum(0.001);
555 hNueStack ->SetMinimum(0.001);
556 hCosStack ->SetMinimum(0.001);
559 double xL = 0.5,
xR = 0.7,
yB = 0.64,
yT = 0.84;
561 if(option.find(
"area") != std::string::npos) {
562 TLegend*
leg =
new TLegend(xL,
yB,
xR,
yT);
563 leg->AddEntry(hNC,
"NC Signal",
"L");
564 leg->AddEntry(hNue,
"#nu_{e} CC Background",
"L");
565 leg->AddEntry(hNumu,
"#nu_{#mu} CC Background",
"L");
566 if(det.compare(
"ND") != 0) { leg->AddEntry(hCos,
"Cosmic Background",
"L"); }
567 leg->SetY1(leg->GetY2() - leg->GetNRows()*0.05);
570 hNumu->Scale(1./nNumu);
571 hNue ->Scale(1./nNue);
572 if(nCos > 0.) { hCos->Scale(1./nCos); }
575 maxval =
std::max(maxval, hNC ->GetBinContent(hNC ->GetMaximumBin()));
576 maxval =
std::max(maxval, hNumu->GetBinContent(hNumu->GetMaximumBin()));
577 maxval =
std::max(maxval, hNue ->GetBinContent(hNue ->GetMaximumBin()));
578 maxval =
std::max(maxval, hCos ->GetBinContent(hCos ->GetMaximumBin()));
581 hNC ->SetMaximum(maxval);
582 hNumu->SetMaximum(maxval);
583 hNue ->SetMaximum(maxval);
584 hCos ->SetMaximum(maxval);
586 TCanvas*
c =
new TCanvas(name.c_str(), title.c_str(), 800, 500);
587 gPad->SetFillStyle(0);
589 hNumu->Draw(
"hist same");
590 hNue ->Draw(
"hist same");
591 if(det.compare(
"ND") != 0) { hCos ->Draw(
"hist same"); }
596 rootOut->WriteTObject(c);
602 TLegend*
leg =
new TLegend(xL,
yB,
xR,
yT);
604 leg->AddEntry(hAll,
"Total Prediction",
"l");
605 if(option.find(
"hist") != std::string::npos) {
606 leg->AddEntry(hNC,
"NC Prediction",
"l");
609 leg->AddEntry(hNC,
"NC Prediction",
"le");
611 leg->AddEntry(hNue,
"#nu_{e} CC Background",
"l");
612 leg->AddEntry(hNumu,
"#nu_{#mu} CC Background",
"l");
613 if(det.compare(
"ND") != 0) {
614 leg->AddEntry(hCos,
"Cosmic Background",
"l");
616 leg->SetY1(leg->GetY2() - leg->GetNRows()*0.05);
618 TLegend* legStack =
new TLegend(xL,
yB,
xR,
yT);
620 if(option.find(
"hist") != std::string::npos) {
621 legStack->AddEntry(hNCStack,
"NC Prediction",
"f");
624 legStack->AddEntry(hNCStack,
"NC Prediction",
"le");
626 legStack->AddEntry(hNueStack,
"#nu_{e} CC Background",
"f");
627 legStack->AddEntry(hNumuStack,
"#nu_{#mu} CC Background",
"f");
628 if(det.compare(
"ND") != 0) {
629 legStack->AddEntry(hCosStack,
"Cosmic Background",
"f");
631 legStack->SetY1(legStack->GetY2() - legStack->GetNRows()*0.05);
634 TCanvas*
c =
new TCanvas(name.c_str(), title.c_str(), 800, 500);
635 gPad->SetFillStyle(0);
638 hNumu->Draw(
"hist same");
639 if(det.compare(
"ND") != 0) { hCos ->Draw(
"hist same"); }
641 if(option.find(
"hist") != std::string::npos) { hNC->Draw(
"hist same"); }
642 else { hNC->Draw(
"same"); }
644 hAll ->Draw(
"hist same");
646 if(det.compare(
"FD") == 0) {
DrawLatexLines(xL + .025, leg->GetY1() - 0.045, spot); }
647 if(option.find(
"logy") != std::string::npos) { c->SetLogy(); }
650 rootOut->WriteTObject(c);
652 TCanvas* cStack =
new TCanvas((name +
"Stack").c_str(), title.c_str(), 800, 500);
653 gPad->SetFillStyle(0);
655 hNueStack ->Draw(
"hist");
656 hNumuStack->Draw(
"hist same");
657 if(det.compare(
"ND") != 0) { hCosStack ->Draw(
"hist same"); }
659 if(option.find(
"hist") != std::string::npos) { hNCStack->Draw(
"hist same"); }
660 else { hNCStack->Draw(
"same"); }
663 if(det.compare(
"FD") == 0) {
DrawLatexLines(xL + .025, legStack->GetY1() - 0.045, spot); }
664 if(option.find(
"logy") != std::string::npos) { cStack->SetLogy(); }
669 rootOut->WriteTObject(cStack);
681 TDirectory* rootOut, FILE* textOFS,
685 fprintf(textOFS,
"%s\n", name.c_str());
690 PlotSpectra(spectraND, rootOut, textOFS, fullname, label,
"ND", POT, fulloption);
692 label =
"FD " +
title;
693 fullname = name +
"FD";
694 PlotSpectra(spectraFD, rootOut, textOFS, fullname, label,
"FD", POT, option);
696 label =
"FD (sterile) " +
title;
697 fullname = name +
"St";
698 PlotSpectra(spectraSt, rootOut, textOFS, fullname, label,
"St", POT, option);
700 label =
"FD (Unoscillated) " +
title;
701 fullname = name +
"Un";
702 PlotSpectra(spectraUn, rootOut, textOFS, fullname, label,
"Un", POT, option);
704 fprintf(textOFS,
"\n\n");
715 TDirectory* rootOut, FILE* textOFS,
719 fprintf(textOFS,
"%s\n", name.c_str());
724 PlotSpectra(spectraND, rootOut, textOFS, fullname, label,
"ND", POT, fulloption);
726 label =
"FD " +
title;
727 fullname = name +
"FD";
728 PlotSpectra(spectraFD, rootOut, textOFS, fullname, label,
"FD", POT, option);
730 label =
"FD (swap) " +
title;
731 fullname = name +
"FS";
732 PlotSpectra(spectraFS, rootOut, textOFS, fullname, label,
"FS", POT, option);
734 fprintf(textOFS,
"\n\n");
747 TDirectory* rootOut, FILE* textOFS,
779 predSt->
Predict(calcst) + sCos,
790 predFD->
Predict(&noosc) + sCos,
798 PlotSpectra(spectraND, spectraFD, spectraSt, spectraUn,
799 rootOut, textOFS, name, title, POT, option);
811 TDirectory* rootOut, FILE* textOFS,
845 predFD->
Predict(&noosc) + sCos,
853 fprintf(textOFS,
"%s\n", name.c_str());
858 PlotSpectra(spectraND, rootOut, textOFS, fullname, label,
"ND", POT, fulloption);
860 label =
"FD " +
title;
861 fullname = name +
"FD";
862 PlotSpectra(spectraFD, rootOut, textOFS, fullname, label,
"FD", POT, option);
864 label =
"FD (Unoscillated) " +
title;
865 fullname = name +
"Un";
866 PlotSpectra(spectraUn, rootOut, textOFS, fullname, label,
"Un", POT, option);
868 fprintf(textOFS,
"\n\n");
877 TDirectory* rootOut, FILE* textOFS,
880 fprintf(textOFS,
"%s\n", name.c_str());
895 PlotSpectra(spectraFD, rootOut, textOFS, name, title,
"FD", POT, option);
913 std::string fulltitle = title +
" Purity and Efficiency";
915 TH1* hpur = pureff[1].
ToTH1(NCSCALE);
916 TH1* hpurD = pureff[0].
ToTH1(NCSCALE);
918 TH1* heff = pureff[1].
ToTH1(NCSCALE);
919 TH1* heffD = effcyD[1].
ToTH1(NCSCALE);
922 heff->SetLineColor(
kRed);
924 TH1* hnum = pureff[1].
ToTH1(NCSCALE);
925 double numerator = 0., efcncyD = 0., purityD = 0.;
926 for(
int i = 1,
n = hnum->GetNbinsX();
i <=
n; ++
i) {
927 numerator += hnum->GetBinContent(
i);
928 efcncyD += heffD->GetBinContent(
i);
929 purityD += hpurD->GetBinContent(
i);
931 double efcncy = numerator/efcncyD;
932 double purity = numerator/purityD;
933 std::cout << title <<
" Efficiency, Purity: " << efcncy <<
", " << purity <<
std::endl;
935 TLegend*
leg =
new TLegend(0.5, 0.8, 0.8, 0.9);
936 leg->AddEntry(hpur,
"Purity",
"L");
937 leg->AddEntry(heff,
"Efficiency",
"L");
939 TCanvas*
c =
new TCanvas(fullname.c_str(), fulltitle.c_str(), 800, 500);
940 gPad->SetFillStyle(0);
941 if(hpur->GetBinContent(hpur->GetMaximumBin()) > heff->GetBinContent(heff->GetMaximumBin())) {
942 hpur->SetTitle(fulltitle.c_str());
944 heff->Draw(
"hist same");
947 heff->SetTitle(fulltitle.c_str());
949 hpur->Draw(
"hist same");
953 out->WriteTObject(c);
968 PlotPurEff(pureffND, effcyDND, out, fullname, label);
970 label =
"FD " +
title;
971 fullname = name +
"FD";
972 PlotPurEff(pureffFD, effcyDFD, out, fullname, label);
974 label =
"FD (swap) " +
title;
975 fullname = name +
"FS";
976 PlotPurEff(pureffFS, effcyDFS, out, fullname, label);
1000 spectra[0] += spectra[
MAXSPEC - 1];
1002 int NX = binsX.
NBins();
1003 int NY = binsY.
NBins();
1005 std::string titlehelper = det +
" " + labelY +
" vs " + labelX +
", ";
1006 std::string labelhelper =
";" + labelX +
";" + labelY;
1011 std::vector<TH2*>
h2;
1014 h2.push_back(spectra[
i].
ToTH2(NCSCALE));
1016 fulltitle = titlehelper +
flavors[
i] + labelhelper;
1017 fullname = namehelper +
flavors[
i];
1018 h2[
i]->SetNameTitle(fullname.c_str(), fulltitle.c_str());
1020 if(option.find(
"norm") != std::string::npos) {
1021 for(
int i_x = 1; i_x <= NX; ++i_x) {
1022 double column_norm = 0.;
1024 for(
int i_y = 1; i_y <= NY; ++i_y) {
1025 column_norm += h2[
i]->GetBinContent(i_x, i_y);
1028 for(
int i_y = 1; i_y <= NY; ++i_y) {
1029 double h2bin = ( (column_norm > 0.) ? h2[
i]->GetBinContent(i_x, i_y)/column_norm : 0. );
1030 h2[
i]->SetBinContent(i_x, i_y, h2bin);
1036 if(option.find(
"avg") != std::string::npos) {
1037 std::vector<TH1*> hp;
1039 fulltitle = titlehelper + labelhelper;
1040 fullname = namehelper;
1043 hp.push_back(h2[
i]->
ProjectionX(fullname.c_str(), 1, NY));
1045 TAxis* ay = h2[
i]->GetYaxis();
1046 for(
int i_x = 1; i_x <= NX; ++i_x) {
1047 double weighted_val = 0.;
1049 for(
int i_y = 1; i_y <= NY; ++i_y) {
1050 weighted_val += h2[
i]->GetBinContent(i_x, i_y) * ay->GetBinCenter(i_y);
1053 double val_norm = hp[
i]->GetBinContent(i_x);
1054 hp[
i]->SetBinContent(i_x, ((val_norm > 0.) ? weighted_val/val_norm : 0.));
1057 hp[
i]->SetTitle(fulltitle.c_str());
1062 hp[0]->SetLineStyle(2);
1066 hp[4]->SetLineColor(kCosmicBackgroundColor);
1068 TLegend*
leg =
new TLegend(0.5, 0.7, 0.8, 0.9);
1072 leg->AddEntry(hp[
i],
flavors[i].c_str(),
"L");
1074 if(hp[i]->GetBinContent(hp[i]->GetMaximumBin()) > maxval) {
1075 maxval = hp[
i]->GetBinContent(hp[i]->GetMaximumBin());
1079 fulltitle = titlehelper;
1080 TCanvas*
c =
new TCanvas(fullname.c_str(), fulltitle.c_str(), 800, 500);
1081 gPad->SetFillStyle(0);
1084 hp[0]->SetMaximum(maxval);
1085 hp[0]->Draw(
"hist");
1089 hp[
i]->SetMaximum(maxval);
1090 hp[
i]->Draw(
"hist same");
1096 rootOut->WriteTObject(c);
1100 fulltitle = titlehelper +
flavors[
i];
1101 fullname = namehelper + flavors[
i];
1103 TCanvas*
c =
new TCanvas(fullname.c_str(), fulltitle.c_str(), 800, 500);
1104 gPad->SetFillStyle(0);
1107 h2[
i]->Draw(
"colz");
1110 rootOut->WriteTObject(c);
1122 TDirectory* rootOut,
1127 Make2DFrom1D(spectraND, binsX, binsY, rootOut, name,
"ND", labelX, labelY, option);
1128 Make2DFrom1D(spectraFD, binsX, binsY, rootOut, name,
"FD", labelX, labelY, option);
1129 Make2DFrom1D(spectraFS, binsX, binsY, rootOut, name,
"FS", labelX, labelY, option);
void PlotStack(Spectrum spectra[], TDirectory *rootOut, FILE *textOFS, std::string name, std::string det, double POT, double potEquiv, PlotOptions opt, Spectrum *dataspec)
void SetHistOptions(TH1 *h, double max, std::string title, int ndiv, Color_t col, bool fill)
Set common options for a TLegend.
T max(const caf::Proxy< T > &a, T b)
Pass neutrinos through unchanged.
TLatex * DrawLatexLines(double x, double y, std::string sPOT)
Draw common TLatex lines.
Represent the binning of a Spectrum's x-axis.
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
virtual Spectrum AntiNueComponent() const =0
Eigen::ArrayXd ProjectionX(const Eigen::MatrixXd &mat)
Helper for Unweighted.
void PlotPurEff(Spectrum pureff[], Spectrum effcyD[], TDirectory *out, std::string name, std::string title)
const Color_t kCosmicBackgroundColor
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.
void Make2DFrom1D(Spectrum spectra[], const Binning &binsX, const Binning &binsY, TDirectory *rootOut, std::string name, std::string det, std::string labelX, std::string labelY, std::string option)
virtual Spectrum NumuComponent() const =0
virtual Spectrum Predict(osc::IOscCalc *calc) const =0
void OverridePOT(double newpot)
DO NOT USE UNLESS YOU ARE 110% CERTAIN THERE ISN'T A BETTER WAY!
General interface to oscillation calculators.
void CenterTitles(TH1 *histo)
osc::IOscCalcAdjustable * DefaultOscCalc()
Create a new calculator with default assumptions for all parameters.
const Color_t kNumuBackgroundColor
Representation of a spectrum in any variable, with associated POT.
const Color_t kNueSignalColor
Charged-current interactions.
std::vector< std::string > flavors
Optimized version of OscCalcPMNS.
virtual Spectrum AntiNumuComponent() const =0
osc::NoOscillations noosc
void DrawLineArrow(double cut, bool left, TH1 *h)
std::vector< double > POT
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
void SetLegendOptions(TLegend *leg)
Set common options for a TLegend.
virtual Spectrum NCTotalComponent() const
Standard interface to all decomposition techniques.
Neutral-current interactions.
Both neutrinos and antineutrinos.
void fill(std::vector< T > &x, const S &y)
Standard interface to all prediction techniques.
const Color_t kTotalMCColor
All neutrinos, any flavor.
void PlotSpectra(Spectrum spectra[], TDirectory *rootOut, FILE *textOFS, std::string name, std::string title, std::string det, int POT, std::string option)
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
const Color_t kNCBackgroundColor
double Livetime() const
Seconds. For informational purposes only. No calculations use this.
void FillWithDimColor(TH1 *h, bool usealpha, float dim)
TH2 * ToTH2(const Spectrum &s, double exposure, ana::EExposureType expotype, const Binning &binsx, const Binning &binsy, ana::EBinType bintype)
For use with Var2D.
virtual Spectrum NueComponent() const =0