6 if __name__==
'__main__':
12 parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
13 parser.add_argument(
'-r',
'--run', dest=
'run', default=
'00408918', help=
'Run number string as in input filename', type=str)
14 parser.add_argument(
'-g',
'--gain', dest=
'gain', default=
"MEDIUM", help=
'Gain string', type=str)
15 parser.add_argument(
'-d',
'--insqlitefile', dest=
'insqlitefile', default=
"", help=
'Input sqlite file with PhysWave and PhysAutocorr`', type=str)
16 parser.add_argument(
'-e',
'--outrdir', dest=
'outrdir', default=
"/eos/atlas/atlascerngroupdisk/det-larg/Temp/Weekly/ntuples", help=
'Output root file directory', type=str)
17 parser.add_argument(
'-k',
'--outpdir', dest=
'outpdir', default=
"/eos/atlas/atlascerngroupdisk/det-larg/Temp/Weekly/poolFiles", help=
'Output root file directory', type=str)
18 parser.add_argument(
'-l',
'--outprefix', dest=
'outprefix', default=
"LArPhysOFC", help=
'Output root file name', type=str)
19 parser.add_argument(
'-n',
'--outsqlite', dest=
'outsql', default=
"mysql_physofc.db", help=
'Output sqlite file, in pool output dir.', type=str)
20 parser.add_argument(
'-c',
'--isSC', dest=
'supercells', default=
False, action=
"store_true", help=
'is SC data ?')
21 parser.add_argument(
'-b',
'--badchansqlite', dest=
'badsql', default=
"SnapshotBadChannel.db", help=
'Input sqlite file for bad channels', type=str)
22 parser.add_argument(
'-m',
'--subdet', dest=
'subdet', default=
"EMB", help=
'Subdetector, EMB, EMEC, HEC or FCAL', type=str)
23 parser.add_argument(
'-s',
'--side', dest=
'side', default=
"C", help=
'Detector side empty (means both), C or A', type=str)
25 args = parser.parse_args()
26 if help
in args
and args.help
is not None and args.help:
30 for _, value
in args._get_kwargs():
36 from LArCalibProcessing.LArCalib_OFCPhysConfig
import LArOFCPhysCfg
39 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
42 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
44 from LArCalibProcessing.LArCalibConfigFlags
import addLArCalibFlags
50 flags.LArCalib.Input.Files = [ ]
51 flags.LArCalib.Input.RunNumbers = [
int(args.run),]
52 gainNumMap={
"HIGH":0,
"MEDIUM":1,
"LOW":2}
53 flags.LArCalib.Gain=gainNumMap[args.gain.upper()]
55 flags.LArCalib.Input.Database = args.outpdir +
"/" + args.insqlitefile
58 flags.LArCalib.OFC.Ncoll = 60
61 flags.LArCalib.OFC.UsePhysCalibTDiff =
False
64 flags.LArCalib.isSC = args.supercells
65 flags.LArCalib.Input.SubDet=args.subdet
69 flags.LArCalib.BadChannelDB = args.badsql
72 OutputPoolFileName = args.outprefix+
"_"+args.run
74 OutputPoolFileName +=
"_"+args.subdet
75 OutputPoolFileName +=
".pool.root"
77 idx=OutputPoolFileName.find(
'.pool.root')
79 OutputRootFileName = OutputPoolFileName[0:idx]+
'.root'
81 OutputRootFileName = OutputPoolFileName+
'.root'
83 flags.LArCalib.Output.ROOTFile = args.outrdir +
"/" + OutputRootFileName
84 flags.LArCalib.Output.POOLFile = args.outpdir +
"/" + OutputPoolFileName
85 flags.IOVDb.DBConnection=
"sqlite://;schema="+args.outpdir +
"/" + args.outsql +
";dbname=CONDBR2"
88 flags.IOVDb.GlobalTag =
"LARCALIB-RUN2-00"
90 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
91 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
95 flags.Exec.OutputLevel = INFO
103 cfg.getService(
"MessageSvc").defaultLimit = 9999999
109 cmdline = ([
'/afs/cern.ch/user/l/larcalib/LArDBTools/python/BuildTagHierarchy.py',args.outpdir +
"/" + args.outsql , flags.IOVDb.GlobalTag])
112 subprocess.run(cmdline, check=
True)
113 except Exception
as e:
114 print(
'Could not create tag hierarchy in output sqlite file !!!!')