Belle II Software  release-06-02-00
DBImportChannelMaskTest.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 # --------------------------------------------------------------------------------
13 # Generate a random channel mask for given fraction of dead / fraction of noisy
14 # --------------------------------------------------------------------------------
15 
16 import basf2 as b2
17 from ROOT.Belle2 import TOPDatabaseImporter
18 
19 # define local database with write access
20 b2.use_local_database("localDB/localDB.txt", "localDB", False)
21 
22 # create path
23 main = b2.create_path()
24 
25 # Event info setter - execute single event
26 eventinfosetter = b2.register_module('EventInfoSetter')
27 eventinfosetter.param('evtNumList', [1])
28 main.add_module(eventinfosetter)
29 
30 # Gearbox - access to xml files
31 gearbox = b2.register_module('Gearbox')
32 main.add_module(gearbox)
33 
34 # Geometry
35 geometry = b2.register_module('Geometry')
36 geometry.param('useDB', False)
37 geometry.param('components', ['TOP'])
38 main.add_module(geometry)
39 
40 # process single event
41 b2.process(main)
42 
43 # and then run the importer
44 dbImporter = TOPDatabaseImporter()
45 dbImporter.generateFakeChannelMask(0.0, 0.0)
46 # change these vaulus to increase the fractions of dead/noisy channels
47 # dbImporter.generateFakeChannelMask(0.1, 0.2)