16 #include "TPaletteAxis.h" 20 void DrawArrow(TCanvas *
c,
double x, TString arrow_opt,
int line_color = kBlack,
int line_style = 1,
int line_width = 3);
26 std::string input_file_name =
"/nova/ana/users/ddoyle/NuebarFiducialOptimization/fiducial_optimization_nocvn_all.root",
27 std::string plot_dump =
"/nova/ana/users/ddoyle/NuebarFiducialOptimization/plots_2d_nocvn/")
31 double arrow_down = 0;
56 results_file_name.insert(results_file_name.find(
".root"),
"_results");
60 TFile * input = TFile::Open(input_file_name.c_str(),
"read");
64 TFile *
results =
new TFile(results_file_name.c_str(),
"recreate");
68 results->mkdir(rootdir.c_str()),
72 TH2D * frac_uncert_xsec = (TH2D*) results->Get((rootdir +
"/frac_uncert_xsec" ).c_str());
73 TH2D * frac_uncert_sel = (TH2D*) results->Get((rootdir +
"/frac_uncert_sel" ).c_str());
74 TH2D * frac_uncert_bkgd_stat = (TH2D*) results->Get((rootdir +
"/frac_uncert_bkgd_stat").c_str());
75 TH2D * frac_uncert_bkgd_syst = (TH2D*) results->Get((rootdir +
"/frac_uncert_bkgd_syst").c_str());
76 TH2D * frac_uncert_eff = (TH2D*) results->Get((rootdir +
"/frac_uncert_eff" ).c_str());
80 TCanvas *
c =
new TCanvas();
81 c->SetRightMargin(0.2);
84 frac_uncert_xsec->GetZaxis()->SetRangeUser(0,6);
87 frac_uncert_sel->GetZaxis()->SetRangeUser(0, 1.2);
90 frac_uncert_bkgd_stat->GetZaxis()->SetRangeUser(0, 1.2);
93 frac_uncert_bkgd_syst->GetZaxis()->SetRangeUser(0, 6);
96 frac_uncert_eff->GetZaxis()->SetRangeUser(0, 1.2);
99 frac_uncert_xsec->Draw(
"colz");
103 c->Print((plot_dump +
"/" + rootdir +
"_frac_uncert_xsec.pdf").c_str());
105 frac_uncert_sel->Draw(
"colz");
109 c->Print((plot_dump +
"/" + rootdir +
"_frac_uncert_sel.pdf").c_str());
111 frac_uncert_bkgd_stat->Draw(
"colz");
115 c->Print((plot_dump +
"/" + rootdir +
"_frac_uncert_bkgd_stat.pdf").c_str());
117 frac_uncert_bkgd_syst->Draw(
"colz");
121 c->Print((plot_dump +
"/" + rootdir +
"_frac_uncert_bkgd_syst.pdf").c_str());
123 frac_uncert_eff->Draw(
"colz");
127 c->Print((plot_dump +
"/" + rootdir +
"_frac_uncert_eff.pdf").c_str());
131 TFile * fdebug = TFile::Open((plot_dump +
"/debug.root").c_str());
132 auto syst_defs = optimize->GetSystDefs();
133 auto mvsyst_defs = optimize->GetMVSystDefs();
134 syst_defs.insert(syst_defs.end(), mvsyst_defs.begin(), mvsyst_defs.end());
135 std::vector<TH1*> vabs_uncert_eff_syst;
136 std::vector<TH1*> vabs_uncert_bkgd_syst;
137 std::vector<TH1*> vfrac_uncert_eff_syst;
138 std::vector<TH1*> vfrac_uncert_bkgd_syst;
139 for(
auto syst : syst_defs) {
140 vabs_uncert_eff_syst .push_back((TH1*) fdebug->Get((syst->GetName() +
"_abs_uncert_eff_syst" ).c_str()));
141 vabs_uncert_bkgd_syst .push_back((TH1*) fdebug->Get((syst->GetName() +
"_abs_uncert_bkgd_syst" ).c_str()));
142 vfrac_uncert_eff_syst .push_back((TH1*) fdebug->Get((syst->GetName() +
"_frac_uncert_eff_syst" ).c_str()));
143 vfrac_uncert_bkgd_syst.push_back((TH1*) fdebug->Get((syst->GetName() +
"_frac_uncert_bkgd_syst").c_str()));
146 PlotSysts(vabs_uncert_eff_syst , syst_defs, arrow_down, arrow_up, plot_dump +
"/vabs_uncert_eff_syst" );
147 PlotSysts(vabs_uncert_bkgd_syst , syst_defs, arrow_down, arrow_up, plot_dump +
"/vabs_uncert_bkgd_syst" );
148 PlotSysts(vfrac_uncert_eff_syst , syst_defs, arrow_down, arrow_up, plot_dump +
"/vfrac_uncert_eff_syst" , 1);
149 PlotSysts(vfrac_uncert_bkgd_syst, syst_defs, arrow_down, arrow_up, plot_dump +
"/vfrac_uncert_bkgd_syst", 1);
156 TCanvas *
c =
new TCanvas(
UniqueName().c_str(),
"");
157 c->SetRightMargin(0.2);
158 for(
auto ihist = 0
u; ihist < hists.size(); ihist++) {
159 hists[ihist]->SetTitle(systs[ihist]->
GetName().c_str());
160 if(limit) hists[ihist]->GetZaxis()->SetRangeUser(0, limit);
161 hists[ihist]->Draw(
"colz");
167 c->Print((name +
"_" +systs[ihist]->
GetName() +
".pdf").c_str());
173 auto palette = (TPaletteAxis*) hist->GetListOfFunctions()->FindObject(
"palette");
174 palette->SetX1NDC(0.81);
175 palette->SetX2NDC(0.85);
181 TGraph * glo =
new TGraph();
182 TGraph * ghi =
new TGraph();
183 glo->SetPoint(0, lo, -1e6);
184 glo->SetPoint(1, lo, 1e6);
186 ghi->SetPoint(0, -1e6, hi);
187 ghi->SetPoint(1, 1e6, hi);
189 glo->SetLineStyle(line_style);
190 glo->SetLineWidth(line_width);
191 glo->SetLineColor(line_color);
192 ghi->SetLineStyle(line_style);
193 ghi->SetLineWidth(line_width);
194 ghi->SetLineColor(line_color);
204 bool left = arrow_opt.Contains(
"<");
205 double offset = 0.07 * (c->GetX2() - c->GetX1());
206 if(left) offset *= -1;
208 double y = c->GetY1() + 0.7 * (c->GetY2() - c->GetY1());
210 TLine *
l1 =
new TLine(x, 0, x, y);
211 TArrow * arrow =
new TArrow(x, y, x+offset, y, 0.04, arrow_opt.Data());
212 if(left) arrow =
new TArrow(x+offset, y, x, y, 0.04, arrow_opt.Data());
214 arrow->SetLineColor(line_color);
215 l1 ->SetLineColor(line_color);
217 arrow->SetLineStyle(line_style);
218 l1 ->SetLineStyle(line_style);
220 arrow->SetLineWidth(line_width);
221 l1 ->SetLineWidth(line_width);
TSpline3 lo("lo", xlo, ylo, 12,"0")
Cuts and Vars for the 2020 FD DiF Study.
const TVector3 vNueCCIncFiducialMin(-130,-140, 150)
void DrawArrow(TCanvas *c, double x, TString arrow_opt, int line_color=kBlack, int line_style=1, int line_width=3)
static std::unique_ptr< CutOptimization > LoadFrom(TDirectory *dir, const std::string &name)
void fiducial_optimization_plots_2d(int axis, std::string input_file_name="/nova/ana/users/ddoyle/NuebarFiducialOptimization/fiducial_optimization_nocvn_all.root", std::string plot_dump="/nova/ana/users/ddoyle/NuebarFiducialOptimization/plots_2d_nocvn/")
void CenterTitles(TH1 *histo)
std::string GetName(int i)
TSpline3 hi("hi", xhi, yhi, 18,"0")
const TVector3 vNueCCIncFiducialMax(150, 140, 800)
const double kAna2019RHCPOT
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
void MovePalette(TH1 *hist)
void PlotSysts(std::vector< TH1 * > hists, std::vector< SystematicDef * > systs, double arrow_down, double arrow_up, std::string name, double limit=0)
void DrawBox(double lo, double hi, int line_color=kBlack, int line_style=7, int line_width=3)
std::string UniqueName()
Return a different string each time, for creating histograms.