13from ROOT
import Belle2
16from runIPVXD_CAF
import get_calibration
17import millepede_calibration
as mpc
19cal = get_calibration(dict(), [tag
for tag
in basf2.conditions.globaltags])
20collector_file =
'CollectorOutput.root'
21collector_file = mpc.collect(cal,
25mpc.calibrate(cal, [collector_file])
27algo = cal.algorithms[0].algorithm
31payloads = list(algo.getPayloads())
33for payload
in payloads:
34 if payload.name ==
'VXDAlignment':
41 "correction & errors",
42 algo.result().getNoDeterminedParameters(),
44 algo.result().getNoDeterminedParameters())
47param = np.zeros(1, dtype=int)
48value = np.zeros(1, dtype=float)
49correction = np.zeros(1, dtype=float)
50error = np.zeros(1, dtype=float)
51layer = np.zeros(1, dtype=int)
52ladder = np.zeros(1, dtype=int)
53sensor = np.zeros(1, dtype=int)
54segment = np.zeros(1, dtype=int)
55x = np.zeros(1, dtype=float)
56y = np.zeros(1, dtype=float)
57z = np.zeros(1, dtype=float)
58eigenweight = np.zeros(1, dtype=float)
61vxdtree = ROOT.TTree(
'vxd',
'VXD data')
62vxdtree.Branch(
'layer', layer,
'layer/I')
63vxdtree.Branch(
'ladder', ladder,
'ladder/I')
64vxdtree.Branch(
'sensor', sensor,
'sensor/I')
65vxdtree.Branch(
'segment', segment,
'segment/I')
66vxdtree.Branch(
'param', param,
'param/I')
67vxdtree.Branch(
'value', value,
'value/D')
68vxdtree.Branch(
'correction', correction,
'correction/D')
69vxdtree.Branch(
'error', error,
'error/D')
70vxdtree.Branch(
'x', x,
'x/D')
71vxdtree.Branch(
'y', y,
'y/D')
72vxdtree.Branch(
'z', z,
'z/D')
73vxdtree.Branch(
'eigenweight', eigenweight,
'eigenweight/D')
81for 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])
121if 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)
129diagfile = ROOT.TFile(
'MillepedeJobDiagnostics.root',
'recreate')
133corrections.Write(
'corrections')
134errors.Write(
'errors')
135eigenweights.Write(
'eigenweights')
136vxdtree.Write(
'vxdtree')
137profile.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.