12 from ROOT
import Belle2
21 Count the number of events passing this module and create a dictionary
22 of {(exp,run): events}
29 """Creates an entry in the global num_events dictionary"""
32 run = evtmetadata.obj().
getRun()
33 exp = evtmetadata.obj().getExperiment()
34 if (exp, run)
not in num_events:
35 num_events[(exp, run)] = 0
38 """Increments the right (Exp,Run) entry in the num_events dictionary"""
41 run = evtmetadata.obj().
getRun()
42 exp = evtmetadata.obj().getExperiment()
43 num_events[(exp, run)] += 1
50 main.add_module(
"EventInfoSetter", evtNumList=[input_events] * 3, expList=[0, 0, 1], runList=[0, 1, 0])
51 eventlimiter_mod = main.add_module(
'EventLimiter', maxEventsPerRun=500)
53 success_path = basf2.Path()
54 success_count = success_path.add_module(
CountEvents())
55 eventlimiter_mod.if_true(success_path)
59 print(basf2.statistics)
61 for passing_events
in num_events.values():
62 assert passing_events == max_events
a (simplified) python wrapper for StoreObjPtr.
static ExpRun getRun(std::map< ExpRun, std::pair< double, double >> runs, double t)
Get exp number + run number from time.