Belle II Software light-2406-ragdoll
check_payload_names.py
1
8'''
9Check if the database correctly returns the names of all the payloads used by the basf2 process.
10'''
11
12import basf2 as b2
13import b2test_utils as b2tu
14import ROOT.Belle2 as B2
15
16
17class CheckPayloadNames(b2.Module):
18 '''
19 Small module that asks for some payloads and checks their names.
20 '''
21
22 def __init__(self):
23 '''Constructor.'''
24 super().__init__()
25
27 'BeamParameters',
28 'BeamSpot',
29 'BunchStructure',
30 'CollisionBoostVector',
31 'HardwareClockSettings',
32 'MagneticField']
33 self.payload_names.sort()
34 for payload_name in self.payload_names:
35 B2.PyDBObj(payload_name)
36
37 def event(self):
38 '''Event.'''
39 payload_names = sorted(B2.Database.Instance().getAllDataNames())
40 print('Set payloads:', self.payload_names)
41 print('Got payloads:', payload_names)
42 assert(self.payload_names == payload_names)
43
44
45if __name__ == '__main__':
46
47 with b2tu.clean_working_directory():
48 main = b2.Path()
49 main.add_module('EventInfoSetter', expList=[0], runList=[0], evtNumList=[1])
50 main.add_module(CheckPayloadNames())
51 b2.process(main)
payload_names
Payload names to be required.