drawSensitivity.C
Go to the documentation of this file.
3 #include "CAFAna/Fit/Fit.h"
6 #include "CAFAna/Core/Loaders.h"
9 #include "CAFAna/Core/Spectrum.h"
11 #include "CAFAna/Cuts/Cuts.h"
12 #include "CAFAna/Cuts/SpillCuts.h"
13 #include "CAFAna/Cuts/TimingCuts.h"
28 #include "CAFAna/Vars/FitVars.h"
32 #include "CAFAna/Vars/Vars.h"
33 
34 #include "OscLib/OscCalcPMNSOpt.h"
35 
36 #include "TCanvas.h"
37 #include "TH1.h"
38 #include "TGraph.h"
39 #include "TMarker.h"
40 #include "TLegend.h"
41 #include "TStyle.h"
42 
43 using namespace ana;
44 
46 {
47 
48 
49  // surface -> SaveTo(fSurf -> mkdir("surface"));
50  // surface_stats -> SaveTo(fSurf -> mkdir("surface_stats_cosmics"));
51  // surface_maxMix -> SaveTo(fSurf -> mkdir("surface_maxMix"));
52  // surface_maxMix_stats -> SaveTo(fSurf -> mkdir("surface_maxMix_stats"));
53 
54 
55  DontAddDirectory guard;
56  TFile* fSurf = new TFile("SensitivityAna2017.root");
57  FrequentistSurface* surface = LoadFrom< FrequentistSurface >(fSurf, "surface").release();
58  FrequentistSurface* surface_stats = LoadFrom< FrequentistSurface >(fSurf, "surface_stats_cosmics").release();
59  FrequentistSurface* surface_maxMix = LoadFrom< FrequentistSurface >(fSurf, "surface_maxMix").release();
60  FrequentistSurface* surface_maxMix_stats = LoadFrom< FrequentistSurface >(fSurf, "surface_maxMix_stats").release();
61  TH1D* hSin = (TH1D*)fSurf->Get("profileSinsq");
62  fSurf -> Close();
63  delete fSurf;
64 
65  std::cout<< "Minimum: " << hSin->GetMinimum()
66  << "Max-mix rejection: "
67  << hSin->Interpolate(0.5) - hSin->GetMinimum()
68  <<std::endl;
69 
70  // Get other results:
71  TFile* fT2K = new TFile(FindCAFAnaDir().c_str() + (TString)"/data/expt/T2KJointNuNuBarOscillation_Run17c_2016/sinsqth23Vsdmsq_Run17c_Data_react_nh.root");
72  TGraph *t2kplot = (TGraph*)fT2K->Get("g90_valor_0");
73  fT2K -> Close();
74  for (int point = 0; point < t2kplot->GetN(); point++){
75  double xval, yval;
76  t2kplot->GetPoint(point,xval,yval);
77  yval = yval * 1000.0; // rescale into units of 10^-3 ev^2 for our plots
78  t2kplot->SetPoint(point,xval,yval);
79  }
80 
81  // get and rescale minos result
82  const std::string minospath = FindCAFAnaDir() +
83  "/data/expt/MINOSPlus_ThreeFlavour_PreliminaryContours_June2014.root";
84  TFile minosfile(minospath.c_str(),"READ");
85  TGraph *minosplot = (TGraph*)minosfile.Get("minosPlus_nu2014_prelim_contour_sinsq23_dmsq32_normal_90CL");
86  minosfile.Close();
87  for (int point = 0; point < minosplot->GetN(); point++) {
88  double xval, yval;
89  minosplot->GetPoint(point,xval,yval);
90  yval = yval * 1000.0; // rescale into units of 10^-3 ev^2 for our plots
91  minosplot->SetPoint(point,xval,yval);
92  }
93 
94  TFile* fNOvASA = new TFile("NOvA_official_numu_2017.root");
95  TGraph* gUO = (TGraph*)fNOvASA->Get("contour_FC90percent_UO_NH");
96  TGraph* gLO = (TGraph*)fNOvASA->Get("contour_FC90percent_LO_NH");
97  TMarker* mUO = (TMarker*)fNOvASA->Get("bestfit_UO_NH");
98  TMarker* mLO = (TMarker*)fNOvASA->Get("bestfit_LO_NH");
99  fNOvASA -> Close();
100 
101 
102  // Plot
103  TCanvas* c = new TCanvas();
104  c->SetLeftMargin(0.12);
105  c->SetBottomMargin(0.15);
106  surface->DrawBestFit(kBlue);
107  surface->DrawContour( Gaussian90Percent2D(*surface), kSolid, kBlue);
108  TH1D* hBlue = new TH1D();
109  hBlue -> SetLineColor(kBlue);
110  gUO -> SetLineColor(kRed);
111  gLO -> SetLineColor(kRed);
112  mUO -> SetMarkerColor(kRed);
113  mLO -> SetMarkerColor(kRed);
114  gUO -> Draw("same");
115  gLO -> Draw("same");
116  mUO -> Draw("same");
117  mLO -> Draw("same");
118  t2kplot -> SetLineColor(kMagenta);
119  t2kplot -> Draw("same");
120  minosplot -> SetLineColor(kGreen);
121  minosplot -> Draw("same");
122  TLegend* lCont = new TLegend(0.38,0.74,0.68,0.88);
123  lCont -> AddEntry(hBlue, "New sensitivity", "l");
124  lCont -> AddEntry(gUO, "NOvA SA Result", "l");
125  lCont -> AddEntry(t2kplot, "T2K 2016", "l");
126  lCont -> AddEntry(minosplot, "MINOS+ 2014", "l");
127  lCont -> SetFillColor(0);
128  lCont -> SetFillStyle(0);
129  lCont -> Draw();
130  c->SaveAs("Sensitivity_compExps.root");
131  c->SaveAs("Sensitivity_compExps.pdf");
132  c->Clear();
133 
134 
135  TCanvas* cStat = new TCanvas();
136  cStat->SetLeftMargin(0.12);
137  cStat->SetBottomMargin(0.15);
138  surface->DrawBestFit(kBlue);
139  surface->DrawContour( Gaussian90Percent2D(*surface), kSolid, kBlue);
140  surface_stats->DrawBestFit(kBlue);
141  surface_stats->DrawContour( Gaussian90Percent2D(*surface_stats), kDashed, kRed);
142  TH1D* hRedDashed = new TH1D();
143  hRedDashed -> SetLineColor(kRed);
144  hRedDashed -> SetLineStyle(kDashed);
145  TLegend* lContStat = new TLegend(0.38,0.74,0.68,0.88);
146  lContStat -> AddEntry(hBlue, "90\% C.L. systs. + cosmics", "l");
147  lContStat -> AddEntry(hRedDashed, "90\% C.L. stats. + cosmics", "l");
148  lContStat -> SetFillColor(0);
149  lContStat -> SetFillStyle(0);
150  lContStat -> Draw();
151  cStat->SaveAs("Sensitivity_compStat.root");
152  cStat->SaveAs("Sensitivity_compStat.pdf");
153  cStat->Clear();
154 
155 
156 
157 
158  TCanvas* cMaxMix = new TCanvas();
159  cMaxMix->SetLeftMargin(0.12);
160  cMaxMix->SetBottomMargin(0.15);
161  surface_maxMix->DrawBestFit(kBlue);
162  surface_maxMix->DrawContour( Gaussian90Percent2D(*surface_maxMix), kSolid, kBlue);
163  gUO -> SetLineColor(kRed);
164  gLO -> SetLineColor(kRed);
165  mUO -> SetMarkerColor(kRed);
166  mLO -> SetMarkerColor(kRed);
167  gUO -> Draw("same");
168  gLO -> Draw("same");
169  mUO -> Draw("same");
170  mLO -> Draw("same");
171  t2kplot -> SetLineColor(kMagenta);
172  t2kplot -> Draw("same");
173  minosplot -> SetLineColor(kGreen);
174  minosplot -> Draw("same");
175  lCont -> Draw();
176  cMaxMix->SaveAs("Sensitivity_maxMix_compExps.root");
177  cMaxMix->SaveAs("Sensitivity_maxMix_compExps.pdf");
178  cMaxMix->Clear();
179 
180 
181  TCanvas* cStatMaxMix = new TCanvas();
182  cStatMaxMix->SetLeftMargin(0.12);
183  cStatMaxMix->SetBottomMargin(0.15);
184  surface_maxMix->DrawBestFit(kBlue);
185  surface_maxMix->DrawContour( Gaussian90Percent2D(*surface_maxMix), kSolid, kBlue);
186  surface_maxMix_stats->DrawBestFit(kBlue);
187  surface_maxMix_stats->DrawContour( Gaussian90Percent2D(*surface_maxMix_stats), kDashed, kRed);
188  lContStat -> Draw();
189  cStatMaxMix->SaveAs("Sensitivity_maxMix_compStat.root");
190  cStatMaxMix->SaveAs("Sensitivity_maxMix_compStat.pdf");
191  cStatMaxMix->Clear();
192 
193 
194 
195 } // End of function
tree Draw("slc.nhit")
bin1_2sigma SetFillColor(3)
enum BeamMode kRed
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
hmean SetLineStyle(2)
std::string FindCAFAnaDir()
Definition: Utilities.cxx:204
ntuple SetFillStyle(1001)
Log-likelihood scan across two parameters.
void DrawBestFit(Color_t color, Int_t marker=kFullCircle) const
Draw the best fit point.
Definition: ISurface.cxx:32
void DrawContour(TH2 *fc, Style_t style, Color_t color, double minchi=-1)
Definition: ISurface.cxx:44
leg AddEntry(GRdata,"data","p")
hmean SetLineColor(4)
h1 SetMarkerColor(4)
c1 Close()
OStream cout
Definition: OStream.cxx:6
void drawSensitivity()
TH2 * Gaussian90Percent2D(const FrequentistSurface &s)
Up-value surface for 90% confidence in 2D in gaussian approximation.
Prevent histograms being added to the current directory.
Definition: UtilsExt.h:46
enum BeamMode kGreen
enum BeamMode kBlue
enum BeamMode string