9from iov_conditional
import phase_2_conditional, make_conditional_at
13 """Print the given string on each event"""
16 """Remember the given string to print later"""
18 ## The string we want to print each event
19 self._print_string = print_string
22 """And now would be a good time for printing ..."""
23 print(self._print_string)
26def simulate_run(run_numbers, exp_numbers):
27 assert len(exp_numbers) == len(run_numbers)
29 path = basf2.create_path()
31 path.add_module("EventInfoSetter", evtNumList=[1] * len(run_numbers), runList=run_numbers, expList=exp_numbers)
32 path.add_module("EventInfoPrinter")
35 phase2_path = basf2.create_path()
36 phase2_path.add_module(PrinterModule("Phase 2 is here"))
39 phase3_path = basf2.create_path()
40 phase3_path.add_module(PrinterModule("Phase 3 is here"))
43 no_phase3_path = basf2.create_path()
44 no_phase3_path.add_module(PrinterModule("Phase 3 is not here"))
47 weird_path = basf2.create_path()
48 weird_path.add_module(PrinterModule("Strange condition"))
50 # Condition for phase2
51 phase_2_conditional(path, phase2_path=phase2_path)
53 # Condition for phase3
54 make_conditional_at(path, iov_list=[(0, 0, 0, -1)], path_when_in_iov=phase3_path, path_when_not_in_iov=no_phase3_path)
56 # Some weird condition
57 make_conditional_at(path, iov_list=[(42, 42, 47, 47)], path_when_in_iov=weird_path)
60 path.add_module(PrinterModule("Finish"))
65if __name__ == "__main__":
66 basf2.set_random_seed(1)
67 simulate_run(exp_numbers=[0, 1002], run_numbers=[1, 67])
68 simulate_run(exp_numbers=[42, 43, 47], run_numbers=[41, 1, 48])
__init__(self, print_string)