Belle II Software development
SVDCalibrationMonitor.py
1#!/usr/bin/env python
2
3
10
11"""
12SVD Local Calibration Monitor Script
13usage:
14> open this file and edit the file:
15. GLOBAL_TAG = xxx
16. you can add also a local database uncommenting the relative line
17Then execute the script:
18> basf2 SVDLocalCalibrationMonitor.py --exp EXP --run RUN --local --cluster --cog
19where:
20local -> local calibration (from xml)
21cluster -> cluster parameters
22cog -> cog calibration parameters
23"""
24
25import basf2 as b2
26import argparse
27
28
29parser = argparse.ArgumentParser(description="SVD Calibration Monitor")
30parser.add_argument('--exp', metavar='expNumber', dest='exp', type=int, nargs=1, help='Experiment Number')
31parser.add_argument('--run', metavar='runNumber', dest='run', type=int, nargs=1, help='Run Number')
32parser.add_argument('--local', dest='doLocal', action='store_const', const=True,
33 default=False, help='produce Local Calibration Monitor plots')
34parser.add_argument('--cog6', dest='doCoG6', action='store_const', const=True,
35 default=False, help='produce CoG6 Calibration Monitor plots')
36parser.add_argument('--cog3', dest='doCoG3', action='store_const', const=True,
37 default=False, help='produce CoG3 Calibration Monitor plots')
38parser.add_argument('--els3', dest='doELS3', action='store_const', const=True,
39 default=False, help='produce ELS3 Calibration Monitor plots')
40parser.add_argument('--cluster', dest='doCluster', action='store_const', const=True,
41 default=False, help='produce Cluster Calibration Monitor plots')
42parser.print_help()
43print('')
44args = parser.parse_args()
45RunList = args.run
46ExpList = args.exp
47
48
49b2.conditions.prepend_globaltag("online")
50b2.conditions.prepend_globaltag("svd_basic")
51b2.conditions.prepend_globaltag("data_reprocessing_prompt")
52b2.conditions.prepend_globaltag("svd_onlySVDinGeoConfiguration")
53
54myLocalDB = None
55
56if myLocalDB is not None:
57 b2.conditions.testing_payloads = [str(myLocalDB)]
58else:
59 b2.B2INFO("No local DB provided, monitoring payloads from GTs.")
60
61if myLocalDB is not None:
62 filenameLocal = "SVDLocalCalibrationMonitor_experiment" + \
63 str(ExpList[0]) + "_run" + str(RunList[0]) + "_fromLocalDB" + str(myLocalDB) + ".root"
64 filenameCoG = "SVDCoGTimeCalibrationMonitor_experiment" + \
65 str(ExpList[0]) + "_run" + str(RunList[0]) + "_fromLocalDB" + str(myLocalDB) + ".root"
66 filenameCluster = "SVDClusterCalibrationMonitor_experiment" + \
67 str(ExpList[0]) + "_run" + str(RunList[0]) + "_fromLocalDB" + str(myLocalDB) + ".root"
68else:
69 filenameLocal = "SVDLocalCalibrationMonitor_experiment" + str(ExpList[0]) + "_run" + str(RunList[0]) + ".root"
70 filenameCoG6 = "SVDCoG6TimeCalibrationMonitor_experiment" + str(ExpList[0]) + "_run" + str(RunList[0]) + ".root"
71 filenameCoG3 = "SVDCoG3TimeCalibrationMonitor_experiment" + str(ExpList[0]) + "_run" + str(RunList[0]) + ".root"
72 filenameELS3 = "SVDELS3TimeCalibrationMonitor_experiment" + str(ExpList[0]) + "_run" + str(RunList[0]) + ".root"
73 filenameCluster = "SVDClusterCalibrationMonitor_experiment" + str(ExpList[0]) + "_run" + str(RunList[0]) + ".root"
74
75main = b2.create_path()
76
77eventinfosetter = b2.register_module('EventInfoSetter')
78eventinfosetter.param({'evtNumList': [1], 'expList': ExpList, 'runList': RunList})
79main.add_module(eventinfosetter)
80main.add_module("Gearbox")
81main.add_module("Geometry")
82
83# add calibration monitor modules
84if args.doLocal:
85 local = b2.register_module('SVDLocalCalibrationsMonitor')
86 local. param('outputFileName', filenameLocal)
87 main.add_module(local)
88
89if args.doCoG6:
90 time = b2.register_module('SVDTimeCalibrationsMonitor')
91 time.set_name("SVDTimeCalibrationsMonitor_CoG6")
92 time.param('outputFileName', filenameCoG6)
93 time.param('timeAlgo', "CoG6")
94 main.add_module(time)
95
96if args.doCoG3:
97 time = b2.register_module('SVDTimeCalibrationsMonitor')
98 time.set_name("SVDTimeCalibrationsMonitor_CoG3")
99 time.param('outputFileName', filenameCoG3)
100 time.param('timeAlgo', "CoG3")
101 main.add_module(time)
102
103if args.doELS3:
104 time = b2.register_module('SVDTimeCalibrationsMonitor')
105 time.set_name("SVDTimeCalibrationsMonitor_ELS3")
106 time.param('outputFileName', filenameELS3)
107 time.param('timeAlgo', "ELS3")
108 main.add_module(time)
109
110if args.doCluster:
111 cluster = b2.register_module('SVDClusterCalibrationsMonitor')
112 cluster. param('outputFileName', filenameCluster)
113 main.add_module(cluster)
114
115# process single event
116b2.print_path(main)
117b2.process(main)