Belle II Software development
unpackToTOPDigits.py
1#!/usr/bin/env python
2
3
10
11# ---------------------------------------------------------------------------------------
12# Unpack raw data to TOPDigits
13# Usage: basf2 unpackToTOPDigits.py -i <input_file.root> -o <output_file.root>
14# ---------------------------------------------------------------------------------------
15
16import basf2 as b2
17
18# Define a global tag
19b2.conditions.override_globaltags()
20b2.conditions.append_globaltag('online')
21
22# Create path
23main = b2.create_path()
24
25# input
26# roinput = b2.register_module('SeqRootInput') # sroot files
27roinput = b2.register_module('RootInput') # root files
28main.add_module(roinput)
29
30# Initialize TOP geometry parameters (creation of Geant geometry is not needed)
31main.add_module('TOPGeometryParInitializer')
32
33# Unpacking (format auto detection works now)
34unpack = b2.register_module('TOPUnpacker')
35main.add_module(unpack)
36
37# Convert to TOPDigits
38converter = b2.register_module('TOPRawDigitConverter')
39main.add_module(converter)
40
41# output
42output = b2.register_module('RootOutput')
43output.param('branchNames', ['TOPDigits', 'TOPRawDigits', 'TOPProductionEventDebugs',
44 'TOPProductionHitDebugs', 'TOPRawDigitsToTOPProductionHitDebugs',
45 # 'TOPRawWaveforms', 'TOPRawDigitsToTOPRawWaveforms',
46 ])
47main.add_module(output)
48
49# Print progress
50progress = b2.register_module('Progress')
51main.add_module(progress)
52
53# Process events
54b2.process(main)
55
56# Print statistics
57print(b2.statistics)