Classes | Functions | Variables
make_DiF_plots.C File Reference
#include "TLine.h"
#include "Rtypes.h"
#include "TCanvas.h"
#include "TFile.h"
#include "TGraph.h"
#include "TH1.h"
#include "TH2.h"
#include "TMath.h"
#include "TGaxis.h"
#include "TMultiGraph.h"
#include "TLegend.h"
#include "TLegendEntry.h"
#include "TLatex.h"
#include "TStyle.h"
#include "THStack.h"
#include "TPaveText.h"
#include "TList.h"
#include "TAttLine.h"
#include "TAttMarker.h"
#include <cmath>
#include <iostream>
#include <vector>
#include <list>
#include <sstream>
#include <string>
#include <fstream>
#include <iomanip>
#include "CAFAna/Core/Spectrum.h"
#include "CAFAna/Analysis/Plots.h"
#include "CAFAna/Analysis/Style.h"
#include "TColor.h"

Go to the source code of this file.

Classes

struct  Plot
 ====================================================================== /// More...
 

Functions

void myPreliminary ()
 
void DrawBeamLabelEff (bool isFHC)
 
void makePlot (TCanvas *c1, TH1 *hCosmicsData, TH1 *hCRYMC, TH1 *hGENIEFluxswap, int sel, int legSide, bool isFHC)
 
void makeWgtdPlot (TCanvas *c1, TH1 *hCosmicsData, TH1 *hCRYMC, TH1 *hGENIEFluxswap, int sel, int legSide, bool isFHC)
 
void makePlot (TCanvas *c1, TH1 *hCosmicsData, TH1 *hCRYMC, int sel, int legSide)
 
void makeWgtdPlot (TCanvas *c1, TH1 *hCosmicsData, TH1 *hCRYMC, int sel, int legSide)
 
void makeDataCryRatio (TCanvas *c1, TH1 *hCosmicsData, TH1 *hCRYMC, int sel, int legSide, bool isFHC, bool isWgtd)
 
void makeEffPlot (TCanvas *c1, TH1 *hCosmicsDataCore, TH1 *hCosmicsDataPresel, TH1 *hCRYMCCore, TH1 *hCRYMCPresel, int legSide, bool isFHC)
 
void makeWgtdEffPlot (TCanvas *c1, TH1 *hCosmicsDataCore, TH1 *hCosmicsDataPresel, TH1 *hCRYMCCore, TH1 *hCRYMCPresel, int legSide, bool isFHC)
 
void makeEffPlotNoRatio (TCanvas *c1, TH1 *hCosmicsDataCEff, TH1 *hCRYMCCoreEff, int legSide, bool isFHC, bool isWgtd)
 
void make_eff_plots_areaNorm (std::string beam="FHC")
 

Variables

const std::vector< Plotplots
 

Function Documentation

void DrawBeamLabelEff ( bool  isFHC)

Definition at line 64 of file make_DiF_plots.C.

Referenced by makeDataCryRatio(), makeEffPlot(), and makeWgtdEffPlot().

65 {
66  TPaveText *pText = new TPaveText (0.1, 0.94, 0.16, 0.98,"NDC");
67  pText->SetFillStyle(0);
68  pText->SetLineColor(0);
69  pText->SetLineWidth(0);
70  pText->SetBorderSize(1);
71  pText->SetTextColor(kGray+2);
72  //pText->SetNDC();
73  if (isFHC) pText->AddText("#nu-beam");
74  else pText->AddText("#bar{#nu}-beam");
75  pText->SetTextSize(2/40.);
76  pText->SetTextAlign(11);
77  pText->Draw();
78 }
static bool isFHC
void make_eff_plots_areaNorm ( std::string  beam = "FHC")

Definition at line 118 of file make_DiF_plots.C.

References POTSpillRate::beam, demo5::c1, demo5::c2, chisquared::c3, chisquared::c4, om::cout, ana::DrawBeamLabel(), allTimeWatchdog::endl, f1, MECModelEnuComparisons::i, inFile, ana::kLivetime, ana::Spectrum::LoadFrom(), makeDataCryRatio(), makeEffPlot(), makeEffPlotNoRatio(), makePlot(), makeWgtdEffPlot(), makeWgtdPlot(), plots, and string.

