88 #include "TDirectory.h" 101 #include "CAFAna/Core/Binning.h" 102 #include "CAFAna/Core/Cut.h" 115 #include "Utilities/func/MathUtil.h" 123 std::vector<std::string>
flavors{
"All",
"NC",
"NuMu",
"NuE",
"Cos"};
143 TLatex *
tex =
new TLatex();
145 tex->SetTextFont(42);
146 tex->SetTextSize(0.037);
147 tex->SetTextAlign(11);
149 std::string potStr = sPOT +
" #times 10^{20} POT-equiv.";
151 tex->DrawLatex(x, y,
"#Deltam^{2}_{32} = 2.44x10^{-3} eV^{2}");
152 tex->DrawLatex(x, y - 0.055,
"#theta_{13} = 8.5#circ, ^{}#theta_{23} = 45#circ");
153 tex->DrawLatex(x, y - 0.110, potStr.c_str());
166 double axLen = h->GetXaxis()->GetXmax() - h->GetXaxis()->GetXmin();
167 double ayTop = h->GetMaximum();
168 double delta = axLen/20.;
169 if(!left) { delta *= -1.; }
170 TLine*
line =
new TLine(cut, 0, cut, ayTop);
171 TArrow* arrow =
new TArrow(cut, ayTop*0.95,
172 cut + delta, ayTop*0.95,
174 line->SetLineColor(
kRed);
175 line->SetLineStyle(2);
176 line->SetLineWidth(3);
179 arrow->SetFillColor(
kRed);
180 arrow->SetFillStyle(1001);
181 arrow->SetLineColor(
kRed);
182 arrow->SetLineWidth(3);
190 int ndiv, Color_t
col,
bool fill)
193 h->SetLineColor(col);
198 h->SetMaximum(max*1.05);
199 if(ndiv) { h->GetXaxis()->SetNdivisions(ndiv); }
200 h->SetTitle(title.c_str());
208 leg->SetBorderSize(0);
209 leg->SetFillColor(kWhite);
210 leg->SetFillStyle(0);
211 leg->SetFillStyle(0);
212 leg->SetTextFont(42);
213 leg->SetTextSize(0.037);
219 double POT,
double potEquiv,
223 sprintf(pot,
"%4.2f", potEquiv);
225 std::string potStr = spot +
" #times 10^{20} POT-equiv.";
226 std::string NDpotStr = spot +
" #times 10^{20} POT";
230 TH1* hAll = spectra[0].
ToTH1(POT);
231 TH1* hNC = spectra[1].
ToTH1(POT);
232 TH1* hNumu = spectra[2].
ToTH1(POT);
233 TH1* hNue = spectra[3].
ToTH1(POT);
234 TH1* hNutau = spectra[4].
ToTH1(POT);
235 TH1* hCos = spectra[5].
ToTH1(POT);
237 TH1* hData = (dataspec ? dataspec->
ToTH1(dataspec->
POT()) :
nullptr);
243 if(name.find(
"PTP") != std::string::npos) { xLabel =
"p_{T}/p"; }
244 if(name.find(
"CVN") != std::string::npos) { xLabel =
"CVN NC Classifier"; }
245 std::string yLabel = (det.compare(
"ND") == 0 ?
"10^{3} Events":
"Events");
246 if(det.compare(
"FD") == 0){
247 if(name.find(
"CalE") != std::string::npos ||
248 name.find(
"ECal") != std::string::npos) { yLabel +=
" / 0.25 GeV"; }
251 if(det.compare(
"ND") == 0){
252 if(name.find(
"CalE") != std::string::npos ||
253 name.find(
"ECal") != std::string::npos) { yLabel +=
" / 0.25 GeV / "+NDpotStr; }
255 yLabel +=
" / "+NDpotStr;
258 std::string histTitle =
";" + xLabel +
";" + yLabel;
261 fprintf(textOFS,
"Event numbers at the %2.2s for %s %.2fe20 POT-equiv.:\n", det.c_str(), name.c_str(), potEquiv);
262 if(hData) { fprintf(textOFS,
"%12.12s, ",
"Data"); }
263 else { fprintf(textOFS,
"%14.14s",
""); }
264 fprintf(textOFS,
"%12.12s, %12.12s, %12.12s, %12.12s, %12.12s, %12.12s\n",
265 "All",
"NC (3 Flav)",
"Numu",
"Nue",
"Cosmic",
"FOM");
268 double nAll = hAll ->Integral();
269 double nNC3F = hNC ->Integral();
270 double nNumu = hNumu->Integral();
271 double nNue = hNue ->Integral();
272 double nCos = hCos ->Integral();
273 double fom = nNC3F/
sqrt(nAll);
275 double nData = hData->Integral(1, hData->GetNbinsX());
276 fprintf(textOFS,
"%10E, ", nData);
279 fprintf(textOFS,
"%14.14s",
"");
281 fprintf(textOFS,
"%10E, %10E, %10E, %10E, %10E, %10E\n\n",
282 nAll, nNC3F, nNumu, nNue, nCos, fom);
288 TH1* hCosStack = (TH1*)hCos->Clone();
291 TH1* hNumuStack = (TH1*)hCosStack->Clone();
292 hNumuStack->Add(hNumu);
295 TH1* hNueStack = (TH1*)hNumuStack->Clone();
296 hNueStack->Add(hNue);
299 TH1* hNCStack = (TH1*)hNueStack->Clone();
303 double maxval = hAll->GetBinContent(hAll->GetMaximumBin());
304 for(
int i = 1,
n = hNC->GetNbinsX();
i <=
n; ++
i) {
309 double data_value = hData->GetBinContent(
i);
310 double data_error =
sqrt(data_value);
312 maxval =
std::max(maxval, data_value + data_error);
317 if(det.compare(
"ND") == 0) {
318 double ndScale = 1./1000.;
319 hAll ->Scale(ndScale);
320 hNC ->Scale(ndScale);
321 hNue ->Scale(ndScale);
322 hNumu->Scale(ndScale);
323 hNCStack ->Scale(ndScale);
324 hNueStack ->Scale(ndScale);
325 hNumuStack->Scale(ndScale);
327 if(hData) { hData->Scale(ndScale); }
335 SetHistOptions(hCos, maxval, histTitle, ndiv, kCosmicBackgroundColor,
false);
337 if(hData) {
SetHistOptions(hData, maxval, histTitle, ndiv, kBlack,
false); }
339 if(name.find(
"CosBDT") != std::string::npos) {
340 hAll ->GetXaxis()->SetRangeUser(0.31, 0.7);
341 hNC ->GetXaxis()->SetRangeUser(0.31, 0.7);
342 hNumu->GetXaxis()->SetRangeUser(0.31, 0.7);
343 hNue ->GetXaxis()->SetRangeUser(0.31, 0.7);
344 hCos ->GetXaxis()->SetRangeUser(0.31, 0.7);
345 hNCStack ->GetXaxis()->SetRangeUser(0.31, 0.7);
346 hNueStack ->GetXaxis()->SetRangeUser(0.31, 0.7);
347 hNumuStack->GetXaxis()->SetRangeUser(0.31, 0.7);
348 hCosStack ->GetXaxis()->SetRangeUser(0.31, 0.7);
349 if(hData) { hData->GetXaxis()->SetRangeUser(0.31, 0.7); }
352 if(hData) { hData->SetMarkerStyle(kFullCircle); }
358 SetHistOptions(hCosStack, maxval, histTitle, ndiv, kCosmicBackgroundColor,
true);
360 std::string dataleg = ( (det.compare(
"ND") == 0) ?
"ND Data" :
"FD Data" );
363 TCanvas*
c =
new TCanvas(fullname.c_str(), fullname.c_str(), 800, 500);
364 gPad->SetFillStyle(0);
368 TLegend* leg =
new TLegend(xL,
yB,
xR,
yT);
370 if(hData) { leg->AddEntry(hData, dataleg.c_str(),
"lp"); }
371 leg->AddEntry(hAll,
"Total Prediction",
"l");
372 leg->AddEntry(hNC,
"NC 3 Flavor Prediction",
"l");
373 leg->AddEntry(hNue,
"#nu_{e} CC Background",
"l");
374 leg->AddEntry(hNumu,
"#nu_{#mu} CC Background",
"l");
375 if(det.compare(
"FD") == 0) {
376 leg->AddEntry(hCos,
"Cosmic Background",
"l");
378 leg->SetY1(leg->GetY2() - leg->GetNRows()*0.05);
382 hNumu->Draw(
"hist same");
383 if(det.compare(
"FD") == 0) { hCos->Draw(
"hist same"); }
384 hAll ->Draw(
"hist same");
385 hNC ->Draw(
"hist same");
386 if(hData) { hData->Draw(
"same"); }
397 rootOut->WriteTObject(c);
401 TCanvas* cStack =
new TCanvas(fullname.c_str(), fullname.c_str(), 800, 500);
402 gPad->SetFillStyle(0);
404 TLegend* legStack =
new TLegend(xL,
yB,
xR,
yT);
406 if(hData) { legStack->AddEntry(hData, dataleg.c_str(),
"lp"); }
407 legStack->AddEntry(hNCStack,
"NC 3 Flavor Prediction",
"f");
408 legStack->AddEntry(hNueStack,
"#nu_{e} CC Background",
"f");
409 legStack->AddEntry(hNumuStack,
"#nu_{#mu} CC Background",
"f");
410 if(det.compare(
"FD") == 0) {
411 legStack->AddEntry(hCosStack,
"Cosmic Background",
"f");
413 legStack->SetY1(legStack->GetY2() - legStack->GetNRows()*0.05);
416 hNCStack ->Draw(
"hist");
417 hNueStack ->Draw(
"hist same");
418 hNumuStack->Draw(
"hist same");
419 if(det.compare(
"FD") == 0) { hCosStack->Draw(
"hist same"); }
420 if(hData) { hData->Draw(
"same"); }
429 rootOut->WriteTObject(cStack);
452 double realPOT = (double)POT*1e20;
456 sprintf(potBuff,
"%d", POT);
461 TH1* hAll = spectra[0].
ToTH1(realPOT);
462 TH1* hNC = spectra[1].
ToTH1(realPOT);
463 TH1* hNumu = spectra[2].
ToTH1(realPOT);
464 TH1* hNue = spectra[3].
ToTH1(realPOT);
470 std::string yLabel = (det.compare(
"ND") == 0 ?
"10^{3} Events" :
"Event");
471 std::string histTitle =
";" + xLabel +
";" + yLabel;
473 if(option.find(
"label") != std::string::npos) {
474 fprintf(textOFS,
" %12.12s, %12.12s, %8.8s, %12.12s, %12.12s, %12.12s, %12.12s\n",
475 "NC",
"All",
"Numu",
"Nue",
"Cosmic",
"Purity",
"FOM");
478 double nNC = hNC ->Integral();
479 double nAll = hAll->Integral();
480 double nNumu = hNumu->Integral();
481 double nNue = hNue ->Integral();
482 double nCos = hCos->Integral();
483 double fom = nNC/
sqrt(nAll);
484 fprintf(textOFS,
"%2.2s -- %10E, %10E, %10E, %10E, %10E, %.6f, %10E\n",
485 det.c_str(), nNC, nAll, nNumu, nNue, nCos, nNC/nAll, fom);
489 TH1* hCosStack = (TH1*)hCos->Clone();
492 TH1* hNumuStack = (TH1*)hCosStack->Clone();
493 hNumuStack->Add(hNumu);
496 TH1* hNueStack = (TH1*)hNumuStack->Clone();
497 hNueStack->Add(hNue);
500 TH1* hNCStack = (TH1*)hNueStack->Clone();
505 double maxvalstack = 0.;
506 for(
int i = 1,
n = hNC->GetNbinsX();
i <=
n; ++
i) {
511 maxvalstack =
std::max(maxvalstack, hNCStack->GetBinContent(
i) +
error);
514 if(det.compare(
"ND") == 0) {
515 double ndScale = 1./1000.;
516 hAll ->Scale(ndScale);
517 hNC ->Scale(ndScale);
518 hNumu->Scale(ndScale);
519 hNue ->Scale(ndScale);
520 hCos ->Scale(ndScale);
521 hNCStack ->Scale(ndScale);
522 hNueStack ->Scale(ndScale);
523 hNumuStack->Scale(ndScale);
525 maxvalstack *= ndScale;
528 if(option.find(
"logy") != std::string::npos) {
529 maxval = maxval*2/1.05;
530 maxvalstack = maxvalstack*2/1.05;
538 SetHistOptions(hCos, maxval, histTitle, -404, kCosmicBackgroundColor,
false);
544 SetHistOptions(hCosStack, maxval, histTitle, -404, kCosmicBackgroundColor,
true);
546 if(option.find(
"logy") != std::string::npos) {
547 hAll ->SetMinimum(0.001);
548 hNC ->SetMinimum(0.001);
549 hNumu->SetMinimum(0.001);
550 hNue ->SetMinimum(0.001);
551 hCos ->SetMinimum(0.001);
552 hNCStack ->SetMinimum(0.001);
553 hNumuStack->SetMinimum(0.001);
554 hNueStack ->SetMinimum(0.001);
555 hCosStack ->SetMinimum(0.001);
558 double xL = 0.5,
xR = 0.7,
yB = 0.64,
yT = 0.84;
560 if(option.find(
"area") != std::string::npos) {
561 TLegend* leg =
new TLegend(xL,
yB,
xR,
yT);
562 leg->AddEntry(hNC,
"NC Signal",
"L");
563 leg->AddEntry(hNue,
"#nu_{e} CC Background",
"L");
564 leg->AddEntry(hNumu,
"#nu_{#mu} CC Background",
"L");
565 if(det.compare(
"ND") != 0) { leg->AddEntry(hCos,
"Cosmic Background",
"L"); }
566 leg->SetY1(leg->GetY2() - leg->GetNRows()*0.05);
569 hNumu->Scale(1./nNumu);
570 hNue ->Scale(1./nNue);
571 if(nCos > 0.) { hCos->Scale(1./nCos); }
574 maxval =
std::max(maxval, hNC ->GetBinContent(hNC ->GetMaximumBin()));
575 maxval =
std::max(maxval, hNumu->GetBinContent(hNumu->GetMaximumBin()));
576 maxval =
std::max(maxval, hNue ->GetBinContent(hNue ->GetMaximumBin()));
577 maxval =
std::max(maxval, hCos ->GetBinContent(hCos ->GetMaximumBin()));
580 hNC ->SetMaximum(maxval);
581 hNumu->SetMaximum(maxval);
582 hNue ->SetMaximum(maxval);
583 hCos ->SetMaximum(maxval);
585 TCanvas*
c =
new TCanvas(name.c_str(), title.c_str(), 800, 500);
586 gPad->SetFillStyle(0);
588 hNumu->Draw(
"hist same");
589 hNue ->Draw(
"hist same");
590 if(det.compare(
"ND") != 0) { hCos ->Draw(
"hist same"); }
595 rootOut->WriteTObject(c);
601 TLegend* leg =
new TLegend(xL,
yB,
xR,
yT);
603 leg->AddEntry(hAll,
"Total Prediction",
"l");
604 if(option.find(
"hist") != std::string::npos) {
605 leg->AddEntry(hNC,
"NC Prediction",
"l");
608 leg->AddEntry(hNC,
"NC Prediction",
"le");
610 leg->AddEntry(hNue,
"#nu_{e} CC Background",
"l");
611 leg->AddEntry(hNumu,
"#nu_{#mu} CC Background",
"l");
612 if(det.compare(
"ND") != 0) {
613 leg->AddEntry(hCos,
"Cosmic Background",
"l");
615 leg->SetY1(leg->GetY2() - leg->GetNRows()*0.05);
617 TLegend* legStack =
new TLegend(xL,
yB,
xR,
yT);
619 if(option.find(
"hist") != std::string::npos) {
620 legStack->AddEntry(hNCStack,
"NC Prediction",
"f");
623 legStack->AddEntry(hNCStack,
"NC Prediction",
"le");
625 legStack->AddEntry(hNueStack,
"#nu_{e} CC Background",
"f");
626 legStack->AddEntry(hNumuStack,
"#nu_{#mu} CC Background",
"f");
627 if(det.compare(
"ND") != 0) {
628 legStack->AddEntry(hCosStack,
"Cosmic Background",
"f");
630 legStack->SetY1(legStack->GetY2() - legStack->GetNRows()*0.05);
633 TCanvas*
c =
new TCanvas(name.c_str(), title.c_str(), 800, 500);
634 gPad->SetFillStyle(0);
637 hNumu->Draw(
"hist same");
638 if(det.compare(
"ND") != 0) { hCos ->Draw(
"hist same"); }
640 if(option.find(
"hist") != std::string::npos) { hNC->Draw(
"hist same"); }
641 else { hNC->Draw(
"same"); }
643 hAll ->Draw(
"hist same");
645 if(det.compare(
"FD") == 0) {
DrawLatexLines(xL + .025, leg->GetY1() - 0.045, spot); }
646 if(option.find(
"logy") != std::string::npos) { c->SetLogy(); }
649 rootOut->WriteTObject(c);
651 TCanvas* cStack =
new TCanvas((name +
"Stack").c_str(), title.c_str(), 800, 500);
652 gPad->SetFillStyle(0);
654 hNueStack ->Draw(
"hist");
655 hNumuStack->Draw(
"hist same");
656 if(det.compare(
"ND") != 0) { hCosStack ->Draw(
"hist same"); }
658 if(option.find(
"hist") != std::string::npos) { hNCStack->Draw(
"hist same"); }
659 else { hNCStack->Draw(
"same"); }
662 if(det.compare(
"FD") == 0) {
DrawLatexLines(xL + .025, legStack->GetY1() - 0.045, spot); }
663 if(option.find(
"logy") != std::string::npos) { cStack->SetLogy(); }
668 rootOut->WriteTObject(cStack);
680 TDirectory* rootOut, FILE* textOFS,
684 fprintf(textOFS,
"%s\n", name.c_str());
689 PlotSpectra(spectraND, rootOut, textOFS, fullname, label,
"ND", POT, fulloption);
691 label =
"FD " +
title;
692 fullname = name +
"FD";
693 PlotSpectra(spectraFD, rootOut, textOFS, fullname, label,
"FD", POT, option);
695 label =
"FD (sterile) " +
title;
696 fullname = name +
"St";
697 PlotSpectra(spectraSt, rootOut, textOFS, fullname, label,
"St", POT, option);
699 label =
"FD (Unoscillated) " +
title;
700 fullname = name +
"Un";
701 PlotSpectra(spectraUn, rootOut, textOFS, fullname, label,
"Un", POT, option);
703 fprintf(textOFS,
"\n\n");
714 TDirectory* rootOut, FILE* textOFS,
718 fprintf(textOFS,
"%s\n", name.c_str());
723 PlotSpectra(spectraND, rootOut, textOFS, fullname, label,
"ND", POT, fulloption);
725 label =
"FD " +
title;
726 fullname = name +
"FD";
727 PlotSpectra(spectraFD, rootOut, textOFS, fullname, label,
"FD", POT, option);
729 label =
"FD (swap) " +
title;
730 fullname = name +
"FS";
731 PlotSpectra(spectraFS, rootOut, textOFS, fullname, label,
"FS", POT, option);
733 fprintf(textOFS,
"\n\n");
746 TDirectory* rootOut, FILE* textOFS,
778 predSt->
Predict(calcst) + sCos,
789 predFD->
Predict(&noosc) + sCos,
797 PlotSpectra(spectraND, spectraFD, spectraSt, spectraUn,
798 rootOut, textOFS, name, title, POT, option);
810 TDirectory* rootOut, FILE* textOFS,
844 predFD->
Predict(&noosc) + sCos,
852 fprintf(textOFS,
"%s\n", name.c_str());
857 PlotSpectra(spectraND, rootOut, textOFS, fullname, label,
"ND", POT, fulloption);
859 label =
"FD " +
title;
860 fullname = name +
"FD";
861 PlotSpectra(spectraFD, rootOut, textOFS, fullname, label,
"FD", POT, option);
863 label =
"FD (Unoscillated) " +
title;
864 fullname = name +
"Un";
865 PlotSpectra(spectraUn, rootOut, textOFS, fullname, label,
"Un", POT, option);
867 fprintf(textOFS,
"\n\n");
876 TDirectory* rootOut, FILE* textOFS,
879 fprintf(textOFS,
"%s\n", name.c_str());
894 PlotSpectra(spectraFD, rootOut, textOFS, name, title,
"FD", POT, option);
912 std::string fulltitle = title +
" Purity and Efficiency";
914 TH1* hpur = pureff[1].
ToTH1(NCSCALE);
915 TH1* hpurD = pureff[0].
ToTH1(NCSCALE);
917 TH1* heff = pureff[1].
ToTH1(NCSCALE);
918 TH1* heffD = effcyD[1].
ToTH1(NCSCALE);
921 heff->SetLineColor(
kRed);
923 TH1* hnum = pureff[1].
ToTH1(NCSCALE);
924 double numerator = 0., efcncyD = 0., purityD = 0.;
925 for(
int i = 1,
n = hnum->GetNbinsX();
i <=
n; ++
i) {
926 numerator += hnum->GetBinContent(
i);
927 efcncyD += heffD->GetBinContent(
i);
928 purityD += hpurD->GetBinContent(
i);
930 double efcncy = numerator/efcncyD;
931 double purity = numerator/purityD;
932 std::cout << title <<
" Efficiency, Purity: " << efcncy <<
", " << purity <<
std::endl;
934 TLegend* leg =
new TLegend(0.5, 0.8, 0.8, 0.9);
935 leg->AddEntry(hpur,
"Purity",
"L");
936 leg->AddEntry(heff,
"Efficiency",
"L");
938 TCanvas*
c =
new TCanvas(fullname.c_str(), fulltitle.c_str(), 800, 500);
939 gPad->SetFillStyle(0);
940 if(hpur->GetBinContent(hpur->GetMaximumBin()) > heff->GetBinContent(heff->GetMaximumBin())) {
941 hpur->SetTitle(fulltitle.c_str());
943 heff->Draw(
"hist same");
946 heff->SetTitle(fulltitle.c_str());
948 hpur->Draw(
"hist same");
952 out->WriteTObject(c);
967 PlotPurEff(pureffND, effcyDND, out, fullname, label);
969 label =
"FD " +
title;
970 fullname = name +
"FD";
971 PlotPurEff(pureffFD, effcyDFD, out, fullname, label);
973 label =
"FD (swap) " +
title;
974 fullname = name +
"FS";
975 PlotPurEff(pureffFS, effcyDFS, out, fullname, label);
999 spectra[0] += spectra[
MAXSPEC - 1];
1001 int NX = binsX.
NBins();
1002 int NY = binsY.
NBins();
1004 std::string titlehelper = det +
" " + labelY +
" vs " + labelX +
", ";
1005 std::string labelhelper =
";" + labelX +
";" + labelY;
1010 std::vector<TH2*>
h2;
1013 h2.push_back(spectra[
i].
ToTH2(NCSCALE));
1015 fulltitle = titlehelper +
flavors[
i] + labelhelper;
1016 fullname = namehelper +
flavors[
i];
1017 h2[
i]->SetNameTitle(fullname.c_str(), fulltitle.c_str());
1019 if(option.find(
"norm") != std::string::npos) {
1020 for(
int i_x = 1; i_x <= NX; ++i_x) {
1021 double column_norm = 0.;
1023 for(
int i_y = 1; i_y <= NY; ++i_y) {
1024 column_norm += h2[
i]->GetBinContent(i_x, i_y);
1027 for(
int i_y = 1; i_y <= NY; ++i_y) {
1028 double h2bin = ( (column_norm > 0.) ? h2[
i]->GetBinContent(i_x, i_y)/column_norm : 0. );
1029 h2[
i]->SetBinContent(i_x, i_y, h2bin);
1035 if(option.find(
"avg") != std::string::npos) {
1036 std::vector<TH1*> hp;
1038 fulltitle = titlehelper + labelhelper;
1039 fullname = namehelper;
1042 hp.push_back(h2[
i]->
ProjectionX(fullname.c_str(), 1, NY));
1044 TAxis* ay = h2[
i]->GetYaxis();
1045 for(
int i_x = 1; i_x <= NX; ++i_x) {
1046 double weighted_val = 0.;
1048 for(
int i_y = 1; i_y <= NY; ++i_y) {
1049 weighted_val += h2[
i]->GetBinContent(i_x, i_y) * ay->GetBinCenter(i_y);
1052 double val_norm = hp[
i]->GetBinContent(i_x);
1053 hp[
i]->SetBinContent(i_x, ((val_norm > 0.) ? weighted_val/val_norm : 0.));
1056 hp[
i]->SetTitle(fulltitle.c_str());
1061 hp[0]->SetLineStyle(2);
1065 hp[4]->SetLineColor(kCosmicBackgroundColor);
1067 TLegend* leg =
new TLegend(0.5, 0.7, 0.8, 0.9);
1071 leg->AddEntry(hp[
i],
flavors[i].c_str(),
"L");
1073 if(hp[i]->GetBinContent(hp[i]->GetMaximumBin()) > maxval) {
1074 maxval = hp[
i]->GetBinContent(hp[i]->GetMaximumBin());
1078 fulltitle = titlehelper;
1079 TCanvas*
c =
new TCanvas(fullname.c_str(), fulltitle.c_str(), 800, 500);
1080 gPad->SetFillStyle(0);
1083 hp[0]->SetMaximum(maxval);
1084 hp[0]->Draw(
"hist");
1088 hp[
i]->SetMaximum(maxval);
1089 hp[
i]->Draw(
"hist same");
1095 rootOut->WriteTObject(c);
1099 fulltitle = titlehelper +
flavors[
i];
1100 fullname = namehelper + flavors[
i];
1102 TCanvas*
c =
new TCanvas(fullname.c_str(), fulltitle.c_str(), 800, 500);
1103 gPad->SetFillStyle(0);
1106 h2[
i]->Draw(
"colz");
1109 rootOut->WriteTObject(c);
1121 TDirectory* rootOut,
1126 Make2DFrom1D(spectraND, binsX, binsY, rootOut, name,
"ND", labelX, labelY, option);
1127 Make2DFrom1D(spectraFD, binsX, binsY, rootOut, name,
"FD", labelX, labelY, option);
1128 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.
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