CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1CondDBSource_cff.py
Go to the documentation of this file.
1 # Default behavior: deliver current L1-O2O tags from Frontier.
2 
3 # IF tagBaseVec is empty then
4 # IF tagBaseVec is given, use uniform tags with the given tagBase
5 # ELSE use current L1-O2O tags
6 
7 # If tagBase AND tagBaseVec are both given, then tagBaseVec trumps tagBase.
8 
9 def initCondDBSource( process,
10  inputDBConnect = 'frontier://FrontierProd/CMS_COND_31X_L1T',
11  inputDBAuth = '.',
12  tagBase = "",
13  tagBaseVec = [],
14  includeAllTags = False,
15  includeRSTags = False,
16  use30XTagList = False,
17  applyESPrefer = True ):
18  import FWCore.ParameterSet.Config as cms
19  from CondCore.DBCommon.CondDBSetup_cfi import CondDBSetup
20  from CondTools.L1Trigger.L1CondEnum_cfi import L1CondEnum
21 
22  if len( tagBaseVec ) == 0:
23  if len( tagBase ) != 0:
24  from CondTools.L1Trigger.L1UniformTags_cfi import initL1UniformTags
25  initL1UniformTags( tagBase )
26  tagBaseVec = initL1UniformTags.tagBaseVec
27  else:
28  from CondTools.L1Trigger.L1O2OTags_cfi import initL1O2OTags
30  tagBaseVec = initL1O2OTags.tagBaseVec
31 
32  process.l1conddb = cms.ESSource("PoolDBESSource",
33  CondDBSetup,
34  connect = cms.string(inputDBConnect),
35  toGet = cms.VPSet(cms.PSet(
36  record = cms.string('L1TriggerKeyListRcd'),
37  tag = cms.string('L1TriggerKeyList_' + tagBaseVec[ L1CondEnum.L1TriggerKeyList ])
38  ),
39  cms.PSet(
40  record = cms.string('L1TriggerKeyRcd'),
41  tag = cms.string('L1TriggerKey_' + tagBaseVec[ L1CondEnum.L1TriggerKey ])
42  ))
43  )
44  process.l1conddb.DBParameters.authenticationPath = inputDBAuth
45 
46  # The more records, the longer it takes PoolDBESSource to initialize, so be
47  # selective if possible.
48 
49  if includeAllTags == True:
50  if use30XTagList == True:
51  from CondTools.L1Trigger.L1SubsystemParams30X_cfi import initL1Subsystems
52  else:
53  from CondTools.L1Trigger.L1SubsystemParams_cfi import initL1Subsystems
54  initL1Subsystems( tagBaseVec = tagBaseVec )
55  process.l1conddb.toGet.extend(initL1Subsystems.params.recordInfo)
56  elif includeRSTags == True:
57  from CondTools.L1Trigger.L1RSSubsystemParams_cfi import initL1RSSubsystems
58  initL1RSSubsystems( tagBaseVec = tagBaseVec )
59  process.l1conddb.toGet.extend(initL1RSSubsystems.params.recordInfo)
60 
61  if applyESPrefer == True:
62  process.es_prefer_l1conddb = cms.ESPrefer("PoolDBESSource","l1conddb")