Belle II Software  release-05-01-25
TestModule Class Reference
Inheritance diagram for TestModule:
Collaboration diagram for TestModule:

Public Member Functions

def event (self)
 

Detailed Description

test module to compare the output of TRGCDC and CDCTriggerTSF

Definition at line 109 of file TSF_OldVsNew.py.

Member Function Documentation

◆ event()

def event (   self)
give info for both output lists and warnings in the case of mismatches

Definition at line 114 of file TSF_OldVsNew.py.

114  def event(self):
115  """
116  give info for both output lists and warnings in the case of mismatches
117  """
118  oldHits = Belle2.PyStoreArray("CDCTriggerSegmentHits")
119  newHits = Belle2.PyStoreArray("TSHits")
120  if oldHits.getEntries() == newHits.getEntries():
121  basf2.B2INFO("%d hits" % oldHits.getEntries())
122  else:
123  basf2.B2WARNING("old version: %d, new version: %d" %
124  (oldHits.getEntries(), newHits.getEntries()))
125  for i in range(max(oldHits.getEntries(), newHits.getEntries())):
126  if i < oldHits.getEntries():
127  oldString = "ID %d priority %d LR %d fastest T %d priority T %d found T %d" % \
128  (oldHits[i].getSegmentID(), oldHits[i].getPriorityPosition(),
129  oldHits[i].getLeftRight(), oldHits[i].fastestTime(),
130  oldHits[i].priorityTime(), oldHits[i].foundTime())
131  else:
132  oldString = "no hit"
133  if i < newHits.getEntries():
134  newString = "ID %d priority %d LR %d fastest T %d priority T %d found T %d" % \
135  (newHits[i].getSegmentID(), newHits[i].getPriorityPosition(),
136  newHits[i].getLeftRight(), newHits[i].fastestTime(),
137  newHits[i].priorityTime(), newHits[i].foundTime())
138  else:
139  newString = "no hit"
140  if oldString == newString:
141  basf2.B2INFO(oldString)
142  else:
143  basf2.B2WARNING("old: " + oldString)
144  basf2.B2WARNING("new: " + newString)
145  # check relations
146  if clock:
147  oldCDCRels = oldHits[i].getRelationsTo("CDCHits4Trg")
148  newCDCRels = newHits[i].getRelationsTo("CDCHits4Trg")
149  else:
150  oldCDCRels = oldHits[i].getRelationsTo("CDCHits")
151  newCDCRels = newHits[i].getRelationsTo("CDCHits")
152  if len(oldCDCRels) == len(newCDCRels):
153  basf2.B2INFO("%d related CDCHits" % len(oldCDCRels))
154  else:
155  basf2.B2WARNING("old version: %d related CDCHits" % len(oldCDCRels))
156  basf2.B2WARNING("new version: %d related CDCHits" % len(newCDCRels))
157  for irel in range(max(len(oldCDCRels), len(newCDCRels))):
158  if irel < len(oldCDCRels):
159  oldString = "relation to hit %d, weight %.1f" % \
160  (oldCDCRels[irel].getArrayIndex(), oldCDCRels.weight(irel))
161  else:
162  oldString = "no relation"
163  if irel < len(newCDCRels):
164  newString = "relation to hit %d, weight %.1f" % \
165  (newCDCRels[irel].getArrayIndex(), newCDCRels.weight(irel))
166  else:
167  newString = "no relation"
168  if oldString == newString:
169  basf2.B2INFO(oldString)
170  else:
171  basf2.B2WARNING(oldString)
172  basf2.B2WARNING(newString)
173 
174 
175 main.add_module(TestModule(), logLevel=basf2.LogLevel.INFO)
176 
177 # Process events
178 basf2.process(main)
179 
180 # Print call statistics
181 print(basf2.statistics)

The documentation for this class was generated from the following file:
basf2.process
def process(path, max_event=0)
Definition: __init__.py:25
ClusterEfficiency.ClusterEfficiency.event
def event(self)
Definition: ClusterEfficiency.py:146
Belle2::PyStoreArray
a (simplified) python wrapper for StoreArray.
Definition: PyStoreArray.h:58