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