11from basf2
import create_path, LogLevel, LogInfo, logging, set_random_seed, B2INFO, Module
13from ROOT
import Belle2, gRandom
17 """Small test module to print something in Path.doWhile"""
20 """Remember how many iterations we want"""
26 """Print the current iteration for this event as well as the first five random numbers"""
27 weight = self.
eventInfo.getGeneratedWeight()
28 B2INFO(f
"Current Iteration: {weight}")
29 rndm = [f
"{gRandom.Rndm():.4f}" for i
in range(5)]
30 B2INFO(f
"First 5 random numbers: {rndm}")
33 self.return_value(weight > self.
eventInfo.getRun())
38set_random_seed(
"something important")
40for level
in LogLevel.values.values():
41 logging.set_info(level, LogInfo.LEVEL | LogInfo.MESSAGE)
44logging.enable_summary(
False)
47path.add_module(
'EventInfoSetter', evtNumList=[2, 2, 1], runList=[0, 3, 5], expList=[0, 1, 3])
48path.add_module(
'EventInfoPrinter')
49subpath = create_path()
51path.do_while(subpath, max_iterations=3)
55test_module.if_true(create_path())
62path.add_module(
'EventInfoSetter')
63subpath = create_path()
64subpath.add_module(
"EventInfoPrinter")
71path.add_module(
"EventInfoSetter", evtNumList=5)
72subpath = create_path()
73subpath.add_module(
"EventInfoPrinter")
74p1 = subpath.add_module(
"Prescale", prescale=0.9)
75p1.if_true(create_path())
76subpath.add_module(
"Prescale", prescale=0.2)
81path.add_module(
'EventInfoSetter', evtNumList=5)
82subpath = create_path()
83subpath.add_module(
"EventInfoPrinter")
84subpath.add_module(
"Prescale", prescale=0.2)
93 env.setPicklePath(
"testpath.pkl")
97 path.add_module(
"EventInfoPrinter")
100 env.setPicklePath(
"")
static Environment & Instance()
Static method to get a reference to the Environment instance.
a (simplified) python wrapper for StoreObjPtr.
eventInfo
use the event meta info to store the iterations
def run_in_subprocess(*args, target, **kwargs)
def clean_working_directory()
def safe_process(*args, **kwargs)