8 if __name__==
"__main__":
10 parser = argparse.ArgumentParser(prog=
"l1calo-dq-test",description=
"Runs the DQ algorithm for a given histogram",formatter_class=argparse.ArgumentDefaultsHelpFormatter
12 parser.add_argument(
"run",help=
"run number")
13 parser.add_argument(
"hist",help=
"hist path and name")
14 args = parser.parse_args()
16 xx = [f
for f
in subprocess.run([
'l1calo-dq-file',args.run],stdout=subprocess.PIPE).stdout.decode(
"utf-8").
split(
'\n')
if f!=
'']
18 print(
"ERROR, could not get file for run",args.run)
22 h = f.Get(
"run_"+args.run+
"/"+args.hist)
24 print(
"Cannot find histogram:",args.hist)
26 print(
"INPUT HISTOGRAM:",h)
29 cFile = ROOT.TFile(os.path.expandvars(
"$BuildArea/$CMTCONFIG/data/DataQualityConfigurations/collisions_run.hcfg"))
30 conf = cFile.Get(
"top_level").
GetNode(args.hist.rsplit(
'/',1)[0]).GetAssessor(args.hist)
31 cItr = conf.GetAllAlgPars()
32 c = ROOT.dqm_algorithms.tools.SimpleAlgorithmConfig()
33 print(
"DQ ALGORITHM:",conf.GetAlgName())
34 exec(f
"a = ROOT.dqm_algorithms.{conf.GetAlgName()}()")
35 print(
"DQ CONFIGURATION:")
36 while (x := cItr.Next()):
37 print(
" ",x.GetName(),
"=",x.GetValue())
38 c.addParameter(x.GetName(),x.GetValue())
39 cItr = conf.GetAllAlgStrPars()
40 while (x := cItr.Next()):
41 print(
" ",x.GetName(),
"=",x.GetValue())
42 c.addGenericParameter(x.GetName(),x.GetValue())
44 r = a.execute(
"testAlg",h,c)
47 print(
"---------------------")
48 print(
"Status=",r.status_)