1 import ROOT,array,math,sys
3 beam_config =
"reference" 7 ROOT.gStyle.SetPadRightMargin(0.15);
8 ROOT.gStyle.SetPadLeftMargin(0.15);
11 plots = [
"numu_neutrino_ND",
"numubar_neutrino_ND",
"nue_neutrino_ND",
"nuebar_neutrino_ND",
"numu_antineutrino_ND",
"numubar_antineutrino_ND",
"nue_antineutrino_ND",
"nuebar_antineutrino_ND",
"numu_neutrino_FD",
"numubar_neutrino_FD",
"nue_neutrino_FD",
"nuebar_neutrino_FD",
"numu_antineutrino_FD",
"numubar_antineutrino_FD",
"nue_antineutrino_FD",
"nuebar_antineutrino_FD"]
13 start_indices = [0,19,38,45,52,71,90,97,104,123,142,149,156,175,194,201]
18 n_universes = len(universes)
19 avg_hist = universes[0].Clone(universes[0].GetName()+
"_avg")
20 error_hist = universes[0].Clone(universes[0].GetName()+
"_error")
25 for i
in range(n_universes):
26 avg_hist.Add(universes[i])
27 avg_hist.Scale(1/float(n_universes))
30 for j
in range(error_hist.GetNbinsX()+2):
32 for i
in range(n_universes):
33 error += 1/float(n_universes)*ROOT.TMath.Power(universes[i].GetBinContent(j)-avg_hist.GetBinContent(j),2)
34 error_hist.SetBinContent(j,ROOT.TMath.Sqrt(error))
36 error_hist.Divide(avg_hist)
42 n_universes = len(universes)
43 avg_hist = universes[0].Clone(universes[0].GetName()+
"_avg")
45 nbins = universes[0].GetNbinsX()
47 for i
in range(n_universes):
48 avg_hist.Add(universes[i])
49 avg_hist.Scale(1/float(n_universes))
51 covariance = ROOT.TH2D(
"Flux_Covariance",
"Flux_Covariance",nbins,0.5,nbins+0.5,nbins,0.5,nbins+0.5)
53 for j
in range(avg_hist.GetNbinsX()):
54 for k
in range(avg_hist.GetNbinsX()):
56 for i
in range(n_universes):
57 cov += 1/float(n_universes)*(universes[i].GetBinContent(j+1)-avg_hist.GetBinContent(j+1))*(universes[i].GetBinContent(k+1)-avg_hist.GetBinContent(k+1))
59 if(avg_hist.GetBinContent(j+1)*avg_hist.GetBinContent(k+1) != 0):
60 cov = cov / avg_hist.GetBinContent(j+1) / avg_hist.GetBinContent(k+1)
63 covariance.SetBinContent(j+1,k+1,cov)
69 nbins += cv.GetNbinsX()
70 new_cv = ROOT.TH1D(
"Flux_CV",
"Flux_CV",nbins,0.5,nbins+0.5)
72 for universe
in range(len(universes[0])):
73 new_universes.append(ROOT.TH1D(
"Flux_Universe_"+
str(universe)+name,
"Flux_Universe_"+
str(universe)+name,nbins,0.5,nbins+0.5))
75 for cv
in range(len(cvs)):
76 for local_bin_iter
in range(cvs[cv].GetNbinsX()):
78 new_cv.SetBinContent(global_bin_iter,cvs[cv].GetBinContent(local_bin_iter+1))
79 for universe
in range(len(universes[0])):
80 new_universes[universe].SetBinContent(global_bin_iter,universes[cv][universe].GetBinContent(local_bin_iter+1))
81 global_bin_iter = global_bin_iter+1
82 return_array = [new_cv,new_universes]
86 cor_matrix = cov_matrix.Clone()
87 for i
in range(cor_matrix.GetNbinsX()):
88 for j
in range(cor_matrix.GetNbinsX()):
89 if cov_matrix.GetBinContent(i+1,i+1)!=0
and cov_matrix.GetBinContent(j+1,j+1)!=0:
90 cor_matrix.SetBinContent(i+1,j+1,cov_matrix.GetBinContent(i+1,j+1)/ROOT.TMath.Sqrt(cov_matrix.GetBinContent(i+1,i+1))/ROOT.TMath.Sqrt(cov_matrix.GetBinContent(j+1,j+1)))
92 if i==j: cor_matrix.SetBinContent(i+1,j+1,1)
93 else: cor_matrix.SetBinContent(i+1,j+1,0)
94 cor_matrix.SetMinimum(-1.0)
95 cor_matrix.SetMaximum(1.0)
101 if(beam_config==
"reference"):
102 in_files.append(ROOT.TFile(
"laura_histos_24Jan2017/histos_g4lbne_v3r4p3_QGSP_BERT_DUNECDR_Ref80GeV_neutrino_LBNFND_ppfx_500_rebinned.root"))
103 in_files.append(ROOT.TFile(
"amit_histos_10August2016/histos_g4lbne_v3r4p3_QGSP_BERT_DUNECDR_Ref80GeV_antineutrino_LBNFND_ppfx_500_rebinned.root"))
104 in_files.append(ROOT.TFile(
"amit_histos_10August2016/histos_g4lbne_v3r4p3_QGSP_BERT_DUNECDR_Ref80GeV_neutrino_LBNFFD_ppfx_500_rebinned.root"))
105 in_files.append(ROOT.TFile(
"amit_histos_10August2016/histos_g4lbne_v3r4p3_QGSP_BERT_DUNECDR_Ref80GeV_antineutrino_LBNFFD_ppfx_500_rebinned.root"))
108 in_files.append(ROOT.TFile(
"amit_histos_10August2016/histos_g4lbne_v3r4p3_QGSP_BERT_CP_run15_12388_neutrino_LBNFND_500_rebinned.root"))
109 in_files.append(ROOT.TFile(
"amit_histos_10August2016/histos_g4lbne_v3r4p3_QGSP_BERT_CP_run15_12388_antineutrino_LBNFND_500_rebinned.root"))
110 in_files.append(ROOT.TFile(
"amit_histos_10August2016/histos_g4lbne_v3r4p3_QGSP_BERT_CP_run15_12388_neutrino_LBNFFD_500_rebinned.root"))
111 in_files.append(ROOT.TFile(
"amit_histos_10August2016/histos_g4lbne_v3r4p3_QGSP_BERT_CP_run15_12388_antineutrino_LBNFFD_500_rebinned.root"))
115 for in_file
in in_files:
116 cv_histos.append(in_file.Get(
"nom/hcv_numu"))
117 cv_histos.append(in_file.Get(
"nom/hcv_numubar"))
118 cv_histos.append(in_file.Get(
"nom/hcv_nue"))
119 cv_histos.append(in_file.Get(
"nom/hcv_nuebar"))
124 error_types = [
"total",
"others",
"targetpcpi",
"targetpck",
"targetncpi",
"targetpcnu",
"targetmesonInc",
"targetnuA",
"tgtabsorption",
"totabsorption"]
125 error_types2 = [
"total",
"others",
"targetpcpi",
"targetpcK",
"targetncpi",
"targetpcnu",
"targetmesonInc",
"targetnucleonA",
"targetabsorption",
"absorption"]
126 error_titles = [
"Total",
"Other",
"pC#rightarrow#pi",
"pC#rightarrowK",
"nC#rightarrow#pi",
"pc#rightarrowN",
"Meson Inc",
"NucleonA",
"Target Absorption",
"Other Absorption"]
127 for error
in error_types:
128 error_universes.append([])
130 for in_file
in in_files:
131 for error_iter
in range(len(error_types)):
132 error_universes[error_iter].append([])
133 for i
in range(n_universes):
134 error_universes[error_iter][-1].append(in_file.Get(
"numu_"+error_types[error_iter]+
"/h"+error_types2[error_iter]+
"_numu_"+
str(i)))
136 error_universes[error_iter].append([])
137 for i
in range(n_universes):
138 error_universes[error_iter][-1].append(in_file.Get(
"numubar_"+error_types[error_iter]+
"/h"+error_types2[error_iter]+
"_numubar_"+
str(i)))
140 error_universes[error_iter].append([])
141 for i
in range(n_universes):
142 error_universes[error_iter][-1].append(in_file.Get(
"nue_"+error_types[error_iter]+
"/h"+error_types2[error_iter]+
"_nue_"+
str(i)))
144 error_universes[error_iter].append([])
145 for i
in range(n_universes):
146 error_universes[error_iter][-1].append(in_file.Get(
"nuebar_"+error_types[error_iter]+
"/h"+error_types2[error_iter]+
"_nuebar_"+
str(i)))
149 numu_bins = [0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,7 ,8,12,16,20,40,100]
150 flavors = [
"neutrino_near_numu",
"neutrino_near_numubar",
"neutrino_near_nue",
"neutrino_near_nuebar",
"antineutrino_near_numu",
"antineutrino_near_numubar",
"antineutrino_near_nue",
"antineutrino_near_nuebar",
"neutrino_far_numu",
"neutrino_far_numubar",
"neutrino_far_nue",
"neutrino_far_nuebar",
"antineutrino_far_numu",
"antineutrino_far_numubar",
"antineutrino_far_nue",
"antineutrino_far_nuebar"]
157 merged_histograms = []
158 merged_universes = []
159 flux_uncertainties = []
160 for error_iter
in range(len(error_types)):
162 merged_histograms.append(
MergeHistograms(cv_histos,error_universes[error_iter],error_types[error_iter]))
163 merged_universes.append(merged_histograms[error_iter][1])
168 c1 = ROOT.TCanvas(
"c1",
"",1000,800)
170 flux_uncertainties[error_types.index(
"total")].Draw()
171 print "BLAH6",flux_uncertainties[error_types.index(
"total")].GetBinContent(start_indices[plots.index(
"numubar_antineutrino_FD")]+5)
172 c1.Print(
"HP_error_"+beam_config+
".eps")
173 c1.Print(
"HP_error_"+beam_config+
".png")
177 flux_covariance.Reset()
178 for i
in range(1,len(error_types)):
181 flux_covariance.SetMaximum(0.06)
182 flux_covariance.SetMinimum(-0.005)
183 flux_covariance.SetLabelSize(0.001,
"X")
184 flux_covariance.SetLabelSize(0.001,
"Y")
185 flux_covariance.SetTitle(
"Flux Hadron Production Covariance Matrix")
186 flux_covariance.Draw(
"COLZ")
188 latex0 = ROOT.TLatex( 0.5, 0.93,
"Flux Hadron Production Fractional Covariance Matrix" );
189 latex0.SetTextSize(0.04)
190 latex0.SetTextAlign(22)
192 latex0.SetTextFont(42)
196 latex1 = ROOT.TLatex( 0.24, 0.035,
"Near Detector" );
197 latex1.SetTextSize(0.035);
199 latex1.SetTextFont(42);
201 latex2 = latex1.Clone()
202 latex2.SetText(0.61,0.035,
"Far Detector")
204 latex3 = latex1.Clone()
205 latex3.SetText(0.05,0.24,
"Near Detector")
206 latex3.SetTextAngle(90)
208 latex4 = latex1.Clone()
209 latex4.SetText(0.05,0.62,
"Far Detector")
210 latex4.SetTextAngle(90)
213 latex5 = ROOT.TLatex(0.2,0.08,
"#nu Mode")
214 latex5.SetTextSize(0.025);
216 latex5.SetTextFont(42)
218 latex6 = latex5.Clone()
219 latex6.SetText(0.38,0.08,
"#bar{#nu} Mode")
221 latex7 = latex5.Clone()
222 latex7.SetText(0.56,0.08,
"#nu Mode")
224 latex8 = latex5.Clone()
225 latex8.SetText(0.74,0.08,
"#bar{#nu} Mode")
228 latex9 = ROOT.TLatex(0.085,0.21,
"#nu Mode")
229 latex9.SetTextSize(0.025);
231 latex9.SetTextFont(42)
232 latex9.SetTextAngle(90)
234 latex10 = latex9.Clone()
235 latex10.SetText(0.085,0.4,
"#bar{#nu} Mode")
237 latex11 = latex9.Clone()
238 latex11.SetText(0.085,0.59,
"#nu Mode")
240 latex12 = latex9.Clone()
241 latex12.SetText(0.085,0.77,
"#bar{#nu} Mode")
244 latex13 = ROOT.TLatex( 0.175, 0.124,
"#nu_{#mu}" );
245 latex13.SetTextSize(0.02);
247 latex13.SetTextFont(42);
249 latex14 = ROOT.TLatex( 0.245, 0.124,
"#bar{#nu}_{#mu}" );
250 latex14.SetTextSize(0.02);
252 latex14.SetTextFont(42);
254 latex15 = ROOT.TLatex( 0.285, 0.124,
"#nu_{e}" );
255 latex15.SetTextSize(0.02);
257 latex15.SetTextFont(42);
259 latex16 = ROOT.TLatex( 0.31, 0.124,
"#bar{#nu}_{e}" );
260 latex16.SetTextSize(0.02);
262 latex16.SetTextFont(42);
265 latex17 = ROOT.TLatex( 0.35, 0.124,
"#nu_{#mu}" );
266 latex17.SetTextSize(0.02);
268 latex17.SetTextFont(42);
270 latex18 = ROOT.TLatex( 0.415, 0.124,
"#bar{#nu}_{#mu}" );
271 latex18.SetTextSize(0.02);
273 latex18.SetTextFont(42);
275 latex19 = ROOT.TLatex( 0.46, 0.124,
"#nu_{e}" );
276 latex19.SetTextSize(0.02);
278 latex19.SetTextFont(42);
280 latex20 = ROOT.TLatex( 0.485, 0.124,
"#bar{#nu}_{e}" );
281 latex20.SetTextSize(0.02);
283 latex20.SetTextFont(42);
286 latex21 = ROOT.TLatex( 0.53, 0.124,
"#nu_{#mu}" );
287 latex21.SetTextSize(0.02);
289 latex21.SetTextFont(42);
291 latex22 = ROOT.TLatex( 0.595, 0.124,
"#bar{#nu}_{#mu}" );
292 latex22.SetTextSize(0.02);
294 latex22.SetTextFont(42);
296 latex23 = ROOT.TLatex( 0.631, 0.124,
"#nu_{e}" );
297 latex23.SetTextSize(0.02);
299 latex23.SetTextFont(42);
301 latex24 = ROOT.TLatex( 0.654, 0.124,
"#bar{#nu}_{e}" );
302 latex24.SetTextSize(0.02);
304 latex24.SetTextFont(42);
307 latex25 = ROOT.TLatex( 0.70, 0.124,
"#nu_{#mu}" );
308 latex25.SetTextSize(0.02);
310 latex25.SetTextFont(42);
312 latex26 = ROOT.TLatex( 0.77, 0.124,
"#bar{#nu}_{#mu}" );
313 latex26.SetTextSize(0.02);
315 latex26.SetTextFont(42);
317 latex27 = ROOT.TLatex( 0.81, 0.124,
"#nu_{e}" );
318 latex27.SetTextSize(0.02);
320 latex27.SetTextFont(42);
322 latex28 = ROOT.TLatex( 0.835, 0.124,
"#bar{#nu}_{e}" );
323 latex28.SetTextSize(0.02);
325 latex28.SetTextFont(42);
328 latex29 = ROOT.TLatex( 0.11,0.18,
"#nu_{#mu}" );
329 latex29.SetTextAngle(90)
330 latex29.SetTextSize(0.02);
332 latex29.SetTextFont(42);
334 latex30 = ROOT.TLatex( 0.11,0.25,
"#bar{#nu}_{#mu}" );
335 latex30.SetTextAngle(90)
336 latex30.SetTextSize(0.02);
338 latex30.SetTextFont(42);
340 latex31 = ROOT.TLatex( 0.11,0.295,
"#nu_{e}" );
341 latex31.SetTextAngle(90)
342 latex31.SetTextSize(0.02);
344 latex31.SetTextFont(42);
346 latex32 = ROOT.TLatex( 0.11,0.32,
"#bar{#nu}_{e}" );
347 latex32.SetTextAngle(90)
348 latex32.SetTextSize(0.02);
350 latex32.SetTextFont(42);
353 latex33 = ROOT.TLatex( 0.11,0.37,
"#nu_{#mu}" );
354 latex33.SetTextAngle(90)
355 latex33.SetTextSize(0.02);
357 latex33.SetTextFont(42);
359 latex34 = ROOT.TLatex( 0.11,0.435,
"#bar{#nu}_{#mu}" );
360 latex34.SetTextAngle(90)
361 latex34.SetTextSize(0.02);
363 latex34.SetTextFont(42);
365 latex35 = ROOT.TLatex( 0.11,0.48,
"#nu_{e}" );
366 latex35.SetTextAngle(90)
367 latex35.SetTextSize(0.02);
369 latex35.SetTextFont(42);
371 latex36 = ROOT.TLatex( 0.11,0.505,
"#bar{#nu}_{e}" );
372 latex36.SetTextAngle(90)
373 latex36.SetTextSize(0.02);
375 latex36.SetTextFont(42);
378 latex37 = ROOT.TLatex( 0.11,0.56,
"#nu_{#mu}" );
379 latex37.SetTextAngle(90)
380 latex37.SetTextSize(0.02);
382 latex37.SetTextFont(42);
384 latex38 = ROOT.TLatex( 0.11,0.62,
"#bar{#nu}_{#mu}" );
385 latex38.SetTextAngle(90)
386 latex38.SetTextSize(0.02);
388 latex38.SetTextFont(42);
390 latex39 = ROOT.TLatex( 0.11,0.67,
"#nu_{e}" );
391 latex39.SetTextAngle(90)
392 latex39.SetTextSize(0.02);
394 latex39.SetTextFont(42);
396 latex40 = ROOT.TLatex( 0.11,0.70,
"#bar{#nu}_{e}" );
397 latex40.SetTextAngle(90)
398 latex40.SetTextSize(0.02);
400 latex40.SetTextFont(42);
403 latex41 = ROOT.TLatex( 0.11,0.75,
"#nu_{#mu}" );
404 latex41.SetTextAngle(90)
405 latex41.SetTextSize(0.02);
407 latex41.SetTextFont(42);
409 latex42 = ROOT.TLatex( 0.11,0.81,
"#bar{#nu}_{#mu}" );
410 latex42.SetTextAngle(90)
411 latex42.SetTextSize(0.02);
413 latex42.SetTextFont(42);
415 latex43 = ROOT.TLatex( 0.11,0.855,
"#nu_{e}" );
416 latex43.SetTextAngle(90)
417 latex43.SetTextSize(0.02);
419 latex43.SetTextFont(42);
421 latex44 = ROOT.TLatex( 0.11,0.88,
"#bar{#nu}_{e}" );
422 latex44.SetTextAngle(90)
423 latex44.SetTextSize(0.02);
425 latex44.SetTextFont(42);
428 line_1 = ROOT.TLine(19.5,0.5,19.5,208)
429 line_2 = ROOT.TLine(38.5,0.5,38.5,208)
430 line_3 = ROOT.TLine(45.5,0.5,45.5,208)
431 line_4 = ROOT.TLine(52.5,0.5,52.5,208)
432 line_5 = ROOT.TLine(71.5,0.5,71.5,208)
433 line_6 = ROOT.TLine(90.5,0.5,90.5,208)
434 line_7 = ROOT.TLine(97.5,0.5,97.5,208)
435 line_8 = ROOT.TLine(104.5,0.5,104.5,208)
436 line_9 = ROOT.TLine(123.5,0.5,123.5,208)
437 line_10 = ROOT.TLine(142.5,0.5,142.5,208)
438 line_11 = ROOT.TLine(149.5,0.5,149.5,208)
439 line_12 = ROOT.TLine(156.5,0.5,156.5,208)
440 line_13 = ROOT.TLine(175.5,0.5,175.5,208)
441 line_14 = ROOT.TLine(194.5,0.5,194.5,208)
442 line_15 = ROOT.TLine(201.5,0.5,201.5,208)
443 lineb_1 = ROOT.TLine(0.5,19.5,208,19.5)
444 lineb_2 = ROOT.TLine(0.5,38.5,208,38.5)
445 lineb_3 = ROOT.TLine(0.5,45.5,208,45.5)
446 lineb_4 = ROOT.TLine(0.5,52.5,208,52.5)
447 lineb_5 = ROOT.TLine(0.5,71.5,208,71.5)
448 lineb_6 = ROOT.TLine(0.5,90.5,208,90.5)
449 lineb_7 = ROOT.TLine(0.5,97.5,208,97.5)
450 lineb_8 = ROOT.TLine(0.5,104.5,208,104.5)
451 lineb_9 = ROOT.TLine(0.5,123.5,208,123.5)
452 lineb_10 = ROOT.TLine(0.5,142.5,208,142.5)
453 lineb_11 = ROOT.TLine(0.5,149.5,208,149.5)
454 lineb_12 = ROOT.TLine(0.5,156.5,208,156.5)
455 lineb_13 = ROOT.TLine(0.5,175.5,208,175.5)
456 lineb_14 = ROOT.TLine(0.5,194.5,208,194.5)
457 lineb_15 = ROOT.TLine(0.5,201.5,208,201.5)
459 line_8.SetLineWidth(4)
460 lineb_8.SetLineWidth(4)
462 line_4.SetLineWidth(2)
463 lineb_4.SetLineWidth(2)
464 line_12.SetLineWidth(2)
465 lineb_12.SetLineWidth(2)
467 for line
in [line_1,line_2,line_3,line_4,line_5,line_6,line_7,line_8,line_9,line_10,line_11,line_12,line_13,line_14,line_15,lineb_1,lineb_2,lineb_3,lineb_4,lineb_5,lineb_6,lineb_7,lineb_8,lineb_9,lineb_10,lineb_11,lineb_12,lineb_13,lineb_14,lineb_15]:
468 line.SetLineColor(13)
472 c1.Print(
"HP_covariance_"+beam_config+
".eps")
473 c1.Print(
"HP_covariance_"+beam_config+
".png")
476 f_foc = ROOT.TFile(
"focusing_covariance_"+beam_config+
".root")
477 covariance_focusing = f_foc.Get(
"Focusing_Covariance")
479 print "BLAH5",ROOT.TMath.Sqrt(flux_covariance.GetBinContent(start_indices[plots.index(
"numubar_antineutrino_FD")]+5,start_indices[plots.index(
"numubar_antineutrino_FD")]+5))
482 total_covariance = flux_covariance.Clone(
"total_covariance")
483 total_covariance.Add(covariance_focusing)
485 total_covariance.SetMaximum(0.06)
486 total_covariance.SetMinimum(-0.005)
487 total_covariance.SetLabelSize(0.001,
"X")
488 total_covariance.SetLabelSize(0.001,
"Y")
489 total_covariance.SetTitle(
"Fractional Flux Covariance Matrix")
490 total_covariance.Draw(
"COLZ")
492 latex0b = ROOT.TLatex( 0.5, 0.93,
"Fractional Flux Covariance Matrix" );
493 latex0b.SetTextSize(0.04)
494 latex0b.SetTextAlign(22)
496 latex0b.SetTextFont(42)
499 for line
in [line_1,line_2,line_3,line_4,line_5,line_6,line_7,line_8,line_9,line_10,line_11,line_12,line_13,line_14,line_15,lineb_1,lineb_2,lineb_3,lineb_4,lineb_5,lineb_6,lineb_7,lineb_8,lineb_9,lineb_10,lineb_11,lineb_12,lineb_13,lineb_14,lineb_15]:
500 line.SetLineColor(13)
503 for latex
in [latex1,latex2,latex3,latex4,latex5,latex6,latex7,latex8,latex9,latex10,latex11,latex12,latex13,latex14,latex15,latex16,latex17,latex18,latex19,latex20,latex21,latex22,latex23,latex24,latex25,latex26,latex27,latex28,latex29,latex30,latex31,latex32,latex33,latex34,latex35,latex35,latex36,latex37,latex38,latex39,latex40,latex41,latex42,latex43,latex44]:
506 c1.Print(
"Total_covariance_"+beam_config+
".eps")
507 c1.Print(
"Total_covariance_"+beam_config+
".png")
509 f_out = ROOT.TFile(
"total_covariance_DUNE_"+beam_config+
".root",
"RECREATE")
510 total_covariance.Write()
513 total_error = ROOT.TH1D(
"Total Error",
"Total Error",208,0.5,208.5);
515 total_error.SetBinContent(i+1,ROOT.TMath.Sqrt(total_covariance.GetBinContent(i+1,i+1)))
516 total_error.SetLabelSize(0.001,
"X")
517 total_error.SetLabelSize(0.05,
"Y")
518 total_error.GetYaxis().SetTitleOffset(1.3)
519 total_error.GetYaxis().SetTitle(
"Fractional Flux Uncertainty")
521 total_error.SetMaximum(0.4)
522 total_error.SetMinimum(0)
526 linec_1 = ROOT.TLine(19.5,0,19.5,total_error.GetMaximum())
527 linec_2 = ROOT.TLine(38.5,0,38.5,total_error.GetMaximum())
528 linec_3 = ROOT.TLine(45.5,0,45.5,total_error.GetMaximum())
529 linec_4 = ROOT.TLine(52.5,0,52.5,total_error.GetMaximum())
530 linec_5 = ROOT.TLine(71.5,0,71.5,total_error.GetMaximum())
531 linec_6 = ROOT.TLine(90.5,0,90.5,total_error.GetMaximum())
532 linec_7 = ROOT.TLine(97.5,0,97.5,total_error.GetMaximum())
533 linec_8 = ROOT.TLine(104.5,0,104.5,total_error.GetMaximum())
534 linec_9 = ROOT.TLine(123.5,0,123.5,total_error.GetMaximum())
535 linec_10 = ROOT.TLine(142.5,0,142.5,total_error.GetMaximum())
536 linec_11 = ROOT.TLine(149.5,0,149.5,total_error.GetMaximum())
537 linec_12 = ROOT.TLine(156.5,0,156.5,total_error.GetMaximum())
538 linec_13 = ROOT.TLine(175.5,0,175.5,total_error.GetMaximum())
539 linec_14 = ROOT.TLine(194.5,0,194.5,total_error.GetMaximum())
540 linec_15 = ROOT.TLine(201.5,0,201.5,total_error.GetMaximum())
542 for line
in [linec_1,linec_2,linec_3,linec_4,linec_5,linec_6,linec_7,linec_8,linec_9,linec_10,linec_11,linec_12,linec_13,linec_14,linec_15]:
547 for latex
in [latex1,latex2,latex5,latex6,latex7,latex8,latex13,latex14,latex15,latex16,latex17,latex18,latex19,latex20,latex21,latex22,latex23,latex24,latex25,latex26,latex27,latex28]:
550 c1.Print(
"Total_error_"+beam_config+
".eps")
551 c1.Print(
"Total_error_"+beam_config+
".png")
554 const int NRGBs = 3, NCont = 999; 555 gStyle.xSetNumberContours(NCont); 556 Double_t stops[NRGBs] = { 0.00, 0.50, 1.00}; 557 Double_t red[NRGBs] = { 0.00, 1.00, 1.00}; 558 Double_t green[NRGBs] = { 0.00, 1.00, 0.00}; 559 Double_t blue[NRGBs] = { 1.00, 1.00, 0.00}; 560 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont); 564 ROOT.gStyle.SetNumberContours(NCont);
565 stops = [ 0.00, 0.50, 1.00];
566 red = [ 0.00, 1.00, 1.00];
567 green = [ 0.00, 1.00, 0.00];
568 blue = [ 1.00, 1.00, 0.00];
569 ROOT.TColor.CreateGradientColorTable(NRGBs, array.array(
'd',stops), array.array(
'd',red), array.array(
'd',green), array.array(
'd',blue), NCont);
572 correlation.Draw(
"COLZ")
574 for line
in [line_1,line_2,line_3,line_4,line_5,line_6,line_7,line_8,line_9,line_10,line_11,line_12,line_13,line_14,line_15,lineb_1,lineb_2,lineb_3,lineb_4,lineb_5,lineb_6,lineb_7,lineb_8,lineb_9,lineb_10,lineb_11,lineb_12,lineb_13,lineb_14,lineb_15]:
575 line.SetLineColor(13)
577 for latex
in [latex1,latex2,latex3,latex4,latex5,latex6,latex7,latex8,latex9,latex10,latex11,latex12,latex13,latex14,latex15,latex16,latex17,latex18,latex19,latex20,latex21,latex22,latex23,latex24,latex25,latex26,latex27,latex28,latex29,latex30,latex31,latex32,latex33,latex34,latex35,latex36,latex37,latex38,latex39,latex40,latex41,latex42,latex43,latex44]:
580 c1.Print(
"total_correlation_"+beam_config+
".eps")
581 c1.Print(
"total_correlation_"+beam_config+
".png")
586 error_bins = [0,2,4,6,8,10]
587 if plot.startswith(
"numu"):
588 error_bins = [0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,7 ,8,12,20,40]
590 total_uncertainties = [0]*(len(error_bins)-1)
591 for i
in range(1,len(error_types)):
593 temp_hist = ROOT.TH1D(error_types[i],error_types[i],len(error_bins)-1,array.array(
'd',error_bins))
594 for j
in range(len(error_bins)-1):
595 temp_hist.SetBinContent(j+1,
abs(flux_uncertainties[i].GetBinContent(start_indices[plots.index(plot)]+j+1)))
596 total_uncertainties[j] = total_uncertainties[j]+math.pow(flux_uncertainties[i].GetBinContent(start_indices[plots.index(plot)]+j+1),2)
597 error_hists.append(temp_hist)
599 temp_hist = ROOT.TH1D(
"Total",
"Total",len(error_bins)-1,array.array(
'd',error_bins))
600 for j
in range(len(error_bins)-1):
601 temp_hist.SetBinContent(j+1,math.sqrt(total_uncertainties[j]))
602 error_hists.append(temp_hist)
604 error_hists[-1].SetMinimum(0);
605 error_hists[-1].SetMaximum(0.2);
606 error_hists[-1].SetLineWidth(3)
607 error_hists[-1].Draw(
"hist")
608 error_hists[-1].GetXaxis().SetTitle(
"Neutrino Energy (GeV)")
609 error_hists[-1].GetYaxis().SetTitle(
"Fractional Uncertainty")
610 error_hists[-1].GetYaxis().SetTitleOffset(1.3)
611 for i
in range(0,len(error_hists)-1):
612 colors = [2,ROOT.kOrange+3,6,ROOT.kOrange+7,ROOT.kGreen+2,3,ROOT.kAzure+7,ROOT.kBlue-4,7,ROOT.kViolet+1,13,15,17,19]
613 error_hists[i].SetLineColor(colors[i])
614 error_hists[i].SetLineWidth(3)
615 error_hists[i].Draw(
"histsame")
617 leg = ROOT.TLegend(0.25,0.6,0.5,0.88)
618 leg.AddEntry(error_hists[-1],
"Total",
"l")
619 for i
in range(0,len(error_hists)-1):
620 leg.AddEntry(error_hists[i],error_titles[i+1],
"l")
624 c1.Print(
"HP_error_overlay_"+plot+
"_"+beam_config+
".eps")
625 c1.Print(
"HP_error_overlay_"+plot+
"_"+beam_config+
".png")
628 focusing_unc = ROOT.TH1D(
"Focusing",
"Focusing",len(error_bins)-1,array.array(
'd',error_bins))
629 total_unc = ROOT.TH1D(
"Total",
"Total",len(error_bins)-1,array.array(
'd',error_bins))
630 for j
in range(len(error_bins)-1):
631 focusing_unc.SetBinContent(j+1,ROOT.TMath.Sqrt(covariance_focusing.GetBinContent(start_indices[plots.index(plot)]+j+1,start_indices[plots.index(plot)]+j+1)))
632 total_unc.SetBinContent(j+1,ROOT.TMath.Sqrt(total_covariance.GetBinContent(start_indices[plots.index(plot)]+j+1,start_indices[plots.index(plot)]+j+1)))
634 total_unc.SetMinimum(0)
635 total_unc.SetMaximum(0.2)
636 total_unc.SetLineWidth(3)
637 focusing_unc.SetLineWidth(3)
638 total_unc.GetXaxis().SetTitle(
"Neutrino Energy (GeV)")
639 total_unc.GetYaxis().SetTitle(
"Fractional Uncertainty")
640 total_unc.GetYaxis().SetTitleOffset(1.3)
641 total_unc.Draw(
"hist")
642 focusing_unc.SetLineColor(2)
643 error_hists[-1].SetLineColor(4)
644 focusing_unc.Draw(
"histsame")
645 error_hists[-1].Draw(
"histsame")
647 if plot==
"numubar_antineutrino_FD":
648 print "blah3",total_unc.GetBinContent(5),focusing_unc.GetBinContent(5),error_hists[-1].GetBinContent(5)
649 print "BLAH4",ROOT.TMath.Sqrt(total_covariance.GetBinContent(start_indices[plots.index(
"numubar_antineutrino_FD")]+5,start_indices[plots.index(
"numubar_antineutrino_FD")]+5))
650 total_unc.Print(
"ALL")
651 print plots.index(
"numubar_antineutrino_FD"),plots.index(plot)
654 leg2 = ROOT.TLegend(0.25,0.7,0.6,0.88)
655 leg2.AddEntry(total_unc,
"Total",
"l")
656 leg2.AddEntry(error_hists[-1],
"Hadron Production",
"l")
657 leg2.AddEntry(focusing_unc,
"Focusing",
"l")
661 c1.Print(
"error_overlay_"+plot+
"_"+beam_config+
".eps")
662 c1.Print(
"error_overlay_"+plot+
"_"+beam_config+
".png")
def MergeHistograms(cvs, universes, name)
def MakeErrorHistogram(universes, asFrac=True)
def GetCorrelation(cov_matrix)
def MakeCovariance(universes, asFrac=True)