Belle II Software  release-08-01-10
cdst_checkT0calibration.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 # ---------------------------------------------------------------------------------------
13 # Check T0 calibration with Bhabha (or dimuon) events. Results in a root file.
14 #
15 # usage: basf2 cdst_checkT0calibration.py -i <cdst_file.root>
16 # ---------------------------------------------------------------------------------------
17 
18 import basf2 as b2
19 from reconstruction import prepare_user_cdst_analysis
20 
21 # global tags
22 # ******************************************************************************************************************
23 # note: The patching global tags and their order are bucket number and basf2 version dependent.
24 # Given below is what is needed for cdst files of bucket 16 calibration and January-2023 development version.
25 # ******************************************************************************************************************
26 b2.conditions.override_globaltags()
27 b2.conditions.append_globaltag('patch_main_release-07_noTOP')
28 b2.conditions.append_globaltag('data_reprocessing_proc13') # experiments 7 - 18
29 # b2.conditions.append_globaltag('data_reprocessing_prompt') # experiments 20 - 26
30 b2.conditions.append_globaltag('online')
31 
32 # Create path
33 main = b2.create_path()
34 
35 # Input: cDST file(s) of Bhabha skim, use -i option
36 # files of bucket 16 can be found on KEKCC in /gpfs/group/belle2/dataprod/Data/PromptReco/bucket16_calib/
37 roinput = b2.register_module('RootInput')
38 main.add_module(roinput)
39 
40 # run unpackers and post-tracking reconstruction
41 prepare_user_cdst_analysis(main)
42 
43 # Calibration checker: for dimuon sample replace 'bhabha' with 'dimuon'
44 calibrator = b2.register_module('TOPChannelT0Calibrator')
45 calibrator.param('sample', 'bhabha')
46 calibrator.param('outputFileName', 'checkT0cal_r*.root')
47 main.add_module(calibrator)
48 
49 # Print progress
50 progress = b2.register_module('Progress')
51 main.add_module(progress)
52 
53 # Process events
54 b2.process(main)
55 
56 # Print statistics
57 print(b2.statistics)