119 {
120 
121 
122 
123  //get input file opened
124  std::string inFile = "/nova/app/users/amhall/DiF_Cafana_4-6-2020/3FlavorAna/Ana2020/MRstudies/MRDiF_FD_"+beam+"_Step2_v2_clean.root";
125  TFile *f1 = new TFile(inFile.c_str());
126  f1->cd();
127 
128  //get just a couple of the spectra to set our livetime and POT before getting the rest
129  auto sForLivetime=*Spectrum::LoadFrom(f1, "sDataPresel_V0");
130  auto sForPOT=*Spectrum::LoadFrom(f1, "sGENIEPresel_V0");
131 
132  double mylivetime=sForLivetime.Livetime();
133  double myPOT=sForPOT.POT();
134  std::cout<<"myPOT:"<<myPOT<<" mylivetime:"<<mylivetime<<std::endl;
135 
136  std::vector<TH1D*> hDataPresel, hCRYMCPresel, hGENIEPresel, hData, hCRYMC, hGENIE;
137  std::vector<TH1D*> hDataPreselWtd, hCRYMCPreselWtd, hDataWtd, hCRYMCWtd;
138  std::vector<TH1D*> hDataEff, hDataWtdEff, hCRYMCEff, hCRYMCWtdEff;
139  std::vector<TH1D*> hDataPreselEff, hDataPreselWtdEff, hCRYMCPreselEff, hCRYMCPreselWtdEff;
140 
141  char dirname[64];
142  for( unsigned int i =0; i < plots.size(); i++)
143  {
144  //load in Data histos
145 
146  sprintf(dirname, "sDataPresel_V%d", i);
147  std::unique_ptr<Spectrum> sDataPresel = Spectrum::LoadFrom(f1, dirname);
148  hDataPresel.push_back(sDataPresel->ToTH1(mylivetime, kLivetime));
149 
150  sprintf(dirname, "sData_V%d", i);
151  std::unique_ptr<Spectrum> sData = Spectrum::LoadFrom(f1, dirname);
152  hData.push_back(sData->ToTH1(mylivetime, kLivetime));
153 
154  sprintf(dirname, "sDataPreselWtd_V%d", i);
155  std::unique_ptr<Spectrum> sDataPreselWtd = Spectrum::LoadFrom(f1, dirname);
156  hDataPreselWtd.push_back(sDataPreselWtd->ToTH1(mylivetime, kLivetime));
157 
158  sprintf(dirname, "sDataWtd_V%d", i);
159  std::unique_ptr<Spectrum> sDataWtd = Spectrum::LoadFrom(f1, dirname);
160  hDataWtd.push_back(sDataWtd->ToTH1(mylivetime, kLivetime));
161 
162  //and the CRYMC histos
163 
164  sprintf(dirname, "sCRYMCPresel_V%d", i);
165  std::unique_ptr<Spectrum> sCRYMCPresel = Spectrum::LoadFrom(f1, dirname);
166  hCRYMCPresel.push_back(sCRYMCPresel->ToTH1(mylivetime, kLivetime));
167 
168  sprintf(dirname, "sCRYMC_V%d", i);
169  std::unique_ptr<Spectrum> sCRYMC = Spectrum::LoadFrom(f1, dirname);
170  hCRYMC.push_back(sCRYMC->ToTH1(mylivetime, kLivetime));
171 
172  sprintf(dirname, "sCRYMCPreselWtd_V%d", i);
173  std::unique_ptr<Spectrum> sCRYMCPreselWtd = Spectrum::LoadFrom(f1, dirname);
174  hCRYMCPreselWtd.push_back(sCRYMCPreselWtd->ToTH1(mylivetime, kLivetime));
175 
176  sprintf(dirname, "sCRYMCWtd_V%d", i);
177  std::unique_ptr<Spectrum> sCRYMCWtd = Spectrum::LoadFrom(f1, dirname);
178  hCRYMCWtd.push_back(sCRYMCWtd->ToTH1(mylivetime, kLivetime));
179 
180  //and the GENIE histos
181 
182  sprintf(dirname, "sGENIEPresel_V%d", i);
183  std::unique_ptr<Spectrum> sGENIEPresel = Spectrum::LoadFrom(f1, dirname);
184  hGENIEPresel.push_back(sGENIEPresel->ToTH1(myPOT));
185 
186  sprintf(dirname, "sGENIE_V%d", i);
187  std::unique_ptr<Spectrum> sGENIE = Spectrum::LoadFrom(f1, dirname);
188  hGENIE.push_back(sGENIE->ToTH1(myPOT));
189 
190  //and get copies of the data and CRY selected histos to make efficiencies with
191  hDataEff.push_back(sData->ToTH1(mylivetime, kLivetime));
192  hDataWtdEff.push_back(sDataWtd->ToTH1(mylivetime, kLivetime));
193  hDataPreselEff.push_back(sDataPresel->ToTH1(mylivetime, kLivetime));
194  hDataPreselWtdEff.push_back(sDataPreselWtd->ToTH1(mylivetime, kLivetime));
195 
196  hCRYMCEff.push_back(sCRYMC->ToTH1(mylivetime, kLivetime));
197  hCRYMCWtdEff.push_back(sCRYMCWtd->ToTH1(mylivetime, kLivetime));
198  hCRYMCPreselEff.push_back(sCRYMCPresel->ToTH1(mylivetime, kLivetime));
199  hCRYMCPreselWtdEff.push_back(sCRYMCPreselWtd->ToTH1(mylivetime, kLivetime));
200 
201  }
202 
203  //kNormFactor = hDataPresel[0]->Integral(); //will area normalize to the cosmic data preselected number of events
204 
205 
206  std::cout<<"NO NORM FACTORS HERE \n";
207  std::cout<<"===================================== Before reweighting================================================"<<std::endl;
208  std::cout<<" Cosmic Data "<<" CRYMC "<<" GENIE "<<std::endl;
209  std::cout<<"========================================================================================================="<<std::endl;
210  std::cout<<"CorePresel :"<<hDataPresel[0]->Integral()<<" "<<hCRYMCPresel[0]->Integral()<<" "<< hGENIEPresel[0]->Integral()<<std::endl;
211  std::cout<<"Core :"<<hData[0]->Integral()<<" "<<hCRYMC[0]->Integral()<<" "<< hGENIE[0]->Integral()<<std::endl;
212 
213  std::cout<<"NO NORM FACTORS HERE \n";
214  std::cout<<"===================================== After reweighting================================================"<<std::endl;
215  std::cout<<" Cosmic Data "<<" CRYMC "<<" GENIE "<<std::endl;
216  std::cout<<"========================================================================================================="<<std::endl;
217  std::cout<<"CorePresel :"<<hDataPreselWtd[0]->Integral()<<" "<<hCRYMCPreselWtd[0]->Integral()<<" "<< hGENIEPresel[0]->Integral()<<std::endl;
218  std::cout<<"Core :"<<hDataWtd[0]->Integral()<<" "<<hCRYMCWtd[0]->Integral()<<" "<< hGENIE[0]->Integral()<<std::endl;
219 
220 
221  //make any messy variable specific adjustments that have to happen before the plot making-------------------------------------
222 
223  for(unsigned int var=0; var<hData.size(); var++)
224  {
225  //take care of any and all rebinning first
226  if(plots[var].rebinAmt != 0)
227  {
228  hDataPresel[var]->Rebin(plots[var].rebinAmt);
229  hCRYMCPresel[var]->Rebin(plots[var].rebinAmt);
230  hGENIEPresel[var]->Rebin(plots[var].rebinAmt);
231  hData[var]->Rebin(plots[var].rebinAmt);
232  hCRYMC[var]->Rebin(plots[var].rebinAmt);
233  hGENIE[var]->Rebin(plots[var].rebinAmt);
234 
235  hDataPreselWtd[var]->Rebin(plots[var].rebinAmt);
236  hCRYMCPreselWtd[var]->Rebin(plots[var].rebinAmt);
237  hDataWtd[var]->Rebin(plots[var].rebinAmt);
238  hCRYMCWtd[var]->Rebin(plots[var].rebinAmt);
239 
240  hDataPreselEff[var]->Rebin(plots[var].rebinAmt);
241  hCRYMCPreselEff[var]->Rebin(plots[var].rebinAmt);
242  hDataEff[var]->Rebin(plots[var].rebinAmt);
243  hCRYMCEff[var]->Rebin(plots[var].rebinAmt);
244 
245  hDataPreselWtdEff[var]->Rebin(plots[var].rebinAmt);
246  hCRYMCPreselWtdEff[var]->Rebin(plots[var].rebinAmt);
247  hDataWtdEff[var]->Rebin(plots[var].rebinAmt);
248  hCRYMCWtdEff[var]->Rebin(plots[var].rebinAmt);
249  }
250  }
251 
252  //even with our angle cut at the previous stage, a few events still snuck into the last bin by being on the bin edge
253  //so gonna clean those out
254  int lastBin = hData[0]->GetXaxis()->GetLast();
255  hData[0]->SetBinContent(lastBin, 0);
256  hDataPresel[0]->SetBinContent(lastBin, 0);
257  hDataEff[0]->SetBinContent(lastBin, 0);
258  hDataWtd[0]->SetBinContent(lastBin, 0);
259  hDataPreselWtd[0]->SetBinContent(lastBin, 0);
260  hDataWtdEff[0]->SetBinContent(lastBin, 0);
261 
262  hData[0]->SetBinError(lastBin, 0);
263  hDataPresel[0]->SetBinError(lastBin, 0);
264  hDataEff[0]->SetBinError(lastBin, 0);
265  hDataWtd[0]->SetBinError(lastBin, 0);
266  hDataPreselWtd[0]->SetBinError(lastBin, 0);
267  hDataWtdEff[0]->SetBinError(lastBin, 0);
268 
269  hCRYMC[0]->GetXaxis()->SetRangeUser(0.4, 1.0);
270  hCRYMCPresel[0]->GetXaxis()->SetRangeUser(0.4, 1.0);
271  hCRYMCEff[0]->GetXaxis()->SetRangeUser(0.4, 1.0);
272  hCRYMCWtd[0]->GetXaxis()->SetRangeUser(0.4, 1.0);
273  hCRYMCPreselWtd[0]->GetXaxis()->SetRangeUser(0.4, 1.0);
274  hCRYMCWtdEff[0]->GetXaxis()->SetRangeUser(0.4, 1.0);
275 
276  hData[0]->GetXaxis()->SetRangeUser(0.4, 1.0);
277  hDataPresel[0]->GetXaxis()->SetRangeUser(0.4, 1.0);
278  hDataEff[0]->GetXaxis()->SetRangeUser(0.4, 1.0);
279  hDataWtd[0]->GetXaxis()->SetRangeUser(0.4, 1.0);
280  hDataPreselWtd[0]->GetXaxis()->SetRangeUser(0.4, 1.0);
281  hDataWtdEff[0]->GetXaxis()->SetRangeUser(0.4, 1.0);
282 
283  hCRYMC[3]->GetXaxis()->SetRangeUser(0, 4.0);
284  hCRYMCPresel[3]->GetXaxis()->SetRangeUser(0, 4.0);
285  hCRYMCEff[3]->GetXaxis()->SetRangeUser(0, 4.0);
286  hCRYMCWtd[3]->GetXaxis()->SetRangeUser(0, 4.0);
287  hCRYMCPreselWtd[3]->GetXaxis()->SetRangeUser(0, 4.0);
288  hCRYMCWtdEff[3]->GetXaxis()->SetRangeUser(0, 4.0);
289 
290  hData[3]->GetXaxis()->SetRangeUser(0, 4.0);
291  hDataPresel[3]->GetXaxis()->SetRangeUser(0, 4.0);
292  hDataEff[3]->GetXaxis()->SetRangeUser(0, 4.0);
293  hDataWtd[3]->GetXaxis()->SetRangeUser(0, 4.0);
294  hDataPreselWtd[3]->GetXaxis()->SetRangeUser(0, 4.0);
295  hDataWtdEff[3]->GetXaxis()->SetRangeUser(0, 4.0);
296 
297  //this is just because the last energy bin only had data events in it
298  //so clearing it out makes the eff. plots look nicer
299  //as there isn't an eff. for the CRY in this bin
300  lastBin = hDataEff[3]->GetXaxis()->GetLast();
301  hDataEff[3]->SetBinContent(lastBin, 0);
302  hDataWtdEff[3]->SetBinContent(lastBin, 0);
303  hDataEff[3]->SetBinError(lastBin, 0);
304  hDataWtdEff[3]->SetBinError(lastBin, 0);
305 
306  hCRYMC[4]->GetXaxis()->SetRangeUser(0, 0.1);
307  hCRYMCPresel[4]->GetXaxis()->SetRangeUser(0, 0.1);
308  hCRYMCEff[4]->GetXaxis()->SetRangeUser(0, 0.1);
309  hCRYMCWtd[4]->GetXaxis()->SetRangeUser(0, 0.1);
310  hCRYMCPreselWtd[4]->GetXaxis()->SetRangeUser(0, 0.1);
311  hCRYMCWtdEff[4]->GetXaxis()->SetRangeUser(0, 0.1);
312 
313  hCRYMC[5]->GetXaxis()->SetRangeUser(0.3, 1);
314  hCRYMCPresel[5]->GetXaxis()->SetRangeUser(0.3, 1.0);
315  hCRYMCEff[5]->GetXaxis()->SetRangeUser(0.3, 1.0);
316  hCRYMCWtd[5]->GetXaxis()->SetRangeUser(0.3, 1.0);
317  hCRYMCPreselWtd[5]->GetXaxis()->SetRangeUser(0.3, 1.0);
318  hCRYMCWtdEff[5]->GetXaxis()->SetRangeUser(0.3, 1.0);
319 
320  hData[4]->GetXaxis()->SetRangeUser(0, 0.1);
321  hDataPresel[4]->GetXaxis()->SetRangeUser(0, 0.1);
322  hDataEff[4]->GetXaxis()->SetRangeUser(0, 0.1);
323  hDataWtd[4]->GetXaxis()->SetRangeUser(0, 0.1);
324  hDataPreselWtd[4]->GetXaxis()->SetRangeUser(0, 0.1);
325  hDataWtdEff[4]->GetXaxis()->SetRangeUser(0, 0.1);
326 
327  hData[5]->GetXaxis()->SetRangeUser(0.3, 1);
328  hDataPresel[5]->GetXaxis()->SetRangeUser(0.3, 1.0);
329  hDataEff[5]->GetXaxis()->SetRangeUser(0.3, 1.0);
330  hDataWtd[5]->GetXaxis()->SetRangeUser(0.3, 1.0);
331  hDataPreselWtd[5]->GetXaxis()->SetRangeUser(0.3, 1.0);
332  hDataWtdEff[5]->GetXaxis()->SetRangeUser(0.3, 1.0);
333 
334 
335  //and let's make some plots!
336 
337  char saveName[128];
338  for(unsigned int var=0; var < 6; var ++)//var<hData.size(); var++)
339  {
340 
341  //unweighted distributions--------------------------------------------------
342  TCanvas *c1 = new TCanvas("c1", "presel distributions", 800,600);
343  hCRYMCPresel[var]->GetXaxis()->SetTitle(plots[var].XaxisLabel);
344  makePlot(c1, &*hDataPresel[var], &*hCRYMCPresel[var], &*hGENIEPresel[var], 0, plots[var].legSide, beam=="FHC" ? true : false);
345  DrawBeamLabel(beam=="FHC" ? true : false);
346 
347  TCanvas *c2 = new TCanvas("c2", "distributions", 800,600);
348  hCRYMC[var]->GetXaxis()->SetTitle(plots[var].XaxisLabel);
349  makePlot(c2, &*hData[var], &*hCRYMC[var], &*hGENIE[var], 1, plots[var].legSide, beam=="FHC" ? true : false);
350  DrawBeamLabel(beam=="FHC" ? true : false);
351 
352  if(plots[var].yAxisLimit != 0) {
353  hCRYMCPresel[var]->GetYaxis()->SetRangeUser(0, plots[var].yAxisLimit);
354  hCRYMC[var]->GetYaxis()->SetRangeUser(0, plots[var].yAxisLimit);
355  }
356 
357  //weighted distributions-------------------------------------------------------
358  TCanvas *c3 = new TCanvas("c3", "wgtd presel distributions", 800,600);
359  hCRYMCPreselWtd[var]->GetXaxis()->SetTitle(plots[var].XaxisLabel);
360  makeWgtdPlot(c3, &*hDataPreselWtd[var], &*hCRYMCPreselWtd[var], &*hGENIEPresel[var], 0, plots[var].legSide, beam=="FHC" ? true : false);
361  DrawBeamLabel(beam=="FHC" ? true : false);
362 
363  TCanvas *c4 = new TCanvas("c4", "wgtd distributions", 800,600);
364  hCRYMCWtd[var]->GetXaxis()->SetTitle(plots[var].XaxisLabel);
365  makeWgtdPlot(c4, &*hDataWtd[var], &*hCRYMCWtd[var], &*hGENIE[var], 1, plots[var].legSide, beam=="FHC" ? true : false);
366  DrawBeamLabel(beam=="FHC" ? true : false);
367 
368  if(plots[var].yAxisLimit != 0) {
369  hCRYMCPreselWtd[var]->GetYaxis()->SetRangeUser(0, plots[var].yAxisLimit);
370  hCRYMCWtd[var]->GetYaxis()->SetRangeUser(0, plots[var].yAxisLimit);
371  }
372 
373  //unweighted efficiencies------------------------------------------------------
374  TCanvas *c5 =new TCanvas("c5","Eff",800,800);
375  //DrawBeamLabelEff(beam=="FHC" ? true : false);
376  hDataEff[var]->GetXaxis()->SetTitle(plots[var].XaxisLabel);
377 
378  if (var == 3 && beam != "FHC") makeEffPlot(c5, &*hDataEff[var], &*hDataPreselEff[var], &*hCRYMCEff[var], &*hCRYMCPreselEff[var], 0, false);
379  else makeEffPlot(c5, &*hDataEff[var], &*hDataPreselEff[var], &*hCRYMCEff[var], &*hCRYMCPreselEff[var], plots[var].legSide, beam=="FHC" ? true : false);
380  hCRYMCEff[3]->GetYaxis()->SetRangeUser(0,1.2);
381 
382  //weighted efficiencies-------------------------------------------------------------
383  TCanvas *c6 =new TCanvas("c6","Weighted Eff",800,800);
384  //DrawBeamLabelEff(beam=="FHC" ? true : false);
385  hDataWtdEff[var]->GetXaxis()->SetTitle(plots[var].XaxisLabel);
386 
387  if (var == 3 && beam != "FHC") makeWgtdEffPlot(c6, &*hDataWtdEff[var], &*hDataPreselWtdEff[var], &*hCRYMCWtdEff[var], &*hCRYMCPreselWtdEff[var], 0, false);
388  else makeWgtdEffPlot(c6, &*hDataWtdEff[var], &*hDataPreselWtdEff[var], &*hCRYMCWtdEff[var], &*hCRYMCPreselWtdEff[var], plots[var].legSide, beam=="FHC" ? true : false);
389  hCRYMCWtdEff[3]->GetYaxis()->SetRangeUser(0, 2.0);
390 
391  //and repeat the distributions without the GENIE sample
392  //unweighted distributions--------------------------------------------------
393  TCanvas *c7 = new TCanvas("c7", "presel distributions", 800,600);
394  hCRYMCPresel[var]->GetXaxis()->SetTitle(plots[var].XaxisLabel);
395  makePlot(c7, &*hDataPresel[var], &*hCRYMCPresel[var], 0, plots[var].legSide);
396  DrawBeamLabel(beam=="FHC" ? true : false);
397 
398  TCanvas *c8 = new TCanvas("c8", "distributions", 800,600);
399  hCRYMC[var]->GetXaxis()->SetTitle(plots[var].XaxisLabel);
400  makePlot(c8, &*hData[var], &*hCRYMC[var], 1, plots[var].legSide);
401  DrawBeamLabel(beam=="FHC" ? true : false);
402 
403  if(plots[var].yAxisLimit != 0) {
404  hCRYMCPresel[var]->GetYaxis()->SetRangeUser(0, plots[var].yAxisLimit);
405  hCRYMC[var]->GetYaxis()->SetRangeUser(0, plots[var].yAxisLimit);
406  }
407 
408  //weighted distributions-------------------------------------------------------
409  TCanvas *c9 = new TCanvas("c9", "wgtd presel distributions", 800,600);
410  hCRYMCPreselWtd[var]->GetXaxis()->SetTitle(plots[var].XaxisLabel);
411  makeWgtdPlot(c9, &*hDataPreselWtd[var], &*hCRYMCPreselWtd[var], 0, plots[var].legSide);
412  DrawBeamLabel(beam=="FHC" ? true : false);
413 
414  TCanvas *c10 = new TCanvas("c10", "wgtd distributions", 800,600);
415  hCRYMCWtd[var]->GetXaxis()->SetTitle(plots[var].XaxisLabel);
416  makeWgtdPlot(c10, &*hDataWtd[var], &*hCRYMCWtd[var], 1, plots[var].legSide);
417  DrawBeamLabel(beam=="FHC" ? true : false);
418 
419  if(plots[var].yAxisLimit != 0) {
420  hCRYMCPreselWtd[var]->GetYaxis()->SetRangeUser(0, plots[var].yAxisLimit);
421  hCRYMCWtd[var]->GetYaxis()->SetRangeUser(0, plots[var].yAxisLimit);
422  }
423 
424 
425  //and save all the canvases------------------------------------------------------------
426  sprintf(saveName, "EffPlots/%s/%s_Presel_%s.png", beam.c_str(), plots[var].savename, beam.c_str());
427  c1->SaveAs(saveName);
428  sprintf(saveName, "EffPlots/%s/%s_%s.png", beam.c_str(), plots[var].savename, beam.c_str());
429  c2->SaveAs(saveName);
430 
431  sprintf(saveName, "EffPlots/%s/%s_Presel_Wtd_%s.png", beam.c_str(), plots[var].savename, beam.c_str());
432  c3->SaveAs(saveName);
433  sprintf(saveName, "EffPlots/%s/%s_Wtd_%s.png", beam.c_str(), plots[var].savename, beam.c_str());
434  c4->SaveAs(saveName);
435 
436  sprintf(saveName, "EffPlots/%s/%s_Eff_%s.png", beam.c_str(), plots[var].savename, beam.c_str());
437  c5->SaveAs(saveName);
438  sprintf(saveName, "EffPlots/%s/%s_Eff_Wtd_%s.png", beam.c_str(), plots[var].savename, beam.c_str());
439  c6->SaveAs(saveName);
440 
441  sprintf(saveName, "EffPlots/%s/%s_Presel_%s_noGENIE.png", beam.c_str(), plots[var].savename, beam.c_str());
442  c7->SaveAs(saveName);
443  sprintf(saveName, "EffPlots/%s/%s_%s_noGENIE.png", beam.c_str(), plots[var].savename, beam.c_str());
444  c8->SaveAs(saveName);
445 
446  sprintf(saveName, "EffPlots/%s/%s_Presel_Wtd_%s_noGENIE.png", beam.c_str(), plots[var].savename, beam.c_str());
447  c9->SaveAs(saveName);
448  sprintf(saveName, "EffPlots/%s/%s_Wtd_%s_noGENIE.png", beam.c_str(), plots[var].savename, beam.c_str());
449  c10->SaveAs(saveName);
450 
451  // make data/CRY comparison for the CVN spectra
452  if(var == 5){
453  //unweighted
454  TCanvas *c11 =new TCanvas("c11","Eff",800,800);
455  hDataPresel[var]->GetXaxis()->SetTitle(plots[var].XaxisLabel);
456  makeDataCryRatio(c11, &*hDataPresel[var], &*hCRYMCPresel[var], 0, plots[var].legSide, beam=="FHC" ? true : false, false);
457  sprintf(saveName, "EffPlots/%s/%s_%s_Ratio.png", beam.c_str(), plots[var].savename, beam.c_str());
458  c11->SaveAs(saveName);
459 
460  //weighted
461  TCanvas *c12 =new TCanvas("c12","Eff",800,800);
462  hDataPreselWtd[var]->GetXaxis()->SetTitle(plots[var].XaxisLabel);
463  makeDataCryRatio(c12, &*hDataPreselWtd[var], &*hCRYMCPreselWtd[var], 0, plots[var].legSide, beam=="FHC" ? true : false, true);
464  sprintf(saveName, "EffPlots/%s/%s_Wtd_%s_Ratio.png", beam.c_str(), plots[var].savename, beam.c_str());
465  c12->SaveAs(saveName);
466  }
467  //------------
468  //and make the efficiency plots without the ratio on the bottom
469  //unweighted efficiencies------------------------------------------------------
470  TCanvas *c13 =new TCanvas("c13","Eff",800,600);
471  hCRYMCEff[var]->GetXaxis()->SetTitle(plots[var].XaxisLabel);
472  if (var == 3 && beam != "FHC") makeEffPlotNoRatio(c13, &*hDataEff[var], &*hCRYMCEff[var], 0, false, false);
473  else makeEffPlotNoRatio(c13, &*hDataEff[var], &*hCRYMCEff[var], plots[var].legSide, beam=="FHC" ? true : false, false);
474  hCRYMCEff[3]->GetYaxis()->SetRangeUser(0,1.2);
475 
476  //weighted efficiencies-------------------------------------------------------------
477  TCanvas *c14 =new TCanvas("c14","Weighted Eff",800,600);
478  hCRYMCWtdEff[var]->GetXaxis()->SetTitle(plots[var].XaxisLabel);
479  if (var == 3 && beam != "FHC") makeEffPlotNoRatio(c14, &*hDataWtdEff[var], &*hCRYMCWtdEff[var], 0, false, true);
480  else makeEffPlotNoRatio(c14, &*hDataWtdEff[var], &*hCRYMCWtdEff[var], plots[var].legSide, beam=="FHC" ? true : false, true);
481  //hCRYMCWtdEff[3]->GetYaxis()->SetRangeUser(0, 2.0);
482 
483  sprintf(saveName, "EffPlots/%s/%s_Eff_%s_noRatio.png", beam.c_str(), plots[var].savename, beam.c_str());
484  c13->SaveAs(saveName);
485  sprintf(saveName, "EffPlots/%s/%s_Eff_Wtd_%s_noRatio.png", beam.c_str(), plots[var].savename, beam.c_str());
486  c14->SaveAs(saveName);
487 
488 
489  }
490 
491 
492 }
void makeEffPlot(TCanvas *c1, TH1 *hCosmicsDataCore, TH1 *hCosmicsDataPresel, TH1 *hCRYMCCore, TH1 *hCRYMCPresel, int legSide, bool isFHC)
void makePlot(TCanvas *c1, TH1 *hCosmicsData, TH1 *hCRYMC, TH1 *hGENIEFluxswap, int sel, int legSide, bool isFHC)
void makeEffPlotNoRatio(TCanvas *c1, TH1 *hCosmicsDataCEff, TH1 *hCRYMCCoreEff, int legSide, bool isFHC, bool isWgtd)
var_value< double > var
Definition: StanTypedefs.h:14
std::unique_ptr< T > LoadFrom(TDirectory *dir, const std::string &label)
Definition: LoadFromFile.h:17
c2
Definition: demo5.py:33
ifstream inFile
Definition: AnaPlotMaker.h:34
TPaveText * DrawBeamLabel(bool isFHC)
Put the standardized beam label in the left corner of the active canvas.
Definition: Plots.cxx:1557
const std::vector< Plot > plots
Float_t f1
void makeDataCryRatio(TCanvas *c1, TH1 *hCosmicsData, TH1 *hCRYMC, int sel, int legSide, bool isFHC, bool isWgtd)
OStream cout
Definition: OStream.cxx:6
void makeWgtdPlot(TCanvas *c1, TH1 *hCosmicsData, TH1 *hCRYMC, TH1 *hGENIEFluxswap, int sel, int legSide, bool isFHC)
c1
Definition: demo5.py:24
void makeWgtdEffPlot(TCanvas *c1, TH1 *hCosmicsDataCore, TH1 *hCosmicsDataPresel, TH1 *hCRYMCCore, TH1 *hCRYMCPresel, int legSide, bool isFHC)
enum BeamMode string
void makeDataCryRatio ( TCanvas *  c1,
TH1 *  hCosmicsData,
TH1 *  hCRYMC,
int  sel,
int  legSide,
bool  isFHC,
bool  isWgtd 
)

