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