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