SystematicShiftEffect.C
Go to the documentation of this file.
1 //Program writen by Prabhjot Singh on July 08, 2016 at 17:42.
2 //Purpose: To compare neutrino energy spectrum for three cases, no systematics, +sigma and -sigma for a particular systematic shift.
3 
4 #include<Header.h>
5 #include<HistogramAttr.h>
6 
8  gStyle->SetOptStat(0);
9 
10  //------------- USER INTERVENTION STARTS HERE ---------------------//
11  //path of the directory that has the required files
12  TString dir = "/nova/ana/users/prabhjot/FNEX/SystematicsTest/fitpointjobs/interactive/fakedata_bugfix/sabestfit/";
13 
14  //Systematic Shift Name
15  TString shift = "ND Beam";
16 
17  //name of the no systematic, plus sigma and minus sigma systematic files.
18  TString file_nosyst = "fnex_fitpoint_hist_nosyst.root";
19 // TString file_plussigma = "fnex_fitpoint_plus1sigma_hist_recohadeshifter.root";
20 // TString file_minussigma = "fnex_fitpoint_minus1sigma_hist_recohadeshifter.root";
21  TString file_plussigma = "fnex_fitpoint_plus1sigma_hist_nearbeamsystwgt.root";
22  TString file_minussigma = "fnex_fitpoint_minus1sigma_hist_nearbeamsystwgt.root";
23 // TString file_plussigma = "fnex_fitpoint_plus1sigma_hist_rpaccqewgt.root";
24 // TString file_minussigma = "fnex_fitpoint_minus1sigma_hist_rpaccqewgt.root";
25 
26  //Corrected or Uncorrected histograms
27  TString type = "Corrected";
28 
29  //Detector ND or FD
30  TString det = "FD";
31 
32  //Data or MC
33  TString datamc = "Data";
34 
35  //------------- USER INTERVENTION ENDS HERE ---------------------//
36 
37  //name of the histogram that you wan to plot
38  TString hist = det+datamc+type;
39 
40  TFile *f_nosyst = TFile::Open(dir+file_nosyst);
41  TFile *f_plussigma = TFile::Open(dir+file_plussigma);
42  TFile *f_minussigma = TFile::Open(dir+file_minussigma);
43 
44 
45  TString add = "fit/Fit/MultiExperiment/NOvA_NuMuSel/"+type+"Stacks/";
46 
47  TH1* h0 = (TH1*)f_nosyst->Get(add+hist);
48  TH1* h1 = (TH1*)f_plussigma->Get(add+hist);
49  TH1* h2 = (TH1*)f_minussigma->Get(add+hist);
50 
51  new TCanvas;
52  float margin = 0.15;
53  gPad->SetLeftMargin(margin);
54  gPad->SetBottomMargin(margin);
55 
56  h0->Draw("HIST same");
57  h0->SetLineColor(kBlue);
58  h0->SetLineWidth(2);
59 
60  HistogramAttr1D(h0, "E_{#nu}^{reco} (GeV)", "Events");
61 
62  h1->Draw("HIST same");
63  h1->SetLineColor(kBlack);
64  h1->SetLineWidth(2);
65  h1->SetLineStyle(2);
66 
67  h2->Draw("HIST same");
68  h2->SetLineColor(kRed);
69  h2->SetLineWidth(2);
70  h2->SetLineStyle(2);
71 
72  TLegend *legend = new TLegend(.42,.60,.87,.87);
73  legend->SetBorderSize(0);
74  legend->SetFillStyle(0);
75  legend->AddEntry(h0, hist, "");
76  legend->AddEntry(h0, "no syst.");
77  legend->AddEntry(h1, "+1 #sigma "+shift+" shift");
78  legend->AddEntry(h2, "-1 #sigma "+shift+" shift");
79  legend->Draw();
80 }
void SystematicShiftEffect()
bool datamc
Definition: fnexvscaf.C:20
TH1F * h2
Definition: plot.C:45
TH1F * h1
TDirectory * dir
Definition: macro.C:5
HistogramAttr1D(TH1 *h, char *title_x, char *title_y, Double_t binlowx, Double_t binhighx, Double_t binlowy, Double_t binhighy, Color_t lcolor)
add("abs", expr_type(int_type()), expr_type(int_type()))