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