make_UU_plot.C
Go to the documentation of this file.
1 #include <fstream>
2 #include <iostream>
3 #include <vector>
4 #include <string>
5 
6 double Distance(double x1, double y1, double x2, double y2) {
7  return TMath::Sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
8 }
9 
10 void make_UU_plot() {
11 
12  gROOT->ForceStyle();
13  gStyle->SetFillStyle(0);
14  gStyle->SetPadBottomMargin(0.15);
15  gStyle->SetPadLeftMargin(0.15);
16  gStyle->SetLabelOffset(0.01,"y");
17 
18  // SK
19  TFile* fSK = new TFile("./SKContour_flip.root");
20  TGraph* gSK = (TGraph*)fSK->Get("SK90");
21  TGraph* gSKClone = (TGraph*)gSK->Clone();
22  gSK->SetLineColor(kRed);
23  gSK->SetLineWidth(3);
24  gSK->SetLineStyle(kSolid);
25  gSKClone->SetLineColor(kRed);
26  gSKClone->SetLineWidth(3);
27  gSKClone->SetLineStyle(kSolid);
28  gSK->SetPoint(gSK->GetN(), 0, 0);
29 
30  // IceCube
31  TGraph* gIC = new TGraph("./IceCubeSterileContour_flip.dat","%lg %lg");
32  TGraph* gICClone = (TGraph*)gIC->Clone();
33  gIC->SetLineColor(kGreen+2);
34  gIC->SetLineWidth(3);
35  gIC->SetLineStyle(kSolid);
36  gICClone->SetLineColor(kGreen+2);
37  gICClone->SetLineWidth(3);
38  gICClone->SetLineStyle(kSolid);
39  gIC->SetPoint(gIC->GetN(), 0, 0);
40 
41  // FC
42  std::ifstream infile_fc("contour90.csv");
43  double x, y;
44  std::vector<double> x_fc_v, y_fc_v;
45  while (infile_fc >> x >> y) {
46  x_fc_v.push_back(x);
47  y_fc_v.push_back(y);
48  }
49  infile_fc.close();
50 
51  // Non-FC
52  std::ifstream infile_nonfc("contour68.csv");
53  std::vector<double> x_nonfc_v, y_nonfc_v;
54  while (infile_nonfc >> x >> y) {
55  x_nonfc_v.push_back(x);
56  y_nonfc_v.push_back(y);
57  }
58  infile_nonfc.close();
59 
60  // Calculating UU_fc
61  double* Utau4_fc = new double[x_fc_v.size()];
62  double* Umu4_fc = new double[x_fc_v.size()];
63  for (unsigned int i = 0; i < x_fc_v.size(); i++) {
64  double th24_inPi = (y_fc_v.at(i) / 180) * TMath::Pi();
65  double th34_inPi = (x_fc_v.at(i) / 180) * TMath::Pi();
66  Utau4_fc[i] = TMath::Power(TMath::Cos(th24_inPi),2)*TMath::Power(TMath::Sin(th34_inPi),2);
67  Umu4_fc[i] = TMath::Power(TMath::Sin(th24_inPi),2);
68  }
69 
70  // Calculatin UU_nonfc
71  double* Utau4_nonfc = new double[x_nonfc_v.size()];
72  double* Umu4_nonfc = new double[x_nonfc_v.size()];
73  for (unsigned int i = 0; i < x_nonfc_v.size(); i++) {
74  double th24_inPi = (y_nonfc_v.at(i) / 180) * TMath::Pi();
75  double th34_inPi = (x_nonfc_v.at(i) / 180) * TMath::Pi();
76  Utau4_nonfc[i] = TMath::Power(TMath::Cos(th24_inPi),2)*TMath::Power(TMath::Sin(th34_inPi),2);
77  Umu4_nonfc[i] = TMath::Power(TMath::Sin(th24_inPi),2);
78  }
79 
80  // Sorting UU_fc in closest distance between points
81  double* Utau4_fc_sorted = new double[x_fc_v.size()];
82  double* Umu4_fc_sorted = new double[x_fc_v.size()];
83  //** finding smallest x value:
84  double x_min_fc = 10000;
85  double y_min_fc;
86  unsigned int index_min_fc = 10000;
87  for (unsigned int i = 0; i < x_fc_v.size(); i++) {
88  if (Utau4_fc[i] < x_min_fc) {
89  x_min_fc = Utau4_fc[i];
90  y_min_fc = Umu4_fc[i];
91  index_min_fc = i;
92  }
93  }
94  //** starting to find the closest distance
95  Utau4_fc_sorted[0] = x_min_fc;
96  Umu4_fc_sorted[0] = y_min_fc;
97  Utau4_fc[index_min_fc] = 0;
98  Umu4_fc[index_min_fc] = 0;
99  for (unsigned int i = 1; i < x_fc_v.size(); i++) {
100  double distance_min = 10000;
101  unsigned int index_dist_min = 10000;
102  for (unsigned int j = 0; j < x_fc_v.size(); j++) {
103  double x0 = Utau4_fc_sorted[i-1];
104  double y0 = Umu4_fc_sorted[i-1];
105  double x1 = Utau4_fc[j];
106  double y1 = Umu4_fc[j];
107  double dist = Distance(x0, y0, x1, y1);
108  if (dist < distance_min) {
109  distance_min = dist;
110  index_dist_min = j;
111  }
112  }
113  Utau4_fc_sorted[i] = Utau4_fc[index_dist_min];
114  Umu4_fc_sorted[i] = Umu4_fc[index_dist_min];
115  Utau4_fc[index_dist_min] = 0;
116  Umu4_fc[index_dist_min] = 0;
117  }
118 
119  // Sorting UU_nonfc in closest distance between points
120  double* Utau4_nonfc_sorted = new double[x_nonfc_v.size()];
121  double* Umu4_nonfc_sorted = new double[x_nonfc_v.size()];
122  //** finding smallest x value:
123  double x_min_nonfc = 10000;
124  double y_min_nonfc;
125  unsigned int index_min_nonfc = 10000;
126  for (unsigned int i = 0; i < x_nonfc_v.size(); i++) {
127  if (Utau4_nonfc[i] < x_min_nonfc) {
128  x_min_nonfc = Utau4_nonfc[i];
129  y_min_nonfc = Umu4_nonfc[i];
130  index_min_nonfc = i;
131  }
132  }
133  //** starting to find the closest distance
134  Utau4_nonfc_sorted[0] = x_min_nonfc;
135  Umu4_nonfc_sorted[0] = y_min_nonfc;
136  Utau4_nonfc[index_min_nonfc] = 0;
137  Umu4_nonfc[index_min_nonfc] = 0;
138  for (unsigned int i = 1; i < x_nonfc_v.size(); i++) {
139  double distance_min = 10000;
140  unsigned int index_dist_min = 10000;
141  for (unsigned int j = 0; j < x_nonfc_v.size(); j++) {
142  double x0 = Utau4_nonfc_sorted[i-1];
143  double y0 = Umu4_nonfc_sorted[i-1];
144  double x1 = Utau4_nonfc[j];
145  double y1 = Umu4_nonfc[j];
146  double dist = Distance(x0, y0, x1, y1);
147  if (dist < distance_min) {
148  distance_min = dist;
149  index_dist_min = j;
150  }
151  }
152  Utau4_nonfc_sorted[i] = Utau4_nonfc[index_dist_min];
153  Umu4_nonfc_sorted[i] = Umu4_nonfc[index_dist_min];
154  Utau4_nonfc[index_dist_min] = 0;
155  Umu4_nonfc[index_dist_min] = 0;
156  }
157 
158  double max_Utau4 = 0;
159  for (unsigned int i = 0; i < x_fc_v.size(); i++) {
160  if (Utau4_fc_sorted[i] > max_Utau4) {
161  max_Utau4 = Utau4_fc_sorted[i];
162  }
163  }
164  std::cout << "Maximum value of Utau4 = " << max_Utau4 << std::endl;
165 
166  double max_Umu4 = 0;
167  for (unsigned int i = 0; i < x_fc_v.size(); i++) {
168  if (Umu4_fc_sorted[i] > max_Umu4) {
169  max_Umu4 = Umu4_fc_sorted[i];
170  }
171  }
172  std::cout << "Maximum value of Umu4 = " << max_Umu4 << std::endl;
173 
174 
175  // Graphing
176  TGraph* gr_fc = new TGraph(x_fc_v.size(), Utau4_fc_sorted, Umu4_fc_sorted);
177  TGraph* gr_nonfc = new TGraph(x_nonfc_v.size(), Utau4_nonfc_sorted, Umu4_nonfc_sorted);
178  TCanvas* c_fc = new TCanvas();
179  TGraph* gr_fc_Clone = (TGraph*)gr_fc->Clone();
180  TGraph* gr_nonfc_Clone = (TGraph*)gr_nonfc->Clone();
181 
182  Int_t kFillColor90 = TColor::GetColorTransparent(kAzure+2, .35);
183  Int_t kFillColor68 = TColor::GetColorTransparent(kAzure+2, .60);
184  gr_fc->SetPoint(gr_fc->GetN(),0,0);
185  gr_nonfc_Clone->SetPoint(gr_nonfc_Clone->GetN(),0,0);
186  gr_fc->GetXaxis()->SetLimits(0, 0.4);
187  gr_fc->GetYaxis()->SetRangeUser(0, 0.25);
188  gr_fc->SetFillColor(kFillColor90);
189  gr_fc_Clone->SetLineColor(kAzure+2);
190  gr_nonfc->SetLineColor(kAzure+2);
191  gr_fc->SetLineWidth(3);
192  gr_nonfc->SetLineWidth(3);
193  gr_nonfc->SetLineStyle(kDashed);
194  gr_nonfc_Clone->SetFillColor(kFillColor68);
195 
196  gr_fc->SetTitle("");
197  gr_fc->GetXaxis()->SetRangeUser(0, 0.4);
198  gr_fc->GetYaxis()->SetLimits(0, 0.25);
199  gr_fc->GetXaxis()->SetTitle("|U_{#tau4}|^{2}");
200  gr_fc->GetXaxis()->CenterTitle();
201  gr_fc->GetYaxis()->SetTitle("|U_{#mu4}|^{2}");
202  gr_fc->GetYaxis()->CenterTitle();
203 
204  TLegend* leg = new TLegend(0.47, 0.56, 0.67, 0.74);
205  leg->SetBorderSize(0);
206  leg->SetFillColor(kWhite);
207  leg->SetFillStyle(0);
208  leg->SetFillStyle(0);
209  leg->SetTextFont(42);
210  leg->SetTextSize(0.05);
211  leg->AddEntry(gr_nonfc,"NOvA 68% C.L.","L");
212  leg->AddEntry(gr_fc_Clone,"NOvA 90% C.L.","L");
213  leg->AddEntry(gSKClone, "SK 90% C.L. *","L");
214  leg->AddEntry(gICClone, "IceCube-DC 90% C.L. **","L");
215  leg->Draw();
216 
217  gr_fc->GetXaxis()->SetTitleOffset(0.92);
218  gr_fc->GetYaxis()->SetTitleOffset(0.92);
219  gr_fc->GetXaxis()->SetTitleSize(0.07);
220  gr_fc->GetYaxis()->SetTitleSize(0.07);
221  gr_fc->GetXaxis()->SetLabelSize(0.06);
222  gr_fc->GetYaxis()->SetLabelSize(0.06);
223 
224  gr_fc->Draw("ACF");
225  gr_fc_Clone->SetLineWidth(3);
226  gr_fc_Clone->Draw("l same");
227  gr_nonfc->Draw("l same");
228  gr_nonfc_Clone->Draw("f same");
229  // SK Draw
230  Int_t kFillSK = TColor::GetColorTransparent(kRed-10, .35);
231  gSK->SetFillColor(kFillSK);
232  gSK->Draw("cf same");
233  gSKClone->Draw("l same");
234  leg->Draw();
235  // IceCube Draw
236  Int_t kFillIC = TColor::GetColorTransparent(kGreen-8, .35);
237  gIC->SetFillColor(kFillIC);
238  gIC->Draw("cf same");
239  gICClone->Draw("l same");
240 
241  TLatex *tex = new TLatex();
242  tex->SetNDC();
243  tex->SetTextFont(42);
244  tex->SetTextSize(0.05);
245  tex->SetTextAlign(11);
246  tex->DrawLatex(0.19, 0.83, "NOvA 8.85#times10^{20} POT-equiv.");
247  tex->DrawLatex(0.19, 0.83-1.*0.057, "#Deltam^{2}_{32} = 2.44#times10^{-3} eV^{2}");
248  tex->DrawLatex(0.19, 0.83-2.*0.057, "#theta_{13} = 8.5#circ");
249  tex->DrawLatex(0.19, 0.83-3.*0.057, "sin^{2}#theta_{23} = 0.475");
250  tex->DrawLatex(0.19, 0.83-4.*0.057, "#Deltam^{2}_{41} = 0.5 eV^{2}");
251 
252  TLatex *texSK = new TLatex(0.58,0.49,"PRD 91, 052019 (2015) *");
253  texSK->SetNDC();
254  texSK->SetTextFont(42);
255  texSK->SetTextSize(0.04);
256  texSK->SetLineWidth(2);
257  texSK->Draw();
258 
259  TLatex *texIC = new TLatex(0.58,0.44,"PRD 95, 112002 (2017) **");
260  texIC->SetNDC();
261  texIC->SetTextFont(42);
262  texIC->SetTextSize(0.04);
263  texIC->SetLineWidth(2);
264  texIC->Draw();
265 
266  c_fc->SaveAs("fc_UU_blessing.eps");
267 }
enum BeamMode kRed
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
double dist
Definition: runWimpSim.h:113
double Distance(double x1, double y1, double x2, double y2)
Definition: make_UU_plot.C:6
const double j
Definition: BetheBloch.cxx:29
OStream cout
Definition: OStream.cxx:6
Var Sqrt(const Var &v)
Use to take sqrt of a var.
Definition: Var.cxx:326
TLatex * tex
Definition: f2_nu.C:499
enum BeamMode kGreen
void make_UU_plot()
Definition: make_UU_plot.C:10