Belle II Software  release-08-01-10
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 115 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 120 of file TSF_OldVsNew.py.

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

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