Belle II Software  release-06-02-00
Calibration.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 import sys
13 
14 import basf2
15 from ROOT.Belle2 import KLMTimeAlgorithm
16 from klm_calibration_utils import get_time_pre_collector_path
17 from prompt.calibrations.caf_klm_time import get_collector
18 from caf.framework import CAF, Calibration, Collection
19 from caf import backends
20 
21 basf2.set_log_level(basf2.LogLevel.INFO)
22 
23 input_files = sys.argv[1:]
24 
25 # Create KLM time calibration.
26 # To run on data, add global tags using cal_klm.use_central_database()
27 # and, if necessary, cal_klm.use_local_database(). The same chain must be
28 # set up for collector using collection_cdst.use_central_database() and
29 # collection_cdst.use_local_database(). Also disable MC setting for
30 # the algorithm by commenting the line algorithm.setMC(True) or changing
31 # True to False. The raw CDST format should be turned on in
32 # get_time_pre_collector_path().
33 algorithm = KLMTimeAlgorithm()
34 algorithm.setMC(True)
35 algorithm.setMinimalDigitNumber(0)
36 cal_klm = Calibration(name='KLMTime', algorithms=algorithm)
37 
38 coll_cdst = get_collector('hlt_mumu', 'klmTime')
39 rec_path_cdst = get_time_pre_collector_path(muon_list_name='klmTime', mc=True)
40 collection_cdst = Collection(collector=coll_cdst,
41  input_files=input_files,
42  pre_collector_path=rec_path_cdst)
43 cal_klm.add_collection(name='cdst', collection=collection_cdst)
44 
45 # Create and run calibration framework.
46 framework = CAF()
47 framework.backend = backends.LSF()
48 framework.add_calibration(cal_klm)
49 framework.run()