Belle II Software  release-08-01-10
unpack_cdc.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 
17 
18 import basf2 as b2
19 from ROOT import Belle2
20 
21 # Set the log level to show only error and fatal messages
22 b2.set_log_level(b2.LogLevel.INFO)
23 
24 # Set Database
25 b2.reset_database()
26 b2.use_database_chain()
27 b2.use_central_database("Calibration_Offline_Development", b2.LogLevel.INFO)
28 
29 # Input file
30 # Get type of input file to decide, which input module we want to use
31 input_files = Belle2.Environment.Instance().getInputFilesOverride()
32 if not input_files.empty() and input_files.front().endswith(".sroot"):
33  root_input = b2.register_module('SeqRootInput')
34 else:
35  root_input = b2.register_module('RootInput')
36 
37 unpacker = b2.register_module('CDCUnpacker')
38 output = b2.register_module('RootOutput')
39 output.param('outputFileName', 'UnpackerOutput.root')
40 output.param('branchNames', ['CDCHits', 'CDCRawHits'])
41 
42 # Create main path
43 main = b2.create_path()
44 
45 # Add modules to main path
46 main.add_module(root_input)
47 main.add_module(unpacker)
48 main.add_module(output)
49 
50 # Process all events
51 b2.print_path(main)
52 b2.process(main)
53 
54 print(b2.statistics)
static Environment & Instance()
Static method to get a reference to the Environment instance.
Definition: Environment.cc:28