Definition at line 725 of file make_DiF_plots.C.

References bin, DrawBeamLabelEff(), MECModelEnuComparisons::leg, myPreliminary(), pad1, and pad2.

Referenced by make_eff_plots_areaNorm().

726 {
727  c1->cd();
728  TPad * pad1 = new TPad("pad1", "pad1", 0, 0.375, 1, 1.0);
729  pad1->Draw();
730  pad1->SetBottomMargin(0.02);
731  pad1->cd();
732 
733  hCRYMC->GetXaxis()->CenterTitle();
734  hCRYMC->GetYaxis()->CenterTitle();
735  hCosmicsData->SetLineColor(kBlack);
736  hCosmicsData->SetMarkerStyle(20);
737  hCRYMC->SetLineColor(kMagenta+2);
738  hCRYMC->SetFillColorAlpha(kMagenta+2, 0.5);
739 
740  double kNormFactor = hCosmicsData->Integral();
741  hCRYMC->Scale(kNormFactor/hCRYMC->Integral());
742 
743  hCRYMC->GetYaxis()->SetTitle(isWgtd ? "Events (cos#theta_{beam} weighted)" : "Events");
744  hCRYMC->Draw("E2");
745  //this copy is literally just to be able to have the horizontal line for each bin
746  //without the vertical lines
747  auto hCRYMC2 = (TH1*)hCRYMC->Clone();
748  for(int bin =0; bin <= hCRYMC2->GetXaxis()->GetLast(); bin ++) hCRYMC2->SetBinError(bin, 0.000001);
749  hCRYMC2->SetFillColor(kWhite);
750  hCRYMC2->SetMarkerColor(kMagenta+2);
751  hCRYMC2->Draw("E hist same");
752  hCosmicsData->Draw("E1 same");
753  hCRYMC->GetYaxis()->SetLabelSize(0.037);
754  hCRYMC->GetYaxis()->SetTitleOffset(0.95);
755  hCRYMC->GetXaxis()->SetLabelSize(0);
756 
757  TLegend * leg;
758  if (legSide ==0) leg = new TLegend(0.15,0.68,0.75,0.85);
759  else leg = new TLegend(0.5,0.68,0.8,0.85);
760  leg->SetNColumns(2);
761  leg->AddEntry(hCosmicsData,"Cosmic Data","p");
762  leg->AddEntry((TObject*)0, sel==0 ? "Preselected DiF Events": "Selected DiF Events", "");
763  leg->AddEntry(hCRYMC,"Cosmics MC (CRY)","l");
764  leg->AddEntry((TObject*)0, "Area norm. to data", "");
765  leg->AddEntry(hCRYMC, "Cosmics MC Stat. Err.", "f");
766  leg->SetTextSize(0.05);
767  leg->Draw("same");
768  myPreliminary();
769 
770  c1->cd();
771  TPad * pad2 = new TPad("pad2", "pad2", 0, 0.002, 1, 0.375);
772  pad2->SetTopMargin(0);
773  pad2->SetBottomMargin(0.2);
774  pad2->Draw();
775  pad2->cd();
776  pad2->SetGridy();
777 
778  TH1D* hRatio =(TH1D*)hCosmicsData->Clone("hRatio");
779 
780  hRatio->GetXaxis()->CenterTitle();
781  hRatio->GetYaxis()->CenterTitle();
782  hRatio->SetLineColor(kBlack);
783  hRatio->SetMarkerStyle(20);
784  hRatio->SetLineWidth(3);
785  hRatio->Divide(hCRYMC);
786  hRatio->Draw("E1");
787  hRatio->GetXaxis()->SetLabelSize(0.075);
788  hRatio->GetYaxis()->SetLabelSize(0.075);
789  hRatio->GetXaxis()->SetTitleOffset(0.85);
790  hRatio->GetYaxis()->SetTitleOffset(0.55);
791  hRatio->GetXaxis()->SetTitleSize(0.09);
792  hRatio->GetYaxis()->SetTitleSize(0.085);
793  hRatio->GetYaxis()->SetRangeUser(0.,2.0);
794  hRatio->GetYaxis()->SetTitle("#frac{Data}{MC}");
795 
796  hCRYMC->GetXaxis()->SetTitle("");
797  c1->cd();
799 }
void myPreliminary()
float bin[41]
Definition: plottest35.C:14
void DrawBeamLabelEff(bool isFHC)
static bool isFHC
c1
Definition: demo5.py:24
TPad * pad2
Definition: analysis.C:13
TPad * pad1
Definition: analysis.C:13
void makeEffPlot ( TCanvas *  c1,
TH1 *  hCosmicsDataCore,
TH1 *  hCosmicsDataPresel,
TH1 *  hCRYMCCore,
TH1 *  hCRYMCPresel,
int  legSide,
bool  isFHC 
)

