7 #include "CAFAna/Core/Binning.h" 8 #include "CAFAna/Core/Cut.h" 9 #include "CAFAna/Core/HistAxis.h" 26 #include "TObjectTable.h" 43 #include "CAFAna/shared/Ana2018/syst_variations.h" 44 #include "CAFAna/shared/Ana2018/draw_plots_util.h" 53 void LtxSection (TString sec,
bool newpage =
true,
int sublevel = 0, TString comment =
"");
60 const bool isNumu=
false,
61 const TString& option=
"FHC_All_nue",
62 const TString& analysis=
"allxp_nue",
79 if (option.Contains(
"FHC"))
90 const bool printtableNumuND=
true;
91 const bool printtableNueND=
true;
92 const bool printtable=
true;
96 TString thisoutname (filename_sh);
97 thisoutname.Remove(0,thisoutname.Last(
'/')+1);
98 thisoutname.ReplaceAll(
".root",
"");
100 if (!(option ==
"" || analysis ==
""))
102 thisoutname = TString(option.Data());
103 thisoutname +=
"_" + analysis +
"_" + TString(
period.c_str());
108 mainfilename +=
".tex";
114 TString latexout =
"latex/";
115 gSystem -> MakeDirectory(latexout);
116 mainoutput <<
"\\input{" + latexout + thisoutname +
"_summary.tex}\n";
117 mainoutput <<
"\\input{" + latexout + thisoutname +
"_tables.tex}\n";
118 mainoutput <<
"\\input{" + latexout + thisoutname +
".tex}\n";
120 output.open((latexout+thisoutname+
".tex").Data());
121 summary.open((latexout+thisoutname+
"_summary.tex").Data());
122 tables.open((latexout+thisoutname+
"_tables.tex").Data());
125 (TString)
"Comparing the shifted predictions from:"+filename_sh);
136 std::vector<xpDef> xps;
141 if (analysis.Contains(
"nxp") || analysis.Contains(
"allxp"))
142 xps.push_back({kNoExtrap,
"pred_nxp", false});
144 if (analysis.Contains(
"xp_prop") || analysis.Contains(
"allxp_nue"))
145 xps.push_back({kProportional,
"pred_xp_prop", true});
147 if (analysis.Contains(
"xp_combo") ||
148 (analysis.Contains(
"allxp_nue") &&
isFHC))
149 xps.push_back({
kCombo,
"pred_xp_combo",
true});
154 if (analysis.Contains(
"nxp") || analysis.Contains(
"allxp")) { xps.push_back({
kNuMuNoExtrap,
"pred_nxp" ,
false}); }
156 if (analysis.Contains(
"extrap") || analysis.Contains(
"allxp")) { xps.push_back({
kNuMu ,
"pred_xp_numu",
true }); }
160 for (
const auto xp:xps)
171 for (
auto xpdef:xpdefs)
175 std::cout <<
"Making plots for the following axes (xpdefs.size is )" 177 for (
auto xpdef:xpdefs)
182 for (
auto const & xp:xps)
185 TString thissec = xp.isExtrap ?
186 "Extrapolated prediction:":
"FDMC prediction (no extrap.):";
187 if(xp.xpName.Contains(
"prop")) thissec +=
" (proportional decomp.)";
188 if(xp.xpName.Contains(
"combo")) thissec +=
" (combo decomp.)";
197 bool isFakeData =
false;
198 if (option.Contains(
"fakeNDData"))
200 std::vector<PredictionSystJoint2018*> PredictionSysts;
202 PredictionSysts.push_back(
204 isFakeData,
false, filename_sh,
false));
208 <<
"so first load the all quantile predictions." <<
std::endl;
210 PredictionSysts.push_back(
212 systs, filename_sh,
false));
214 for (
int quant = 1; quant < 5; quant++ )
216 std::cout <<
"\n Now load predictions for quantile " 218 PredictionSysts.push_back(
220 systs, filename_sh,
false));
223 std::cout <<
"\n PredictionSysts has size " << PredictionSysts.size()
229 for (
const auto syst:
systs)
234 "Processing systematic: " + syst->ShortName());
244 for (
auto const &
var:xpdefs)
256 ApName =
"_"+
var.name(
var.name.Index(
"_")+1,
var.name.Sizeof());
257 ApName.ReplaceAll(
"Quant",
"Q" );
258 if ( ApName.Contains(
"Q1") ) ThisPredSyst = PredictionSysts[1];
259 else if ( ApName.Contains(
"Q2") ) ThisPredSyst = PredictionSysts[2];
260 else if ( ApName.Contains(
"Q3") ) ThisPredSyst = PredictionSysts[3];
261 else if ( ApName.Contains(
"Q4") ) ThisPredSyst = PredictionSysts[4];
264 LtxSection((syst->ShortName() + ApName),
false, 2,
268 if(
var.name.Contains(
"Nue2018Axis")) axistype =
kNue3bin;
276 TString AnaType =
"_";
277 if (!analysis.Contains(
"numu") &&
isNumuAna) AnaType =
"_numu_";
278 if (!analysis.Contains(
"nue" ) && !
isNumuAna) AnaType =
"_nue_";
279 TString plottitle = (
280 syst->ShortName() + ApName +
281 (xp.isExtrap ?
" FarDet Extrap (" + xp.xpName +
")":
" (FarDet MC)")+
282 ";" +
var.name +
";" +
"Events / Bin");
283 TString plotname =
"compare_" + xp.xpName + AnaType +
285 TString
prefix =
"nue_pred_";
288 bool printtable =
true;
291 plotname, printtable, axistype);
325 TString plottitleMu = syst->ShortName() + ApName +
326 "(NearDet MC); Non-Quasielastic Energy Estimator (GeV); Events / Bin";
327 TString plotnameMu =
"compare_numu_ND_" +
334 plotnameMu =
"compare_numu_ND_" +
var.name +
"_" +
337 LtxSection(
"$\\nu_{\\mu}$ ND",
true, 2,
"Numu Comparisons");
340 ThisPredSyst, syst, modExtrapComp, plottitleMu, plotnameMu,
351 TString plottitleND = syst->ShortName() + ApName +
352 " (NearDet MC) "+
";" +
var.name +
";" +
"Events / Bin";
353 TString plotnameND =
"compare_nue_ND_"+
356 LtxSection(
"$\\nu_{e}$ ND",
true, 2,
"Nue comparisons");
358 ThisPredSyst, syst, modExtrapComp, plottitleND,
364 for (
auto predictionSyst:PredictionSysts)
366 delete predictionSyst;
367 predictionSyst = NULL;
375 if (xp.xpName.Contains(
"nxp"))
378 "FDMC Prediction (no extrapolation) - Signal (Sorted by chisq)",
382 "FDMC Prediction (no extrapolation) - Background (Sorted by chisq)",
387 if (xp.xpName.Contains(
"combo"))
389 LtxSection(
"Extrapolated Prediction - Signal (Sorted by chisq)",
true, 1);
391 LtxSection(
"Extrapolated Prediction - Background (Sorted by chisq)",
396 if (xp.xpName.Contains(
"prop"))
399 "Extrapolated Prediction - Signal PROP (Sorted by chisq)",
true, 1);
402 "Extrapolated Prediction - Background PROP (Sorted by chisq)",
true, 1);
405 if (xp.xpName.Contains(
"pred_xp_numu")) {
406 LtxSection (
"Extrapolated Prediction - Signal PROP (Sorted by chisq)" ,
true, 1);
408 LtxSection (
"Extrapolated Prediction - Background PROP (Sorted by chisq)",
true, 1);
427 void LtxSection (TString sec,
bool newpage,
int sublevel , TString comment)
430 output<<
"\n \n% ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~ ~~~ ~~~ ~~~~ \n" 431 <<
"% ~~~ " << comment
432 <<
"% ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ \n \n"<<
std::endl;
434 if (
isNumuAna && sublevel ==1 && !sec.Contains(
"Q1") )
435 output<<
" \\newpage\n"<<std::endl;
437 sec.ReplaceAll(
"_",
" ");
438 sec.ReplaceAll(
"\\nu {",
"\\nu_{");
440 TString section =
"section";
441 if(sublevel ==1) section =
"subsection";
442 if(sublevel ==2) section =
"subsubsection";
443 output <<
"\n \\"<<section<<
"{" << sec ;
Cuts and Vars for the 2020 FD DiF Study.
TString FixPlotName(TString mystring)
osc::IOscCalc * GetCalculator(bool usingdumb)
Loads shifted spectra from files.
const NOvARwgtSyst kRPARESSyst2018Test("RPAShapeRES2018Test","RPA shape: resonance events (2018)", novarwgt::kRPARESSyst2018_ExtrapKludge)
same as the regular 2018 version but with a nudge above sigma = 1 to help the extrapolation ...
static Var numuid(const std::shared_ptr< CAFAnaModel > &model)
std::vector< const ISyst * > GetSystematics2018(const TString option)
const TString mainfilename
void CompareNDDataMCFromVector(TDirectory *d_no, std::vector< TDirectory * > d_sh, TString plottitle, TString out_name, TString tag, bool printtable=true, AxisType pidaxis=kNue1bin)
std::vector< ExtrapDef > GetExtrapolationDefs(const TString analysis, const TString period)
void ComparePredictionsFromVector(TDirectory *dpred_no, std::vector< TDirectory * > dpred_sh, TString plottitle, TString out_name, bool printtable=true, AxisType pidaxis=kNue1bin)
void MakeSummaryV(bool signal=true, TString xptype="nxp", bool sorted=false)
TString MakeLatexCommandName(TString mystring)
void LtxSection(TString sec, bool newpage=true, int sublevel=0, TString comment="")
void plot_prediction_systs(const std::string &filename_sh, const std::string &period="full", const std::string &filename_nom="")
void PrintLatexComment(TString comment="")