14 from ROOT
import Belle2
17 from runIPVXD_CAF
import get_calibration
18 import millepede_calibration
as mpc
20 cal = get_calibration(dict(), [tag
for tag
in basf2.conditions.globaltags])
21 collector_file =
'CollectorOutput.root'
22 collector_file = mpc.collect(cal,
26 mpc.calibrate(cal, [collector_file])
28 algo = cal.algorithms[0].algorithm
32 payloads = list(algo.getPayloads())
34 for payload
in payloads:
35 if payload.name ==
'VXDAlignment':
42 "correction & errors",
43 algo.result().getNoDeterminedParameters(),
45 algo.result().getNoDeterminedParameters())
48 param = np.zeros(1, dtype=int)
49 value = np.zeros(1, dtype=float)
50 correction = np.zeros(1, dtype=float)
51 error = np.zeros(1, dtype=float)
52 layer = np.zeros(1, dtype=int)
53 ladder = np.zeros(1, dtype=int)
54 sensor = np.zeros(1, dtype=int)
55 segment = np.zeros(1, dtype=int)
56 x = np.zeros(1, dtype=float)
57 y = np.zeros(1, dtype=float)
58 z = np.zeros(1, dtype=float)
59 eigenweight = np.zeros(1, dtype=float)
62 vxdtree = ROOT.TTree(
'vxd',
'VXD data')
63 vxdtree.Branch(
'layer', layer,
'layer/I')
64 vxdtree.Branch(
'ladder', ladder,
'ladder/I')
65 vxdtree.Branch(
'sensor', sensor,
'sensor/I')
66 vxdtree.Branch(
'segment', segment,
'segment/I')
67 vxdtree.Branch(
'param', param,
'param/I')
68 vxdtree.Branch(
'value', value,
'value/D')
69 vxdtree.Branch(
'correction', correction,
'correction/D')
70 vxdtree.Branch(
'error', error,
'error/D')
71 vxdtree.Branch(
'x', x,
'x/D')
72 vxdtree.Branch(
'y', y,
'y/D')
73 vxdtree.Branch(
'z', z,
'z/D')
74 vxdtree.Branch(
'eigenweight', eigenweight,
'eigenweight/D')
82 for ipar
in range(0, algo.result().getNoParameters()):
83 if not algo.result().isParameterDetermined(ipar):
89 param[0] = label.getParameterId()
90 correction[0] = algo.result().getParameterCorrection(ipar)
91 error[0] = algo.result().getParameterError(ipar)
94 sid = label.getElementId()
95 pid = label.getParameterId()
96 ew = algo.result().getEigenVectorElement(0, ipar)
99 value[0] = vxd.get(sid, pid)
102 corrections.set(sid, pid, correction[0])
103 errors.set(sid, pid, error[0])
104 eigenweights.set(sid, pid, ew)
117 profile.SetBinContent(ibin, value[0])
118 profile.SetBinError(ibin, error[0])
122 if algo.result().getNoEigenPairs():
123 maxEigenValue = algo.result().getEigenNumber(algo.result().getNoEigenPairs() - 1)
124 minEigenValue = algo.result().getEigenNumber(0)
125 condition = maxEigenValue / minEigenValue
128 print(
"Condition number of the matrix: ", condition)
130 diagfile = ROOT.TFile(
'MillepedeJobDiagnostics.root',
'recreate')
134 corrections.Write(
'corrections')
135 errors.Write(
'errors')
136 eigenweights.Write(
'eigenweights')
137 vxdtree.Write(
'vxdtree')
138 profile.Write(
'profile')
static Environment & Instance()
Static method to get a reference to the Environment instance.
Class to convert to/from global labels for Millepede II to/from detector & parameter identificators.
VXD alignment (and maybe some calibration) parameters.
static unsigned short getGlobalUniqueID()
Get global unique id.
Class to uniquely identify a any structure of the PXD and SVD.