Belle II Software  release-05-01-25
unpackToTOPDigits.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 # ---------------------------------------------------------------------------------------
5 # Unpack raw data to TOPDigits
6 # Usage: basf2 unpackToTOPDigits.py -i <input_file.sroot> -o <output_file.root>
7 # ---------------------------------------------------------------------------------------
8 
9 from basf2 import *
10 
11 # Define a global tag (note: the one given bellow will become out-dated!)
12 use_central_database('data_reprocessing_proc8')
13 
14 # Create path
15 main = create_path()
16 
17 # input
18 roinput = register_module('SeqRootInput')
19 # roinput = register_module('RootInput')
20 main.add_module(roinput)
21 
22 # Initialize TOP geometry parameters (creation of Geant geometry is not needed)
23 main.add_module('TOPGeometryParInitializer')
24 
25 # Unpacking (format auto detection works now)
26 unpack = register_module('TOPUnpacker')
27 main.add_module(unpack)
28 
29 # Convert to TOPDigits
30 converter = register_module('TOPRawDigitConverter')
31 main.add_module(converter)
32 
33 # output
34 output = register_module('RootOutput')
35 output.param('branchNames', ['TOPDigits', 'TOPRawDigits', 'TOPInterimFEInfos',
36  'TOPRawDigitsToTOPInterimFEInfos',
37  # 'TOPRawWaveforms', 'TOPRawWaveformsToTOPInterimFEInfos',
38  # 'TOPRawDigitsToTOPRawWaveforms',
39  ])
40 main.add_module(output)
41 
42 # Print progress
43 progress = register_module('Progress')
44 main.add_module(progress)
45 
46 # Process events
47 process(main)
48 
49 # Print statistics
50 print(statistics)