2 from AthenaConfiguration.ComponentFactory
import CompFactory
3 from IOVDbSvc.IOVDbSvcConfig
import addFolders
6 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
9 if flags.LArCalib.isSC:
11 from LArCabling.LArCablingConfig
import LArOnOffIdMappingSCCfg
15 from LArCabling.LArCablingConfig
import LArOnOffIdMappingCfg
20 if dbname
in (
"LAR",
"LAR_ONL"):
21 folder=
"/LAR/BadChannels/BadChannels"
23 folder=
"/LAR/BadChannelsOfl/BadChannels"
25 if flags.LArCalib.isSC:
29 if not tag.startswith(
"LAR"):
30 if not tag.startswith(
"-"): tag=
"-"+tag
31 tag=
"".
join(folder.split(
"/"))+tag
35 result.merge(
addFolders(flags,folder,dbname,tag=tag,
36 className=
"CondAttrListCollection"))
37 theLArBadChannelCondAlgo=CompFactory.LArBadChannelCondAlg(ReadKey=folder)
38 if flags.LArCalib.isSC:
39 theLArBadChannelCondAlgo.CablingKey=
"LArOnOffIdMapSC"
40 theLArBadChannelCondAlgo.isSC=
True
42 result.addCondAlgo(theLArBadChannelCondAlgo)
45 if (
not flags.LArCalib.isSC):
46 from LArBadChannelTool.LArBadFebsConfig
import LArKnownBadFebCfg
49 theLArBadChannels2Ascii=CompFactory.LArBadChannel2Ascii(SkipDisconnected=
True)
50 theLArBadChannels2Ascii.FileName=OutputFile
51 theLArBadChannels2Ascii.WithMissing=
False if (summaryfile==
"" and not flags.LArCalib.isSC)
else True
52 theLArBadChannels2Ascii.ExecutiveSummaryFile=summaryfile
53 theLArBadChannels2Ascii.BFKey=
"LArKnownBadFEBs"
54 if (flags.LArCalib.isSC):
55 theLArBadChannels2Ascii.LArOnOffIdMapKey=
"LArOnOffIdMapSC"
56 theLArBadChannels2Ascii.SuperCell=
True
57 result.addEventAlgo(theLArBadChannels2Ascii)
63 if __name__==
"__main__":
65 parser= argparse.ArgumentParser()
66 parser.add_argument(
"--loglevel", default=
None, help=
"logging level (ALL, VERBOSE, DEBUG,INFO, WARNING, ERROR, or FATAL")
67 parser.add_argument(
"-r",
"--runnumber",default=0x7fffffff, type=int, help=
"run number to query the DB")
68 parser.add_argument(
"-l",
"--lbnumber",default=1, type=int, help=
"LB number to query the DB")
69 parser.add_argument(
"-d",
"--database",default=
"LAR_OFL", help=
"Database name or sqlite file name")
70 parser.add_argument(
"-o",
"--output",default=
"bc_output.txt", help=
"output file name")
71 parser.add_argument(
"-f",
"--folder",default=
None, help=
"database folder to read")
72 parser.add_argument(
"-t",
"--tag",default=
None, help=
"folder-level tag to read")
73 parser.add_argument(
"-s",
"--summary",default=
"", help=
"Executive summary file")
74 parser.add_argument(
"--SC", action=
'store_true', help=
"Work on SuperCells")
76 (args,leftover)=parser.parse_known_args(sys.argv[1:])
79 print(
"ERROR, unhandled argument(s):",leftover)
82 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
83 from LArCalibProcessing.LArCalibConfigFlags
import addLArCalibFlags
87 flags.Input.isMC =
False
88 flags.IOVDb.DatabaseInstance=
"CONDBR2"
89 flags.LAr.doAlign=
False
90 flags.Input.RunNumbers=[args.runnumber]
91 flags.IOVDb.GlobalTag=
"CONDBR2-ES1PA-2023-02"
92 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
93 flags.GeoModel.AtlasVersion=defaultGeometryTags.RUN3
94 flags.LArCalib.isSC=args.SC
97 from AthenaCommon
import Constants
98 if hasattr(Constants,args.loglevel):
99 flags.Exec.OutputLevel=getattr(Constants,args.loglevel)
101 raise ValueError(
"Unknown log-level, allowed values are ALL, VERBOSE, DEBUG,INFO, WARNING, ERROR, FATAL")
105 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
108 from McEventSelector.McEventSelectorConfig
import McEventSelectorCfg
110 FirstLB=args.lbnumber,
113 InitialTimeStamp = 0,
114 TimeStampInterval = 1))
117 dbname=args.database,
120 summaryfile=args.summary))