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