Belle II Software  release-08-01-10
printMappings.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 mapping of TOP electronic channels to pixels and to front end mapping
17 # e.g. scrods to slot/boardstacks
18 #
19 # Usage: basf2 top/analysis/printMappings.py
20 #
21 # The filename of the main xml file can be specified as an optional argument
22 # example: basf2 top/analysis/printMappings.py top/TOPSpareModule.xml
23 # (hint: omit 'data' from the path)
24 # ---------------------------------------------------------------------------
25 
26 # Suppress messages and warnings for all other packages
27 b2.set_log_level(b2.LogLevel.ERROR)
28 
29 # set DEBUG level for top only to print mappings
30 b2.logging.set_package('top', b2.LogConfig(b2.LogLevel.DEBUG, 100))
31 
32 # Create path
33 main = b2.create_path()
34 
35 # Set number of events to generate
36 eventinfosetter = b2.register_module('EventInfoSetter')
37 eventinfosetter.param('evtNumList', [1])
38 main.add_module(eventinfosetter)
39 
40 # Gearbox: access to database (xml files)
41 gearbox = b2.register_module('Gearbox')
42 argvs = sys.argv
43 if len(argvs) > 1:
44  fileName = argvs[1]
45  gearbox.param('fileName', fileName)
46 main.add_module(gearbox)
47 
48 # Geometry
49 geometry = b2.register_module('Geometry')
50 geometry.param('useDB', False)
51 geometry.param('components', ['TOP'])
52 main.add_module(geometry)
53 
54 # Process events
55 b2.process(main)