Belle II Software  release-06-02-00
runTOPWaveformQuality.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 # ---------------------------------------------------------------------------------------
13 # Display of waveforms with feature extraction points superimposed
14 # Unpacker is set for Interim FE format v2.1
15 # ---------------------------------------------------------------------------------------
16 
17 # avoid race conditions beetween pyroot and GUI thread
18 from ROOT import PyConfig
19 PyConfig.StartGuiThread = False # noqa
20 from ROOT import gROOT
21 gROOT.SetBatch() # noqa
22 
23 import basf2 as b2
24 
25 import argparse
26 parser = argparse.ArgumentParser(description='Go through a data file, apply calibration, and write the waveforms to a root file.',
27  usage='%(prog)s [options]')
28 
29 # parser.add_argument(
30 # '--inputRun',
31 # metavar='InputRun',
32 # required=True,
33 # help='the name for the input data files.')
34 #
35 args = parser.parse_args()
36 
37 b2.set_log_level(b2.LogLevel.INFO)
38 
39 # Create path
40 main = b2.create_path()
41 
42 # input
43 roinput = b2.register_module('SeqRootInput')
44 main.add_module(roinput)
45 
46 # conversion from RawCOPPER or RawDataBlock to RawTOP
47 converter = b2.register_module('Convert2RawDet')
48 main.add_module(converter)
49 
50 # geometry parameters
51 gearbox = b2.register_module('Gearbox')
52 main.add_module(gearbox)
53 
54 # Geometry (only TOP needed)
55 geometry = b2.register_module('Geometry')
56 geometry.param('components', ['TOP'])
57 main.add_module(geometry)
58 
59 # Unpacking (format auto detection works now)
60 unpack = b2.register_module('TOPUnpacker')
61 main.add_module(unpack)
62 
63 # TOP's data quality module
64 histomanager = b2.register_module("HistoManager")
65 main.add_module(histomanager)
66 wfqp = b2.register_module('TOPWaveformQualityPlotter')
67 main.add_module(wfqp)
68 
69 # Print progress
70 progress = b2.register_module('Progress')
71 main.add_module(progress)
72 
73 # Process events
74 b2.process(main)
75 
76 # Print statistics
77 print(b2.statistics)