Belle II Software development
PXDROIUnpackerModule.py
1#!/usr/bin/env python3
2
3
10
11from basf2 import Module, B2ERROR
12from ROOT import Belle2
13
14
16 """Unpack Raw Rois"""
17
18 def initialize(self):
19 """reimplementation of Module::initialize()."""
20
21 self.mHLT = Belle2.PyStoreArray(Belle2.ROIid.Class(), "PXDROIsHLT")
22
23 self.mDC = Belle2.PyStoreArray(Belle2.ROIid.Class(), "PXDROIsDC")
24
25 self.mHLT.registerInDataStore()
26 self.mDC.registerInDataStore()
27
28 def event(self):
29 """reimplementation of Module::event()."""
30
31 rois = Belle2.PyStoreArray('PXDRawROIss')
32 if not rois:
33 return
34 for q in rois:
35 m = q.getNrROIs()
36 for i in range(0, m):
37 DHEID = q.getDHHID(i)
38 sensor = (DHEID & 0x1) + 1
39 ladder = (DHEID & 0x1E) >> 1 # no +1
40 layer = ((DHEID & 0x20) >> 5) + 1
41 v = Belle2.VxdID(layer, ladder, sensor)
42 if q.getType(i) == 0:
43 ROI = self.mHLT.appendNew()
44 ROI.setSensorID(v)
45 ROI.setMinUid(q.getMinUid(i))
46 ROI.setMaxUid(q.getMaxUid(i))
47 ROI.setMinVid(q.getMinVid(i))
48 ROI.setMaxVid(q.getMaxVid(i))
49 else:
50 ROI = self.mDC.appendNew()
51 ROI.setSensorID(v)
52 ROI.setMinUid(q.getMinUid(i))
53 ROI.setMaxUid(q.getMaxUid(i))
54 ROI.setMinVid(q.getMinVid(i))
55 ROI.setMaxVid(q.getMaxVid(i))
56
57
59 """Unpack HLT Payload Rois"""
60
61 def initialize(self):
62 """reimplementation of Module::initialize()."""
63
64 self.mPHLT = Belle2.PyStoreArray(Belle2.ROIid.Class(), "PXDROIsPayHLT")
65
66 self.mPDC = Belle2.PyStoreArray(Belle2.ROIid.Class(), "PXDROIsPayDC")
67
68 self.mPHLT.registerInDataStore()
69 self.mPDC.registerInDataStore()
70
71 def event(self):
72 """reimplementation of Module::event()."""
73
74 q = Belle2.PyStoreObj('ROIpayload')
75 if not q:
76 B2ERROR("ROIpayload is missing")
77 return
78 q = q.obj()
79 n = q.getNrROIs()
80 for i in range(0, n):
81 DHEID = q.getDHHID(i)
82 sensor = (DHEID & 0x1) + 1
83 ladder = (DHEID & 0x1E) >> 1 # no +1
84 layer = ((DHEID & 0x20) >> 5) + 1
85 v = Belle2.VxdID(layer, ladder, sensor)
86 if q.getType(i) == 0:
87 ROI = self.mPHLT.appendNew()
88 ROI.setSensorID(v)
89 ROI.setMinUid(q.getMinUid(i))
90 ROI.setMaxUid(q.getMaxUid(i))
91 ROI.setMinVid(q.getMinVid(i))
92 ROI.setMaxVid(q.getMaxVid(i))
93 else:
94 ROI = self.mPDC.appendNew()
95 ROI.setSensorID(v)
96 ROI.setMinUid(q.getMinUid(i))
97 ROI.setMaxUid(q.getMaxUid(i))
98 ROI.setMinVid(q.getMinVid(i))
99 ROI.setMaxVid(q.getMaxVid(i))
A (simplified) python wrapper for StoreArray.
Definition: PyStoreArray.h:72
a (simplified) python wrapper for StoreObjPtr.
Definition: PyStoreObj.h:67
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33