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