Definition at line 803 of file make_DiF_plots.C.

References bin, DrawBeamLabelEff(), MECModelEnuComparisons::leg, myPreliminary(), pad1, and pad2.

Referenced by make_eff_plots_areaNorm().

804 {
805  c1->cd();
806  TPad * pad1 = new TPad("pad1", "pad1", 0, 0.375, 1, 1.0);
807  pad1->Draw();
808  pad1->SetBottomMargin(0.02);
809  pad1->cd();
810 
811  hCRYMCCore->GetXaxis()->CenterTitle();
812  hCRYMCCore->GetYaxis()->CenterTitle();
813  hCosmicsDataCore->SetLineColor(kBlack);
814  hCosmicsDataCore->SetMarkerStyle(20);
815  hCosmicsDataCore->SetLineWidth(2);
816  hCRYMCCore->SetLineColor(kMagenta+2);
817  hCRYMCCore->SetFillColorAlpha(kMagenta+2, 0.5);
818  hCRYMCCore->SetLineWidth(2);
819 
820  hCosmicsDataCore->Divide(hCosmicsDataPresel);
821  hCRYMCCore->Divide(hCRYMCPresel);
822  hCRYMCCore->Draw("E2");
823  //this copy is literally just to be able to have the horizontal line for each bin
824  //without the vertical lines
825  auto hCRYMC2 = (TH1*)hCRYMCCore->Clone();
826  for(int bin =0; bin <= hCRYMC2->GetXaxis()->GetLast(); bin ++) hCRYMC2->SetBinError(bin, 0.000001);
827  hCRYMC2->SetFillColor(kWhite);
828  hCRYMC2->SetMarkerColor(kMagenta+2);
829  hCRYMC2->Draw("E hist same");
830  hCosmicsDataCore->Draw("E1 same");
831 
832  //hCRYMCCore->GetYaxis()->SetLabelSize(0.037);
833  hCRYMCCore->GetXaxis()->SetLabelSize(0);
834  hCRYMCCore->GetYaxis()->SetTitle("Selection Efficiency");
835 
836  //hCRYMCCore->GetYaxis()->SetTitleOffset(0.95);
837  hCRYMCCore->GetYaxis()->SetRangeUser(0,1.2*gPad->GetUymax());
838 
839  TLegend * leg;
840  if (legSide ==0) leg = new TLegend(0.15,0.68,0.45,0.85);
841  else leg = new TLegend(0.5,0.68,0.8,0.85);
842  leg->AddEntry(hCosmicsDataCore,"Cosmic Data","p");
843  leg->AddEntry(hCRYMCCore,"Cosmic MC (CRY)","l");
844  leg->AddEntry(hCRYMCCore, "Cosmic MC Stat. Err.", "f");
845  leg->SetTextSize(0.05);
846  leg->Draw("same");
847  myPreliminary();
848 
849  //double dif_label_y = isWgtd ? 1.6 : 1.0;
850  //double dif_label_y = hCRYMCEff->GetYaxis()->GetBinUpEdge(hCRYMCEff->GetYaxis()->GetLast());
851  double dif_label_x = 0.5;//hCRYMCCore->GetXaxis()->GetBinLowEdge(2);
852  TText * tt = new TText(0.9*dif_label_x, 0.6, "FD Decay-in-Flight");
853  tt->SetTextSize(0.06);
854  tt->Draw();
855 
856  //DrawBeamLabelEff(isFHC);
857 
858  c1->cd();
859  TPad * pad2 = new TPad("pad2", "pad2", 0, 0.002, 1, 0.375);
860  pad2->SetTopMargin(0);
861  pad2->SetBottomMargin(0.2);
862  pad2->Draw();
863  pad2->cd();
864  pad2->SetGridy();
865 
866  TH1D* hEffRatio =(TH1D*)hCosmicsDataCore->Clone("hEffRatio");
867 
868  hEffRatio->GetXaxis()->CenterTitle();
869  hEffRatio->GetYaxis()->CenterTitle();
870  hEffRatio->SetLineColor(kBlack);
871  hEffRatio->SetMarkerStyle(20);
872  hEffRatio->SetLineWidth(3);
873  hEffRatio->Divide(hCRYMCCore);
874  hEffRatio->Draw("E1");
875  hEffRatio->GetXaxis()->SetLabelSize(0.075);
876  hEffRatio->GetYaxis()->SetLabelSize(0.075);
877  hEffRatio->GetXaxis()->SetTitleOffset(0.85);
878  hEffRatio->GetYaxis()->SetTitleOffset(0.55);
879  hEffRatio->GetXaxis()->SetTitleSize(0.09);
880  hEffRatio->GetYaxis()->SetTitleSize(0.085);
881  hEffRatio->GetYaxis()->SetRangeUser(0.5,1.5);
882  hEffRatio->GetYaxis()->SetTitle("#frac{Data}{MC}");
883 
884  hCRYMCCore->GetXaxis()->SetTitle("");
885  c1->cd();
887 }
void myPreliminary()
Definition: type_traits.h:56
float bin[41]
Definition: plottest35.C:14
void DrawBeamLabelEff(bool isFHC)
static bool isFHC
c1
Definition: demo5.py:24
TPad * pad2
Definition: analysis.C:13
TPad * pad1
Definition: analysis.C:13
void makeEffPlotNoRatio ( TCanvas *  c1,
TH1 *  hCosmicsDataCEff,
TH1 *  hCRYMCCoreEff,
int  legSide,
bool  isFHC,
bool  isWgtd 
)

