NusContoursPlusMINOS.C
Go to the documentation of this file.
1 #include <vector>
2 #include <iostream>
3 #include <iomanip>
4 
5 #include "TString.h"
6 #include "TH1.h"
7 #include "TH2.h"
8 #include "TCanvas.h"
9 #include "TAxis.h"
10 #include "TROOT.h"
11 #include "TStyle.h"
12 #include "TLine.h"
13 #include "TLegend.h"
14 #include "TCollection.h"
15 #include "TGraph.h"
16 #include "TObjArray.h"
17 #include "TObject.h"
18 #include "TVirtualPad.h"
19 #include "TFile.h"
20 #include "TMarker.h"
21 #include "TLatex.h"
22 #include "TMath.h"
23 #include "TColor.h"
24 #include "TFrame.h"
25 
26 #include "Utilities/rootlogon.C"
27 
28 using namespace std;
29 
30 
31 void DrawAxes(TH2* surface)
32 {
33  TString dummyName = surface->GetName();
34  dummyName += "_dummy";
35  TH2* hDummy = (TH2*)surface->Clone(dummyName);
36  hDummy->Reset();
37  hDummy->Draw();
38 
39  return;
40 }
41 
42 TLegend* MakeLegend(double x1, double y1, double x2, double y2, double textsize = 0.03)
43 {
44  TLegend* leg = new TLegend(x1, y1, x2, y2);
45  leg->SetBorderSize(0);
46  leg->SetFillColor(kWhite);
47  leg->SetFillStyle(0);
48  leg->SetFillStyle(0);
49  leg->SetTextFont(42);
50  leg->SetTextSize(textsize);
51  return leg;
52 }
53 
54 
55 vector<TGraph*> GetContour(TH2* surface, double up, int color, int style)
56 {
57  TVirtualPad* bak = gPad;
58 
59  const bool wasbatch = gROOT->IsBatch();
60  gROOT->SetBatch(); // User doesn't want to see our temporary canvas
61 
62  TCanvas tmp;
63  gStyle->SetOptStat(0);
64  gPad->SetFillStyle(0);
65  vector<TGraph*> results;
66 
67  tmp.cd();
68  double minLike = surface->GetBinContent( surface->GetMinimumBin() );
69  double maxLike = surface->GetBinContent( surface->GetMaximumBin() );
70  cout << "TH1 Name = " << surface->GetName() << " : minLike = " << minLike << " maxLike = " << maxLike << " up = " << up << endl;
71  surface->SetContour(1);
72  surface->SetContourLevel(0, minLike + up);
73  surface->Draw("cont list");
74  tmp.Update();
75  tmp.Paint();
76 
77  gROOT->SetBatch(wasbatch);
78  gPad = bak;
79 
80  TObjArray* contArr = (TObjArray*)gROOT->GetListOfSpecials()->FindObject("contours");
81  TList* contList = (TList*)contArr->At(0);
82  TIter next(contList);
83  TGraph* gr(0);
84  while ( gr = (TGraph*)next() )
85  {
86  TGraph* toSave = (TGraph*)gr->Clone();
87  toSave->SetLineWidth(2);
88  toSave->SetLineColor(color);
89  toSave->SetLineStyle(style);
90  toSave->Draw("same");
91  results.push_back( toSave );
92  }
93  return results;
94 }
95 
96 void NusContoursPlusMINOS(bool minos = false)
97 {
98 
99 
100  TLine* line2 = new TLine();
101  line2->SetLineWidth(2);
102  line2->SetLineStyle(kSolid);
103  line2->SetLineColor(kBlack);
104 
105  double start(0), step(0);
106 
107 
108  TFile* fData = new TFile("$NOVA_ANA/steriles/Ana01/nus_ana01_results_final.root");
109  TFile* fMC = new TFile("$NOVA_ANA/steriles/Ana01/AnaResultsMCSensAna.root");
110 
111  // MINOS contour traced by A. Aurisano
112  // TODO: Add source of trace
113  TFile* fMINOS = new TFile("th24th34MINOS2011.root");
114  gROOT->ForceStyle();
115 
116  gStyle->SetLabelOffset(0.01,"y");
117 
118  double th24lo = 0.;
119  double th24hi = 45.;
120 
121  double th34lo2D = 0.;
122  double th34hi2D = 50.;
123 
124  TLatex *tex = new TLatex();
125  tex->SetNDC();
126  tex->SetTextFont(42);
127  tex->SetTextSize(0.04);
128  tex->SetTextAlign(11);
129 
130  TLatex *tex2 = new TLatex();
131  tex2->SetNDC();
132  tex2->SetTextFont(42);
133  tex2->SetTextSize(0.04);
134  tex2->SetTextAlign(11);
135 
136  //---------------------------------------------------------------------------
137  //-------------------------2D Profiles - All together------------------------
138 
139 
140  double up68 = TMath::ChisquareQuantile(0.68, 2);
141  double up90 = TMath::ChisquareQuantile(0.90, 2);
142 
143  TH2D* hDummyTh34Th24 = new TH2D("hDummyTh34Th24", ";#theta_{34} (deg.);#theta_{24} (deg.)", 1, 1.1, 50, 1, 0, 40);
144  hDummyTh34Th24->GetYaxis()->SetTitleOffset(0.85);
145  CenterTitles(hDummyTh34Th24);
146 
147  TCanvas* cContours2D_1yr = new TCanvas("cContours2D_1yr", "cContours2D_1yr");
148  gPad->SetFillStyle(0);
149  DrawAxes(hDummyTh34Th24);
150  TH2D* hTh34Th24_1yr = (TH2D*)fData->Get("h3424syst");
151  hTh34Th24_1yr->SetTitle(";#theta_{34} (degrees);#theta_{24} (degrees)");
152  //hTh34Th24_1yr->GetXaxis()->SetRangeUser(th34lo2D, th34hi2D);
153  //hTh34Th24_1yr->GetYaxis()->SetRangeUser(th24lo, th24hi);
154  hTh34Th24_1yr->GetYaxis()->SetTitleOffset(0.85);
155  hTh34Th24_1yr->SetLineColor(kBlack);
156 
157  vector<TGraph*> vecTh34Th24_90_1yr = GetContour(hTh34Th24_1yr, up90, kBlack, kSolid);
158 
159  TH2D* hMCTh34Th24_1yr = (TH2D*)fMC->Get("hTh34Th24Prof");
160  hTh34Th24_1yr->SetLineColor(kAzure+2);
161  vector<TGraph*> vecMCTh34Th24_90_1yr = GetContour(hMCTh34Th24_1yr, up90, kAzure+2, kSolid);
162 
163  TGraph* hMINOS = (TGraph*)fMINOS->Get("minosTh24vTh34Contour");
164  hMINOS->SetLineColor(kRed);
165  hMINOS->SetLineStyle(kDashed);
166  if(minos) hMINOS->Draw("l same");
167  Preliminary();
168  tex2->DrawLatex(0.135, 0.50, "NOvA 6.05#times10^{20} POT-equiv.");
169  tex2->DrawLatex(0.135, 0.5-1.*0.055, "#Deltam^{2}_{32} = 2.44#times10^{-3} eV^{2}");
170  tex2->DrawLatex(0.135, 0.5-2.*0.055, "#theta_{13} = 8.5#circ, #theta_{23} = 45#circ");
171  tex2->DrawLatex(0.135, 0.5-3.*0.055, "#Deltam^{2}_{41} = 0.5 eV^{2}");
172 
173  TLegend* leg2D_1yr = new TLegend(0.6, 0.65, 0.85, 0.85);
174  leg2D_1yr->SetBorderSize(0);
175  leg2D_1yr->SetFillColor(kWhite);
176  leg2D_1yr->SetFillStyle(0);
177  leg2D_1yr->SetFillStyle(0);
178  leg2D_1yr->SetTextFont(42);
179  leg2D_1yr->SetTextSize(0.037);
180  leg2D_1yr->AddEntry(vecTh34Th24_90_1yr[0],"90% C.L. Data","L");
181  leg2D_1yr->AddEntry(vecMCTh34Th24_90_1yr[0],"90% C.L. Sensitivity","L");
182  TH1* dummy = new TH1F("","",1,0,1);
183  dummy->SetLineColor(kRed);
184  dummy->SetLineStyle(kDashed);
185  dummy->SetLineWidth(2);
186  if(minos) leg2D_1yr->AddEntry(dummy->Clone(),"MINOS* (#theta_{13} = 11.5#circ)","L");
187 
188  leg2D_1yr->Draw();
189 
190  if(minos){
191  tex = new TLatex(0.15,0.15,"* PRL 107, 011802 (2011)");
192  tex->SetNDC();
193  tex->SetTextFont(42);
194  tex->SetTextSize(0.037);
195  tex->SetLineWidth(2);
196  tex->Draw();
197  }
198 
199 
200 }
void DrawAxes(TH2 *surface)
enum BeamMode kRed
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
Float_t tmp
Definition: plot.C:36
TLegend * MakeLegend(double x1, double y1, double x2, double y2, double textsize=0.03)
void CenterTitles(TH1 *h)
void Preliminary()
vector< TGraph * > GetContour(TH2 *surface, double up, int color, int style)
OStream cout
Definition: OStream.cxx:6
TLatex * tex
Definition: f2_nu.C:499
void NusContoursPlusMINOS(bool minos=false)
void next()
Definition: show_event.C:84