Belle II Software  release-08-01-10
checkUnpacking.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 # ---------------------------------------------------------------------------------------
13 # Checks the unpacking of raw data
14 # Usage: basf2 checkUnpacking.py -i <file_name.root> [<debug_level>]
15 # debug_level 21: to print additional information on errors
16 # debug_level 22: to print buffer sizes and additional information on errors
17 # ---------------------------------------------------------------------------------------
18 
19 import basf2 as b2
20 import sys
21 
22 debuglevel = 0
23 argvs = sys.argv
24 if len(argvs) > 1:
25  debuglevel = int(argvs[1])
26 
27 # Define a global tag
28 b2.conditions.override_globaltags()
29 b2.conditions.append_globaltag('online')
30 
31 # Create path
32 main = b2.create_path()
33 
34 # input
35 # roinput = b2.register_module('SeqRootInput') # sroot files
36 roinput = b2.register_module('RootInput') # root files
37 main.add_module(roinput)
38 
39 # conversion from RawCOPPER or RawDataBlock to RawDetector objects (needed if PocketDAQ)
40 converter = b2.register_module('Convert2RawDet')
41 main.add_module(converter)
42 
43 # Initialize TOP geometry parameters (creation of Geant geometry is not needed)
44 main.add_module('TOPGeometryParInitializer')
45 
46 # Unpacking (format auto detection works now)
47 unpack = b2.register_module('TOPUnpacker')
48 unpack.logging.log_level = b2.LogLevel.DEBUG
49 unpack.logging.debug_level = debuglevel
50 main.add_module(unpack)
51 
52 # Print progress
53 progress = b2.register_module('Progress')
54 main.add_module(progress)
55 
56 # Process events
57 b2.process(main)
58 
59 # Print statistics
60 print(b2.statistics)