Functions
make_angle_plot.C File Reference
#include <fstream>
#include <iostream>
#include <vector>
#include <string>

Go to the source code of this file.

Functions

double Distance (double x1, double y1, double x2, double y2)
 
void make_angle_plot ()
 

Function Documentation

double Distance ( double  x1,
double  y1,
double  x2,
double  y2 
)

Definition at line 8 of file make_angle_plot.C.

References ana::Sqrt().

Referenced by novaddt::SlowMMTrigger::filter(), make_angle_plot(), zcl::SPCluster::produce(), and ana::RefineSeeds().

8  {
9  return TMath::Sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
10 }
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
Var Sqrt(const Var &v)
Use to take sqrt of a var.
Definition: Var.cxx:326
void make_angle_plot ( )

Definition at line 12 of file make_angle_plot.C.

References om::cout, dist, Distance(), allTimeWatchdog::endl, MECModelEnuComparisons::i, calib::j, MECModelEnuComparisons::leg, tex, submit_syst::x, x1, x_min, submit_syst::y, and y1.

12  {
13 
14  gROOT->ForceStyle();
15  gStyle->SetFillStyle(0);
16  gStyle->SetPadBottomMargin(0.15);
17  gStyle->SetPadLeftMargin(0.15);
18  gStyle->SetLabelOffset(0.01,"y");
19 
20  // FC new param
21  std::ifstream infile_fc("contour90.csv");
22  double x, y;
23  std::vector<double> x_fc_v, y_fc_v;
24  while (infile_fc >> x >> y) {
25  x_fc_v.push_back(x);
26  y_fc_v.push_back(y);
27  }
28  infile_fc.close();
29 
30  // Non-FC
31  std::ifstream infile_nonfc("contour68.csv");
32  std::vector<double> x_nonfc_v, y_nonfc_v;
33  while (infile_nonfc >> x >> y) {
34  x_nonfc_v.push_back(x);
35  y_nonfc_v.push_back(y);
36  }
37  infile_nonfc.close();
38 
39  // Sorting fc_newparams in closest distance between points
40  double* x_fc_sorted = new double[x_fc_v.size()];
41  double* y_fc_sorted = new double[x_fc_v.size()];
42  //** finding smallest x value:
43  double x_min = 10000;
44  double y_min;
45  unsigned int index_min = 10000;
46  for (unsigned int i = 0; i < x_fc_v.size(); i++) {
47  if (x_fc_v.at(i) < x_min) {
48  x_min = x_fc_v.at(i);
49  y_min = y_fc_v.at(i);
50  index_min = i;
51  }
52  }
53  //** starting to find the closest distance
54  x_fc_sorted[0] = x_min;
55  y_fc_sorted[0] = y_min;
56  x_fc_v[index_min] = 0;
57  y_fc_v[index_min] = 0;
58  for (unsigned int i = 1; i < x_fc_v.size(); i++) {
59  double distance_min = 10000;
60  unsigned int index_dist_min = 10000;
61  for (unsigned int j = 0; j < x_fc_v.size(); j++) {
62  double x0 = x_fc_sorted[i-1];
63  double y0 = y_fc_sorted[i-1];
64  double x1 = x_fc_v[j];
65  double y1 = y_fc_v[j];
66  double dist = Distance(x0, y0, x1, y1);
67  if (dist < distance_min) {
68  distance_min = dist;
69  index_dist_min = j;
70  }
71  }
72  x_fc_sorted[i] = x_fc_v[index_dist_min];
73  y_fc_sorted[i] = y_fc_v[index_dist_min];
74  x_fc_v[index_dist_min] = 0;
75  y_fc_v[index_dist_min] = 0;
76  }
77 
78  // Sorting nonfc in closest distance between points
79  double* x_nonfc_sorted = new double[x_nonfc_v.size()];
80  double* y_nonfc_sorted = new double[x_nonfc_v.size()];
81  //** finding smallest x value:
82  double x_min_nonfc = 10000;
83  double y_min_nonfc;
84  unsigned int index_min_nonfc = 10000;
85  for (unsigned int i = 0; i < x_nonfc_v.size(); i++) {
86  if (x_nonfc_v.at(i) < x_min_nonfc) {
87  x_min_nonfc = x_nonfc_v.at(i);
88  y_min_nonfc = y_nonfc_v.at(i);
89  index_min_nonfc = i;
90  }
91  }
92  //** starting to find the closest distance
93  x_nonfc_sorted[0] = x_min_nonfc;
94  y_nonfc_sorted[0] = y_min_nonfc;
95  x_nonfc_v[index_min_nonfc] = 0;
96  y_nonfc_v[index_min_nonfc] = 0;
97  for (unsigned int i = 1; i < x_nonfc_v.size(); i++) {
98  double distance_min = 10000;
99  unsigned int index_dist_min = 10000;
100  for (unsigned int j = 0; j < x_nonfc_v.size(); j++) {
101  double x0 = x_nonfc_sorted[i-1];
102  double y0 = y_nonfc_sorted[i-1];
103  double x1 = x_nonfc_v[j];
104  double y1 = y_nonfc_v[j];
105  double dist = Distance(x0, y0, x1, y1);
106  if (dist < distance_min) {
107  distance_min = dist;
108  index_dist_min = j;
109  }
110  }
111  x_nonfc_sorted[i] = x_nonfc_v[index_dist_min];
112  y_nonfc_sorted[i] = y_nonfc_v[index_dist_min];
113  x_nonfc_v[index_dist_min] = 0;
114  y_nonfc_v[index_dist_min] = 0;
115  }
116 
117  double max_theta34 = 0;
118  for (unsigned int i = 0; i < x_fc_v.size(); i++) {
119  if (x_fc_sorted[i] > max_theta34) {
120  max_theta34 = x_fc_sorted[i];
121  }
122  }
123  std::cout << "Maximum value of Theta34 = " << max_theta34 << std::endl;
124 
125  double max_theta24 = 0;
126  for (unsigned int i = 0; i < x_fc_v.size(); i++) {
127  if (y_fc_sorted[i] > max_theta24) {
128  max_theta24 = y_fc_sorted[i];
129  }
130  }
131  std::cout << "Maximum value of Theta24 = " << max_theta24 << std::endl;
132 
133  // Graphing
134  TGraph* gr_fc = new TGraph(x_fc_v.size(), x_fc_sorted, y_fc_sorted);
135  TGraph* gr_fc_Clone = (TGraph*)gr_fc->Clone();
136  gr_fc_Clone->SetPoint(gr_fc_Clone->GetN(), 0, 0);
137 
138  TGraph* gr_nonfc = new TGraph(x_nonfc_v.size(), x_nonfc_sorted, y_nonfc_sorted);
139  TGraph* gr_nonfc_Clone = (TGraph*)gr_nonfc->Clone();
140  gr_nonfc_Clone->SetPoint(gr_nonfc_Clone->GetN(), 0, 0);
141 
142  TCanvas* c_fc = new TCanvas();
143  gr_fc->GetXaxis()->SetLimits(0, 40);
144  gr_fc->GetYaxis()->SetRangeUser(0, 40);
145  gr_nonfc->GetXaxis()->SetLimits(0, 40);
146  gr_nonfc->GetYaxis()->SetRangeUser(0, 40);
147  gr_fc->SetLineColor(kAzure+2);
148  Int_t kFillColor90_FC = TColor::GetColorTransparent(kAzure+2, .20);
149  gr_fc_Clone->SetFillColor(kFillColor90_FC);
150  gr_fc->SetLineWidth(3);
151  gr_nonfc->SetLineColor(kAzure+2);
152  Int_t kFillColor90_NonFC = TColor::GetColorTransparent(kAzure+2, .60);
153  gr_nonfc_Clone->SetFillColor(kFillColor90_NonFC);
154  gr_nonfc->SetLineStyle(kDashed);
155  gr_nonfc->SetLineWidth(3);
156 
157  gr_fc->GetYaxis()->CenterTitle();
158  gr_fc->GetXaxis()->CenterTitle();
159  gr_fc->GetXaxis()->SetTitleOffset(0.9);
160  gr_fc->GetYaxis()->SetTitleOffset(0.9);
161  gr_fc->GetXaxis()->SetTitleSize(0.07);
162  gr_fc->GetYaxis()->SetTitleSize(0.07);
163  gr_fc->GetXaxis()->SetLabelSize(0.06);
164  gr_fc->GetYaxis()->SetLabelSize(0.06);
165 
166  gr_fc->SetTitle("");
167  gr_fc->GetXaxis()->SetTitle("#theta_{34} (deg.)");
168  gr_fc->GetYaxis()->SetTitle("#theta_{24} (deg.)");
169 
170  TLegend* leg = new TLegend(0.57, 0.64, 0.77, 0.76);
171  leg->SetBorderSize(0);
172  leg->SetFillColor(kWhite);
173  leg->SetFillStyle(0);
174  leg->SetFillStyle(0);
175  leg->SetTextFont(42);
176  leg->SetTextSize(0.05);
177  leg->AddEntry(gr_fc,"NOvA 90% C.L.","L");
178  leg->AddEntry(gr_nonfc,"NOvA 68% C.L.","L");
179  leg->Draw();
180 
181  gr_fc->Draw("AC");
182  gr_fc_Clone->Draw("f same");
183  gr_nonfc->Draw("l same");
184  gr_nonfc_Clone->Draw("f same");
185  leg->Draw();
186 
187  TLatex *tex = new TLatex();
188  tex->SetNDC();
189  tex->SetTextFont(42);
190  tex->SetTextSize(0.05);
191  tex->SetTextAlign(11);
192  tex->DrawLatex(0.19, 0.83, "NOvA 8.85#times10^{20} POT-equiv.");
193  tex->DrawLatex(0.19, 0.83-1.*0.057, "#Deltam^{2}_{32} = 2.44#times10^{-3} eV^{2}");
194  tex->DrawLatex(0.19, 0.83-2.*0.057, "#theta_{13} = 8.5#circ");
195  tex->DrawLatex(0.19, 0.83-3.*0.057, "sin^{2}#theta_{23} = 0.475");
196  tex->DrawLatex(0.19, 0.83-4.*0.057, "#Deltam^{2}_{41} = 0.5 eV^{2}");
197  c_fc->SaveAs("fc.eps");
198 }
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
double Distance(double x1, double y1, double x2, double y2)
double dist
Definition: runWimpSim.h:113
double x_min
Definition: berger.C:15
const double j
Definition: BetheBloch.cxx:29
OStream cout
Definition: OStream.cxx:6
TLatex * tex
Definition: f2_nu.C:499