Definition at line 977 of file make_DiF_plots.C.

References bin, ana::DrawBeamLabel(), MECModelEnuComparisons::leg, and myPreliminary().

Referenced by make_eff_plots_areaNorm().

978 {
979  //should only be used after the regular eff plot functions have been used
980 
981  hCRYMCEff->GetXaxis()->SetLabelSize(0.04);
982  hCRYMCEff->Draw("E2");
983 
984  //this copy is literally just to be able to have the horizontal line for each bin
985  //without the vertical lines
986  auto hCRYMC2 = (TH1*)hCRYMCEff->Clone();
987  for(int bin =0; bin <= hCRYMC2->GetXaxis()->GetLast(); bin ++) hCRYMC2->SetBinError(bin, 0.000001);
988  hCRYMC2->SetFillColor(kWhite);
989  hCRYMC2->SetMarkerColor(kMagenta+2);
990  hCRYMC2->Draw("E hist same");
991  hCosmicsDataEff->Draw("E1 same");
992 
993  TLegend * leg;
994  if (legSide ==0) leg = new TLegend(0.15,0.68,0.45,0.85);
995  else leg = new TLegend(0.5,0.68,0.8,0.85);
996  leg->SetTextSize(0.05);
997  leg->AddEntry(hCosmicsDataEff,"Cosmic Data","p");
998  leg->AddEntry(hCRYMCEff,"Cosmic MC (CRY)","l");
999  leg->AddEntry(hCRYMCEff, "Cosmic MC Stat. Err.", "f");
1000  leg->Draw("same");
1001  myPreliminary();
1003 
1004  double dif_label_y = 0.6;
1005  double dif_label_x = 0.25;
1006  TText * tt = new TText(dif_label_x, dif_label_y, "FD Decay-in-Flight");
1007  tt->SetTextSize(0.06);
1008  tt->Draw();
1009 
1010  gPad->RedrawAxis();
1011 }
void myPreliminary()
Definition: type_traits.h:56
TPaveText * DrawBeamLabel(bool isFHC)
Put the standardized beam label in the left corner of the active canvas.
Definition: Plots.cxx:1557
float bin[41]
Definition: plottest35.C:14
static bool isFHC
void makePlot ( TCanvas *  c1,
TH1 *  hCosmicsData,
TH1 *  hCRYMC,
TH1 *  hGENIEFluxswap,
int  sel,
int  legSide,
bool  isFHC 
)

