Belle II Software  release-08-01-10
printGeometry.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 import basf2 as b2
13 import sys
14 
15 # ---------------------------------------------------------------------------
16 # Prints all geometry parameters of TOP
17 #
18 # Usage: basf2 top/analysis/printGeometry.py
19 #
20 # Note: print-out is about 2000 lines long
21 # pipe it to less or redirect the output to a file
22 #
23 # The filename of the main xml file can be specified as an optional argument
24 # example: basf2 top/analysis/printGeometry.py top/TOPSpareModule.xml
25 # (hint: omit 'data' from the path)
26 # ---------------------------------------------------------------------------
27 
28 # Suppress messages and warnings for all other packages
29 b2.set_log_level(b2.LogLevel.ERROR)
30 
31 # set DEBUG level for top only to print mappings
32 b2.logging.set_package('top', b2.LogConfig(b2.LogLevel.DEBUG, 10000))
33 
34 # Create path
35 main = b2.create_path()
36 
37 # Set number of events to generate
38 eventinfosetter = b2.register_module('EventInfoSetter')
39 eventinfosetter.param('evtNumList', [1])
40 main.add_module(eventinfosetter)
41 
42 # Gearbox: access to database (xml files)
43 gearbox = b2.register_module('Gearbox')
44 argvs = sys.argv
45 if len(argvs) > 1:
46  fileName = argvs[1]
47  gearbox.param('fileName', fileName)
48 main.add_module(gearbox)
49 
50 # Geometry
51 geometry = b2.register_module('Geometry')
52 geometry.param('useDB', False)
53 geometry.param('components', ['TOP'])
54 main.add_module(geometry)
55 
56 # Process events
57 b2.process(main)