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

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().

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, makeTrainCVSamples::int, calib::j, kBlue, kOrange, kRed, MECModelEnuComparisons::leg, Preliminary(), rootlogon(), tex, submit_syst::x, x1, x_min, submit_syst::y, and y1.

12  {
13 
14  rootlogon();
15 
16  // FC new param
17  std::ifstream infile_fc("fc_newparams");
18  double x, y;
19  std::vector<double> x_fc_v, y_fc_v;
20  while (infile_fc >> x >> y) {
21  x_fc_v.push_back(x);
22  y_fc_v.push_back(y);
23  }
24  infile_fc.close();
25 
26  // FC old param
27  std::ifstream infile_fc_old("fc");
28  std::vector<double> x_oldfc_v, y_oldfc_v;
29  while (infile_fc_old >> x >> y) {
30  x_oldfc_v.push_back(x);
31  y_oldfc_v.push_back(y);
32  }
33  infile_fc_old.close();
34 
35  // Non-FC
36  std::ifstream infile_nonfc("nonfc");
37  std::vector<double> x_nonfc_v, y_nonfc_v;
38  while (infile_nonfc >> x >> y) {
39  x_nonfc_v.push_back(x);
40  y_nonfc_v.push_back(y);
41  }
42  infile_nonfc.close();
43 
44  // Sorting fc_newparams in closest distance between points
45  double* x_fc_sorted = new double[x_fc_v.size()];
46  double* y_fc_sorted = new double[x_fc_v.size()];
47  //** finding smallest x value:
48  double x_min = 10000;
49  double y_min;
50  unsigned int index_min = 10000;
51  for (unsigned int i = 0; i < x_fc_v.size(); i++) {
52  if (x_fc_v.at(i) < x_min) {
53  x_min = x_fc_v.at(i);
54  y_min = y_fc_v.at(i);
55  index_min = i;
56  }
57  }
58  //** starting to find the closest distance
59  x_fc_sorted[0] = x_min;
60  y_fc_sorted[0] = y_min;
61  x_fc_v[index_min] = 0;
62  y_fc_v[index_min] = 0;
63  for (unsigned int i = 1; i < x_fc_v.size(); i++) {
64  double distance_min = 10000;
65  unsigned int index_dist_min = 10000;
66  for (unsigned int j = 0; j < x_fc_v.size(); j++) {
67  double x0 = x_fc_sorted[i-1];
68  double y0 = y_fc_sorted[i-1];
69  double x1 = x_fc_v[j];
70  double y1 = y_fc_v[j];
71  double dist = Distance(x0, y0, x1, y1);
72  if (dist < distance_min) {
73  distance_min = dist;
74  index_dist_min = j;
75  }
76  }
77  x_fc_sorted[i] = x_fc_v[index_dist_min];
78  y_fc_sorted[i] = y_fc_v[index_dist_min];
79  x_fc_v[index_dist_min] = 0;
80  y_fc_v[index_dist_min] = 0;
81  }
82 
83  // Sorting nonfc in closest distance between points
84  double* x_nonfc_sorted = new double[x_nonfc_v.size()];
85  double* y_nonfc_sorted = new double[x_nonfc_v.size()];
86  //** finding smallest x value:
87  double x_min_nonfc = 10000;
88  double y_min_nonfc;
89  unsigned int index_min_nonfc = 10000;
90  for (unsigned int i = 0; i < x_nonfc_v.size(); i++) {
91  if (x_nonfc_v.at(i) < x_min_nonfc) {
92  x_min_nonfc = x_nonfc_v.at(i);
93  y_min_nonfc = y_nonfc_v.at(i);
94  index_min_nonfc = i;
95  }
96  }
97  //** starting to find the closest distance
98  x_nonfc_sorted[0] = x_min_nonfc;
99  y_nonfc_sorted[0] = y_min_nonfc;
100  x_nonfc_v[index_min_nonfc] = 0;
101  y_nonfc_v[index_min_nonfc] = 0;
102  for (unsigned int i = 1; i < x_nonfc_v.size(); i++) {
103  double distance_min = 10000;
104  unsigned int index_dist_min = 10000;
105  for (unsigned int j = 0; j < x_nonfc_v.size(); j++) {
106  double x0 = x_nonfc_sorted[i-1];
107  double y0 = y_nonfc_sorted[i-1];
108  double x1 = x_nonfc_v[j];
109  double y1 = y_nonfc_v[j];
110  double dist = Distance(x0, y0, x1, y1);
111  if (dist < distance_min) {
112  distance_min = dist;
113  index_dist_min = j;
114  }
115  }
116  x_nonfc_sorted[i] = x_nonfc_v[index_dist_min];
117  y_nonfc_sorted[i] = y_nonfc_v[index_dist_min];
118  x_nonfc_v[index_dist_min] = 0;
119  y_nonfc_v[index_dist_min] = 0;
120  }
121 
122  // Sorting oldfc in closest distance between points
123  double* x_oldfc_sorted = new double[x_oldfc_v.size()];
124  double* y_oldfc_sorted = new double[x_oldfc_v.size()];
125  //** finding smallest x value:
126  double x_min_oldfc = 10000;
127  double y_min_oldfc;
128  unsigned int index_min_oldfc = 10000;
129  for (unsigned int i = 0; i < x_oldfc_v.size(); i++) {
130  if (x_oldfc_v.at(i) < x_min_oldfc) {
131  x_min_oldfc = x_oldfc_v.at(i);
132  y_min_oldfc = y_oldfc_v.at(i);
133  index_min_oldfc = i;
134  }
135  }
136  //** starting to find the closest distance
137  x_oldfc_sorted[0] = x_min_oldfc;
138  y_oldfc_sorted[0] = y_min_oldfc;
139  x_oldfc_v[index_min_oldfc] = 0;
140  y_oldfc_v[index_min_oldfc] = 0;
141  for (unsigned int i = 1; i < x_oldfc_v.size(); i++) {
142  double distance_min = 10000;
143  unsigned int index_dist_min = 10000;
144  for (unsigned int j = 0; j < x_oldfc_v.size(); j++) {
145  double x0 = x_oldfc_sorted[i-1];
146  double y0 = y_oldfc_sorted[i-1];
147  double x1 = x_oldfc_v[j];
148  double y1 = y_oldfc_v[j];
149  double dist = Distance(x0, y0, x1, y1);
150  if (dist < distance_min) {
151  distance_min = dist;
152  index_dist_min = j;
153  }
154  }
155  x_oldfc_sorted[i] = x_oldfc_v[index_dist_min];
156  y_oldfc_sorted[i] = y_oldfc_v[index_dist_min];
157  x_oldfc_v[index_dist_min] = 0;
158  y_oldfc_v[index_dist_min] = 0;
159  }
160 
161  // Trimming fc
162  unsigned int trim_factor_fc = 3;
163  double* x_fc_sorted_trimmed = new double[int (x_fc_v.size() / trim_factor_fc)];
164  double* y_fc_sorted_trimmed = new double[int (x_fc_v.size() / trim_factor_fc)];
165  unsigned int trim_index_fc = 0;
166  for (unsigned int i = 0; i < x_fc_v.size(); i++) {
167  if (i % trim_factor_fc == 0) {
168  x_fc_sorted_trimmed[trim_index_fc] = x_fc_sorted[i];
169  y_fc_sorted_trimmed[trim_index_fc] = y_fc_sorted[i];
170  trim_index_fc++;
171  }
172  }
173  std::cout << x_fc_v.size() << std::endl;
174  std::cout << trim_index_fc << std::endl;
175 
176  // Trimming nonfc
177  unsigned int trim_factor_nonfc = 3;
178  double* x_nonfc_sorted_trimmed = new double[int (x_nonfc_v.size() / trim_factor_nonfc)];
179  double* y_nonfc_sorted_trimmed = new double[int (x_nonfc_v.size() / trim_factor_nonfc)];
180  unsigned int trim_index_nonfc = 0;
181  for (unsigned int i = 0; i < x_nonfc_v.size(); i++) {
182  if (i % trim_factor_nonfc == 0) {
183  x_nonfc_sorted_trimmed[trim_index_nonfc] = x_nonfc_sorted[i];
184  y_nonfc_sorted_trimmed[trim_index_nonfc] = y_nonfc_sorted[i];
185  trim_index_nonfc++;
186  }
187  }
188 
189  double max_theta24 = 0;
190  for (unsigned int i = 0; i < trim_index_fc; i++) {
191  if (Utau4_fc_sorted[i] > max_Utau4) {
192  max_Utau4 = Utau4_fc_sorted[i];
193  }
194  }
195  std::cout << "Maximum value of Utau4 = " << max_Utau4 << std::endl;
196 
197  double max_Umu4 = 0;
198  for (unsigned int i = 0; i < x_fc_v.size(); i++) {
199  if (Umu4_fc_sorted[i] > max_Umu4) {
200  max_Umu4 = Umu4_fc_sorted[i];
201  }
202  }
203  std::cout << "Maximum value of Umu4 = " << max_Umu4 << std::endl;
204 
205  // Graphing
206  TGraph* gr_fc = new TGraph(trim_index_fc, x_fc_sorted_trimmed, y_fc_sorted_trimmed);
207  TGraph* gr_nonfc = new TGraph(trim_index_nonfc, x_nonfc_sorted_trimmed, y_nonfc_sorted_trimmed);
208  TGraph* gr_oldfc = new TGraph(x_oldfc_v.size(), x_oldfc_sorted, y_oldfc_sorted);
209  TCanvas* c_fc = new TCanvas();
210  gr_fc->GetXaxis()->SetLimits(0, 40);
211  gr_fc->GetYaxis()->SetRangeUser(0, 40);
212  gr_nonfc->GetXaxis()->SetLimits(0, 40);
213  gr_nonfc->GetYaxis()->SetRangeUser(0, 40);
214  gr_oldfc->GetXaxis()->SetLimits(0, 40);
215  gr_oldfc->GetYaxis()->SetRangeUser(0, 40);
216  gr_fc->SetLineColor(kRed);
217  gr_nonfc->SetLineColor(kBlue);
218  gr_oldfc->SetLineColor(kOrange);
219 
220  gr_fc->SetTitle("");
221  gr_fc->GetXaxis()->SetTitle("#theta_{34} (deg.)");
222  gr_fc->GetXaxis()->CenterTitle();
223  gr_fc->GetYaxis()->SetTitle("#theta_{24} (deg.)");
224  gr_fc->GetYaxis()->CenterTitle();
225  gr_fc->SetLineWidth(2);
226  gr_nonfc->SetLineWidth(2);
227 
228  TLegend* leg = new TLegend(0.55, 0.70, 0.85, 0.85);
229  leg->SetBorderSize(0);
230  leg->SetFillColor(kWhite);
231  leg->SetFillStyle(0);
232  leg->SetFillStyle(0);
233  leg->SetTextFont(42);
234  leg->SetTextSize(0.037);
235  leg->AddEntry(gr_fc,"90% C.L. w/FC", "L");
236  leg->AddEntry(gr_oldfc,"90% C.L. w/FC old", "L");
237  leg->AddEntry(gr_nonfc,"90% C.L.", "L");
238 
239  gr_fc->Draw("AC");
240  gr_nonfc->Draw("same");
241  gr_oldfc->Draw("same");
242  leg->Draw();
243 
244  TLatex *tex = new TLatex();
245  tex->SetNDC();
246  tex->SetTextFont(42);
247  tex->SetTextSize(0.04);
248  tex->SetTextAlign(11);
249  tex->DrawLatex(0.135, 0.80, "NOvA 8.85#times10^{20} POT-equiv.");
250  tex->DrawLatex(0.135, 0.8-1.*0.055, "#Deltam^{2}_{32} = 2.44#times10^{-3} eV^{2}");
251  tex->DrawLatex(0.135, 0.8-2.*0.055, "#theta_{13} = 8.5#circ, sin^{2}#theta_{23} = 0.468");
252  tex->DrawLatex(0.135, 0.8-3.*0.055, "#Deltam^{2}_{41} = 0.5 eV^{2}");
253 
254  Preliminary();
255  c_fc->SaveAs("fc.eps");
256 }
enum BeamMode kOrange
enum BeamMode kRed
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
void rootlogon()
Definition: rootlogon.C:7
const double j
Definition: BetheBloch.cxx:29
void Preliminary()
OStream cout
Definition: OStream.cxx:6
TLatex * tex
Definition: f2_nu.C:499
enum BeamMode kBlue