Definition at line 495 of file make_DiF_plots.C.

References bin, kBlue, MECModelEnuComparisons::leg, and myPreliminary().

Referenced by make_eff_plots_areaNorm().

496 {
497  c1->cd();
498 
499  hCRYMC->GetXaxis()->CenterTitle();
500  hCRYMC->GetYaxis()->CenterTitle();
501  hCosmicsData->SetLineColor(kBlack);
502  hCosmicsData->SetMarkerStyle(20);
503  hCRYMC->SetFillColorAlpha(kMagenta+2, 0.5);
504  hCRYMC->SetLineColor(kMagenta+2);
505  hGENIEFluxswap->SetLineColor(kBlue);
506 
507  double kNormFactor = hCosmicsData->Integral();
508  hGENIEFluxswap->Scale(kNormFactor/hGENIEFluxswap->Integral());
509  hCRYMC->Scale(kNormFactor/hCRYMC->Integral());
510 
511  hCRYMC->GetYaxis()->SetTitle("Events");
512  hCRYMC->Draw("E2");
513  //this copy is literally just to be able to have the horizontal line for each bin
514  auto hCRYMC2 = (TH1*)hCRYMC->Clone();
515  for(int bin =0; bin <= hCRYMC2->GetXaxis()->GetLast(); bin ++) hCRYMC2->SetBinError(bin, 0.000001);
516  hCRYMC2->SetFillColor(kWhite);
517  hCRYMC2->SetMarkerColor(kMagenta+2);
518  hCRYMC2->Draw("E hist same");
519  hCosmicsData->Draw("E1 same");
520  hGENIEFluxswap->Draw("hist E1 same");
521  hCRYMC->GetYaxis()->SetLabelSize(0.037);
522  hCRYMC->GetYaxis()->SetTitleOffset(0.95);
523 
524  TLegend * leg;
525  if (legSide ==0) {
526  leg = new TLegend(0.15,0.62,0.75,0.85);
527  leg->SetNColumns(2);
528  leg->AddEntry(hCosmicsData,"Cosmic Data","p");
529  leg->AddEntry((TObject*)0, sel==0 ? "Preselected DiF Events": "Selected DiF Events", "");
530  leg->AddEntry(hCRYMC,"Cosmics MC (CRY)","l");
531  leg->AddEntry((TObject*)0, "Area norm. to data", "");
532  leg->AddEntry(hCRYMC, "Cosmics MC Stat. Err.", "f");
533  leg->AddEntry((TObject*)0, "","");
534  leg->AddEntry(hGENIEFluxswap, isFHC ? "#nu_{e} Signal MC" : "#bar{#nu}_{e} Signal MC","l");
535  }
536  else {
537  leg = new TLegend(0.15,0.62,0.85,0.85);
538  leg->SetNColumns(2);
539  leg->AddEntry((TObject*)0, sel==0 ? "Preselected DiF Events": "Selected DiF Events", "");
540  leg->AddEntry(hCosmicsData,"Cosmic Data","p");
541  leg->AddEntry((TObject*)0, "Area norm. to data", "");
542  leg->AddEntry(hCRYMC,"Cosmics MC (CRY)","l");
543  leg->AddEntry((TObject*)0, "","");
544  leg->AddEntry(hCRYMC, "Cosmics MC Stat. Err.", "f");
545  leg->AddEntry((TObject*)0, "","");
546  leg->AddEntry(hGENIEFluxswap, isFHC ? "#nu_{e} Signal MC" : "#bar{#nu}_{e} Signal MC","l");
547  }
548  leg->SetFillStyle(0);
549  leg->SetTextSize(0.04);
550  leg->Draw("same");
551  myPreliminary();
552 }
void myPreliminary()
float bin[41]
Definition: plottest35.C:14
static bool isFHC
c1
Definition: demo5.py:24
enum BeamMode kBlue
void makePlot ( TCanvas *  c1,
TH1 *  hCosmicsData,
TH1 *  hCRYMC,
int  sel,
int  legSide 
)

Definition at line 554 of file make_DiF_plots.C.

References bin, MECModelEnuComparisons::leg, and myPreliminary().

555 {
556  //don't plot the GENIE histo
557  c1->cd();
558 
559  hCRYMC->GetXaxis()->CenterTitle();
560  hCRYMC->GetYaxis()->CenterTitle();
561  hCosmicsData->SetLineColor(kBlack);
562  hCosmicsData->SetMarkerStyle(20);
563  hCRYMC->SetLineColor(kMagenta+2);
564  hCRYMC->SetFillColorAlpha(kMagenta+2, 0.5);
565 
566  double kNormFactor = hCosmicsData->Integral();
567  hCRYMC->Scale(kNormFactor/hCRYMC->Integral());
568 
569  hCRYMC->GetYaxis()->SetTitle("Events");
570  hCRYMC->Draw("E2");
571  //this copy is literally just to be able to have the horizontal line for each bin
572  //without the vertical lines
573  auto hCRYMC2 = (TH1*)hCRYMC->Clone();
574  for(int bin =0; bin <= hCRYMC2->GetXaxis()->GetLast(); bin ++) hCRYMC2->SetBinError(bin, 0.000001);
575  hCRYMC2->SetFillColor(kWhite);
576  hCRYMC2->SetMarkerColor(kMagenta+2);
577  hCRYMC2->Draw("E hist same");
578  hCosmicsData->Draw("E1 same");
579  hCRYMC->GetYaxis()->SetLabelSize(0.037);
580  //hCRYMC->GetYaxis()->SetTitleOffset(0.95);
581 
582  TLegend * leg;
583  if (legSide ==0) {
584  leg = new TLegend(0.15,0.68,0.75,0.85);
585  leg->SetNColumns(2);
586  leg->AddEntry(hCosmicsData,"Cosmic Data","p");
587  leg->AddEntry((TObject*)0, sel==0 ? "Preselected DiF Events": "Selected DiF Events", "");
588  leg->AddEntry(hCRYMC,"Cosmics MC (CRY)","l");
589  leg->AddEntry((TObject*)0, "Area norm. to data", "");
590  leg->AddEntry(hCRYMC, "Cosmics MC Stat. Err.", "f");
591  }
592  else {
593  leg = new TLegend(0.15,0.68,0.85,0.85);
594  leg->SetNColumns(2);
595  leg->AddEntry((TObject*)0, sel==0 ? "Preselected DiF Events": "Selected DiF Events", "");
596  leg->AddEntry(hCosmicsData,"Cosmic Data","p");
597  leg->AddEntry((TObject*)0, "Area norm. to data", "");
598  leg->AddEntry(hCRYMC,"Cosmics MC (CRY)","l");
599  leg->AddEntry((TObject*)0, "","");
600  leg->AddEntry(hCRYMC, "Cosmics MC Stat. Err.", "f");
601  }
602  leg->SetFillStyle(0);
603  leg->SetTextSize(0.04);
604  leg->Draw("same");
605  myPreliminary();
606 }
void myPreliminary()
float bin[41]
Definition: plottest35.C:14
c1
Definition: demo5.py:24
void makeWgtdEffPlot ( TCanvas *  c1,
TH1 *  hCosmicsDataCore,
TH1 *  hCosmicsDataPresel,
TH1 *  hCRYMCCore,
TH1 *  hCRYMCPresel,
int  legSide,
bool  isFHC 
)

