6 #include "CAFAna/Cuts/NueCutsSecondAna.h" 28 const Int_t
NRGBs = 3;
29 const Int_t
NCont = 255;
31 Double_t
red[
NRGBs] = { 1 , 0.6, .2};
34 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
35 gStyle->SetNumberContours(NCont);
40 const double pot =9.47964e20/12;
50 if (std::strstr(file.c_str(),
"official")) {
fname =
"/nova/ana/nu_e_ana/Ana2018/Predictions/provisional_singles/NueProd4SystematicsOnRealNDData_2018-05-03/pred_allxp_Nue2018Axis_full_FHCAllSyst_nueconcat_realNDData_2018-05-11.root";}
57 const std::string bennames[1] = {
"pred_xp_combo_Nominal/noShift/nue_pred_Nue2018Axis/extrap/EEextrap/Decomp/NueEstimate"};
59 TFile *
outfile =
new TFile((TString)file +
"BEN_plots.root",
"recreate");
61 for (
int i = 0;
i< 1; ++
i){
62 TDirectory*
d = outfile->mkdir((TString)bennames[
i]);
64 const double pot = 2.34*ben[
i] -> Data_Component().POT();
78 gStyle->SetTitleOffset(.82,
"xyz");
79 gStyle->SetLabelSize(0.035,
"xy");
80 gStyle->SetLabelSize(.035,
"z");
81 gStyle->SetTitleSize(0.05,
"xyz");
86 data->SetMarkerStyle(kFullCircle);
113 nemc->SetLineStyle(7);
115 nemc->GetXaxis()->SetTitle(
"Reconstructed Neutrino Energy (GeV)");
116 nemc->GetYaxis()->SetRangeUser(0,1.2*nemc->GetMaximum());
117 TLine*
line =
new TLine();
118 line->SetLineStyle(3);
124 ne->Draw(
"hist same");
128 TH1* fnuepiunwei = nuepiunwei->ToTH1(
pot,kAzure +6, 7);
130 TH1* fnuekaunwei = nuekaunwei->ToTH1(
pot,kMagenta -9, 7);
133 TH1* fnueotherunwei = nueotherunwei->ToTH1(
pot,
kGreen + 2, 7);
134 fnuepiunwei ->Draw(
"hist same");
135 fnuekaunwei ->Draw(
"hist same");
136 fnueotherunwei ->Draw(
"hist same");
138 TH1* fnuepiweight = dcmp -> NuePiEstimate().ToTH1(
pot,kAzure +6);
139 fnuepiweight->Draw(
"hist same");
141 TH1* fnuekaweight = dcmp -> NueKaEstimate().ToTH1(
pot, kMagenta -9);
142 fnuekaweight->Draw(
"hist same");
145 fnueotherweight->Add(fnuekaweight, -1);
146 fnueotherweight->Add(fnuepiweight, -1);
147 fnueotherweight->Draw(
"hist same");
152 TLegend *
leg =
new TLegend(0.665,0.4,0.89,0.89);
153 gStyle->SetTextSize(0.047);
154 leg->AddEntry(ne,
"Total #nu_{e} Corr.",
"l");
155 leg->AddEntry(fnuepiweight,
"#nu_{e} from #pi^{#pm} Corr.",
"l");
156 leg->AddEntry(fnuekaweight,
"#nu_{e} from K^{#pm} Corr.",
"l");
157 leg->AddEntry(fnueotherweight,
"#nu_{e} from Other Corr.",
"l");
158 leg->AddEntry(nemc,
"#nu_{e} Uncorr.",
"l");
163 std::cout<<
"\\multirow{2}*{Total $\\nu_e$} & Uncorrected &"<< nemc->Integral(0,9) <<
" & "<< nemc->Integral(10, 18)<<
" & "<< nemc->Integral(19, 27)<<
" & "<< nemc->Integral()<<
" \\\\"<<
std::endl;
165 std::cout<<setprecision(4)<<
" & Corrected & "<< ne->Integral(0,9) <<
"("<<100*(ne->Integral(0,9)-nemc->Integral(0,9))/nemc->Integral(0,9)<<
"\\%)" <<
" & "<< ne->Integral(10, 18)<<
"("<<100*(ne->Integral(10,18)-nemc->Integral(10,18))/nemc->Integral(10,18)<<
"\\%)" <<
" & "<< ne->Integral(19,27) <<
"("<<100*(ne->Integral(19,27)-nemc->Integral(19,27))/nemc->Integral(19,27)<<
"\\%)" <<
" & "<< ne->Integral() <<
"("<<100*(ne->Integral()-nemc->Integral())/nemc->Integral()<<
"\\%)" <<
" \\\\"<<
std::endl;
169 std::cout<<
"\\multirow{2}*{$\\nu_e$ From Pion} & Uncorrected &"<< fnuepiunwei->Integral(0,9) <<
" & "<< fnuepiunwei->Integral(10, 18)<<
" & "<< fnuepiunwei->Integral(19,27)<<
" & "<< fnuepiunwei->Integral()<<
" \\\\"<<
std::endl;
171 std::cout<<
" & Corrected & "<< fnuepiweight->Integral(0,9) <<
"("<<100*(fnuepiweight->Integral(0,9)-fnuepiunwei->Integral(0,9))/fnuepiunwei->Integral(0,9)<<
"\\%)" <<
" & "<< fnuepiweight->Integral(10, 18)<<
"("<<100*(fnuepiweight->Integral(10,18)-fnuepiunwei->Integral(10,18))/fnuepiunwei->Integral(10,18)<<
"\\%)" <<
" & "<< fnuepiweight->Integral(19,27)<<
"("<<100*(fnuepiweight->Integral(19,27)-fnuepiunwei->Integral(19,27))/fnuepiunwei->Integral(19,27)<<
"\\%)" <<
" & "<< fnuepiweight->Integral()<<
"("<<100*(fnuepiweight->Integral()-fnuepiunwei->Integral())/fnuepiunwei->Integral()<<
"\\%)" <<
" \\\\"<<
std::endl;
174 std::cout<<
"\\multirow{2}*{$\\nu_e$ From Kaon} & Uncorrected &"<< fnuekaunwei->Integral(0,9) <<
" & "<< fnuekaunwei->Integral(10, 18)<<
" & "<< fnuekaunwei->Integral(19,27)<<
" & "<< fnuekaunwei->Integral()<<
" \\\\"<<
std::endl;
175 std::cout<<
" & Corrected & "<< fnuekaweight->Integral(0,9) <<
"("<<100*(fnuekaweight->Integral(0,9)-fnuekaunwei->Integral(0,9))/fnuekaunwei->Integral(0,9)<<
"\\%)" <<
" & "<< fnuekaweight->Integral(10, 18)<<
"("<<100*(fnuekaweight->Integral(10,18)-fnuekaunwei->Integral(10,18))/fnuekaunwei->Integral(10,18)<<
"\\%)" <<
" & "<< fnuekaweight->Integral(19,27)<<
"("<<100*(fnuekaweight->Integral(19,27)-fnuekaunwei->Integral(19,27))/fnuekaunwei->Integral(19,27)<<
"\\%)" <<
" & "<< fnuekaweight->Integral()<<
"("<<100*(fnuekaweight->Integral()-fnuekaunwei->Integral())/fnuekaunwei->Integral()<<
"\\%)" <<
" \\\\"<<
std::endl;
179 std::cout<<
"\\multirow{2}*{$\\nu_e$ From Other} & Uncorrected &"<< fnueotherunwei->Integral(0,9) <<
" & "<< fnueotherunwei->Integral(10, 18)<<
" & "<< fnueotherunwei->Integral(19,27)<<
" & "<< fnueotherunwei->Integral()<<
" \\\\"<<
std::endl;
181 std::cout<<
" & Corrected & "<< fnueotherweight->Integral(0,9) <<
"("<<100*(fnueotherweight->Integral(0,9)-fnueotherunwei->Integral(0,9))/fnueotherunwei->Integral(0,9)<<
"\\%)" <<
" & "<< fnueotherweight->Integral(10, 18)<<
"("<<100*(fnueotherweight->Integral(10,18)-fnueotherunwei->Integral(10,18))/fnueotherunwei->Integral(10,18)<<
"\\%)" <<
" & "<< fnueotherweight->Integral(19,27)<<
"("<<100*(fnueotherweight->Integral(19,27)-fnueotherunwei->Integral(19,27))/fnueotherunwei->Integral(19,27)<<
"\\%)" <<
" & "<< fnueotherweight->Integral()<<
"("<<100*(fnueotherweight->Integral()-fnueotherunwei->Integral())/fnueotherunwei->Integral()<<
"\\%)" <<
" \\\\"<<
std::endl;
185 gPad->SaveAs((TString)
"plots/"+ ananame +
"_nueCC_from_All.pdf");
210 data->SetMarkerStyle(kFullCircle);
215 ccmc->SetLineStyle(7);
218 ccbarmc->SetLineStyle(7);
221 nemc->SetLineStyle(7);
224 nebarmc->SetLineStyle(7);
227 ncmc->SetLineStyle(7);
232 THStack * hsmc =
new THStack (
"hsmc",
"");
233 hsmc->Add(nemc,
"hist");
234 hsmc->Add(nebarmc,
"hist");
235 hsmc->Add(ncmc,
"hist");
236 hsmc->Add(ccmc,
"hist");
237 hsmc->Add(ccbarmc,
"hist");
239 char leg_data[50], leg_tot[50], leg_nemc[50],leg_nebarmc[50],leg_ccmc[50],leg_ccbarmc[50],leg_nc[50];
241 sprintf(leg_data,
"Data: Bin1= %.1f, Bin2= %.1f",
data->Integral(0,9),
data->Integral(10, 18));
243 sprintf(leg_nemc,
"#{nu}_{e}: Bin1= %.1f, Bin2= %.1f", nemc->Integral(0,9), nemc->Integral(10, 18));
244 sprintf(leg_nebarmc,
"#bar{#nu}_{e}: Bin1= %.1f, Bin2= %.1f", nebarmc->Integral(0,9), nebarmc->Integral(10, 18));
245 sprintf(leg_ccmc,
"#{nu}_{#mu}: Bin1= %.1f, Bin2= %.1f", ccmc->Integral(0,9), ccmc->Integral(10, 18));
246 sprintf(leg_ccbarmc,
"#bar{#nu}_{#mu}: Bin1= %.1f, Bin2= %.1f", ccbarmc->Integral(0,9), ccbarmc->Integral(10, 18));
247 sprintf(leg_nc,
"NC: Bin1= %.1f, Bin2= %.1f", ncmc->Integral(0,9), ncmc->Integral(10, 18));
265 THStack * hs =
new THStack (
"hs",
"");
274 hs->Add(nebar,
"hist");
277 hs->Add(ccbar,
"hist");
279 char leg_totc[50], leg_ne[50],leg_nebar[50],leg_cc[50],leg_ccbar[50],leg_ncc[50];
281 sprintf(leg_totc,
"MC: Bin1= %.1f, Bin2= %.1f", totalmcc->Integral(0,9), totalmcc->Integral(10, 18));
282 sprintf(leg_ne,
"#{nu}_{e}: Bin1= %.1f, Bin2= %.1f", ne->Integral(0,9), ne->Integral(10, 18));
283 sprintf(leg_nebar,
"#bar{#nu}_{e}: Bin1= %.1f, Bin2= %.1f", nebar->Integral(0,9), nebar->Integral(10, 18));
284 sprintf(leg_cc,
"#{nu}_{#mu}: Bin1= %.1f, Bin2= %.1f", cc->Integral(0,9), cc->Integral(10, 18));
285 sprintf(leg_ccbar,
"#bar{#nu}_{#mu}: Bin1= %.1f, Bin2= %.1f", ccbar->Integral(0,9), ccbar->Integral(10, 18));
286 sprintf(leg_ncc,
"NC: Bin1= %.1f, Bin2= %.1f",
nc->Integral(0,9),
nc->Integral(10, 18));
288 std::cout<<
"\\multirow{2}*{$\\nu_e$} & Uncorrected & "<< nemc->Integral(0,9) <<
" & "<< nemc->Integral(10, 18)<<
" \\\\"<<
std::endl;
289 std::cout<<
" & Corrected & "<< ne->Integral(0,9) <<
" & "<< ne->Integral(10, 18)<<
" \\\\"<<
std::endl;
290 std::cout<<
"\\multirow{2}*{$\\bar{\\nu}_e$} & Uncorrected & "<< nebarmc->Integral(0,9) <<
" & "<< nebarmc->Integral(10, 18)<<
" \\\\"<<
std::endl;
291 std::cout<<
" & Corrected & "<< nebar->Integral(0,9) <<
" & "<< nebar->Integral(10, 18)<<
" \\\\"<<
std::endl;
293 std::cout<<
"\\multirow{2}*{$\\nu_\\mu$} & Uncorrected & "<< ccmc->Integral(0,9) <<
" & "<< ccmc->Integral(10, 18)<<
" \\\\"<<
std::endl;
294 std::cout<<
" & Corrected & "<< cc->Integral(0,9) <<
" & "<< cc->Integral(10, 18)<<
" \\\\"<<
std::endl;
295 std::cout<<
"\\multirow{2}*{$\\bar{\\nu}_\\mu$} & Uncorrected & "<< ccbarmc->Integral(0,9) <<
" & "<< ccbarmc->Integral(10, 18)<<
" \\\\"<<
std::endl;
296 std::cout<<
" & Corrected & "<< ccbar->Integral(0,9) <<
" & "<< ccbar->Integral(10, 18)<<
" \\\\"<<
std::endl;
298 std::cout<<
"\\multirow{2}*{nc} & Uncorrected & "<< ncmc->Integral(0,9) <<
" & "<< ncmc->Integral(10, 18)<<
" \\\\"<<
std::endl;
305 hsmc->Draw(
"hist same");
306 hs->Draw(
"hist same");
311 TLegend *
leg =
new TLegend(0.7,0.5,0.89,0.89);
312 leg->AddEntry(
data,
"ND Data",
"lep");
313 leg->AddEntry(ne,
"Beam #nu_{e}",
"l");
314 leg->AddEntry(nebar,
"Beam #bar{#nu}_{e}",
"l");
315 leg->AddEntry(cc,
"#nu_{#mu} CC",
"l");
316 leg->AddEntry(ccbar,
"#bar{#nu}_{#mu} CC",
"l");
317 leg->AddEntry(
nc,
"NC",
"l");
319 auto dummy = (TH1*) nemc->Clone();
320 dummy->SetLineColor(kBlack);
321 leg->AddEntry(
dummy,
"Uncorr. MC",
"l");
339 leg->SetLineColor(4000);
340 leg->SetTextSize(0.03);
341 leg->SetTextFont(42);
344 gPad->SaveAs((TString)
"plots/"+ ananame +
"_Data_MC_corrected_uncorrected_stack.pdf");
348 cc->Draw(
"hist same");
349 nc->Draw(
"hist same");
350 ccmc->Draw(
"hist same");
351 nemc->Draw(
"hist same");
352 ncmc->Draw(
"hist same");
353 nebar->Draw(
"hist same");
354 ccbar->Draw(
"hist same");
355 ccbarmc->Draw(
"hist same");
356 nebarmc->Draw(
"hist same");
362 gPad->SaveAs((TString)
"plots/"+ ananame +
"_Data_MC_corrected_uncorrected.pdf");
const Color_t kBeamNueBarBackgroundColor
void Nue2018ThreeBinAxis(THStack *axes, bool drawLabels, bool merged, bool coreOnly)
Spectrum MC_NCTotalComponent() const override
Cuts and Vars for the 2020 FD DiF Study.
void SavePlotsPi(TDirectory *dir)
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.
Spectrum MC_AntiNueComponent() const override
void CenterTitles(TH1 *histo)
Spectrum NCTotalComponent() const override
const Color_t kNumuBackgroundColor
const XML_Char const XML_Char * data
Spectrum NueComponent() const override
double GetKaonScale() const
void PlotPionPlots(BENDecomp *dcmp, std::string ananame)
Spectrum MC_NumuComponent() const override
void Nue2018ThreeBinDivisions(bool coreOnly, const int color, const int style)
Spectrum AntiNueComponent() const override
void CompareDecompDataMC(BENDecomp *ben, std::string ana)
const Color_t kBeamNueBackgroundColor
Spectrum NumuComponent() const override
void plot_BEN(const std::string file)
Spectrum MC_NueComponent() const override
void SavePlots(TDirectory *dir)
void SavePlotsKa(TDirectory *dir)
Spectrum AntiNumuComponent() const override
void Nue2018ThreeBinLabels(const double yNDC, const double textsize, const int color, const bool nd)
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
const Color_t kNumuBarBackgroundColor
const Color_t kNCBackgroundColor
Spectrum Data_Component() const override
Spectrum MC_AntiNumuComponent() const override