6 if __name__==
'__main__':
12 parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
14 parser.add_argument(
'-r',
'--run', dest=
'run', default=
'00408920', help=
'Run number string as in input filename', type=str)
15 parser.add_argument(
'-g',
'--gain', dest=
'gain', default=
"MEDIUM", help=
'Gain string', type=str)
16 parser.add_argument(
'-p',
'--partition', dest=
'partition', default=
"Em", help=
'Data taking partition string', type=str)
17 parser.add_argument(
'-f',
'--fileprefix', dest=
'fprefix', default=
"data24_calib", help=
'File prefix string', type=str)
18 parser.add_argument(
'-i',
'--indirprefix', dest=
'dprefix', default=
"/eos/atlas/atlastier0/rucio/", help=
'Input directory prefix string', type=str)
19 parser.add_argument(
'-d',
'--indir', dest=
'indir', default=
"", help=
'Full input dir string', type=str)
20 parser.add_argument(
'-t',
'--trigger', dest=
'trig', default=
'calibration_', help=
'Trigger string in filename', type=str)
21 parser.add_argument(
'-o',
'--outrprefix', dest=
'outrprefix', default=
"LArRamp", help=
'Prefix of output ramp root filename', type=str)
22 parser.add_argument(
'-j',
'--outpprefix', dest=
'outpprefix', default=
"LArRamp", help=
'Prefix of output ramp pool filename', type=str)
23 parser.add_argument(
'-e',
'--outrdir', dest=
'outrdir', default=
"/eos/atlas/atlascerngroupdisk/det-larg/Temp/Weekly/ntuples", help=
'Output root file directory', type=str)
24 parser.add_argument(
'-k',
'--outpdir', dest=
'outpdir', default=
"/eos/atlas/atlascerngroupdisk/det-larg/Temp/Weekly/poolFiles", help=
'Output pool file directory', type=str)
25 parser.add_argument(
'-u',
'--inpsqlite', dest=
'inpsql', default=
"mysql.db", help=
'Input sqlite file with pedestals, in pool output dir.', type=str)
26 parser.add_argument(
'-l',
'--inofcsqlite', dest=
'inofcsql', default=
"mysql_delay.db", help=
'Input sqlite file with ofcs, in pool output dir', type=str)
27 parser.add_argument(
'-n',
'--outsqlite', dest=
'outsql', default=
"mysql_ramp.db", help=
'Output sqlite file, in pool output dir.', type=str)
28 parser.add_argument(
'-m',
'--subdet', dest=
'subdet', default=
"EMB", help=
'Subdetector, EMB, EMEC, HEC or FCAL', type=str)
29 parser.add_argument(
'-s',
'--side', dest=
'side', default=
"C", help=
'Detector side empty (means both), C or A', type=str)
30 parser.add_argument(
'-c',
'--isSC', dest=
'supercells', default=
False, action=
"store_true", help=
'is SC data ?')
31 parser.add_argument(
'-a',
'--isRawdata', dest=
'rawdata', default=
False, action=
"store_true", help=
'is raw data ?')
32 parser.add_argument(
'-b',
'--badchansqlite', dest=
'badsql', default=
"SnapshotBadChannel.db", help=
'Output sqlite file, in pool output dir.', type=str)
33 parser.add_argument(
'-x',
'--ignoreBarrel', dest=
'ignoreB', default=
False, action=
"store_true", help=
'ignore Barrel channels ?')
34 parser.add_argument(
'-v',
'--ignoreEndcap', dest=
'ignoreE', default=
False, action=
"store_true", help=
'ignore Endcap channels ?')
35 parser.add_argument(
'-w',
'--doValid', dest=
'doValid', default=
False, action=
"store_true", help=
'run vcalidation ?')
36 parser.add_argument(
'--FW6', dest=
'fw6', default=
False, help=
'Is it for fw v. 6', action=
'store_true')
37 parser.add_argument(
'--EMF', dest=
'emf', default=
False, help=
'Is it for EMF', action=
'store_true')
40 args = parser.parse_args()
41 if help
in args
and args.help
is not None and args.help:
45 for _, value
in args._get_kwargs():
50 args.run = args.run.zfill(8)
56 gain=args.gain.lower().capitalize()
58 if not args.supercells:
59 partstr = args.partition
61 partstr = args.partition+
"-DT"
66 InputDir = args.dprefix+args.fprefix+
"/calibration_LArElec-Ramp-32s-"+gain+
"-"+partstr+
"/"+args.run+
"/"+args.fprefix+
"."+args.run+
".calibration_LArElec-Ramp-32s-"+gain+
"-"+partstr+
".daq.RAW/"
68 InputDir = args.dprefix+args.fprefix+
"/calibration_LArElec-Ramp-7s-"+gain+
"-"+partstr+
"/"+args.run+
"/"+args.fprefix+
"."+args.run+
".calibration_LArElec-Ramp-7s-"+gain+
"-"+partstr+
".daq.RAW/"
72 from LArCalibProcessing.LArCalib_RampConfig
import LArRampCfg
75 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
78 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
79 from LArCalibProcessing.LArCalibConfigFlags
import addLArCalibFlags
85 flags.LArCalib.Input.Dir = InputDir
86 flags.LArCalib.Input.Type = args.trig
87 flags.LArCalib.Input.RunNumbers = [
int(args.run),]
88 flags.LArCalib.Input.Database = args.outpdir +
"/" +args.inpsql
89 if 'db' in args.inofcsql:
90 flags.LArCalib.Input.Database2 = args.outpdir +
"/" +args.inofcsql
92 flags.LArCalib.Input.Database2 = args.inofcsql
93 gainNumMap={
"HIGH":0,
"MEDIUM":1,
"LOW":2}
94 flags.LArCalib.Gain=gainNumMap[args.gain.upper()]
97 flags.Input.Files=flags.LArCalib.Input.Files
99 print (
"Input files to be processed:")
100 for f
in flags.Input.Files:
103 if len(flags.Input.Files) == 0 :
104 print(
"Unable to find any input files. Please check the input directory:",InputDir)
109 if not flags.LArCalib.isSC:
110 if args.subdet ==
'EMB' or args.subdet ==
'EMEC':
111 flags.LArCalib.Input.SubDet=
"EM"
113 flags.LArCalib.Input.SubDet=args.subdet
116 flags.LArCalib.Preselection.Side = [0,1]
117 elif args.side ==
"C":
118 flags.LArCalib.Preselection.Side = [0]
119 elif args.side ==
"A":
120 flags.LArCalib.Preselection.Side = [1]
122 print(
"unknown side ",args.side)
125 if args.subdet !=
"EM":
126 if args.subdet ==
'EMB':
127 flags.LArCalib.Preselection.BEC = [0]
129 flags.LArCalib.Preselection.BEC = [1]
131 if args.subdet ==
'FCAL':
132 flags.LArCalib.Preselection.FT = [6]
133 elif args.subdet ==
'HEC':
134 flags.LArCalib.Preselection.FT = [3,10,16,22]
135 elif args.subdet ==
'HECFCAL':
136 flags.LArCalib.Preselection.FT = [3,6,10,16,22]
140 flags.LArCalib.BadChannelDB = args.outpdir +
"/" + args.badsql
143 OutputRampRootFileName = args.outrprefix +
"_" + args.run
144 OutputRampPoolFileName = args.outpprefix +
"_" + args.run
146 if args.subdet !=
"" and not flags.LArCalib.isSC:
147 OutputRampRootFileName +=
"_"+args.subdet
148 OutputRampPoolFileName +=
"_"+args.subdet
149 if flags.LArCalib.Input.SubDet==
"EM":
150 OutputRampRootFileName += args.side
151 OutputRampPoolFileName += args.side
153 OutputRampRootFileName +=
".root"
154 OutputRampPoolFileName +=
".pool.root"
156 flags.LArCalib.Output.ROOTFile = args.outrdir +
"/" + OutputRampRootFileName
157 flags.LArCalib.Output.POOLFile = args.outpdir +
"/" + OutputRampPoolFileName
158 flags.IOVDb.DBConnection=
"sqlite://;schema="+args.outpdir +
"/" + args.outsql +
";dbname=CONDBR2"
161 flags.IOVDb.GlobalTag =
"LARCALIB-RUN2-00"
163 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
164 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
167 if flags.LArCalib.isSC:
168 flags.LArCalib.doValidation= args.doValid
170 flags.LArCalib.doValidation=
True
175 flags.Exec.OutputLevel = INFO
179 from AthenaConfiguration.Enums
import LHCPeriod
180 flags.GeoModel.Run = LHCPeriod.Run3
184 flags.IOVDb.SqliteInput=
"/afs/cern.ch/user/p/pavol/public/EMF_otherCond.db"
185 flags.IOVDb.SqliteFolders = (
"/LAR/BadChannelsOfl/BadChannelsSC",
"/LAR/BadChannels/BadChannelsSC",
"/LAR/Identifier/OnOffIdMap",)
194 cfg.getService(
"MessageSvc").debugLimit = 9999999
212 from IOVDbSvc.IOVDbSvcConfig
import addOverride
213 cfg.merge(
addOverride(flags,
"/LAR/Identifier/LatomeMapping",
"LARIdentifierLatomeMapping-fw6"))
218 cfg.getEventAlgo(
"LArRawSCCalibDataReadingAlg").LATOMEDecoder.IgnoreBarrelChannels=args.ignoreB
220 cfg.getEventAlgo(
"LArRawSCCalibDataReadingAlg").LATOMEDecoder.IgnoreEndcapChannels=args.ignoreE
222 cfg.getService(
"IOVDbSvc").DBInstance=
""
225 cfg.getService(
"MessageSvc").debugLimit = 99999999
232 cmdline = ([
'/afs/cern.ch/user/l/larcalib/LArDBTools/python/BuildTagHierarchy.py',args.outpdir +
"/" + args.outsql , flags.IOVDb.GlobalTag])
235 subprocess.run(cmdline, check=
True)
236 except Exception
as e:
237 print(
'Could not create tag hierarchy in output sqlite file !!!!')