13 from ROOT
import Belle2
16 from runIPVXD_CAF
import get_calibration
17 import millepede_calibration
as mpc
19 cal = get_calibration(dict(), [tag
for tag
in basf2.conditions.globaltags])
20 collector_file =
'CollectorOutput.root'
21 collector_file = mpc.collect(cal,
25 mpc.calibrate(cal, [collector_file])
27 algo = cal.algorithms[0].algorithm
31 payloads = list(algo.getPayloads())
33 for payload
in payloads:
34 if payload.name ==
'VXDAlignment':
41 "correction & errors",
42 algo.result().getNoDeterminedParameters(),
44 algo.result().getNoDeterminedParameters())
47 param = np.zeros(1, dtype=int)
48 value = np.zeros(1, dtype=float)
49 correction = np.zeros(1, dtype=float)
50 error = np.zeros(1, dtype=float)
51 layer = np.zeros(1, dtype=int)
52 ladder = np.zeros(1, dtype=int)
53 sensor = np.zeros(1, dtype=int)
54 segment = np.zeros(1, dtype=int)
55 x = np.zeros(1, dtype=float)
56 y = np.zeros(1, dtype=float)
57 z = np.zeros(1, dtype=float)
58 eigenweight = np.zeros(1, dtype=float)
61 vxdtree = ROOT.TTree(
'vxd',
'VXD data')
62 vxdtree.Branch(
'layer', layer,
'layer/I')
63 vxdtree.Branch(
'ladder', ladder,
'ladder/I')
64 vxdtree.Branch(
'sensor', sensor,
'sensor/I')
65 vxdtree.Branch(
'segment', segment,
'segment/I')
66 vxdtree.Branch(
'param', param,
'param/I')
67 vxdtree.Branch(
'value', value,
'value/D')
68 vxdtree.Branch(
'correction', correction,
'correction/D')
69 vxdtree.Branch(
'error', error,
'error/D')
70 vxdtree.Branch(
'x', x,
'x/D')
71 vxdtree.Branch(
'y', y,
'y/D')
72 vxdtree.Branch(
'z', z,
'z/D')
73 vxdtree.Branch(
'eigenweight', eigenweight,
'eigenweight/D')
81 for ipar
in range(0, algo.result().getNoParameters()):
82 if not algo.result().isParameterDetermined(ipar):
88 param[0] = label.getParameterId()
89 correction[0] = algo.result().getParameterCorrection(ipar)
90 error[0] = algo.result().getParameterError(ipar)
93 sid = label.getElementId()
94 pid = label.getParameterId()
95 ew = algo.result().getEigenVectorElement(0, ipar)
98 value[0] = vxd.get(sid, pid)
101 corrections.set(sid, pid, correction[0])
102 errors.set(sid, pid, error[0])
103 eigenweights.set(sid, pid, ew)
116 profile.SetBinContent(ibin, value[0])
117 profile.SetBinError(ibin, error[0])
121 if algo.result().getNoEigenPairs():
122 maxEigenValue = algo.result().getEigenNumber(algo.result().getNoEigenPairs() - 1)
123 minEigenValue = algo.result().getEigenNumber(0)
124 condition = maxEigenValue / minEigenValue
127 print(
"Condition number of the matrix: ", condition)
129 diagfile = ROOT.TFile(
'MillepedeJobDiagnostics.root',
'recreate')
133 corrections.Write(
'corrections')
134 errors.Write(
'errors')
135 eigenweights.Write(
'eigenweights')
136 vxdtree.Write(
'vxdtree')
137 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.