13from ROOT
import Belle2
14from b2test_utils
import safe_process, clean_working_directory
16basf2.conditions.disable_globaltag_replay()
17basf2.set_random_seed(
"something important")
20basf2.logging.set_info(basf2.LogLevel.FATAL, basf2.logging.get_info(basf2.LogLevel.ERROR))
21basf2.logging.enable_summary(
False)
25 """Doesn't do anything."""
28with clean_working_directory():
29 for filename
in [
"root_input.root",
"chaintest_empty.root",
"chaintest_1.root",
"chaintest_2.root"]:
30 os.symlink(basf2.find_file(f
'framework/tests/{filename}'), filename)
38 input_module = main.add_module(
"RootInput", inputFileName=
"root_input.root",
39 branchNames=[
'EventMetaData',
'PXDDigits',
'PXDTrueHits',
'PXDClusters'],
40 excludeBranchNames=[
'PXDClusters'], skipNEvents=1, logLevel=basf2.LogLevel.WARNING)
42 main.add_module(
"EventInfoPrinter")
43 main.add_module(
"PrintCollections", printForEvent=0)
46 assert safe_process(main) == 0
50 input_module.param(
'entrySequences', [
"0,3:10,23"])
51 assert safe_process(main) == 0
56 for evtNo
in range(1, 7):
58 main.add_module(
"RootInput", inputFileName=
'root_input.root',
59 branchNames=[
"EventMetaData"], skipToEvent=[0, 1, evtNo], logLevel=basf2.LogLevel.WARNING)
60 main.add_module(
"EventInfoPrinter")
65 input_module = main.add_module(
'RootInput', inputFileNames=[
'chaintest_1.root',
'chaintest_2.root'],
66 logLevel=basf2.LogLevel.WARNING)
72 input_module.param(
'entrySequences', [
'0,3:4,10:100',
'1:2,4,12:13'])
76 Test module which writes out the processed event numbers
77 into the global processed_event_numbers list
82 Initialize this nice class with the list of expected
event
83 numbers to see
in the correct order
108 main.add_module(
TestingModule([2, 9, 10, 15, 16, 6, 3, 9, 18, 14]))
109 assert safe_process(main) == 0
111 basf2.set_random_seed(
"something important")
114 basf2.logging.set_info(basf2.LogLevel.FATAL, basf2.logging.get_info(basf2.LogLevel.ERROR))
118 input_module = main.add_module(
'RootInput', inputFileNames=[
'chaintest_1.root',
'chaintest_2.root'],
119 logLevel=basf2.LogLevel.WARNING)
125 input_module.param(
'entrySequences', [
':',
'1:2,4,12:13'])
127 expected_event_numbers = [2, 6, 5, 9, 10, 11, 8, 12, 1, 13, 15, 16, 6, 3, 9, 18, 14]
130 assert safe_process(main) == 0
132 full_list = [
"chaintest_empty.root",
"chaintest_1.root",
"chaintest_2.root",
"chaintest_1.root"]
133 for i
in range(len(full_list)):
135 main.add_module(
'RootInput', inputFileNames=full_list[:i + 1])
136 main.add_module(
"EventInfoPrinter")
141 Small module to mark all events except for the ones
in the given list
as
147 Initialize this nice class with the list/set of accepted event
148 numbers to see. Order
not important. All other events will be flagged
158 """Set error flag if required"""
160 error = Belle2.EventMetaData.c_HLTDiscard
if self.
emd.getEvent() % 2 == 0
else \
161 Belle2.EventMetaData.c_HLTCrash
162 self.
emd.addErrorFlag(error)
165 main.add_module(
"EventInfoSetter", evtNumList=10)
167 main.add_module(
"RootOutput", outputFileName=
"brokenevents.root")
168 assert safe_process(main) == 0
171 main.add_module(
"RootInput", inputFileName=
"brokenevents.root")
173 assert safe_process(main) == 0
a (simplified) python wrapper for StoreObjPtr.