Belle II Software  release-08-01-10
MinModule Class Reference
Inheritance diagram for MinModule:
Collaboration 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 68 of file readout.py.

Member Function Documentation

◆ event()

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

Definition at line 77 of file readout.py.

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