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