nue_cafvsfnex_cosmics.C
Go to the documentation of this file.
1 //Author: Prabhjot Singh (prabhjot@fnal.gov).
2 //Date Jan 05, 2017
3 //
4 //Make and Compare FD cosmic backgrounds between CAF and FNEX.
5 //
6 //
7 
8 
9 #include <Header.h>
10 #include <HistogramAttr.h>
11 
12 
14 
15  int firstbin = 0;
16 
17  //CAF file
18  TFile* file_base = new TFile("/nova/ana/users/prabhjot/FNEX/nue_analysis/caf/histograms_forFNEX_CVN_prop_stats.root ");
19  TH1F* h_base = (TH1F*)file_base->Get("fd_cosmic");
20 
21  //FNEX file
22  TFile* file_sec = new TFile("/nova/ana/users/prabhjot/FNEX/nue_analysis/realdata/test_cosmic/test_commit/fnex_plotpoint_hist.root");
23 
24  //Three PIDs range
25  TString pid[3] = {"Low", "Mid", "High"};
26 
27  //Loop over three PIDs
28  for(int i = 0; i < 3; ++i){
29 
30  if (pid[i]=="Low") firstbin = 0;
31  else if(pid[i]=="Mid") firstbin = 10;
32  else if(pid[i]=="High") firstbin = 20;
33 
34  //Need to remake individual CAF histograms for Low, Mid and High CVN bins because
35  //in the CAF histogram file all three histograms are present as one histogram
36  TH1F* cosmicCounts = new TH1F("cosmicCounts", "", 10, 0, 5);
37  for(Int_t j = 1; j < cosmicCounts->GetNbinsX()+1; ++j){
38  cosmicCounts->SetBinContent(j, h_base->GetBinContent(j+firstbin));
39  }
40 
41  //FNEX cosmic histogram
42  TH1F* h_sec1 = (TH1F*)file_sec->Get("plot/MultiExperiment/NOvA_NuESel_"+pid[i]+"PID_NuMuSel/CorrectedStacks/FDcosmicCorrected");
43  TH1F* h_sec = (TH1F*)h_sec1->Clone("h_sec");
44 
45  std::cout << "CAF events = " << cosmicCounts->Integral() << std::endl;
46  std::cout << "FNEX events = " << h_sec ->Integral() << std::endl;
47  std::cout << "Ratio FNEX/CAF events = " << h_sec ->Integral() / cosmicCounts->Integral() << std::endl;
48 
49  h_sec->Rebin(2);
50 
51  //Uncomment it if you want to normalize FNEX wrt. CAF area
52  // h_sec->Scale(cosmicCounts->Integral()/h_sec->Integral());
53 
54  //Calling a function to compare CAF and FNEX histograms
56  cosmicCounts,
57  h_sec,
58  "E^{reco}_{#nu} (GeV)",
59  "Events",
60  632,
61  600,
62  2,
63  1,
64  0.52,
65  0.33,
66  0.89,
67  0.86,
68  "Cosmics "+pid[i],
69  "CAF",
70  "FNEX ",
71  "nue_cosmic_caf_vs_fnex"+pid[i]
72  );
73  }//end of loop over three pids
74 
75 }//end of main function.
void CompareHistos(TH1 *hbase_orig, TH1 *hsec_orig, TString xlabel, TString ylabel, int cbase, int csec, int lbase, int lsec, float x1, float y1, float x2, float y2, TString legtitle, TString legbase, TString legsec, TString savefile)
const double j
Definition: BetheBloch.cxx:29
OStream cout
Definition: OStream.cxx:6
void nue_cafvsfnex_cosmics()