Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
import FWCore.ParameterSet.Config as cms

def addPoolDBESSource(process,moduleName,record,tag,label='',connect='sqlite_file:'):
    from CondCore.DBCommon.CondDBSetup_cfi import CondDBSetup 
    calibDB = cms.ESSource("PoolDBESSource",
                           CondDBSetup,
                           toGet = cms.VPSet(cms.PSet(
                               record = cms.string(record),
                               tag = cms.string(tag),
                               label = cms.untracked.string(label)
                           )),
                           connect = cms.string(connect)
                           )
    #if authPath: calibDB.DBParameters.authenticationPath = authPath
    if connect.find('oracle:') != -1: calibDB.DBParameters.authenticationPath = '/afs/cern.ch/cms/DB/conddb'
    setattr(process,moduleName,calibDB)
    setattr(process,"es_prefer_" + moduleName,cms.ESPrefer('PoolDBESSource',moduleName))