26 TFile *
inFile =
new TFile(inName.c_str(),
"READ");
34 if (inName.find(
"fhc") != std::string::npos) {
36 horn =
"Neutrino Beam";
41 else if (inName.find(
"rhc") != std::string::npos) {
44 horn =
"Antineutrino Beam";
52 std::string sFitDir =
"/nova/ana/3flavor/Ana2020/Fits/BestFits/";
53 std::string sFitFile = sFitDir +
"bestfits_joint_realData_both_systs.root";
54 TFile *fBestFit =
new TFile(sFitFile.c_str(),
"READ");
60 if (inFile->GetDirectory(
"dtSpec_muonE_AllQuants")) {
61 std::unique_ptr<Spectrum> TempSpec =
Spectrum::LoadFrom(inFile,
"dtSpec_muonE_AllQuants");
62 dpot = TempSpec->POT();
63 dlt = TempSpec->Livetime();
67 const std::vector<std::string> quantNames =
68 {
"AllQuants",
"Quant1",
"Quant2",
"Quant3",
"Quant4"};
72 std::vector< TH1D* > hPred[5];
73 std::vector< TH1D* > hBkg[5];
74 std::vector< TH1D* > hNumu[5];
75 std::vector< TH1D* > hWS[5];
76 std::vector< TH1D* > hCosm[5];
77 std::vector< TH1D* > hData[5];
78 std::vector< TH1D* > hDataUS[5];
80 for (
uint q = 0; q < quantNames.size(); ++q) {
90 hCosm[q].push_back(
Load1DHistFromSpec(inFile,
"csSpec_" + varName +
"_" + quantNames[q],
true , pot, lt) );
93 hData [q].push_back(
LoadFakeDataFromPred(inFile,
"mcPred_" + varName +
"_" + quantNames[q], pot) );
94 hDataUS[q].push_back(
LoadFakeDataFromPred(inFile,
"mcPred_" + varName +
"_" + quantNames[q], pot) );
97 hData [q].push_back(
Load1DHistFromSpec(inFile,
"dtSpec_" + varName +
"_" + quantNames[q],
false, dpot, dlt) );
98 hDataUS[q].push_back(
Load1DHistFromSpec(inFile,
"dtSpec_" + varName +
"_" + quantNames[q],
false, dpot, dlt) );
102 hBkg [q].back()->Add(hNumu[q].back(), -1);
103 hBkg [q].back()->Add(hCosm[q].back(), +1);
104 hWS [q].back()->Add(hBkg [q].back(), +1);
105 hPred[q].back()->Add(hCosm[q].back(), +1);
117 if (varName ==
"recoE"){
118 hData[q].back()->Scale(0.1,
"width");
119 hPred[q].back()->Scale(0.1,
"width");
120 hCosm[q].back()->Scale(0.1,
"width");
121 hBkg [q].back()->Scale(0.1,
"width");
122 hWS [q].back()->Scale(0.1,
"width");
123 hNumu[q].back()->Scale(0.1,
"width");
131 std::ofstream
f((
"dataMC_" + HORN +
"_" +
var.first.first +
"_AllQuants.txt").c_str());
132 std::ofstream f_ByQ((
"dataMC_" + HORN +
"_" +
var.first.first +
"_ByQuant.txt").c_str());
133 TCanvas *
c =
new TCanvas(
"c",
"c", 960, 800);
137 c_ByQ->SetTitle(
"c_ByQ");
139 TLatex* xTitle =
new TLatex(0.5, 0.03,
var.first.second.c_str());
141 xTitle->SetTextAlign(22);
142 TString eventAppend = Form(
"%.2f #times 10^{20} POT", dpot/1e20);
146 eventAppend = Form(
"%.2f #times 10^{20} POT-equiv.", dpot/1e20);
148 if (
var.first.first ==
"recoE")
149 eventAppend =
"0.1 GeV";
150 TLatex* yTitle =
new TLatex(0.023, 0.5,
"Events / " + eventAppend);
152 yTitle->SetTextAlign(22);
153 yTitle->SetTextAngle(90.);
156 TLegend *
leg =
new TLegend(0.60,0.60,0.88,0.88);
157 TLegend *leg_l =
new TLegend(0.10,0.75,0.25,0.88);
158 TLegend *leg_r =
new TLegend(0.52,0.75,0.65,0.88);
159 leg->AddEntry(hData[0][v],
"FD data" ,
"LEP"); leg_l->AddEntry(hData[0][v],
"FD data" ,
"LEP");
160 leg->AddEntry(hPred[0][v],
"2020 Best-fit" ,
"L" ); leg_l->AddEntry(hPred[0][v],
"2020 Best-fit" ,
"L" );
161 leg->AddEntry(hBkg [0][v],
"Background" ,
"BF" ); leg_l->AddEntry(hBkg [0][v],
"Background" ,
"BF" );
162 leg ->SetTextSize (0.05); leg ->SetBorderSize(0); leg ->SetFillStyle (0);
163 leg_l->SetTextSize (0.03); leg_l->SetBorderSize(0); leg_l->SetFillStyle (0);
164 leg_r->SetTextSize (0.03); leg_r->SetBorderSize(0); leg_r->SetFillStyle (0);
167 float maxDataByQ = 0;
168 float maxPredByQ = 0;
169 for (
uint q = 1; q < quantNames.size(); ++q) {
170 float maxData = hData[q][
v]->GetMaximum();
171 float maxPred = hPred[q][
v]->GetMaximum();
173 if (maxData > maxDataByQ) maxDataByQ = maxData;
174 if (maxPred > maxPredByQ) maxPredByQ = maxPred;
178 for (
uint q = 0; q < quantNames.size(); ++q) {
185 if (q == 0) c ->cd();
186 if (q == 1) p1->cd();
187 if (q == 2) p2->cd();
188 if (q == 3) p3->cd();
189 if (q == 4) p4->cd();
194 grData->SetMarkerStyle(kFullCircle);
196 hPred[q][
v]->Draw(
"hist same");
197 hBkg[q][
v] ->Draw(
"hist same");
198 if ( !(
var.first.first ==
"trueE" ||
var.first.first ==
"resE") )
211 c->SaveAs((
"dataMC_" + HORN +
"_" +
var.first.first +
"_AllQuants.pdf").c_str());
212 c->SaveAs((
"dataMC_" + HORN +
"_" +
var.first.first +
"_AllQuants.png").c_str());
213 c->SaveAs((
"dataMC_" + HORN +
"_" +
var.first.first +
"_AllQuants.eps").c_str());
214 f << HORN <<
" " <<
var.first.second
215 <<
" with an un-extrapolated prediction set to the 2020 joint analysis best fit point" 221 xTitle->SetTextSize(0.04);
222 yTitle->SetTextSize(0.04);
230 c_ByQ->SaveAs((
"dataMC_" + HORN +
"_" +
var.first.first +
"_ByQuant.pdf").c_str());
231 c_ByQ->SaveAs((
"dataMC_" + HORN +
"_" +
var.first.first +
"_ByQuant.png").c_str());
232 c_ByQ->SaveAs((
"dataMC_" + HORN +
"_" +
var.first.first +
"_ByQuant.eps").c_str());
233 f_ByQ << HORN <<
" " <<
var.first.second
234 <<
" split by hadronic energy fraction quartile with an" 235 <<
" un-extrapolated prediction set to the 2020 joint analysis best fit point" 259 std::unique_ptr<PredictionNoExtrap> TempPred =
262 return TempPred->PredictComponent(calc, predsel.
flav, predsel.
curr, predsel.
sign).ToTH1(pot);
270 std::unique_ptr<PredictionNoExtrap> TempPred =
273 return TempPred->Predict(calc).MockData(pot).ToTH1(pot);
280 std::unique_ptr<Spectrum> TempSpec =
286 return TempSpec->ToTH1(pot);
TH1D * LoadFakeDataFromPred(TFile *inFile, std::string name, double pot)
void plot_DataMCComp_numu(std::string inName, bool fakeData=false)
Cuts and Vars for the 2020 FD DiF Study.
void MakeHistCanvasReady_Quant(const int quant, TH1 *hist, double ymax)
const Color_t kCosmicBackgroundColor
General interface to oscillation calculators.
TPaveText * DrawQuantLabel(int quant)
void PimpHist(TH1 *hist, Style_t linestyle, Color_t linecolor, int linewidth, Style_t markerstyle, Color_t markercolor, double markersize)
Pimp histogram once and for all.
const Color_t kFullPredColor
Sum up livetimes from individual cosmic triggers.
static std::unique_ptr< Spectrum > LoadFrom(TDirectory *dir, const std::string &name)
TGraph * graphAsymmErrorScaled(TH1 *histScaled, TH1 *hist, double overallScale)
TPaveText * DrawBeamLabel(bool isFHC)
Put the standardized beam label in the left corner of the active canvas.
TGraphAsymmErrors * GraphWithPoissonErrors2(const TH1 *h, const TH1 *h2, bool noErrorsXaxis, bool drawEmptyBins)
Same as above but use a reference histogram to determine which empty bins to draw.
TH1D * Load1DHistFromSpec(TFile *inFile, std::string name, bool cosmic, double pot, double lt)
const double kAna2020FHCLivetime
const Color_t kTotalBkgColor
Simple oscillation probability calculator that has no solar term or mass hierarchy or delta so it's s...
const double kAna2020FHCPOT
const double kAna2020RHCPOT
const double kAna2020RHCLivetime
const Color_t kNumuWSColor
void SplitCanvasQuant(TCanvas *&canvas, TPad *&pad1, TPad *&pad2, TPad *&pad3, TPad *&pad4)
void FillWithDimColor(TH1 *h, bool usealpha, float dim)
TH1D * Load1DHistFromPred(TFile *inFile, std::string name, PredSel predsel, double pot, osc::IOscCalc *calc)