File indexing completed on 2024-04-06 11:56:34
0001 import FWCore.ParameterSet.Config as cms
0002
0003 def setCondition(process,
0004 connect = "frontier://FrontierProd/CMS_CONDITIONS",
0005 record = None,
0006 tag = None,
0007 label = None):
0008 """
0009 Overrides a condition in startgeometry from globaltag.
0010 """
0011
0012 if record is None or tag is None:
0013 raise ValueError("A 'record' and a 'tag' have to be provided to 'setCondition'.")
0014
0015 if not hasattr(process, "GlobalTag"):
0016 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0017
0018 args = {"connect": cms.string(connect),
0019 "record": cms.string(record),
0020 "tag": cms.string(tag)}
0021 if label is not None:
0022 args["label"] = cms.untracked.string(label)
0023
0024 process.GlobalTag.toGet \
0025 = cms.VPSet([x for x in process.GlobalTag.toGet.value() if x.record.value() != record])
0026 process.GlobalTag.toGet.append(cms.PSet(**args))