Belle II Software development
MinModule Class Reference
Inheritance diagram for MinModule:

Public Member Functions

def event (self)
 

Detailed Description

Example module to drop into ipython and create some objects to look at.
If you just want to start IPython and create PyStoreArray etc.
interactively in your own steering file, the 'Interactive' module
might be of interest.

Definition at line 67 of file readout.py.

Member Function Documentation

◆ event()

def event (   self)
reimplement Module::event()

Definition at line 76 of file readout.py.

76 def event(self):
77 """
78 reimplement Module::event()
79 """
80 self.return_value(0)
81 # function namespace caching
82 frombuffer = np.frombuffer
83 GetNodeID = Belle2.RawTRG.GetNodeID
84 GetDetectorNwords = Belle2.RawTRG.GetDetectorNwords
85 GetDetectorBuffer = Belle2.RawTRG.GetDetectorBuffer
86 trgary = Belle2.PyStoreArray("RawTRGs")
87
88 evtmeta = Belle2.PyStoreObj("EventMetaData")
89
90 # integrity check
91 if integrity_check:
92 print(len(trgary), 'copper(s)')
93 for evt in trgary:
94 for entry in range(evt.GetNumEntries()): # flattened. Usually only 1 entry
95 print(f'{GetNodeID(evt, entry):0x}')
96 for bid in range(4):
97 if (GetNodeID(evt, entry), bid) in hslb:
98 count = GetDetectorNwords(evt, entry, bid)
99 print(bid, "exist, ", count, "words.")
100 return
101 dataList = []
102 for evt in trgary:
103 # assuming smaller Copper ID comes first
104 for entry in range(evt.GetNumEntries()): # flattened. Usually only 1 entry
105 # print('{:0x}'.format(GetNodeID(evt, entry)))
106 for bid in range(4):
107 if (GetNodeID(evt, entry), bid) not in hslb:
108 continue
109 count = GetDetectorNwords(evt, entry, bid)
110 if count == 0:
111 # continue
112 pass
113 bf = GetDetectorBuffer(evt, entry, bid)
114 ary = frombuffer(bf, np.uintc, count)
115 # obsolete: skipping dummy buffers
116 # if '{:0x}'.format(ary[0])[:4] == 'dddd':
117 # self.return_value(1)
118 # else:
119 # return
120 self.return_value(1)
121 dataList.append(join(ary))
122
123 event = evtmeta.getEvent()
124 run = evtmeta.getRun()
125 subrun = evtmeta.getSubrun()
126 meta.append((event, run, subrun))
127 data.append(dataList)
128
129
130# Set the log level to show only error and fatal messages
131# set_log_level(LogLevel.ERROR)
A (simplified) python wrapper for StoreArray.
Definition: PyStoreArray.h:72
a (simplified) python wrapper for StoreObjPtr.
Definition: PyStoreObj.h:67

The documentation for this class was generated from the following file: