1 import sys,ROOT,math,array
3 ROOT.gStyle.SetOptStat(0)
11 cor_matrix = cov_matrix.Clone(
"Focusing_Correlation")
12 for i
in range(cor_matrix.GetNbinsX()):
13 for j
in range(cor_matrix.GetNbinsX()):
14 if cov_matrix.GetBinContent(i+1,i+1)!=0
and cov_matrix.GetBinContent(j+1,j+1)!=0:
15 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)))
17 if i==j: cor_matrix.SetBinContent(i+1,j+1,1)
18 else: cor_matrix.SetBinContent(i+1,j+1,0)
19 cor_matrix.SetMinimum(-1.0)
20 cor_matrix.SetMaximum(1.0)
30 if beam_config ==
"opt":
32 uncertainties = [
"HornCurrent",
"WaterThickness",
"DecayPipeRadius",
"Horn1XShift",
"Horn1XTilt"]
34 uncertainty_titles = [
"Horn Current",
"Water Layer",
"Decay Pipe Radius",
"Horn 1 Trans. Offset",
"Horn 1 Tilt"]
36 indir =
"/dune/app/users/pmadigan/beam_sim/ToleranceStudy/" 39 files = [
"table_ND_numu.csv",
"table_ND_numubar.csv",
"table_ND_nue.csv",
"table_ND_nuebar.csv",
"table_ND_numubar.csv",
"table_ND_numu.csv",
"table_ND_nuebar.csv",
"table_ND_nue.csv",
"table_FD_numu.csv",
"table_FD_numubar.csv",
"table_FD_nue.csv",
"table_FD_nuebar.csv",
"table_FD_numubar.csv",
"table_FD_numu.csv",
"table_FD_nuebar.csv",
"table_FD_nue.csv"]
41 for uncertainty
in uncertainties:
46 lines = f_temp.readlines()
48 for i
in range(len(lines)):
49 if lines[i].
split(
",")[0]==
"Nominal value":
51 for i
in range(len(temp)):
52 temp[i] = float(temp[i])
55 for unc_iter
in range(len(uncertainties)):
57 for i
in range(len(lines)):
58 if lines[i].
split(
",")[0]==uncertainties[unc_iter]:
61 print "ERROR: Could not find uncertainty",uncertainties[unc_iter],
"in file",afile
63 temp = lines[line_iter].
split(
",")[7:]
64 for i
in range(len(temp)):
65 temp[i] = float(temp[i].strip())
75 if uncertainties[unc_iter] ==
"DecayPipeRadius": scale = 0.4
85 for i
in range(nbins):
91 temp_2.append(scale*temp[i]/100)
93 new_shift = (temp[12]/100*cv[12]+temp[13]/100*cv[13])/(cv[12]+cv[13])
95 temp_2.append(scale*new_shift)
97 new_shift = (temp[14]/100*cv[15]+temp[14]/100*cv[15])/(cv[14]+cv[15])
98 temp_2.append(scale*new_shift)
100 new_shift = (temp[16]/100*cv[16]+temp[17]/100*cv[17]+temp[18]/100*cv[18]+temp[19]/100*cv[19])/(cv[16]+cv[17]+cv[18]+cv[19])
101 temp_2.append(scale*new_shift)
106 new_shift = (temp[2*i]/100*cv[2*i]+temp[2*i+1]/100*cv[4*i+1])/(cv[2*i+0]+cv[2*i+1])
107 temp_2.append(scale*new_shift)
111 shifts[unc_iter] = shifts[unc_iter]+temp_2
114 temp_uncertainties = [
"Target",
"BeamSigma",
"BeamOffsetX",
"TargetDensity"]
115 uncertainties = uncertainties + temp_uncertainties
116 uncertainty_titles += [
"Target Long. Offset",
"Beam Size",
"Beam Position",
"Target Density"]
117 sigmas = [
"0p5mm",
"1p7mm",
"0p5mm",
"1p8156gcm3"]
119 indir =
"/dune/data/users/ljf26/fluxfiles/g4lbne/v3r4p3/QGSP_BERT/" 121 for uncertainty
in temp_uncertainties:
122 unc_iter2 = temp_uncertainties.index(uncertainty)
124 detectors = [
"ND",
"FD"]
125 modes = [
"neutrino",
"antineutrino"]
126 flavors = [
"numu",
"numubar",
"nue",
"nuebar"]
127 for detector
in detectors:
129 for flavor
in flavors:
131 varied_file = ROOT.TFile(
"/dune/data/users/ljf26/fluxfiles/g4lbne/v3r4p3/QGSP_BERT/CP_run15_12388_80GeV_"+uncertainty+sigmas[unc_iter2]+
"/"+mode+
"/flux/histos_g4lbne_v3r4p3_QGSP_BERT_CP_run15_12388_80GeV_"+uncertainty+sigmas[unc_iter2]+
"_"+mode+
"_LBNE"+detector+
"_fastmc.root")
132 varied_histo = varied_file.Get(flavor+
"_flux")
133 varied_histo.SetDirectory(0);
136 nominal_file = ROOT.TFile(
"/dune/data/users/ljf26/fluxfiles/g4lbne/v3r4p2/QGSP_BERT/CP_run15_12388_80GeV/"+mode+
"/flux/histos_g4lbne_v3r4p2_QGSP_BERT_CP_run15_12388_80GeV_"+mode+
"_LBNE"+detector+
"_fastmc.root")
137 nominal_histo = nominal_file.Get(flavor+
"_flux")
138 nominal_histo.SetDirectory(0);
141 varied_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]
142 if flavor
in [
"nue",
"nuebar"]:
144 varied_bins = [0,2,4,6,8,10,20,100]
145 varied_histo = varied_histo.Rebin(len(varied_bins)-1,uncertainty+flavor,array.array(
'd',varied_bins))
146 nominal_histo = nominal_histo.Rebin(len(varied_bins)-1,uncertainty+flavor,array.array(
'd',varied_bins))
148 varied_histo.Add(nominal_histo,-1.0)
149 varied_histo.Divide(nominal_histo)
151 if(uncertainty==
"TargetDensity" or (mode==
"neutrino" and "bar" not in flavor)
or (mode==
"antineutrino" and "bar" in flavor)):
152 for bin_iter
in range(0,varied_histo.GetNbinsX()):
153 shifts[unc_iter+1+unc_iter2].append(varied_histo.GetBinContent(bin_iter+1))
157 for bin_iter
in range(0,varied_histo.GetNbinsX()):
158 shifts[unc_iter+1+unc_iter2].append(0)
162 uncertainties.append(
"POT Counting")
163 uncertainty_titles.append(
"POT Counting")
165 shifts[unc_iter+1+len(temp_uncertainties)].append(0.02)
169 uncertainties.append(
"Baffle Scraping")
170 uncertainty_titles.append(
"Baffle Scraping")
171 detectors = [
"ND",
"FD"]
172 modes = [
"neutrino",
"antineutrino"]
173 flavors = [
"numu",
"numubar",
"nue",
"nuebar"]
175 for detector
in detectors:
177 for flavor
in flavors:
179 baffle_scraping_file = ROOT.TFile(
"/dune/data/users/ljf26/fluxfiles/g4lbne/v3r4p3/QGSP_BERT/CP_run15_12388_80GeV_BaffleScraping/"+mode+
"/flux/histos_g4lbne_v3r4p3_QGSP_BERT_CP_run15_12388_80GeV_BaffleScraping_"+mode+
"_LBNE"+detector+
"_fastmc.root")
180 baffle_scraping_histo = baffle_scraping_file.Get(flavor+
"_flux")
181 baffle_scraping_histo.SetDirectory(0);
182 baffle_scraping_file.Close()
184 nominal_file = ROOT.TFile(
"/dune/data/users/ljf26/fluxfiles/g4lbne/v3r4p2/QGSP_BERT/CP_run15_12388_80GeV/"+mode+
"/flux/histos_g4lbne_v3r4p2_QGSP_BERT_CP_run15_12388_80GeV_"+mode+
"_LBNE"+detector+
"_fastmc.root")
185 nominal_histo = nominal_file.Get(flavor+
"_flux")
186 nominal_histo.SetDirectory(0);
189 baffle_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]
190 if flavor
in [
"nue",
"nuebar"]:
192 baffle_bins = [0,2,4,6,8,10,20,100]
193 baffle_scraping_histo = baffle_scraping_histo.Rebin(len(baffle_bins)-1,
"baffle_scraping_histo",array.array(
'd',baffle_bins))
194 nominal_histo = nominal_histo.Rebin(len(baffle_bins)-1,
"nominal_histo",array.array(
'd',baffle_bins))
196 baffle_scraping_histo.Scale(0.0025)
197 for bin_iter
in range(0,baffle_scraping_histo.GetNbinsX()):
198 if nominal_histo.GetBinContent(bin_iter+1):
199 shifts[unc_iter+2+len(temp_uncertainties)].append(baffle_scraping_histo.GetBinContent(bin_iter+1)/nominal_histo.GetBinContent(bin_iter+1))
201 shifts[unc_iter+2+len(temp_uncertainties)].append(0)
206 if beam_config ==
"reference":
208 uncertainties = [
"HornCurrent",
"WaterLayer",
"DecayPipeRadius",
"Horn1X",
"Horn1XTilt",
"Target",
"BeamSigma",
"BeamOffsetX",
"TargetDensity"]
209 uncertainty_titles = [
"Horn Current",
"Water Layer",
"Decay Pipe Radius",
"Horn 1 Trans. Offset",
"Horn 1 Tilt",
"Target Long. Offset",
"Beam Size",
"Beam Position",
"Target Density"]
211 sigmas = [
"228",
"0p5mm",
"1p9m",
"0p5mm",
"0p5mm",
"45p5cm",
"1p8mm",
"0p5mm",
"1p8156gcm3"]
213 indir =
"/dune/data/users/ljf26/fluxfiles/g4lbne/v3r4p3/QGSP_BERT/" 215 for uncertainty
in uncertainties:
216 unc_iter = uncertainties.index(uncertainty)
218 detectors = [
"ND",
"FD"]
219 modes = [
"neutrino",
"antineutrino"]
220 flavors = [
"numu",
"numubar",
"nue",
"nuebar"]
221 for detector
in detectors:
223 for flavor
in flavors:
225 varied_file = ROOT.TFile(
"/dune/data/users/ljf26/fluxfiles/g4lbne/v3r4p3/QGSP_BERT/Nominal_80GeV_"+uncertainty+sigmas[unc_iter]+
"/"+mode+
"/flux/histos_g4lbne_v3r4p3_QGSP_BERT_Nominal_80GeV_"+uncertainty+sigmas[unc_iter]+
"_"+mode+
"_LBNE"+detector+
"_fastmc.root")
226 varied_histo = varied_file.Get(flavor+
"_flux")
227 varied_histo.SetDirectory(0);
230 nominal_file = ROOT.TFile(
"/dune/data/users/ljf26/fluxfiles/g4lbne/v3r4p3/QGSP_BERT/Nominal_80GeV_AlignmentStudy/"+mode+
"/flux/histos_g4lbne_v3r4p3_QGSP_BERT_Nominal_80GeV_AlignmentStudy_"+mode+
"_LBNE"+detector+
"_fastmc.root")
231 nominal_histo = nominal_file.Get(flavor+
"_flux")
232 nominal_histo.SetDirectory(0);
235 varied_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]
236 if flavor
in [
"nue",
"nuebar"]:
238 varied_bins = [0,2,4,6,8,10,20,100]
239 varied_histo = varied_histo.Rebin(len(varied_bins)-1,uncertainty+flavor,array.array(
'd',varied_bins))
240 nominal_histo = nominal_histo.Rebin(len(varied_bins)-1,uncertainty+flavor,array.array(
'd',varied_bins))
242 varied_histo.Add(nominal_histo,-1.0)
243 varied_histo.Divide(nominal_histo)
246 if(uncertainty==
"DecayPipeRadius"): scale = 0.4
247 if((mode==
"neutrino" and "bar" not in flavor)
or (mode==
"antineutrino" and "bar" in flavor)):
248 for bin_iter
in range(0,varied_histo.GetNbinsX()):
249 shifts[unc_iter].append(scale*varied_histo.GetBinContent(bin_iter+1))
253 for bin_iter
in range(0,varied_histo.GetNbinsX()):
254 shifts[unc_iter].append(0)
259 uncertainties.append(
"POT Counting")
260 uncertainty_titles.append(
"POT Counting")
262 shifts[unc_iter+1].append(0.02)
267 uncertainties.append(
"Baffle Scraping")
268 uncertainty_titles.append(
"Baffle Scraping")
269 detectors = [
"ND",
"FD"]
270 modes = [
"neutrino",
"antineutrino"]
271 flavors = [
"numu",
"numubar",
"nue",
"nuebar"]
272 for detector
in detectors:
274 for flavor
in flavors:
276 baffle_scraping_file = ROOT.TFile(
"/dune/data/users/ljf26/fluxfiles/g4lbne/v3r4p3/QGSP_BERT/Nominal_80GeV_BaffleScraping/"+mode+
"/flux/histos_g4lbne_v3r4p3_QGSP_BERT_Nominal_80GeV_BaffleScraping_"+mode+
"_LBNE"+detector+
"_fastmc.root")
277 baffle_scraping_histo = baffle_scraping_file.Get(flavor+
"_flux")
278 baffle_scraping_histo.SetDirectory(0);
279 baffle_scraping_file.Close()
281 nominal_file = ROOT.TFile(
"/dune/data/users/ljf26/fluxfiles/g4lbne/v3r4p3/QGSP_BERT/Nominal_80GeV_AlignmentStudy/"+mode+
"/flux/histos_g4lbne_v3r4p3_QGSP_BERT_Nominal_80GeV_AlignmentStudy_"+mode+
"_LBNE"+detector+
"_fastmc.root")
282 nominal_histo = nominal_file.Get(flavor+
"_flux")
283 nominal_histo.SetDirectory(0);
286 baffle_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]
287 if flavor
in [
"nue",
"nuebar"]:
289 baffle_bins = [0,2,4,6,8,10,20,100]
290 baffle_scraping_histo = baffle_scraping_histo.Rebin(len(baffle_bins)-1,
"baffle_scraping_histo",array.array(
'd',baffle_bins))
291 nominal_histo = nominal_histo.Rebin(len(baffle_bins)-1,
"nominal_histo",array.array(
'd',baffle_bins))
293 baffle_scraping_histo.Scale(0.0025)
295 for bin_iter
in range(0,baffle_scraping_histo.GetNbinsX()):
296 if nominal_histo.GetBinContent(bin_iter+1):
297 shifts[unc_iter+2].append(baffle_scraping_histo.GetBinContent(bin_iter+1)/nominal_histo.GetBinContent(bin_iter+1))
299 shifts[unc_iter+2].append(0)
302 if small_bins: nbins = 304
303 error = ROOT.TH1D(
"Focusing_Error",
"Focusing_Error",nbins,0.5,nbins+0.5)
304 covariance = ROOT.TH2D(
"Focusing_Covariance",
"Focusing_Covariance",nbins,0.5,nbins+0.5,nbins,0.5,nbins+0.5)
305 for i
in range(nbins):
306 for j
in range(nbins):
307 for k
in range(len(uncertainties)):
308 covariance.SetBinContent(i+1,j+1,covariance.GetBinContent(i+1,j+1)+shifts[k][i]*shifts[k][j])
310 for i
in range(nbins):
311 error.SetBinContent(i+1,ROOT.TMath.Sqrt(covariance.GetBinContent(i+1,i+1)))
313 c1 = ROOT.TCanvas(
"c1",
"",1000,800)
315 c1.Print(
"focusing_error_"+beam_config+
".eps")
316 c1.Print(
"focusing_error_"+beam_config+
".png")
318 ROOT.gStyle.SetPadRightMargin(0.15);
319 ROOT.gStyle.SetPadLeftMargin(0.15);
320 c1 = ROOT.TCanvas(
"c1",
"",1000,800)
321 covariance.SetMaximum(0.005)
322 covariance.SetMinimum(-.00030)
325 covariance.SetLabelSize(0.001,
"X")
326 covariance.SetLabelSize(0.001,
"Y")
327 covariance.Draw(
"COLZ")
329 latex0 = ROOT.TLatex( 0.5, 0.93,
"Flux Alignment Fractional Covariance Matrix" );
330 latex0.SetTextSize(0.04)
331 latex0.SetTextAlign(22)
333 latex0.SetTextFont(42)
337 latex1 = ROOT.TLatex( 0.24, 0.035,
"Near Detector" );
338 latex1.SetTextSize(0.035);
340 latex1.SetTextFont(42);
342 latex2 = latex1.Clone()
343 latex2.SetText(0.61,0.035,
"Far Detector")
345 latex3 = latex1.Clone()
346 latex3.SetText(0.05,0.24,
"Near Detector")
347 latex3.SetTextAngle(90)
349 latex4 = latex1.Clone()
350 latex4.SetText(0.05,0.62,
"Far Detector")
351 latex4.SetTextAngle(90)
354 latex5 = ROOT.TLatex(0.2,0.08,
"#nu Mode")
355 latex5.SetTextSize(0.025);
357 latex5.SetTextFont(42)
359 latex6 = latex5.Clone()
360 latex6.SetText(0.38,0.08,
"#bar{#nu} Mode")
362 latex7 = latex5.Clone()
363 latex7.SetText(0.56,0.08,
"#nu Mode")
365 latex8 = latex5.Clone()
366 latex8.SetText(0.74,0.08,
"#bar{#nu} Mode")
369 latex9 = ROOT.TLatex(0.085,0.21,
"#nu Mode")
370 latex9.SetTextSize(0.025);
372 latex9.SetTextFont(42)
373 latex9.SetTextAngle(90)
375 latex10 = latex9.Clone()
376 latex10.SetText(0.085,0.4,
"#bar{#nu} Mode")
378 latex11 = latex9.Clone()
379 latex11.SetText(0.085,0.59,
"#nu Mode")
381 latex12 = latex9.Clone()
382 latex12.SetText(0.085,0.77,
"#bar{#nu} Mode")
385 latex13 = ROOT.TLatex( 0.16, 0.124,
"#nu_{#mu}" );
386 latex13.SetTextSize(0.02);
388 latex13.SetTextFont(42);
390 latex14 = ROOT.TLatex( 0.225, 0.124,
"#bar{#nu}_{#mu}" );
391 latex14.SetTextSize(0.02);
393 latex14.SetTextFont(42);
395 latex15 = ROOT.TLatex( 0.27, 0.124,
"#nu_{e}" );
396 latex15.SetTextSize(0.02);
398 latex15.SetTextFont(42);
400 latex16 = ROOT.TLatex( 0.295, 0.124,
"#bar{#nu}_{e}" );
401 latex16.SetTextSize(0.02);
403 latex16.SetTextFont(42);
406 latex17 = ROOT.TLatex( 0.34, 0.124,
"#nu_{#mu}" );
407 latex17.SetTextSize(0.02);
409 latex17.SetTextFont(42);
411 latex18 = ROOT.TLatex( 0.405, 0.124,
"#bar{#nu}_{#mu}" );
412 latex18.SetTextSize(0.02);
414 latex18.SetTextFont(42);
416 latex19 = ROOT.TLatex( 0.45, 0.124,
"#nu_{e}" );
417 latex19.SetTextSize(0.02);
419 latex19.SetTextFont(42);
421 latex20 = ROOT.TLatex( 0.475, 0.124,
"#bar{#nu}_{e}" );
422 latex20.SetTextSize(0.02);
424 latex20.SetTextFont(42);
427 latex21 = ROOT.TLatex( 0.52, 0.124,
"#nu_{#mu}" );
428 latex21.SetTextSize(0.02);
430 latex21.SetTextFont(42);
432 latex22 = ROOT.TLatex( 0.585, 0.124,
"#bar{#nu}_{#mu}" );
433 latex22.SetTextSize(0.02);
435 latex22.SetTextFont(42);
437 latex23 = ROOT.TLatex( 0.631, 0.124,
"#nu_{e}" );
438 latex23.SetTextSize(0.02);
440 latex23.SetTextFont(42);
442 latex24 = ROOT.TLatex( 0.654, 0.124,
"#bar{#nu}_{e}" );
443 latex24.SetTextSize(0.02);
445 latex24.SetTextFont(42);
448 latex25 = ROOT.TLatex( 0.70, 0.124,
"#nu_{#mu}" );
449 latex25.SetTextSize(0.02);
451 latex25.SetTextFont(42);
453 latex26 = ROOT.TLatex( 0.77, 0.124,
"#bar{#nu}_{#mu}" );
454 latex26.SetTextSize(0.02);
456 latex26.SetTextFont(42);
458 latex27 = ROOT.TLatex( 0.81, 0.124,
"#nu_{e}" );
459 latex27.SetTextSize(0.02);
461 latex27.SetTextFont(42);
463 latex28 = ROOT.TLatex( 0.835, 0.124,
"#bar{#nu}_{e}" );
464 latex28.SetTextSize(0.02);
466 latex28.SetTextFont(42);
469 latex29 = ROOT.TLatex( 0.11,0.18,
"#nu_{#mu}" );
470 latex29.SetTextAngle(90)
471 latex29.SetTextSize(0.02);
473 latex29.SetTextFont(42);
475 latex30 = ROOT.TLatex( 0.11,0.25,
"#bar{#nu}_{#mu}" );
476 latex30.SetTextAngle(90)
477 latex30.SetTextSize(0.02);
479 latex30.SetTextFont(42);
481 latex31 = ROOT.TLatex( 0.11,0.295,
"#nu_{e}" );
482 latex31.SetTextAngle(90)
483 latex31.SetTextSize(0.02);
485 latex31.SetTextFont(42);
487 latex32 = ROOT.TLatex( 0.11,0.32,
"#bar{#nu}_{e}" );
488 latex32.SetTextAngle(90)
489 latex32.SetTextSize(0.02);
491 latex32.SetTextFont(42);
494 latex33 = ROOT.TLatex( 0.11,0.37,
"#nu_{#mu}" );
495 latex33.SetTextAngle(90)
496 latex33.SetTextSize(0.02);
498 latex33.SetTextFont(42);
500 latex34 = ROOT.TLatex( 0.11,0.435,
"#bar{#nu}_{#mu}" );
501 latex34.SetTextAngle(90)
502 latex34.SetTextSize(0.02);
504 latex34.SetTextFont(42);
506 latex35 = ROOT.TLatex( 0.11,0.48,
"#nu_{e}" );
507 latex35.SetTextAngle(90)
508 latex35.SetTextSize(0.02);
510 latex35.SetTextFont(42);
512 latex36 = ROOT.TLatex( 0.11,0.505,
"#bar{#nu}_{e}" );
513 latex36.SetTextAngle(90)
514 latex36.SetTextSize(0.02);
516 latex36.SetTextFont(42);
519 latex37 = ROOT.TLatex( 0.11,0.56,
"#nu_{#mu}" );
520 latex37.SetTextAngle(90)
521 latex37.SetTextSize(0.02);
523 latex37.SetTextFont(42);
525 latex38 = ROOT.TLatex( 0.11,0.62,
"#bar{#nu}_{#mu}" );
526 latex38.SetTextAngle(90)
527 latex38.SetTextSize(0.02);
529 latex38.SetTextFont(42);
531 latex39 = ROOT.TLatex( 0.11,0.67,
"#nu_{e}" );
532 latex39.SetTextAngle(90)
533 latex39.SetTextSize(0.02);
535 latex39.SetTextFont(42);
537 latex40 = ROOT.TLatex( 0.11,0.70,
"#bar{#nu}_{e}" );
538 latex40.SetTextAngle(90)
539 latex40.SetTextSize(0.02);
541 latex40.SetTextFont(42);
544 latex41 = ROOT.TLatex( 0.11,0.75,
"#nu_{#mu}" );
545 latex41.SetTextAngle(90)
546 latex41.SetTextSize(0.02);
548 latex41.SetTextFont(42);
550 latex42 = ROOT.TLatex( 0.11,0.81,
"#bar{#nu}_{#mu}" );
551 latex42.SetTextAngle(90)
552 latex42.SetTextSize(0.02);
554 latex42.SetTextFont(42);
556 latex43 = ROOT.TLatex( 0.11,0.855,
"#nu_{e}" );
557 latex43.SetTextAngle(90)
558 latex43.SetTextSize(0.02);
560 latex43.SetTextFont(42);
562 latex44 = ROOT.TLatex( 0.11,0.88,
"#bar{#nu}_{e}" );
563 latex44.SetTextAngle(90)
564 latex44.SetTextSize(0.02);
566 latex44.SetTextFont(42);
569 latex29 = ROOT.TLatex( 0.105,0.18,
"#nu_{#mu}" );
570 latex29.SetTextSize(0.02);
572 latex29.SetTextFont(42);
574 latex30 = ROOT.TLatex( 0.105,0.25,
"#bar{#nu}_{#mu}" );
575 latex30.SetTextSize(0.02);
577 latex30.SetTextFont(42);
579 latex31 = ROOT.TLatex( 0.105,0.295,
"#nu_{e}" );
580 latex31.SetTextSize(0.02);
582 latex31.SetTextFont(42);
584 latex32 = ROOT.TLatex( 0.105,0.32,
"#bar{#nu}_{e}" );
585 latex32.SetTextSize(0.02);
587 latex32.SetTextFont(42);
590 latex33 = ROOT.TLatex( 0.105,0.37,
"#nu_{#mu}" );
591 latex33.SetTextSize(0.02);
593 latex33.SetTextFont(42);
595 latex34 = ROOT.TLatex( 0.105,0.435,
"#bar{#nu}_{#mu}" );
596 latex34.SetTextSize(0.02);
598 latex34.SetTextFont(42);
600 latex35 = ROOT.TLatex( 0.105,0.48,
"#nu_{e}" );
601 latex35.SetTextSize(0.02);
603 latex35.SetTextFont(42);
605 latex36 = ROOT.TLatex( 0.105,0.505,
"#bar{#nu}_{e}" );
606 latex36.SetTextSize(0.02);
608 latex36.SetTextFont(42);
611 latex37 = ROOT.TLatex( 0.105,0.56,
"#nu_{#mu}" );
612 latex37.SetTextSize(0.02);
614 latex37.SetTextFont(42);
616 latex38 = ROOT.TLatex( 0.105,0.62,
"#bar{#nu}_{#mu}" );
617 latex38.SetTextSize(0.02);
619 latex38.SetTextFont(42);
621 latex39 = ROOT.TLatex( 0.105,0.67,
"#nu_{e}" );
622 latex39.SetTextSize(0.02);
624 latex39.SetTextFont(42);
626 latex40 = ROOT.TLatex( 0.105,0.70,
"#bar{#nu}_{e}" );
627 latex40.SetTextSize(0.02);
629 latex40.SetTextFont(42);
632 latex41 = ROOT.TLatex( 0.105,0.75,
"#nu_{#mu}" );
633 latex41.SetTextSize(0.02);
635 latex41.SetTextFont(42);
637 latex42 = ROOT.TLatex( 0.105,0.81,
"#bar{#nu}_{#mu}" );
638 latex42.SetTextSize(0.02);
640 latex42.SetTextFont(42);
642 latex43 = ROOT.TLatex( 0.105,0.855,
"#nu_{e}" );
643 latex43.SetTextSize(0.02);
645 latex43.SetTextFont(42);
647 latex44 = ROOT.TLatex( 0.105,0.88,
"#bar{#nu}_{e}" );
648 latex44.SetTextSize(0.02);
650 latex44.SetTextFont(42);
653 line_locations = [19.5,38.5,45.5,52.5,71.5,90.5,97.5,104.5,123.5,142.5,149.5,156.5,175.5,194.5,201.5]
655 line_locations = [19.5,38.5,57.5,76.5,95.5,114.5,133.5,152.5,171.5,190.5,209.5,228.5,247.5,266.5,285.5]
657 line_1 = ROOT.TLine(19.5,0.5,19.5,208)
658 line_2 = ROOT.TLine(38.5,0.5,38.5,208)
659 line_3 = ROOT.TLine(45.5,0.5,45.5,208)
660 line_4 = ROOT.TLine(52.5,0.5,52.5,208)
661 line_5 = ROOT.TLine(71.5,0.5,71.5,208)
662 line_6 = ROOT.TLine(90.5,0.5,90.5,208)
663 line_7 = ROOT.TLine(97.5,0.5,97.5,208)
664 line_8 = ROOT.TLine(104.5,0.5,104.5,208)
665 line_9 = ROOT.TLine(123.5,0.5,123.5,208)
666 line_10 = ROOT.TLine(142.5,0.5,142.5,208)
667 line_11 = ROOT.TLine(149.5,0.5,149.5,208)
668 line_12 = ROOT.TLine(156.5,0.5,156.5,208)
669 line_13 = ROOT.TLine(175.5,0.5,175.5,208)
670 line_14 = ROOT.TLine(194.5,0.5,194.5,208)
671 line_15 = ROOT.TLine(201.5,0.5,201.5,208)
672 lineb_1 = ROOT.TLine(0.5,19.5,208,19.5)
673 lineb_2 = ROOT.TLine(0.5,38.5,208,38.5)
674 lineb_3 = ROOT.TLine(0.5,45.5,208,45.5)
675 lineb_4 = ROOT.TLine(0.5,52.5,208,52.5)
676 lineb_5 = ROOT.TLine(0.5,71.5,208,71.5)
677 lineb_6 = ROOT.TLine(0.5,90.5,208,90.5)
678 lineb_7 = ROOT.TLine(0.5,97.5,208,97.5)
679 lineb_8 = ROOT.TLine(0.5,104.5,208,104.5)
680 lineb_9 = ROOT.TLine(0.5,123.5,208,123.5)
681 lineb_10 = ROOT.TLine(0.5,142.5,208,142.5)
682 lineb_11 = ROOT.TLine(0.5,149.5,208,149.5)
683 lineb_12 = ROOT.TLine(0.5,156.5,208,156.5)
684 lineb_13 = ROOT.TLine(0.5,175.5,208,175.5)
685 lineb_14 = ROOT.TLine(0.5,194.5,208,194.5)
686 lineb_15 = ROOT.TLine(0.5,201.5,208,201.5)
688 line_8.SetLineWidth(4)
689 lineb_8.SetLineWidth(4)
691 line_4.SetLineWidth(2)
692 lineb_4.SetLineWidth(2)
693 line_12.SetLineWidth(2)
694 lineb_12.SetLineWidth(2)
696 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]:
697 line.SetLineColor(13)
700 c1.Print(
"focusing_covariance_"+beam_config+
".eps")
701 c1.Print(
"focusing_covariance_"+beam_config+
".png")
707 ROOT.gStyle.SetNumberContours(NCont);
708 stops = [ 0.00, 0.50, 1.00];
709 red = [ 0.00, 1.00, 1.00];
710 green = [ 0.00, 1.00, 0.00];
711 blue = [ 1.00, 1.00, 0.00];
712 ROOT.TColor.CreateGradientColorTable(NRGBs, array.array(
'd',stops), array.array(
'd',red), array.array(
'd',green), array.array(
'd',blue), NCont);
715 correlation.Draw(
"COLZ")
717 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]:
718 line.SetLineColor(13)
720 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]:
723 small_bins_string =
"" 724 if small_bins: small_bins_string =
"_small_bins" 725 c1.Print(
"focusing_correlation_"+beam_config+small_bins_string+
".eps")
726 c1.Print(
"focusing_correlation_"+beam_config+small_bins_string+
".png")
728 f = ROOT.TFile(
"focusing_covariance_"+beam_config+small_bins_string+
".root",
"RECREATE")
734 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"]
736 start_indices = [0,19,38,45,52,71,90,97,104,123,142,149,156,175,194,201]
738 f = ROOT.TFile(
"1sigma_histograms_"+beam_config+small_bins_string+
"_"+plot+
".root",
"RECREATE")
743 error_bins = [0,2,4,6,8,10]
744 if plot.startswith(
"numu")
or small_bins:
745 error_bins = [0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,7 ,8,12]
747 total_uncertainties = [0]*(len(error_bins)-1)
748 for i
in range(len(uncertainties)):
750 temp_hist = ROOT.TH1D(uncertainty_titles[i],uncertainty_titles[i],len(error_bins)-1,array.array(
'd',error_bins))
751 for j
in range(len(error_bins)-1):
754 temp_hist.SetBinContent(j+1,(shifts[i][start_indices[plots.index(plot)]+j]))
755 total_uncertainties[j] = total_uncertainties[j]+math.pow(shifts[i][start_indices[plots.index(plot)]+j],2)
756 error_hists.append(temp_hist)
759 temp_hist = ROOT.TH1D(
"Total",
"Total",len(error_bins)-1,array.array(
'd',error_bins))
760 for j
in range(len(error_bins)-1):
761 temp_hist.SetBinContent(j+1,math.sqrt(total_uncertainties[j]))
762 error_hists.append(temp_hist)
766 error_hists[-1].SetMinimum(-0.09);
767 error_hists[-1].SetMaximum(0.09);
768 error_hists[-1].SetLineWidth(3)
769 error_hists[-1].Draw(
"hist")
770 error_hists[-1].GetXaxis().SetTitle(
"Neutrino Energy (GeV)")
772 error_hists[-1].GetYaxis().SetTitle(
"1-Sigma Shift")
773 error_hists[-1].GetYaxis().SetTitleOffset(1.3)
775 for i
in range(0,len(error_hists)-1):
776 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]
777 error_hists[i].SetLineColor(colors[i])
778 error_hists[i].SetLineWidth(3)
779 error_hists[i].SetMinimum(-0.09);
780 error_hists[i].SetMaximum(0.09);
781 error_hists[i].GetXaxis().SetTitle(
"Neutrino Energy (GeV)")
783 error_hists[i].GetYaxis().SetTitle(
"1-Sigma Shift")
784 error_hists[i].GetYaxis().SetTitleOffset(1.3)
785 error_hists[i].Draw(
"histsame")
786 error_hists[i].Write();
788 leg = ROOT.TLegend(0.57,0.5,0.92,0.85)
789 leg.AddEntry(error_hists[-1],error_hists[-1].GetTitle(),
"l")
790 for i
in range(0,len(error_hists)-1):
791 leg.AddEntry(error_hists[i],error_hists[i].GetTitle(),
"l")
795 c1.Print(
"focusing_error_overlay_"+plot+
"_"+beam_config+small_bins_string+
".eps")
796 c1.Print(
"focusing_error_overlay_"+plot+
"_"+beam_config+small_bins_string+
".png")
def GetCorrelation(cov_matrix)
int open(const char *, int)
Opens a file descriptor.
void split(std::string const &s, char c, OutIter dest)