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