Definition at line 890 of file make_DiF_plots.C.

References bin, DrawBeamLabelEff(), MECModelEnuComparisons::leg, myPreliminary(), pad1, and pad2.

Referenced by make_eff_plots_areaNorm().

891 {
892  c1->cd();
893  TPad * pad1 = new TPad("pad1", "pad1", 0, 0.375, 1, 1.0);
894  pad1->Draw();
895  pad1->SetBottomMargin(0.02);
896  pad1->cd();
897 
898  hCRYMCCore->GetXaxis()->CenterTitle();
899  hCRYMCCore->GetYaxis()->CenterTitle();
900  hCosmicsDataCore->SetLineColor(kBlack);
901  hCosmicsDataCore->SetMarkerStyle(20);
902  hCosmicsDataCore->SetLineWidth(2);
903  hCRYMCCore->SetLineColor(kMagenta+2);
904  hCRYMCCore->SetFillColorAlpha(kMagenta+2, 0.5);
905  hCRYMCCore->SetLineWidth(2);
906 
907  hCosmicsDataCore->Divide(hCosmicsDataPresel);
908  hCRYMCCore->Divide(hCRYMCPresel);
909  hCRYMCCore->Draw("E2");
910  //this copy is literally just to be able to have the horizontal line for each bin
911  //without the vertical lines
912  auto hCRYMC2 = (TH1*)hCRYMCCore->Clone();
913  for(int bin =0; bin <= hCRYMC2->GetXaxis()->GetLast(); bin ++) hCRYMC2->SetBinError(bin, 0.000001);
914  hCRYMC2->SetFillColor(kWhite);
915  hCRYMC2->SetMarkerColor(kMagenta+2);
916  hCRYMC2->SetLineWidth(2);
917  hCRYMC2->Draw("E hist same");
918  hCosmicsDataCore->Draw("E1 same");
919  //hCRYMCCore->Draw("hist E1 same");
920 
921  hCRYMCCore->GetYaxis()->SetLabelSize(0.037);
922  hCRYMCCore->GetXaxis()->SetLabelSize(0);
923  hCRYMCCore->GetYaxis()->SetTitle("cos#theta_{beam} Weighted Efficiency");
924 
925  hCRYMCCore->GetYaxis()->SetRangeUser(0,1.2);
926 
927  TLegend * leg;
928  if (legSide ==0) leg = new TLegend(0.15,0.68,0.45,0.85);
929  else leg = new TLegend(0.5,0.68,0.8,0.85);
930  leg->AddEntry(hCosmicsDataCore,"Cosmic Data","p");
931  leg->AddEntry(hCRYMCCore,"Cosmic MC (CRY)","l");
932  leg->AddEntry(hCRYMCCore, "Cosmic MC Stat. Err.", "f");
933  leg->SetTextSize(0.05);
934  leg->Draw("same");
935  myPreliminary();
936 
937  double dif_label_y = 0.6;
938  //double dif_label_y = isWgtd ? 1.6 : 1.0;
939  //double dif_label_y = hCRYMCEff->GetYaxis()->GetBinUpEdge(hCRYMCEff->GetYaxis()->GetLast());
940  double dif_label_x = 0.5;//hCRYMCCore->GetXaxis()->GetBinLowEdge(2);
941  TText * tt = new TText(0.9*dif_label_x, dif_label_y, "FD Decay-in-Flight");
942  tt->SetTextSize(0.06);
943  tt->Draw();
944 
945  c1->cd();
946  TPad * pad2 = new TPad("pad2", "pad2", 0, 0.002, 1, 0.375);
947  pad2->SetTopMargin(0);
948  pad2->SetBottomMargin(0.2);
949  pad2->Draw();
950  pad2->cd();
951  pad2->SetGridy();
952 
953  TH1D* hEffRatio =(TH1D*)hCosmicsDataCore->Clone("hEffRatio");
954 
955  hEffRatio->GetXaxis()->CenterTitle();
956  hEffRatio->GetYaxis()->CenterTitle();
957  hEffRatio->SetLineColor(kBlack);
958  hEffRatio->SetMarkerStyle(20);
959  hEffRatio->SetLineWidth(3);
960  hEffRatio->Divide(hCRYMCCore);
961  hEffRatio->Draw("E1");
962  hEffRatio->GetXaxis()->SetLabelSize(0.075);
963  hEffRatio->GetYaxis()->SetLabelSize(0.075);
964  hEffRatio->GetXaxis()->SetTitleOffset(0.85);
965  hEffRatio->GetYaxis()->SetTitleOffset(0.55);
966  hEffRatio->GetXaxis()->SetTitleSize(0.09);
967  hEffRatio->GetYaxis()->SetTitleSize(0.085);
968  hEffRatio->GetYaxis()->SetRangeUser(0.5,1.5);
969  hEffRatio->GetYaxis()->SetTitle("#frac{Data}{MC}");
970 
971  hCRYMCCore->GetXaxis()->SetTitle("");
972  c1->cd();
974 }
void myPreliminary()
Definition: type_traits.h:56
float bin[41]
Definition: plottest35.C:14
void DrawBeamLabelEff(bool isFHC)
static bool isFHC
c1
Definition: demo5.py:24
TPad * pad2
Definition: analysis.C:13
TPad * pad1
Definition: analysis.C:13
void makeWgtdPlot ( TCanvas *  c1,
TH1 *  hCosmicsData,
TH1 *  hCRYMC,
TH1 *  hGENIEFluxswap,
int  sel,
int  legSide,
bool  isFHC 
)

Definition at line 609 of file make_DiF_plots.C.

References bin, kBlue, MECModelEnuComparisons::leg, and myPreliminary().

Referenced by make_eff_plots_areaNorm().

