2 from AthenaConfiguration.ComponentFactory
import CompFactory
3 from AthenaCommon.Logging
import logging
7 IOVStart=[0,0],IOVEnd=[0x7FFFFFFF,0xFFFFFFFF]):
9 logger = logging.getLogger(
"LArBadChannelDBAlgCfg" )
10 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
13 if flags.LArCalib.isSC:
15 from LArCabling.LArCablingConfig
import LArOnOffIdMappingSCCfg
19 from LArCabling.LArCablingConfig
import LArOnOffIdMappingCfg
24 if dbname
in (
"LAR",
"LAR_ONL"):
25 folder=
"/LAR/BadChannels/BadChannels"
27 folder=
"/LAR/BadChannelsOfl/BadChannels"
29 if flags.LArCalib.isSC:
33 tag=
"".
join(folder.split(
"/"))+
"-RUN2-Bulk-00"
35 if not tag.startswith(
"LAR"):
36 if not tag.startswith(
"-"): tag=
"-"+tag
37 tag=
"".
join(folder.split(
"/"))+tag
39 logger.info(
"Writing to folder %s, tag %s",folder,tag)
40 theLArBadChannelCondAlgo=CompFactory.LArBadChannelCondAlg(ReadKey=
"",InputFileName=InputFile)
41 if flags.LArCalib.isSC:
42 theLArBadChannelCondAlgo.CablingKey=
"LArOnOffIdMapSC"
43 theLArBadChannelCondAlgo.isSC=
True
45 result.addCondAlgo(theLArBadChannelCondAlgo)
48 theLArDBAlg=CompFactory.LArBadChannelDBAlg()
49 theLArDBAlg.WritingMode = 0
50 theLArDBAlg.DBFolder=folder
51 if flags.LArCalib.isSC:
52 theLArDBAlg.SuperCell=
True
53 result.addEventAlgo(theLArDBAlg)
55 from RegistrationServices.OutputConditionsAlgConfig
import OutputConditionsAlgCfg
57 ObjectList=[
"CondAttrListCollection#"+folder],
59 Run1=IOVStart[0],LB1=IOVStart[1],
60 Run2=IOVEnd[0],LB2=IOVEnd[1]))
65 if __name__==
"__main__":
67 parser= argparse.ArgumentParser()
68 parser.add_argument(
"inputfile")
69 parser.add_argument(
"--loglevel", default=
None, help=
"logging level (ALL, VERBOSE, DEBUG,INFO, WARNING, ERROR, or FATAL")
70 parser.add_argument(
"-r",
"--runnumber",default=0, type=int, help=
"IOV start (runnumber)")
71 parser.add_argument(
"-l",
"--lbnumber",default=0, type=int, help=
"IOV start (LB number)")
72 parser.add_argument(
"--runnumber2",default=0x7FFFFFFF, type=int, help=
"IOV start (runnumber)")
73 parser.add_argument(
"--lbnumber2",default=0xFFFFFFFF, type=int, help=
"IOV start (LB number)")
74 parser.add_argument(
"-o",
"--output",default=
"BadChannels.db", help=
"sqlite output file name")
75 parser.add_argument(
"-f",
"--folder",default=
None, help=
"database folder to create")
76 parser.add_argument(
"-t",
"--tag",default=
None, help=
"folder-level tag (or tag-suffix) to create")
77 parser.add_argument(
"--SC", action=
'store_true', help=
"Work on SuperCells")
80 (args,leftover)=parser.parse_known_args(sys.argv[1:])
83 print(
"ERROR, unhandled argument(s):",leftover)
86 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
87 from LArCalibProcessing.LArCalibConfigFlags
import addLArCalibFlags
91 flags.Input.isMC =
False
92 flags.IOVDb.DatabaseInstance=
"CONDBR2"
93 flags.LAr.doAlign=
False
94 flags.Input.RunNumbers=[args.runnumber
if args.runnumber>0
else 300000]
95 flags.IOVDb.GlobalTag=
"CONDBR2-ES1PA-2022-06"
96 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
97 flags.GeoModel.AtlasVersion=defaultGeometryTags.RUN3
98 flags.LArCalib.isSC=args.SC
100 flags.IOVDb.DBConnection=
"sqlite://;schema="+args.output+
";dbname=CONDBR2"
103 from AthenaCommon
import Constants
104 if hasattr(Constants,args.loglevel):
105 flags.Exec.OutputLevel=getattr(Constants,args.loglevel)
107 raise ValueError(
"Unknown log-level, allowed values are ALL, VERBOSE, DEBUG,INFO, WARNING, ERROR, FATAL")
111 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
114 from McEventSelector.McEventSelectorConfig
import McEventSelectorCfg
116 FirstLB=args.lbnumber,
119 InitialTimeStamp = 0,
120 TimeStampInterval = 1))
126 IOVStart=[args.runnumber,args.lbnumber],
127 IOVEnd=[args.runnumber2,args.lbnumber2]