Belle II Software development
pxd_hot_dead_masking.py
1
8
9'''
10Validation of PXD hot/dead pixel calibration.
11'''
12
13
14from prompt import ValidationSettings
15import sys
16import subprocess
17from glob import glob
18
19
20
21settings = ValidationSettings(name='PXD hot/dead pixel calibration',
22 description=__doc__,
23 download_files=['PXDRawHotPixelMaskCollectordebug.root'],
24 expert_config={})
25
26
27def run_validation(job_path, input_data_path, requested_iov, expert_config):
28 '''
29 Run the validation.
30 '''
31 from conditions_db.testing_payloads import parse_testing_payloads_file
32 txt_files = glob(f"{job_path}/*PXDHot*/outputdb/database.txt")
33 cmds = ["b2pxd-db-check", "--only-hist", "--maps",
34 "PXDMaskedPixelPar", "PXDDeadPixelPar", "PXDOccupancyInfoPar"]
35 for txt_file in txt_files:
36 iov_entries = parse_testing_payloads_file(txt_file)
37 exp = iov_entries[0].firstRun["exp"]
38 run = iov_entries[0].firstRun["run"]
39 cmds_add = ["--tag", txt_file,
40 "--exp", f"{exp}", "--runs", f"{run}-9999",
41 "-o", f"conditions_e{exp}_r{run}.root"]
42 subprocess.run(cmds + cmds_add, check=True)
43
44
45if __name__ == "__main__":
46 run_validation(*sys.argv[1:])