15 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
18 parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
19 parser.add_argument(
'-r',
"--run", dest=
'run', default=0x7fffffff, help=
"Run number. Default %(default)s.")
20 parser.add_argument(
'-i',
"--indb", dest=
'indb', default=
"COOLONL_LAR/CONDBR2",help=
"Input DB for base constants. Default %(default)s.")
21 parser.add_argument(
'-p',
"--patchdb", dest=
'patchdb', default=
"freshConstantsOnl.db", help=
"Patching DB, from which constants are taken only for the specified region(s). Default %(default)s.")
22 parser.add_argument(
'-o',
"--outdb", dest=
'outdb', default=
"new.db", help=
"Output DB. Default %(default)s.")
23 parser.add_argument(
'-f',
"--folder", dest=
'folder', default=
"/LAR/ElecCalibFlat/OFC", help=
"COOL folder. Default %(default)s.")
24 parser.add_argument(
'-s',
"--issc", dest=
'issc', default=
False, action=
"store_true", help=
"Is this SuperCell Data? Default %(default)s.")
25 parser.add_argument(
'-d',
"--det", dest=
'patchdet', default=[], nargs=
'+', type=int, help=
"Detector to patch. Default %(default)s. EMB = 0, EMEC OW = 1, EMEC IW = 2, HEC = 3, FCAL = 4")
26 parser.add_argument(
'-ft',
"-FT", dest=
'patchFT', default=[], nargs=
'+', type=str, help=
"Feedthrough to patch. Default %(default)s")
27 parser.add_argument(
'-ch', dest=
'patchChan', default=[], nargs=
'+', type=str, help=
"Channel(s) to patch. Default %(default)s")
38 args = parser.parse_args()
39 if help
in args
and args.help
is not None and args.help:
43 filled = [ len(x) > 0
for x
in [args.patchdet, args.patchFT, args.patchChan] ]
45 if filled.count(
True) == 0:
46 print(
"No list of HW to patch was provided! Please provide desired detectors/FTs/channels to patch")
48 elif filled.count(
True) > 1:
49 print(
"Ambiguous options given. Please only provide one unit of HW to patch (detectors/FTs/channels)")
52 if os.path.isfile(args.outdb):
53 print(f
"OUTPUT FILE {args.outdb} ALREADY EXISTS! Please check, and delete it / supply a different output name")
60 if ".db" in args.indb:
61 indb=
"sqlite://;schema="+args.indb+
";dbname=CONDBR2"
64 if ".db" in args.patchdb:
65 patchdb=
"sqlite://;schema="+args.patchdb+
";dbname=CONDBR2"
68 if ".db" in args.outdb:
69 outdb=
"sqlite://;schema="+args.outdb+
";dbname=CONDBR2"
74 sys.argv = sys.argv[:1] + [
'-b']
76 detdescrtag=defaultGeometryTags.RUN3
77 defTag=
"CONDBR2-BLKPA-2024-01"
79 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
81 from LArCalibProcessing.LArCalibConfigFlags
import addLArCalibFlags
83 flags.Input.Files = []
84 flags.Input.TimeStamps = [1000]
85 flags.Input.isMC=
False
86 flags.Input.RunNumbers=[
int(args.run)]
87 flags.IOVDb.DatabaseInstance=
"CONDBR2" if int(args.run)>222222
else "COMP200"
88 flags.IOVDb.GlobalTag=defTag
89 flags.GeoModel.AtlasVersion = detdescrtag
90 flags.LAr.doAlign=
False
92 flags.Exec.OutputLevel=INFO
95 from RootUtils
import PyROOTFixes
96 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
99 from McEventSelector.McEventSelectorConfig
import McEventSelectorCfg
100 cfg.merge (McEventSelectorCfg (flags))
106 from DetDescrCnvSvc.DetDescrCnvSvcConfig
import DetDescrCnvSvcCfg
109 if flags.LArCalib.isSC:
111 from LArCabling.LArCablingConfig
import LArOnOffIdMappingSCCfg
115 from LArCabling.LArCablingConfig
import LArOnOffIdMappingCfg
118 from LArConditionsCommon.LArBlobMergeAlg
import LArBlobMergeAlg
119 theLArMergeAlg=LArBlobMergeAlg(
"LArBlobMergeAlg", fld=args.folder,
123 runnum=
int(args.run),
124 patchdet=args.patchdet,
125 patchFT=args.patchFT,
126 patchChan=args.patchChan,
127 isSC=flags.LArCalib.isSC)
128 cfg.addEventAlgo(theLArMergeAlg)