nue_signal_extrapolation.C
Go to the documentation of this file.
1 //Program writen by Prabhjot Singh on August 11, 2016 at 12:15 pm.
2 //
3 //Purpose: Make ND prediction over MC histograms and their ratios.
4 // ND prediction over MC histograms helps to make FD prediction for the nue signal (numu to nue signal)
5 // Make FD signal prediction for the numu to nue oscillations.
6 //
7 
8 #include<Header.h>
9 #include<HistogramAttr.h>
10 
11 //root libraries
12 #include "vector.h"
13 
15 
16  //disable stat box.
17  gStyle->SetOptStat(" ");
18 
19  TString det_type[] = {"Near", "Far"};
20  TString interaction_type[] = {"NuMuCC", "NuECC"};
21  TString selection_type[] = {"NuMuSel", "NuESel"}; //replace second NuMuSel by NuESel once we will have nue selected events.
22  TString file_type[] = {"Beam", "FluxSwap"};
23  TString pid[] = {"LowPID", "MidPID", "HighPID" };
24 
25  bool isMC;
26 
27  TString epoch;
28  TString dirPOT;
29  TString filenamePOT;
30  TString POTfile;
31  TString dir;
32  TString filename;
33  TString rootfile;
34  TString histdir;
35  TString histname_reco;
36  TString histname_true;
37  TString histname_recotrue;
38  TString MC;
39  TString Data;
40 
41  Double_t nd_mc_pot;
42  Double_t nd_data_pot;
43 
44  Float_t margin = 0.15;
45 
46  //directory path where the root file exists with the spill and POT summary
47  dirPOT = "/nova/ana/users/prabhjot/FNEX/nue_analysis/";
48 
49  //name of the root file that has spill and POT summary
50  filenamePOT = "eventlisttrees_prod_pid_R16-03-03-prod2reco.a_fhc.root";
51 
52  POTfile = dirPOT+filenamePOT;
53 
54  //ND MC and Data POT
55  nd_mc_pot = POTinformationMC();
56  nd_data_pot = POTinformationData();
57 
58  //directoy path where the root file with histograms exists
59  dir = "/nova/ana/users/prabhjot/FNEX/nue_analysis/realdata/"; //File with correct nue selected FD MC spectra
60 
61  //name of the root file that has all the histograms
62  filename = "fnex_plotpoint_hist.root"; //correct nue selected FD MC spectra
63 
64  rootfile = dir+filename;
65 
66  //name of the histogram directory
67  histdir = "plot/SkimmedListsConcatenatedByEpoch/";
68 
69  //initial name of the reco energy histograms
70  histname_reco = "neutrinoE";
71 
72  //initial name of the true energy histograms
73  histname_true = "neutrinoTrueE";
74 
75  //initial name of the reco vs true histogram
76  histname_recotrue = "recoToTrue";
77 
78  //combined epoch name in the histogram names
79  epoch = "Epoch0z";
80 
81  //MC histogram
82  MC = "MC";
83 
84  //Data histogram
85  Data = "Data";
86 
87  //Open root file
88  TFile* f = new TFile(rootfile, "read");
89  f->cd();
90 
91  //ND data histogram that we want to use.
92  TH1F* hist_nddata = (TH1F*)f->Get(histdir+histname_reco+Data+det_type[0]+selection_type[0]+epoch);
93 
94  //ND MC for the reco energy for Beam, numu CC, numu selection and near detector
95  TH1F* hist_ndMC_reco = (TH1F*)f->Get(histdir+histname_reco+MC+file_type[0]+interaction_type[0]+det_type[0]+selection_type[0]+epoch);
96 
97  //ND MC reco. vs. true energy plot for Beam, numu CC, numu selection and near detector
98  TH2F* hist_ndrecotrue = (TH2F*)f->Get(histdir+histname_recotrue+MC+file_type[0]+interaction_type[0]+det_type[0]+selection_type[0]+epoch);
99 
100  //ND MC for the true energy for Beam, numu CC, numu selection and near detector
101  TH1F* hist_ndMC_true = (TH1F*)hist_ndrecotrue->ProjectionX();
102 
103  //FD MC reco. vs. true energy plot for FluxSwap, numuCC, nue selection and far detector
104  TH2F* hist_fdrecotrue = (TH2F*)f->Get(histdir+histname_recotrue+MC+file_type[1]+interaction_type[1]+det_type[1]+selection_type[1]+pid[0]+epoch);
105 
106  //Normalize data and MC histograms by POT
107  Double_t ratio_pot = hist_nddata->Integral()/hist_ndMC_reco->Integral();
108  std::cout << "Normalization ratio = " << ratio_pot << std::endl;
109 
110  //Check if histograms exist or not?
111  if(!hist_nddata) std::cout << histname_reco+Data+det_type[0]+selection_type[0]+epoch+" doesn't exist" << std::endl;
112  if(!hist_ndMC_reco) std::cout << histname_reco+MC+file_type[0]+interaction_type[0]+det_type[0]+selection_type[0]+epoch+" doesn't exist" << std::endl;
113  if(!hist_ndrecotrue) std::cout << histname_recotrue+MC+file_type[0]+interaction_type[0]+det_type[0]+selection_type[0]+epoch+" doesn't exist" << std::endl;
114  if(!hist_fdrecotrue) std::cout << histname_recotrue+MC+file_type[1]+interaction_type[1]+det_type[1]+selection_type[1]+pid[0]+epoch+" doesn't exist" << std::endl;
115 
116  //Names of the histograms
117  std::cout << " " << std::endl;
118  if(hist_nddata) std::cout << "ND data histogram: " << hist_nddata ->GetName() << std::endl;
119  if(hist_ndMC_reco) std::cout << "ND MC for the reco energy for Beam:" << hist_ndMC_reco ->GetName() << std::endl;
120  if(hist_ndrecotrue) std::cout << "ND MC reco. vs. true energy plot:" << hist_ndrecotrue ->GetName() << std::endl;
121  if(hist_fdrecotrue) std::cout << "FD MC reco. vs. true energy plot:" << hist_fdrecotrue ->GetName() << std::endl;
122 
123  hist_ndMC_reco->Scale(ratio_pot);
124  hist_ndMC_true->Scale(ratio_pot);
125  hist_ndrecotrue->Scale(ratio_pot);
126 
127  //Clones of some histograms
128  TH1F* hist_nddata_clone1 = (TH1F*)hist_nddata->Clone("hist_nddata_clone1");
129  TH2F* hist_ndrecotrue_clone = (TH2F*)hist_ndrecotrue->Clone("hist_ndrecotrue_clone");
130  TH2F* hist_fdrecotrue_clone = (TH2F*)hist_fdrecotrue->Clone("hist_fdrecotrue_clone");
131 
132  std::cout << " " << std::endl;
133  std::cout << "Histogram directory = " << histdir << std::endl;
134  std::cout << "Reco. Histogram name = " << histname_reco << std::endl;
135  std::cout << "True. Histogram name = " << histname_true << std::endl;
136  std::cout << "Data = " << Data << std::endl;
137  std::cout << "MC = " << MC << std::endl;
138  std::cout << "File Type = " << file_type[0] << std::endl;
139  std::cout << "Interaction type = " << interaction_type[0] << std::endl;
140  std::cout << "Detector type = " << det_type[0] << std::endl;
141  std::cout << "Selection type = " << selection_type[0] << std::endl;
142  std::cout << "ND data histogram = " << hist_nddata->GetName() << std::endl;
143  std::cout << "ND 2D MC histogram = " << hist_ndrecotrue->GetName() << std::endl;
144  std::cout << "FD 2D MC histogram = " << hist_fdrecotrue->GetName() << std::endl;
145  std::cout << " " << std::endl;
146 
147  //--------------------------------------------------------------------------//
148  //Draw ND data histogram
149  new TCanvas;
150  gPad->SetLeftMargin(margin);
151  gPad->SetBottomMargin(margin);
152  hist_nddata->Draw();
153  HistogramAttr1D(hist_nddata, "E_{#nu}^{reco} (GeV)", "N^{Data}_{#nu_{#mu}, S_{#mu}} Events");
154  hist_nddata->GetXaxis()->SetRangeUser(0, 5);
155  hist_nddata->SetLineWidth(2);
156  hist_nddata->SetLineColor(kBlack);
157  //Set legends for the data plot
158  TLegend *leg_data = new TLegend(.60,.73,.78,.84);
159  leg_data->SetBorderSize(0);
160  leg_data->SetFillStyle(0);
161  leg_data->AddEntry((TObject*)0, det_type[0]+" "+"Detector"," ");
162  leg_data->AddEntry(hist_nddata, Data);
163  leg_data->SetTextSize(.05);
164  leg_data->Draw();
165  gPad->Print("Images/NDdata_recoE.pdf");
166  //--------------------------------------------------------------------------//
167 
168  //Draw ND reco energy MC histogram
169  new TCanvas;
170  gPad->SetLeftMargin(margin);
171  gPad->SetBottomMargin(margin);
172  hist_ndMC_reco->Draw();
173  HistogramAttr1D(hist_ndMC_reco, "E_{#nu}^{reco} (GeV)", "N^{MC}_{#nu_{#mu}, S_{#mu}} Events");
174  hist_ndMC_reco->GetXaxis()->SetRangeUser(0, 5);
175  hist_ndMC_reco->SetLineWidth(2);
176  hist_ndMC_reco->SetLineColor(kRed);
177  //Set legends for the MC reco energy plot
178  TLegend *leg_MC_reco = new TLegend(.60,.73,.78,.84);
179  leg_MC_reco->SetBorderSize(0);
180  leg_MC_reco->SetFillStyle(0);
181  leg_MC_reco->AddEntry((TObject*)0, det_type[0]+" "+"Detector"," ");
182  leg_MC_reco->AddEntry(hist_ndMC_reco, MC);
183  leg_MC_reco->SetTextSize(.05);
184  leg_MC_reco->Draw();
185  gPad->Print("Images/NDMC_recoE.pdf");
186  //--------------------------------------------------------------------------//
187 
188  //Draw ND true energy MC histogram
189  new TCanvas;
190  gPad->SetLeftMargin(margin);
191  gPad->SetBottomMargin(margin);
192  hist_ndMC_true->Draw();
193  HistogramAttr1D(hist_ndMC_true, "E_{#nu}^{true} (GeV)", "N^{MC}_{#nu_{#mu}, S_{#mu}} Events");
194  hist_ndMC_true->GetXaxis()->SetRangeUser(0, 5);
195  hist_ndMC_true->SetLineWidth(2);
196  hist_ndMC_true->SetLineColor(kBlue);
197  //Set legends for the MC true energy plot
198  TLegend *leg_MC_true = new TLegend(.60,.73,.78,.84);
199  leg_MC_true->SetBorderSize(0);
200  leg_MC_true->SetFillStyle(0);
201  leg_MC_true->AddEntry((TObject*)0, det_type[0]+" "+"Detector"," ");
202  leg_MC_true->AddEntry(hist_ndMC_true, MC);
203  leg_MC_true->SetTextSize(.05);
204  leg_MC_true->Draw();
205  gPad->Print("Images/NDMC_trueE.pdf");
206  //--------------------------------------------------------------------------//
207 
208  //Draw ND 2D reco. vs. true energy histogram.
209  new TCanvas;
210  gPad->SetLeftMargin(margin);
211  gPad->SetBottomMargin(margin);
212  gPad->SetRightMargin(1.2*margin);
213  gPad->SetLogz();
214  hist_ndrecotrue->Draw("colz text");
215  hist_ndrecotrue->GetXaxis()->SetRangeUser(0, 5);
216  hist_ndrecotrue->GetYaxis()->SetRangeUser(0, 5);
217  HistogramAttr2D(hist_ndrecotrue, "E_{#nu}^{true} (GeV)", "E_{#nu}^{reco} (GeV)", "N^{MC}_{#nu_{#mu}, S_{#mu}} Events");
218  gPad->Print("Images/NDMC_recoEtrueE.pdf");
219  // gPad->Print("Images/ND_truevsreco_old.C");
220  //--------------------------------------------------------------------------//
221 
222  //Draw data and MC histograms on the same canvas as well.
223  new TCanvas;
224  gPad->SetLeftMargin(margin);
225  gPad->SetBottomMargin(margin);
226  TH1F* hist_nddata_clone = (TH1F*)hist_nddata->Clone("hist_nddata_clone");
227  TH1F* hist_ndMC_reco_clone = (TH1F*)hist_ndMC_reco->Clone("hist_ndMC_reco_clone");
228  TH1F* hist_ndMC_true_clone = (TH1F*)hist_ndMC_true->Clone("hist_ndMC_true_clone");
229  hist_nddata_clone->Draw();
230  hist_ndMC_reco_clone->Draw("same");
231  hist_ndMC_true_clone->Draw("same");
232  HistogramAttr1D(hist_nddata_clone, "E_{#nu} (GeV)", "Events");
233  hist_nddata_clone->GetYaxis()->SetRangeUser(0, 100e3);
234  //legends for the data and MC plots
235  TLegend *leg_data_MC = new TLegend(.53,.58,.73,.85);
236  leg_data_MC->SetBorderSize(0);
237  leg_data_MC->SetFillStyle(0);
238  leg_data_MC->AddEntry((TObject*)0, det_type[0]+" "+"Detector"," ");
239  leg_data_MC->AddEntry(hist_nddata_clone, Data);
240  leg_data_MC->AddEntry(hist_ndMC_reco_clone, MC+" "+(hist_ndMC_reco_clone->GetXaxis()->GetTitle()));
241  leg_data_MC->AddEntry(hist_ndMC_true_clone, MC+" "+(hist_ndMC_true_clone->GetXaxis()->GetTitle()));
242  leg_data_MC->SetTextSize(.05);
243  leg_data_MC->Draw();
244  gPad->Print("Images/NDSpec.pdf");
245  //--------------------------------------------------------------------------//
246 
247  //Take ratio of N(data)/N(MC) as a function of reco energy.
248  TH1F* ratio_dataByMC = ratio(hist_ndMC_reco, hist_nddata);
249  new TCanvas;
250  gPad->SetLeftMargin(margin);
251  gPad->SetBottomMargin(margin);
252  ratio_dataByMC->Draw("E");
253  ratio_dataByMC->SetMarkerStyle(20);
254  HistogramAttr1D(ratio_dataByMC, (hist_nddata->GetXaxis()->GetTitle()), "N^{Data}_{#nu_{#mu}, S_{#mu}} / N^{MC}_{#nu_{#mu}, s_{#mu}}");
255  gPad->Print("Images/NDdataMCratio_recoE.pdf");
256  //--------------------------------------------------------------------------//
257 
258  //make a modify 2D N(MC) plot by multiplying the original 2D ND(MC) plot by the ratio of the N(data)/N(MC) as a function of reco energy.
259  TH2F* hist_ndrecotrue_modified = modify2D(hist_ndrecotrue, ratio_dataByMC, "NDPrediction");
260  new TCanvas;
261  gPad->SetLogz();
262  gPad->SetLeftMargin(margin);
263  gPad->SetBottomMargin(margin);
264  gPad->SetRightMargin(1.2*margin);
265  hist_ndrecotrue_modified->Draw("colz text");
266  hist_ndrecotrue_modified->GetXaxis()->SetRangeUser(0, 5);
267  hist_ndrecotrue_modified->GetYaxis()->SetRangeUser(0, 5);
268  HistogramAttr2D(hist_ndrecotrue_modified, "E_{#nu}^{true} (GeV)", "E_{#nu}^{reco} (GeV)", "N^{MC}_{#nu_{#mu}, S_{#mu}} Events");
269  gPad->Print("Images/NDSpec_weighted.pdf");
270  // gPad->Print("Images/ND_truevsreco_modified_old.C");
271  //--------------------------------------------------------------------------//
272 
273  //make a ND prediction as a function of true energy.
274  TH1F* ND_prediction = NDPrediction(hist_ndrecotrue_modified);
275  new TCanvas;
276  gPad->SetLogz();
277  gPad->SetLeftMargin(margin);
278  gPad->SetBottomMargin(margin);
279  ND_prediction->Draw("HIST");
280  ND_prediction->GetXaxis()->SetRangeUser(0, 5);
281  HistogramAttr1D(ND_prediction, hist_ndrecotrue_modified->GetXaxis()->GetTitle(), "N^{Prediction}_{#nu_{#mu}, S_{#mu}} Events");
282  ND_prediction->SetLineColor(28);
283  //Set legends for the ND prediction true energy plot
284  TLegend* leg_NDpred_true = new TLegend(.60,.73,.78,.84);
285  leg_NDpred_true->SetBorderSize(0);
286  leg_NDpred_true->SetFillStyle(0);
287  leg_NDpred_true->AddEntry((TObject*)0, det_type[0]+" "+"Detector"," ");
288  leg_NDpred_true->AddEntry(ND_prediction, "Prediction");
289  leg_NDpred_true->SetTextSize(.05);
290  leg_NDpred_true->Draw();
291  gPad->Print("Images/NDPred_trueE.pdf");
292  //--------------------------------------------------------------------------//
293 
294  //take ratio of ND prediction and ND MC as a function of true energy.
295  TH1F* ratio_ND_predictionToMC = ratio(hist_ndMC_true, ND_prediction);
296  new TCanvas;
297  gPad->SetLeftMargin(margin);
298  gPad->SetBottomMargin(margin);
299  ratio_ND_predictionToMC->Draw();
300  HistogramAttr1D(ratio_ND_predictionToMC, "E_{#nu}^{true} (GeV)", "N^{Prediction}_{#nu_{#mu}, S_{#mu}} / N^{MC}_{#nu_{#mu}, s_{#mu}}");
301  ratio_ND_predictionToMC->GetXaxis()->SetRangeUser(0, 5);
302  ratio_ND_predictionToMC->SetLineWidth(2);
303  ratio_ND_predictionToMC->SetLineColor(28);
304  ratio_ND_predictionToMC->SetMarkerStyle(20);
305  ratio_ND_predictionToMC->SetMarkerColor(28);
306  gPad->Print("Images/NDPredMCratio_trueE.pdf");
307  //--------------------------------------------------------------------------//
308 
309  //plot both ratios N(data)/N(MC) and N(pred)/N(MC) in same canvas.
310  TH1F* ratio_dataByMC_clone = (TH1F*)ratio_dataByMC->Clone("ratio_dataByMC_clone");
311  TH1F* ratio_ND_predictionToMC_clone = (TH1F*)ratio_ND_predictionToMC->Clone("ratio_ND_predictionToMC_clone");
312  new TCanvas;
313  gPad->SetLeftMargin(margin);
314  gPad->SetBottomMargin(margin);
315  ratio_dataByMC_clone->Draw();
316  HistogramAttr1D(ratio_dataByMC_clone, "E_{#nu} (GeV)", "Ratio");
317  ratio_ND_predictionToMC_clone->Draw("same");
318  //legends for ratios N(data)/N(MC) and N(pred)/N(MC)
319  TLegend* leg_ratios = new TLegend(.31,.61,.51,.88);
320  leg_ratios->SetBorderSize(0);
321  leg_ratios->SetFillStyle(0);
322  leg_ratios->AddEntry((TObject*)0, det_type[0]+" "+"Detector"," ");
323  leg_ratios->AddEntry(ratio_dataByMC_clone, (ratio_dataByMC->GetYaxis()->GetTitle()), "lep");
324  leg_ratios->AddEntry(ratio_ND_predictionToMC_clone, (ratio_ND_predictionToMC_clone->GetYaxis()->GetTitle()), "lep");
325  leg_ratios->SetTextSize(.05);
326  leg_ratios->Draw();
327  gPad->Print("Images/ND_doubleratio.pdf");
328  //--------------------------------------------------------------------------//
329 
330  //plot double ratio of N(data)/N(MC) to N(pred)/N(MC)
331  TH1F* double_ratio = ratio(ratio_ND_predictionToMC_clone, ratio_dataByMC_clone);
332  new TCanvas;
333  gPad->SetLeftMargin(margin);
334  gPad->SetBottomMargin(margin);
335  double_ratio->Draw();
336  double_ratio->SetLineColor(41);
337  double_ratio->SetMarkerColor(41);
338  double_ratio->GetYaxis()->SetRangeUser(0.7, 1.4);
339  HistogramAttr1D(double_ratio, "E_{#nu} (GeV)", "Double Ratio");
340  TLegend* leg_doubleratios = new TLegend(.31,.61,.51,.88);
341  leg_doubleratios->SetBorderSize(0);
342  leg_doubleratios->SetFillStyle(0);
343  leg_doubleratios->AddEntry((TObject*)0, det_type[0]+" "+"Detector"," ");
344  leg_doubleratios->AddEntry(double_ratio, "#frac{N^{data}/N^{MC}}{N^{Pred.}/N^{MC}}_{#nu_{#mu}, S_{#mu}}", "lep");
345  leg_doubleratios->SetTextSize(.05);
346  leg_doubleratios->Draw();
347  gPad->Print("Images/NDdouble_doubleratio.pdf");
348  //--------------------------------------------------------------------------//
349 
350  //take ratios of 2D histograms of N(MC) nu mu events
351  TH2F* ratio_2D_NDMC = ratio2D(hist_ndrecotrue,hist_ndrecotrue_modified);
352  new TCanvas;
353  gPad->SetLeftMargin(margin);
354  gPad->SetBottomMargin(margin);
355  gPad->SetRightMargin(1.2*margin);
356  ratio_2D_NDMC->Draw("colz");
357  HistogramAttr2D(ratio_2D_NDMC, "E_{#nu}^{true} (GeV)", "E_{#nu}^{reco} (GeV)", "Ratio N^{MC}_{#nu_{#mu}, S_{#mu}} Events");
358  ratio_2D_NDMC->SetMinimum(0.8);
359  ratio_2D_NDMC->SetMaximum(2.0);
360  gPad->Print("Images/NDratio_weightedTounweighted.pdf");
361  //--------------------------------------------------------------------------//
362 
363  //make the exact same ND prediction/MC for true energy but this time just use the bin content of the ND data and ND MC truereco energy histograms.
364  ND_predictionbyMC(hist_nddata_clone1, hist_ndrecotrue_clone);
365 
366  ND_predictionbyMC_usingbincontent(hist_nddata_clone1, hist_ndrecotrue_clone);
367  //--------------------------------------------------------------------------//
368 
369  //Draw FD 2D reco. vs. true energy histogram.
370  new TCanvas;
371  gPad->SetLeftMargin(margin);
372  gPad->SetBottomMargin(margin);
373  gPad->SetRightMargin(1.2*margin);
374  gPad->SetLogz();
375  hist_fdrecotrue->Draw("colz text");
376  hist_fdrecotrue->GetXaxis()->SetRangeUser(0, 5);
377  hist_fdrecotrue->GetYaxis()->SetRangeUser(0, 5);
378  HistogramAttr2D(hist_fdrecotrue, "E_{#nu}^{true} (GeV)", "E_{#nu}^{reco} (GeV)", "F^{MC}_{#nu_{#mu} #rightarrow #nu_{e}, S_{e}} Events");
379  gPad->Print("Images/FDMC_recoEtrueE.pdf");
380  //--------------------------------------------------------------------------//
381 
382  //make a modified 2D F(MC) plot by multiplying the original 2D FD(MC) plot by the ratio of the N(Prediction)/N(MC) as a function of true energy.
383  TH2F* hist_fdrecotrue_modified = modify2D(hist_fdrecotrue, ratio_ND_predictionToMC, "FDPrediction");
384  new TCanvas;
385  gPad->SetLogz();
386  gPad->SetLeftMargin(margin);
387  gPad->SetBottomMargin(margin);
388  gPad->SetRightMargin(1.2*margin);
389  hist_fdrecotrue_modified->Draw("colz text");
390  hist_fdrecotrue_modified->GetXaxis()->SetRangeUser(0, 5);
391  hist_fdrecotrue_modified->GetYaxis()->SetRangeUser(0, 5);
392  HistogramAttr2D(hist_fdrecotrue_modified, "E_{#nu}^{true} (GeV)", "E_{#nu}^{reco} (GeV)", "F^{MC}_{#nu_{#mu} #rightarrow #nu_{e}, S_{e}} Events");
393  gPad->Print("Images/FDSpec_weighted.pdf");
394  //--------------------------------------------------------------------------//
395  //take ratios of 2D histograms of F(MC) nu e event
396  TH2F* ratio_2D_FDMC = ratio2D(hist_fdrecotrue, hist_fdrecotrue_modified);
397  new TCanvas;
398  gPad->SetLeftMargin(margin);
399  gPad->SetBottomMargin(margin);
400  gPad->SetRightMargin(1.2*margin);
401  ratio_2D_FDMC->Draw("colz");
402  HistogramAttr2D(ratio_2D_FDMC, "E_{#nu}^{true} (GeV)", "E_{#nu}^{reco} (GeV)", "Ratio F^{MC}_{#nu_{#mu} #rightarrow #nu_{e}, S_{e}} Events");
403  ratio_2D_FDMC->SetMinimum(0.8);
404  ratio_2D_FDMC->SetMaximum(2.0);
405  gPad->Print("Images/FDratio_weightedTounweighted.pdf");
406  //--------------------------------------------------------------------------//
407  //plot oscillation probability of numu to mue oscillations.
408  TH1F* prob = Prob_me(hist_nddata_clone1);
409  new TCanvas;
410  gPad->SetLeftMargin(margin);
411  gPad->SetBottomMargin(margin);
412  prob->Draw("P");
413  prob->SetMarkerStyle(20);
414  prob->SetMarkerColor(9);
415  prob->GetXaxis()->SetRangeUser(0, 5);
416  HistogramAttr1D(prob, "E_{#nu}^{true} (GeV)", "P_{#nu_{#mu} #rightarrow #nu_{e}}");
417  //legends
418  TLegend* l_prob = new TLegend(.65,.69,.85,.96);
419  l_prob->SetBorderSize(0);
420  l_prob->SetFillStyle(0);
421  l_prob->AddEntry(prob, "P_{#nu_{#mu} #rightarrow #nu_{e}}", "p");
422  l_prob->SetTextSize(.05);
423  l_prob->Draw();
424  gPad->Print("Images/probability_numutonue.pdf");
425  //--------------------------------------------------------------------------//
426  //make a plot of modified 2D F(MC) hist_fdrecotrue_modified times oscillation probability of numu to mue oscillations.
427  TH2F* prob_times_fdmc = modify2D(hist_fdrecotrue_modified, prob, "FDPrediction");
428  new TCanvas;
429  gPad->SetLogz();
430  gPad->SetLeftMargin(margin);
431  gPad->SetBottomMargin(margin);
432  gPad->SetRightMargin(1.2*margin);
433  prob_times_fdmc->Draw("colz text");
434  prob_times_fdmc->GetXaxis()->SetRangeUser(0, 5);
435  prob_times_fdmc->GetYaxis()->SetRangeUser(0, 5);
436  HistogramAttr2D(prob_times_fdmc, "E_{#nu}^{true} (GeV)", "E_{#nu}^{reco} (GeV)", "F^{MC}_{#nu_{#mu} #rightarrow #nu_{e}, S_{e}} #times P_{#nu_{#mu} #rightarrow #nu_{e}} (E^{true})");
437  gPad->Print("Images/FDSpec_weightedtimesprob.pdf");
438  //--------------------------------------------------------------------------//
439  //take ratios of 2D histograms of F(MC) nu e event before and after the probability multiplication
440  TH2F* ratio_prob_times_fdmc = ratio2D(hist_fdrecotrue_modified, prob_times_fdmc);
441  new TCanvas;
442  gPad->SetLeftMargin(margin);
443  gPad->SetBottomMargin(margin);
444  gPad->SetRightMargin(1.2*margin);
445  ratio_prob_times_fdmc->Draw("colz");
446  HistogramAttr2D(ratio_2D_FDMC, "E_{#nu}^{true} (GeV)", "E_{#nu}^{reco} (GeV)", "Ratio (F^{MC}_{#nu_{#mu} #rightarrow #nu_{e}, S_{e}} #times P_{#nu_{#mu} #rightarrow #nu_{e}} (E^{true}))");
447  ratio_prob_times_fdmc->SetMinimum(0.00);
448  ratio_prob_times_fdmc->SetMaximum(.035);
449  gPad->Print("Images/FDMCratio_afterandbefore_probability.pdf");
450  //--------------------------------------------------------------------------//
451  //make a FD prediction as a function of reco energy.
452  TH1F* FD_prediction = FDPrediction(prob_times_fdmc);
453  new TCanvas;
454  gPad->SetLogz();
455  gPad->SetLeftMargin(margin);
456  gPad->SetBottomMargin(margin);
457  FD_prediction->Draw("HIST");
458  FD_prediction->GetXaxis()->SetRangeUser(0, 5);
459  HistogramAttr1D(FD_prediction, prob_times_fdmc->GetYaxis()->GetTitle(), "F^{Prediction}_{#nu_{#mu} #rightarrow #nu_{e}, S_{e}} Events");
460  FD_prediction->SetLineColor(28);
461  //Set legends for the ND prediction true energy plot
462  TLegend* leg_FDpred_true = new TLegend(.60,.73,.78,.84);
463  leg_FDpred_true->SetBorderSize(0);
464  leg_FDpred_true->SetFillStyle(0);
465  leg_FDpred_true->AddEntry((TObject*)0, det_type[1]+" "+"Detector"," ");
466  leg_FDpred_true->AddEntry(FD_prediction, "Prediction");
467  leg_FDpred_true->SetTextSize(.05);
468  leg_FDpred_true->Draw();
469  gPad->Print("Images/FDPred_recoE.pdf");
470  //--------------------------------------------------------------------------//
471 
472 }//end of program ND_pred_MC_nue_signal()
473 //-------------------------------------------------------------------------------//
enum BeamMode kRed
nue_signal_extrapolation()
TH1 * ratio(TH1 *h1, TH1 *h2)
TH2F * modify2D(TH2F *h2D, TH1F *h1D, TString prediction)
string filename
Definition: shutoffs.py:106
interaction_type
Definition: Constants.h:110
void ND_predictionbyMC(TH1F *h1, TH2F *h2)
OStream cout
Definition: OStream.cxx:6
Double_t POTinformationMC()
det_type
Definition: Constants.h:584
TH1F * NDPrediction(TH2F *h)
void ND_predictionbyMC_usingbincontent(TH1F *hdata, TH2F *htruereco)
TH2F * ratio2D(TH2F *h1, TH2F *h2)
TDirectory * dir
Definition: macro.C:5
void HistogramAttr2D(TH2 *h, char *titlx_x, char *titlx_y, char *titlx_z, Double_t binlowx, Double_t binhighx, Double_t binlowy, Double_t binhighy)
Double_t POTinformationData()
TH1F * Prob_me(TH1F *h)
file_type
Definition: Constants.h:150
TH1F * FDPrediction(TH2F *h)
HistogramAttr1D(TH1 *h, char *title_x, char *title_y, Double_t binlowx, Double_t binhighx, Double_t binlowy, Double_t binhighy, Color_t lcolor)
enum BeamMode kBlue