7 nname = oname.replace(
"-",
"")
8 if nname.startswith(
"S"):
9 return f
"SCAN_S000{nname[1:]}"
11 elif len(oname) == 15
and oname.startswith(
"SCAN_S000"):
15 print(f
"ERROR: Scan name '{oname}' is wrong. Should have for example 'SCAN_S000092961' or 'S092-961' format")
18 if __name__==
"__main__":
21 parser = argparse.ArgumentParser(prog=
'python -m PixelCalibAlgs.IBLCalibrationConfig',
22 description=
"""Calibration tool for IBL.\n\n
23 Example: python -m PixelCalibAlgs.IBLCalibrationConfig --folder "global/path/to/folder/"
24 --thr "threshold_file"
25 --totLowQ "totLowCharge_file"
26 --totHisDis "totHisDisConfig_file"
27 [--runCal --skipPlots]""")
29 parser.add_argument(
'--folder' , type=str, default=
"/eos/atlas/atlascerngroupdisk/det-pix/p1/scan-data/", help=
"Directory path to the files")
30 parser.add_argument(
'--thr' , required=
True, help=
"Format must be \"SCAN_SXXXXXXXXX\" or \"SXXX-XXX\" - THRESHOLD_SCAN (0Preset_full)")
31 parser.add_argument(
'--totLowQ' , required=
True, help=
"Format must be \"SCAN_SXXXXXXXXX\" or \"SXXX-XXX\" - TOT_CALIB (0Preset_lowcharge) ")
32 parser.add_argument(
'--totHisDis' , required=
True, help=
"Format must be \"SCAN_SXXXXXXXXX\" or \"SXXX-XXX\" - TOT_CALIB (0Preset_lowcharge_HisDisConfig)")
33 parser.add_argument(
'--tag' , type=str, default=
"PixelChargeCalibration-DATA-RUN2-UPD4-28", help=
"Tag in order to read the DB")
34 parser.add_argument(
'--runCal' , action=
'store_true', help=
"Runs only the IBL Calibration layer")
35 parser.add_argument(
'--skipPlots' , action=
'store_true', help=
"Skips the plotting step - Slower the running time")
37 args = parser.parse_args()
44 print(
"Running IBLCalibration layers..")
45 command =
'IBLCalibration directory_path=' + args.folder +
' THR=' + args.thr +
' TOT_HISDIS=' + args.totHisDis +
' TOT_LOWQ=' + args.totLowQ
46 print(
"Command: %s\n" % command)
48 stdout, stderr = subprocess.Popen(command, shell=
True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
49 print(
"OUTPUT: \n%s" % (stdout.decode(
'ascii')))
50 print(
"ERRORS: %s" % (
"NONE" if stderr.decode(
'ascii')==
'' else "\n"+stderr.decode(
'ascii')))
55 print(
"IBLCalibration.cxx execution CRASHED - Please check\n",e)
62 print(
"Jobs finished")
65 print(
"Creating Reference file..")
67 command =
'MakeReferenceFile tagName=%s' % (args.tag)
68 print(
"Command: %s\n" % command)
69 (subprocess.Popen(command, shell=
True)).communicate()
73 print(
"Jobs finished")
76 from PixelCalibAlgs.CheckValues
import CheckThresholdsIBL
79 print(
"Validation new vs. previous calibration.")
81 from PixelCalibAlgs.EvoMonitoring
import setupRunEvo
82 setupRunEvo(
"ChargeCalib_ToTbin1_FrtEnd2_"+args.totHisDis+
".TXT", args.tag+
".log" )
86 print(
"Jobs finished")