Belle II Software  release-06-01-15
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.sroot> -o <output_file.root>
15 # ---------------------------------------------------------------------------------------
16 
17 import basf2 as b2
18 
19 # Define a global tag (note: the one given bellow will become out-dated!)
20 b2.use_central_database('data_reprocessing_proc8')
21 
22 # Create path
23 main = b2.create_path()
24 
25 # input
26 roinput = b2.register_module('SeqRootInput')
27 # roinput = register_module('RootInput')
28 main.add_module(roinput)
29 
30 # Initialize TOP geometry parameters (creation of Geant geometry is not needed)
31 main.add_module('TOPGeometryParInitializer')
32 
33 # Unpacking (format auto detection works now)
34 unpack = b2.register_module('TOPUnpacker')
35 main.add_module(unpack)
36 
37 # Convert to TOPDigits
38 converter = b2.register_module('TOPRawDigitConverter')
39 main.add_module(converter)
40 
41 # output
42 output = b2.register_module('RootOutput')
43 output.param('branchNames', ['TOPDigits', 'TOPRawDigits', 'TOPInterimFEInfos',
44  'TOPRawDigitsToTOPInterimFEInfos',
45  # 'TOPRawWaveforms', 'TOPRawWaveformsToTOPInterimFEInfos',
46  # '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)