610 {
611  c1->cd();
612 
613  hCRYMC->GetXaxis()->CenterTitle();
614  hCRYMC->GetYaxis()->CenterTitle();
615  hCosmicsData->SetLineColor(kBlack);
616  hCosmicsData->SetMarkerStyle(20);
617  hCRYMC->SetLineColor(kMagenta+2);
618  hCRYMC->SetFillColorAlpha(kMagenta+2, 0.5);
619  hGENIEFluxswap->SetLineColor(kBlue);
620 
621  double kNormFactor = hCosmicsData->Integral();
622  hGENIEFluxswap->Scale(kNormFactor/hGENIEFluxswap->Integral());
623  hCRYMC->Scale(kNormFactor/hCRYMC->Integral());
624 
625  hCRYMC->GetYaxis()->SetTitle("Events (cos#theta_{beam} weighted)");
626  hCRYMC->Draw("E2");
627  //this copy is literally just to be able to have the horizontal line for each bin
628  //without the vertical lines
629  auto hCRYMC2 = (TH1*)hCRYMC->Clone();
630  for(int bin =0; bin <= hCRYMC2->GetXaxis()->GetLast(); bin ++) hCRYMC2->SetBinError(bin, 0.000001);
631  hCRYMC2->SetFillColor(kWhite);
632  hCRYMC2->SetMarkerColor(kMagenta+2);
633  hCRYMC2->Draw("E hist same");
634  hCosmicsData->Draw("E1 same");
635  //hCRYMC->Draw("E2 same");
636  hGENIEFluxswap->Draw("hist E1 same");
637  hCRYMC->GetYaxis()->SetLabelSize(0.037);
638  hCRYMC->GetYaxis()->SetTitleOffset(1.0);
639  hCRYMC->GetYaxis()->SetTitleSize(0.05);
640 
641  TLegend * leg;
642  if (legSide ==0) {
643  leg = new TLegend(0.15,0.62,0.75,0.85);
644  leg->SetNColumns(2);
645  leg->AddEntry(hCosmicsData,"Cosmic Data","p");
646  leg->AddEntry((TObject*)0, sel==0 ? "Preselected DiF Events": "Selected DiF Events", "");
647  leg->AddEntry(hCRYMC,"Cosmics MC (CRY)","l");
648  leg->AddEntry((TObject*)0, "Area norm. to data", "");
649  leg->AddEntry(hCRYMC, "Cosmics MC Stat. Err.", "f");
650  leg->AddEntry((TObject*)0, "","");
651  leg->AddEntry(hGENIEFluxswap, isFHC ? "#nu_{e} Signal MC" : "#bar{#nu}_{e} Signal MC","l");
652  }
653  else {
654  leg = new TLegend(0.15,0.62,0.85,0.85);
655  leg->SetNColumns(2);
656  leg->AddEntry((TObject*)0, sel==0 ? "Preselected DiF Events": "Selected DiF Events", "");
657  leg->AddEntry(hCosmicsData,"Cosmic Data","p");
658  leg->AddEntry((TObject*)0, "Area norm. to data", "");
659  leg->AddEntry(hCRYMC,"Cosmics MC (CRY)","l");
660  leg->AddEntry((TObject*)0, "","");
661  leg->AddEntry(hCRYMC, "Cosmics MC Stat. Err.", "f");
662  leg->AddEntry((TObject*)0, "","");
663  leg->AddEntry(hGENIEFluxswap, isFHC ? "#nu_{e} Signal MC" : "#bar{#nu}_{e} Signal MC","l");
664  }
665  leg->SetFillStyle(0);
666  leg->SetTextSize(0.04);
667  leg->Draw("same");
668  myPreliminary();
669 }
void myPreliminary()
float bin[41]
Definition: plottest35.C:14
static bool isFHC
c1
Definition: demo5.py:24
enum BeamMode kBlue
void makeWgtdPlot ( TCanvas *  c1,
TH1 *  hCosmicsData,
TH1 *  hCRYMC,
int  sel,
int  legSide 
)

Definition at line 671 of file make_DiF_plots.C.

References bin, MECModelEnuComparisons::leg, and myPreliminary().

672 {
673  //don't plot the GENIE histo
674  c1->cd();
675 
676  hCRYMC->GetXaxis()->CenterTitle();
677  hCRYMC->GetYaxis()->CenterTitle();
678  hCosmicsData->SetLineColor(kBlack);
679  hCosmicsData->SetMarkerStyle(20);
680  hCRYMC->SetLineColor(kMagenta+2);
681  hCRYMC->SetFillColorAlpha(kMagenta+2, 0.5);
682 
683  double kNormFactor = hCosmicsData->Integral();
684  hCRYMC->Scale(kNormFactor/hCRYMC->Integral());
685  hCRYMC->GetYaxis()->SetTitle("Events (cos#theta_{beam} weighted)");
686  hCRYMC->Draw("E2");
687  //this copy is literally just to be able to have the horizontal line for each bin
688  //without the vertical lines
689  auto hCRYMC2 = (TH1*)hCRYMC->Clone();
690  for(int bin =0; bin <= hCRYMC2->GetXaxis()->GetLast(); bin ++) hCRYMC2->SetBinError(bin, 0.000001);
691  hCRYMC2->SetFillColor(kWhite);
692  hCRYMC2->SetMarkerColor(kMagenta+2);
693  hCRYMC2->Draw("E hist same");
694  hCosmicsData->Draw("E1 same");
695  //hCRYMC->GetYaxis()->SetLabelSize(0.037);
696  //hCRYMC->GetYaxis()->SetTitleOffset(0.95);
697 
698  TLegend * leg;
699  if (legSide ==0) {
700  leg = new TLegend(0.15,0.68,0.75,0.85);
701  leg->SetNColumns(2);
702  leg->AddEntry(hCosmicsData,"Cosmic Data","p");
703  leg->AddEntry((TObject*)0, sel==0 ? "Preselected DiF Events": "Selected DiF Events", "");
704  leg->AddEntry(hCRYMC,"Cosmics MC (CRY)","l");
705  leg->AddEntry((TObject*)0, "Area norm. to data", "");
706  leg->AddEntry(hCRYMC, "Cosmics MC Stat. Err.", "f");
707  }
708  else {
709  leg = new TLegend(0.15,0.68,0.85,0.85);
710  leg->SetNColumns(2);
711  leg->AddEntry((TObject*)0, sel==0 ? "Preselected DiF Events": "Selected DiF Events", "");
712  leg->AddEntry(hCosmicsData,"Cosmic Data","p");
713  leg->AddEntry((TObject*)0, "Area norm. to data", "");
714  leg->AddEntry(hCRYMC,"Cosmics MC (CRY)","l");
715  leg->AddEntry((TObject*)0, "","");
716  leg->AddEntry(hCRYMC, "Cosmics MC Stat. Err.", "f");
717  }
718  leg->SetFillStyle(0);
719  leg->SetTextSize(0.04);
720  leg->Draw("same");
721 
722  myPreliminary();
723 }
void myPreliminary()
float bin[41]
Definition: plottest35.C:14
c1
Definition: demo5.py:24
void myPreliminary ( )

Definition at line 52 of file make_DiF_plots.C.

References kBlue, and prelim.

Referenced by makeDataCryRatio(), makeEffPlot(), makeEffPlotNoRatio(), makePlot(), makeWgtdEffPlot(), and makeWgtdPlot().

53 {
54  TLatex* prelim = new TLatex(.9, .95, "NOvA Preliminary");
55  prelim->SetTextColor(kBlue);
56  prelim->SetNDC();
57  prelim->SetTextSize(2/30.);
58  prelim->SetTextAlign(32);
59  prelim->Draw();
60 }
TLatex * prelim
Definition: Xsec_final.C:133
enum BeamMode kBlue

Variable Documentation

const std::vector<Plot> plots
Initial value:
= {
{"Shw_Angle", "Cos(#theta_{beam})", 0, 0, 7000},
{"NHits_in_slice", "Hits in Slice", 4, 1, 8000},
{"NHits_in_shower", "Hits in Shower", 4, 1, 8000},
{"Shw_E", "Energy in Shower (GeV)", 8, 1, 6000},
{"E_per_Hit", "GeV / Hit", 0, 1, 0},
{"CVNe", "CVN #nu_{e} selector", 4, 0, 11000},
{"Shw_Width", "Shower Width (cm)", 2, 1, 8000},
{"Shw_Length", "Shower Length (cm)", 2, 1, 8000},
{"Shw_Start X", "Shower Start X", 32, 0, 3000},
{"Shw_Start Y", "Shower Start Y", 32, 0, 0},
{"Shw_Start Z", "Shower Start Z", 50, 0, 1500},
{"Vtx_X", "Vertex Location X", 32, 0, 3000},
{"Vtx_Y", "Vertex Location Y", 32, 0, 0},
{"Vtx_Z", "Vertex Location Z", 50, 0, 1500},
{"Distance_Top", "Distance to Top (cm)", 100, 1, 4000},
{"Distance_Bottom", "Distance to Bottom (cm)", 100, 0, 2500},
{"Distance_East", "Distance to East Face", 16, 1, 5000},
{"Distance_West", "Distance to West Face", 16, 1, 5000},
{"Distance_Front", "Distance to Front", 50, 0, 1500},
{"Distance_Back", "Distance to Back", 100, 0, 2800}
}

Definition at line 85 of file make_DiF_plots.C.

Referenced by drawLongTerm(), drawTimePlots(), drawVsPOT(), efficiency(), efficiencySA(), FD_plots(), getBNBPlots(), getData(), getPredictions(), getTimePeakPlots(), getTimePeakTotal(), make_eff_plots_areaNorm(), make_pi0_xcheck(), make_pid(), MRDiFStudy_FHC_Step2(), MRDiFStudy_RHC_Step2(), evd::PlotView::Parse(), pi0_xcheck(), plot(), plot_2d(), plot_2d_vars(), plot_diff(), plot_pi0_xcheck(), plot_pid(), plot_resolution(), reco_minus_true_panels(), CalibAnaPlot::SetTreeLoopStride(), timingPeak(), and Plotter::TruthPlots().