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