Belle II Software  release-08-01-10
SpacePointCreatorDemo.py
1 #!/usr/bin/env python3
2 
3 
10 
11 # This steering file will
12 import basf2 as b2
13 from beamparameters import add_beamparameters
14 
15 numEvents = 25
16 initialValue = 42
17 
18 b2.set_log_level(b2.LogLevel.ERROR)
19 b2.set_random_seed(initialValue)
20 
21 eventinfosetter = b2.register_module('EventInfoSetter')
22 eventinfosetter.param('expList', [0])
23 eventinfosetter.param('runList', [1])
24 eventinfosetter.param('evtNumList', [numEvents])
25 
26 eventinfoprinter = b2.register_module('EventInfoPrinter')
27 
28 gearbox = b2.register_module('Gearbox')
29 
30 pxdDigitizer = b2.register_module('PXDDigitizer')
31 svdDigitizer = b2.register_module('SVDDigitizer')
32 pxdClusterizer = b2.register_module('PXDClusterizer')
33 svdClusterizer = b2.register_module('SVDClusterizer')
34 evtgeninput = b2.register_module('EvtGenInput')
35 evtgeninput.logging.log_level = b2.LogLevel.WARNING
36 
37 geometry = b2.register_module('Geometry')
38 geometry.param('components', ['BeamPipe', 'MagneticFieldConstant4LimitedRSVD',
39  'PXD', 'SVD'])
40 
41 g4sim = b2.register_module('FullSim')
42 g4sim.param('StoreAllSecondaries', True)
43 
44 spCreatorSingle = b2.register_module('SVDSpacePointCreator')
45 spCreatorSingle.logging.log_level = b2.LogLevel.INFO
46 spCreatorSingle.logging.debug_level = 1
47 spCreatorSingle.param('OnlySingleClusterSpacePoints', True)
48 spCreatorSingle.param('NameOfInstance', 'singlesOnly')
49 spCreatorSingle.param('SpacePoints', 'singlesOnly')
50 
51 spCreatorCombi = b2.register_module('SVDSpacePointCreator')
52 spCreatorCombi.logging.log_level = b2.LogLevel.DEBUG
53 spCreatorCombi.logging.debug_level = 1
54 spCreatorCombi.param('OnlySingleClusterSpacePoints', False)
55 spCreatorCombi.param('NameOfInstance', 'couplesAllowed')
56 spCreatorCombi.param('SpacePoints', 'couplesAllowed')
57 
58 spCreatorPXD = b2.register_module('PXDSpacePointCreator')
59 spCreatorPXD.logging.log_level = b2.LogLevel.INFO
60 spCreatorPXD.logging.debug_level = 1
61 spCreatorPXD.param('NameOfInstance', 'pxdOnly')
62 spCreatorPXD.param('SpacePoints', 'pxdOnly')
63 
64 spCreatorTest = b2.register_module('SpacePointCreatorTest')
65 spCreatorTest.logging.log_level = b2.LogLevel.DEBUG
66 spCreatorTest.logging.debug_level = 20
67 spCreatorTest.param('NameOfInstance', 'SPTester')
68 # spCreatorTest.param('SpacePoints', 'couplesAllowed')
69 # spCreatorTest.param('AllSpacePointContainers', [ 'pxdOnly'] )
70 spCreatorTest.param('AllSpacePointContainers', ['singlesOnly', 'couplesAllowed', 'pxdOnly'])
71 
72 # Create paths
73 main = b2.create_path()
74 
75 
76 # beam parameters
77 beamparameters = add_beamparameters(main, "Y4S")
78 # beamparameters = add_beamparameters(main, "Y1S")
79 # beamparameters.param("generateCMS", True)
80 # beamparameters.param("smearVertex", False)
81 # beamparameters.param("smearEnergy", False)
82 # print_params(beamparameters)
83 
84 
85 main.add_module(eventinfosetter)
86 main.add_module(eventinfoprinter)
87 main.add_module(gearbox)
88 main.add_module(geometry)
89 main.add_module(evtgeninput)
90 main.add_module(g4sim)
91 main.add_module(pxdDigitizer)
92 main.add_module(pxdClusterizer)
93 main.add_module(svdDigitizer)
94 main.add_module(svdClusterizer)
95 main.add_module(spCreatorSingle)
96 main.add_module(spCreatorCombi)
97 main.add_module(spCreatorPXD)
98 main.add_module(spCreatorTest)
99 
100 # Process events
101 b2.process(main)
102 
103 print('Event Statistics :')
104 print(b2.statistics)