Belle II Software development
t0LaserCalData.py
1#!/usr/bin/env python3
2
3
10
11# -------------------------------------------------------------------------------------------
12# example of generate TOP channel t0 const from TOP digit time with TBC
13# input: "t0mc.root" from TOPChannelT0MC
14# output: "t0datafit_slot<#>.root" fit result
15# "t0const_slot<#>.root" t0 const in root file
16# Usage: basf2 t0LaserCalData.py -i <TOPDigits.root> <slot#>
17# TOPDigits.root is the output file of unpackToTOPDigitsWithTBC.py
18# -------------------------------------------------------------------------------------------
19
20import basf2 as b2
21import sys
22args = sys.argv
23barid = int(args[1])
24
25# Create path
26main = b2.create_path()
27
28# Input
29roinput = b2.register_module('RootInput')
30main.add_module(roinput)
31
32lasercalib = b2.register_module('TOPLaserCalibrator')
33lasercalib.param('dataFitOutput', "t0datafit_slot" + str(args[1]) + ".root")
34lasercalib.param('mcInput', "t0mc.root")
35lasercalib.param('channelT0constant', "t0const_slot" + str(args[1]) + ".root")
36lasercalib.param('barID', barid)
37lasercalib.param('fitMethod', 'cb') # gaus: single gaussian; cb: single Crystal Ball(for MC test); cb2: double Crystal Ball
38lasercalib.param('fitRange', [480, 66, 82]) # fit range[nbins, xmin, xmax]
39lasercalib.param('refCh', 0) # reference channel of t0 constant
40main.add_module(lasercalib)
41
42
43# Show progress of processing
44progress = b2.register_module('Progress')
45main.add_module(progress)
46
47# Process events
48b2.process(main)
49
50# Print call statistics
51print(b2.statistics)