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