3from AthenaConfiguration.ComponentFactory
import CompFactory
5from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator,ConfigurationError
6from IOVDbSvc.IOVDbSvcConfig
import IOVDbSvcCfg,addFolderList, getSqliteContent
11LArDAC2uASymAlg = CompFactory.getComp(
"LArSymConditionsAlg<LArDAC2uAMC, LArDAC2uASym>")
12LArMinBiasAverageSymAlg = CompFactory.getComp(
"LArSymConditionsAlg<LArMinBiasAverageMC, LArMinBiasAverageSym>")
13LArMinBiasSymAlg = CompFactory.getComp(
"LArSymConditionsAlg<LArMinBiasMC, LArMinBiasSym>")
14LArNoiseSymAlg = CompFactory.getComp(
"LArSymConditionsAlg<LArNoiseMC, LArNoiseSym>")
15LArRampSymAlg = CompFactory.getComp(
"LArSymConditionsAlg<LArRampMC, LArRampSym>")
16LArfSamplSymAlg = CompFactory.getComp(
"LArSymConditionsAlg<LArfSamplMC, LArfSamplSym>")
17LArAutoCorrSymAlg = CompFactory.getComp(
"LArSymConditionsAlg<LArAutoCorrMC, LArAutoCorrSym>")
18LAruA2MeVSymAlg = CompFactory.getComp(
"LArSymConditionsAlg<LAruA2MeVMC, LAruA2MeVSym>")
19LArShapeSymAlg = CompFactory.getComp(
"LArSymConditionsAlg<LArShape32MC, LArShape32Sym>")
20LArMPhysOverMcalSymAlg = CompFactory.getComp(
"LArSymConditionsAlg<LArMphysOverMcalMC, LArMphysOverMcalSym>")
23LArHVScaleCorrCondFlatAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArHVScaleCorrFlat>")
24LAruA2MeVCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LAruA2MeVFlat>")
25LArDAC2uACondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArDAC2uAFlat>")
26LArPedestalCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArPedestalFlat>")
27LArRampCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArRampFlat>")
28LArMphysOverMcalCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArMphysOverMcalFlat>")
29LArOFCCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArOFCFlat>")
30LArShapeCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArShapeFlat>")
31LArNoiseCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArNoiseFlat>")
33LArHVScaleCorrSCCondFlatAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArHVScaleCorrSC>")
34LArDAC2uASCCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArDAC2uASC>")
35LArRampSCCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArRampSC>")
36LAruA2MeVSCCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LAruA2MeVSC>")
37LArfSamplSCCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArfSamplSC>")
38LArShapeSCCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArShapeSC>")
39LArPedestalSCCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArPedestalSC>")
40LArNoiseSCCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArNoiseSC>")
41LArMinBiasSCCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArMinBiasSC>")
42LArAutoCorrSCCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArAutoCorrSC>")
43LArPileupAverageSCCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArMinBiasAverageSC>")
44LArMphysOverMcalSCCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArMphysOverMcalSC>")
45LArOFCSCCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArOFCSC>")
49 from AthenaConfiguration.Enums
import LHCPeriod
54 if flags.GeoModel.Run
is LHCPeriod.Run4
and flags.IOVDb.UseCREST
and flags.IOVDb.GlobalTag
not in (
'COND-MC21-SDR-RUN4-05',
'COND-MC21-SDR-RUN4-CHAI-06',
55 'CREST-BLKPA-2025-04',
'CREST-DCS-01',
'CREST-HLTP-2024-02',
56 'CREST-HLTP-2025-01',
'CREST-HLTP-202500',
'CREST-HLTP-2026-01',
57 'CREST-HLTP-2026-02',
'CREST-HLTP-TEST',
'CREST-MC21-SDR-RUN4-03',
64 if flags.GeoModel.Run < LHCPeriod.Run2 :
75 sqliteFolders=getSqliteContent(flags.IOVDb.SqliteInput,flags.IOVDb.SqliteFolders,flags.IOVDb.DatabaseInstance)
77 _larCondDBFoldersDataR2 = {
"Ramp":(
"LArRamp",
"/LAR/ElecCalibFlat/Ramp", LArRampCondAlg ),
78 "DAC2uA":(
"LArDAC2uA",
"/LAR/ElecCalibFlat/DAC2uA",LArDAC2uACondAlg),
79 "Pedestal":(
"LArPedestal",
"/LAR/ElecCalibFlat/Pedestal",LArPedestalCondAlg),
80 "uA2MeV":(
"LAruA2MeV",
"/LAR/ElecCalibFlat/uA2MeV", LAruA2MeVCondAlg),
81 "MphysOverMcal":(
"LArMphysOverMcal",
"/LAR/ElecCalibFlat/MphysOverMcal",LArMphysOverMcalCondAlg),
82 "OFC":(
"LArOFC",
"/LAR/ElecCalibFlat/OFC",LArOFCCondAlg),
83 "Shape":(
"LArShape",
"/LAR/ElecCalibFlat/Shape",LArShapeCondAlg),
84 "HVScaleCorr":(
"LArHVScaleCorr",
"/LAR/ElecCalibFlat/HVScaleCorr",LArHVScaleCorrCondFlatAlg),
85 "fSampl":(
"LArfSamplSym",
"/LAR/ElecCalibMC/fSampl",LArfSamplSymAlg),
88 result=IOVDbSvcCfg(flags)
89 iovDbSvc=result.getService(
"IOVDbSvc")
90 condLoader=result.getCondAlgo(
"CondInputLoader")
92 for condData
in condObjs:
94 outputKey,fldr,calg=_larCondDBFoldersDataR2[condData]
96 raise ConfigurationError(
"No conditions data %s found for Run-2 data" % condData)
98 if fldr
in sqliteFolders:
99 sqlite=sqliteFolders[fldr]
104 persClass=
"CondAttrListCollection"
106 if flags.LAr.OFCShapeFolder
and condData ==
"OFC":
107 fldr=
"/LAR/ElecCalibOfl/OFC/PhysWave/RTM/"+flags.LAr.OFCShapeFolder
108 dbString=sqlite
or "<db>COOLOFL_LAR/CONDBR2</db>"
109 persClass=
"LArOFCComplete"
111 elif flags.LAr.OFCShapeFolder
and condData ==
"Shape":
112 fldr=
"/LAR/ElecCalibOfl/Shape/RTM/"+flags.LAr.OFCShapeFolder
113 dbString=sqlite
or "<db>COOLOFL_LAR/CONDBR2</db>"
114 persClass=
"LArShapeComplete"
116 elif condData ==
"fSampl":
117 if not flags.Overlay.DataOverlay:
118 raise ConfigurationError(
"fSampl is only supported for data overlay")
119 dbString=
"<db>COOLOFL_LAR/OFLP200</db>"
120 persClass=
"LArfSamplMC"
121 result.addCondAlgo(CompFactory.LArMCSymCondAlg(ReadKey=
"LArOnOffIdMap"))
122 result.addCondAlgo(calg(ReadKey=
"LArfSampl", WriteKey=outputKey))
125 dbString=sqlite
or "<db>COOLONL_LAR/CONDBR2</db>"
127 iovDbSvc.Folders.append(fldr+dbString)
128 condLoader.Load.add((persClass,fldr))
130 result.addCondAlgo(calg (ReadKey=fldr, WriteKey=outputKey))
136 sqliteFolders=getSqliteContent(flags.IOVDb.SqliteInput,tuple(flags.IOVDb.SqliteFolders),flags.IOVDb.DatabaseInstance)
138 _larCondDBFoldersDataSC = {
"Ramp":(
"LArRampSC",
"/LAR/ElecCalibFlatSC/Ramp", LArRampSCCondAlg ),
139 "DAC2uA":(
"LArDAC2uASC",
"/LAR/ElecCalibFlatSC/DAC2uA",LArDAC2uASCCondAlg),
140 "Pedestal":(
"LArPedestalSC",
"/LAR/ElecCalibFlatSC/Pedestal",LArPedestalSCCondAlg),
141 "uA2MeV":(
"LAruA2MeVSC",
"/LAR/ElecCalibFlatSC/uA2MeV", LAruA2MeVSCCondAlg),
142 "MphysOverMcal":(
"LArMphysOverMcalSC",
"/LAR/ElecCalibFlatSC/MphysOverMcal",LArMphysOverMcalSCCondAlg),
143 "OFC":(
"LArOFCSC",
"/LAR/ElecCalibFlatSC/OFC",LArOFCSCCondAlg),
144 "Shape":(
"LArShapeSC",
"/LAR/ElecCalibFlatSC/Shape",LArShapeSCCondAlg),
145 "HVScaleCorr":(
"LArHVScaleCorrSC",
"/LAR/ElecCalibFlatSC/HVScaleCorr",LArHVScaleCorrSCCondFlatAlg),
146 "fSampl":(
"LArfSamplSC",
"/LAR/ElecCalibMCSC/fSampl",LArfSamplSCCondAlg),
149 result=IOVDbSvcCfg(flags)
150 iovDbSvc=result.getService(
"IOVDbSvc")
151 condLoader=result.getCondAlgo(
"CondInputLoader")
153 for condData
in condObjs:
155 outputKey,fldr,calg=_larCondDBFoldersDataSC[condData]
157 raise ConfigurationError(
"No conditions data %s found for SCdata" % condData)
159 if fldr
in sqliteFolders:
160 sqlite=sqliteFolders[fldr]
164 persClass=
"CondAttrListCollection"
165 if condData ==
"fSampl":
167 dbString=
"<db>COOLOFL_LAR/OFLP200</db>"
168 result.addCondAlgo(calg(ReadKey=
"LArfSampl", WriteKey=outputKey))
171 dbString=sqlite
or "<db>COOLONL_LAR/CONDBR2</db>"
172 iovDbSvc.Folders.append(fldr+dbString)
173 condLoader.Load.add((persClass,fldr))
175 result.addCondAlgo(calg (ReadKey=fldr, WriteKey=outputKey))
183 _larCondDBFoldersDataR1 = {
"Ramp":(
"/LAR/ElecCalibOnl/Ramp",
"LAR_ONL",
"LArRampComplete",
None),
184 "DAC2uA":(
"/LAR/ElecCalibOnl/DAC2uA",
"LAR_ONL",
"LArDAC2uAMC",LArDAC2uASymAlg),
185 "Pedestal":(
"/LAR/ElecCalibOnl/Pedestal<key>LArPedestal</key>",
"LAR_ONL",
"LArPedestalComplete",
None),
186 "uA2MeV":(
"/LAR/ElecCalibOfl/uA2MeV/Symmetry",
"LAR_OFL",
"LAruA2MeVMC",LAruA2MeVSymAlg),
187 "MphysOverMcal":(
"/LAR/ElecCalibOfl/MphysOverMcal/RTM",
"LAR_OFL",
"LArMphysOverMcalComplete",
None),
188 "HVScaleCorr":(
"/LAR/ElecCalibOnl/HVScaleCorr",
"LAR_ONL",
"LArHVScaleCorrComplete",
None),
189 "OFC":(
"/LAR/ElecCalibOfl/OFC/PhysWave/RTM/"+ flags.LAr.OFCShapeFolder
if len(flags.LAr.OFCShapeFolder)>0
else "/LAR/ElecCalibOfl/OFC/PhysWave/RTM/5samples1phase",
"LAR_OFL",
"LArOFCComplete",
None),
190 "Shape":(
"/LAR/ElecCalibOfl/Shape/RTM/"+ flags.LAr.OFCShapeFolder
if len(flags.LAr.OFCShapeFolder)>0
else "/LAR/ElecCalibOfl/Shape/RTM/5samples1phase",
"LAR_OFL",
"LArShapeComplete",
None),
195 result=ComponentAccumulator()
197 for condData
in condObjs:
199 folder,db,obj,calg=_larCondDBFoldersDataR1[condData]
201 raise ConfigurationError(
"No conditions data %s found for Run-1 data" % condData)
202 folderlist.append((folder,db,obj))
204 if obj.endswith (
'MC'):
206 result.addCondAlgo(calg(ReadKey=obj,WriteKey=obj+
"Sym"))
207 result.merge(addFolderList(flags,folderlist))
213 _larCondDBFoldersMC = {
214 "Ramp":(
"CondAttrListCollection",
"/LAR/ElecCalibMC/Ramp",
"LArRamp", LArRampCondAlg ),
215 "AutoCorr":(
"LArAutoCorrMC",
"/LAR/ElecCalibMC/AutoCorr",
"LArAutoCorr", LArAutoCorrSymAlg),
216 "DAC2uA":(
"LArDAC2uAMC",
"/LAR/ElecCalibMC/DAC2uA",
"LArDAC2uA",LArDAC2uASymAlg),
217 "Pedestal":(
"CondAttrListCollection",
"/LAR/ElecCalibMC/Pedestal",
"LArPedestal",LArPedestalCondAlg),
218 "Noise":(
"CondAttrListCollection",
"/LAR/ElecCalibMC/Noise",
"LArNoise",LArNoiseCondAlg),
219 "fSampl":(
"LArfSamplMC",
"/LAR/ElecCalibMC/fSampl",
"LArfSampl",LArfSamplSymAlg),
220 "uA2MeV":(
"LAruA2MeVMC",
"/LAR/ElecCalibMC/uA2MeV",
"LAruA2MeV", LAruA2MeVSymAlg),
221 "MinBias":(
"LArMinBiasMC",
"/LAR/ElecCalibMC/MinBias",
"LArMinBias",LArMinBiasSymAlg),
222 "Shape":(
"LArShape32MC",
"/LAR/ElecCalibMC/Shape",
"LArShape",LArShapeSymAlg),
223 "MinBiasAvc":(
"LArMinBiasAverageMC",
"/LAR/ElecCalibMC/MinBiasAverage",
"LArMinBiasAverage",LArMinBiasAverageSymAlg),
224 "MphysOverMcal":(
"LArMphysOverMcalMC",
"/LAR/ElecCalibMC/MphysOverMcal",
"LArMphysOverMcal",LArMPhysOverMcalSymAlg),
225 "HVScaleCorr" : (
"LArHVScaleCorrComplete",
'/LAR/ElecCalibMC/HVScaleCorr',
"LArHVScaleCorr",
None)
228 result=ComponentAccumulator()
230 from LArCabling.LArCablingConfig
import LArOnOffIdMappingCfg
231 result.merge(LArOnOffIdMappingCfg(flags))
232 LArMCSymCondAlg=CompFactory.LArMCSymCondAlg
235 for folder
in folders:
237 classname,fldr,key,calg=_larCondDBFoldersMC[folder]
239 raise ConfigurationError(
"No conditions data %s found for Monte Carlo" % folder)
241 folderlist+=[(fldr,
"LAR_OFL",classname),]
243 if (classname==
"CondAttrListCollection"):
244 writeKey= (key
if folder ==
"Pedestal" else key+
"Sym")
245 result.addCondAlgo(calg(ReadKey=fldr,WriteKey=writeKey))
247 result.addCondAlgo(calg(ReadKey=key,WriteKey=key+
"Sym"))
249 result.merge(addFolderList(flags,folderlist,db=
"OFLP200"))
254 _larCondDBFoldersMC = {
255 "Ramp":(
"LArRampMC",
"/LAR/ElecCalibMC/Ramp",
"LArRamp", LArRampSymAlg ),
256 "AutoCorr":(
"LArAutoCorrMC",
"/LAR/ElecCalibMC/AutoCorr",
"LArAutoCorr", LArAutoCorrSymAlg),
257 "DAC2uA":(
"LArDAC2uAMC",
"/LAR/ElecCalibMC/DAC2uA",
"LArDAC2uA",LArDAC2uASymAlg),
258 "Pedestal":(
"LArPedestalMC",
"/LAR/ElecCalibMC/Pedestal",
"LArPedestal",
None),
259 "Noise":(
"LArNoiseMC",
"/LAR/ElecCalibMC/Noise",
"LArNoise",LArNoiseSymAlg),
260 "fSampl":(
"LArfSamplMC",
"/LAR/ElecCalibMC/fSampl",
"LArfSampl",LArfSamplSymAlg),
261 "uA2MeV":(
"LAruA2MeVMC",
"/LAR/ElecCalibMC/uA2MeV",
"LAruA2MeV", LAruA2MeVSymAlg),
262 "MinBias":(
"LArMinBiasMC",
"/LAR/ElecCalibMC/MinBias",
"LArMinBias",LArMinBiasSymAlg),
263 "Shape":(
"LArShape32MC",
"/LAR/ElecCalibMC/Shape",
"LArShape",LArShapeSymAlg),
264 "MinBiasAvc":(
"LArMinBiasAverageMC",
"/LAR/ElecCalibMC/MinBiasAverage",
"LArMinBiasAverage",LArMinBiasAverageSymAlg),
265 "MphysOverMcal":(
"LArMphysOverMcalMC",
"/LAR/ElecCalibMC/MphysOverMcal",
"LArMphysOverMcal",LArMPhysOverMcalSymAlg),
266 "HVScaleCorr" : (
"LArHVScaleCorrComplete",
'/LAR/ElecCalibMC/HVScaleCorr',
"LArHVScaleCorr",
None)
269 result=ComponentAccumulator()
271 from LArCabling.LArCablingConfig
import LArOnOffIdMappingCfg
272 result.merge(LArOnOffIdMappingCfg(flags))
273 LArMCSymCondAlg=CompFactory.LArMCSymCondAlg
276 for folder
in folders:
278 classname,fldr,key,calg=_larCondDBFoldersMC[folder]
280 raise ConfigurationError(
"No conditions data %s found for Monte Carlo" % folder)
282 folderlist+=[(fldr,detdb,classname),]
284 result.addCondAlgo(calg(ReadKey=key,WriteKey=key+
"Sym"))
286 result.merge(addFolderList(flags,folderlist,db=
"OFLP200"))
291 _larCondDBFoldersMC = {
292 "RampSC":(
'CondAttrListCollection',
"/LAR/ElecCalibMCSC/Ramp",
"LArRampSC", LArRampSCCondAlg ),
293 "DAC2uASC":(
'CondAttrListCollection',
"/LAR/ElecCalibMCSC/DAC2uA",
"LArDAC2uASC",LArDAC2uASCCondAlg),
294 "uA2MeVSC":(
'CondAttrListCollection',
"/LAR/ElecCalibMCSC/uA2MeV",
"LAruA2MeVSC",LAruA2MeVSCCondAlg),
295 "fSamplSC":(
'CondAttrListCollection',
'/LAR/ElecCalibMCSC/fSampl',
"LArfSamplSC",LArfSamplSCCondAlg),
296 "ShapeSC":(
'CondAttrListCollection',
'/LAR/ElecCalibMCSC/Shape',
"LArShapeSC",LArShapeSCCondAlg),
297 "PileupAverageSC":(
'CondAttrListCollection',
'/LAR/ElecCalibMCSC/LArPileupAverage',
"LArPileupAverageSC",LArPileupAverageSCCondAlg),
298 "PedestalSC":(
'CondAttrListCollection',
'/LAR/ElecCalibMCSC/Pedestal',
"LArPedestalSC",LArPedestalSCCondAlg),
299 "NoiseSC":(
'CondAttrListCollection',
'/LAR/ElecCalibMCSC/Noise',
"LArNoiseSC",LArNoiseSCCondAlg),
300 "MinBiasSC":(
'CondAttrListCollection',
'/LAR/ElecCalibMCSC/MinBias',
"LArMinBiasSC",LArMinBiasSCCondAlg),
301 "AutoCorrSC":(
'CondAttrListCollection',
'/LAR/ElecCalibMCSC/AutoCorr',
"LArAutoCorrSC",LArAutoCorrSCCondAlg)
304 result=ComponentAccumulator()
306 for folder
in folders:
308 classname,fldr,key,calg=_larCondDBFoldersMC[folder]
310 raise ConfigurationError(
"No conditions data %s found for Monte Carlo" % folder)
312 folderlist+=[(fldr,detdb,classname),]
314 result.addCondAlgo(calg(ReadKey=fldr,WriteKey=key))
316 result.merge(addFolderList(flags,folderlist,db=
"OFLP200"))
320if __name__ ==
"__main__":
321 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
322 from AthenaConfiguration.TestDefaults
import defaultTestFiles
325 flags1 = initConfigFlags()
326 flags1.Input.Files = defaultTestFiles.RAW_RUN2
328 acc1 = LArElecCalibDBCfg (flags1, [
'Ramp',
'Pedestal'])
329 acc1.printCondAlgs(summariseProps=
True)
330 print (
'IOVDbSvc:', acc1.getService(
'IOVDbSvc').Folders)
334 flags2 = initConfigFlags()
335 flags2.Input.Files = defaultTestFiles.RAW_RUN2
336 from AthenaConfiguration.Enums
import LHCPeriod
337 flags2.GeoModel.Run=LHCPeriod.Run1
339 acc2 = LArElecCalibDBCfg (flags2, [
'Ramp',
'Pedestal'])
340 acc2.printCondAlgs(summariseProps=
True)
341 print (
'IOVDbSvc:', acc2.getService(
'IOVDbSvc').Folders)
345 flags3 = initConfigFlags()
346 flags3.Input.Files = defaultTestFiles.ESD
348 acc3 = LArElecCalibDBCfg (flags3, [
'Ramp',
'Pedestal'])
349 acc3.printCondAlgs(summariseProps=
True)
350 print (
'IOVDbSvc:', acc3.getService(
'IOVDbSvc').Folders)
LArElecCalibDBMCCfg(flags, folders, detdb="LAR_OFL")
LArElecCalibDBSCCfg(flags, condObjs, sqlite=None)
LArElecCalibDBCfg(flags, condObjs)
LArElecCalibDBRun1Cfg(flags, condObjs)
LArElecCalibDBMCRun4Cfg(flags, folders)
LArElecCalibDBMCSCCfg(flags, folders, detdb="LAR_OFL")
LArElecCalibDBRun2Cfg(flags, condObjs)