CMS 3D CMS Logo

SetCondition.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 def setCondition(process,
4  connect = "frontier://FrontierProd/CMS_CONDITIONS",
5  record = None,
6  tag = None,
7  label = None):
8  """
9  Overrides a condition in startgeometry from globaltag.
10  """
11 
12  if record is None or tag is None:
13  raise ValueError("A 'record' and a 'tag' have to be provided to 'setCondition'.")
14 
15  if not hasattr(process, "GlobalTag"):
16  process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
17 
18  args = {"connect": cms.string(connect),
19  "record": cms.string(record),
20  "tag": cms.string(tag)}
21  if label is not None:
22  args["label"] = cms.untracked.string(label)
23 
24  process.GlobalTag.toGet \
25  = cms.VPSet([x for x in process.GlobalTag.toGet.value() if x.record.value() != record])
26  process.GlobalTag.toGet.append(cms.PSet(**args))
SetCondition.setCondition
def setCondition(process, connect="frontier://FrontierProd/CMS_CONDITIONS", record=None, tag=None, label=None)
Definition: SetCondition.py:3