-
Notifications
You must be signed in to change notification settings - Fork 1
/
hepdata_mubvscent.py
51 lines (47 loc) · 1.98 KB
/
hepdata_mubvscent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import ROOT
import numpy as np
ifile = ROOT.TFile("muBvsCent_1.root")
chi2 = ifile.Get("h2;1")
covMat = ifile.Get("covM_0")
with open("Chi2MuB.yaml", "w") as ofile:
ofile.write("dependent_variables:\n")
ofile.write("- header: {name: '$\\chi^{2}$'}\n")
ofile.write(" values:\n")
for i in range(0, chi2.GetNbinsX()):
ofile.write(" - {value: " + "{:.6f}".format(chi2.GetBinContent(i + 1)) + "}\n")
ofile.write("independent_variables:\n")
ofile.write("- header: {name: '$\\mu_B$ (MeV)'}\n")
ofile.write(" values:\n")
for i in range(0, chi2.GetNbinsX()):
ofile.write(" - {value: " + "{:.6f}".format(chi2.GetBinCenter(i + 1)) + "}\n")
with open("CovarianceMatrixMuBCent.yaml", "w") as ofile:
ofile.write("independent_variables:\n")
ofile.write("- header: {name: Centrality}\n")
ofile.write(" values:\n")
for i in range(0, 5):
ofile.write(" - {value: \"0-5%\"}\n")
ofile.write(" - {value: \"5-10%\"}\n")
ofile.write(" - {value: \"10-30%\"}\n")
ofile.write(" - {value: \"30-50%\"}\n")
ofile.write(" - {value: \"50-90%\"}\n")
ofile.write("- header: {name: Centrality}\n")
ofile.write(" values:\n")
for i in range(0, 5):
ofile.write(" - {value: \"0-5%\"}\n")
for i in range(0, 5):
ofile.write(" - {value: \"5-10%\"}\n")
for i in range(0, 5):
ofile.write(" - {value: \"10-30%\"}\n")
for i in range(0, 5):
ofile.write(" - {value: \"30-50%\"}\n")
for i in range(0, 5):
ofile.write(" - {value: \"50-90%\"}\n")
ofile.write("dependent_variables:\n")
ofile.write("- header: {name: total covariance matrix}\n")
ofile.write(" values:\n")
for i in range(1, 6):
for j in range(1, 6):
if j < i + 1:
ofile.write(" - {value: " + "{:.6f}".format(covMat.GetBinContent(i, 6 - j)) + "}\n")
else:
ofile.write(" - {value: " + "{:.6f}".format(covMat.GetBinContent(j, 6 - i)) + "}\n")