File indexing completed on 2024-04-06 12:03:14
0001 import FWCore.ParameterSet.Config as cms
0002
0003 process = cms.Process("L1ConfigWriteIOVOnlineExt")
0004 process.load("FWCore.MessageLogger.MessageLogger_cfi")
0005 process.MessageLogger.cout.enable = cms.untracked.bool(True)
0006 process.MessageLogger.cout.threshold = cms.untracked.string('DEBUG')
0007 process.MessageLogger.debugModules = cms.untracked.vstring('*')
0008
0009
0010 import FWCore.ParameterSet.VarParsing as VarParsing
0011 options = VarParsing.VarParsing()
0012 options.register('tscKey',
0013 '',
0014 VarParsing.VarParsing.multiplicity.singleton,
0015 VarParsing.VarParsing.varType.string,
0016 "TSC key")
0017 options.register('rsKey',
0018 '',
0019 VarParsing.VarParsing.multiplicity.singleton,
0020 VarParsing.VarParsing.varType.string,
0021 "RS key")
0022 options.register('runNumber',
0023 0,
0024 VarParsing.VarParsing.multiplicity.singleton,
0025 VarParsing.VarParsing.varType.int,
0026 "Run number")
0027 options.register('outputDBConnect',
0028 'sqlite_file:l1config.db',
0029 VarParsing.VarParsing.multiplicity.singleton,
0030 VarParsing.VarParsing.varType.string,
0031 "Connection string for output DB")
0032 options.register('outputDBAuth',
0033 '.',
0034 VarParsing.VarParsing.multiplicity.singleton,
0035 VarParsing.VarParsing.varType.string,
0036 "Authentication path for output DB")
0037 options.register('forceUpdate',
0038 0,
0039 VarParsing.VarParsing.multiplicity.singleton,
0040 VarParsing.VarParsing.varType.int,
0041 "Check all record IOVs even if L1TriggerKey unchanged")
0042 options.register('logTransactions',
0043 1,
0044 VarParsing.VarParsing.multiplicity.singleton,
0045 VarParsing.VarParsing.varType.int,
0046 "Record transactions in log DB")
0047 options.register('tagUpdate',
0048 '',
0049 VarParsing.VarParsing.multiplicity.singleton,
0050 VarParsing.VarParsing.varType.string,
0051 "Comma-separated list of column-separated pairs relating type to a new tagBase")
0052 options.parseArguments()
0053
0054
0055 from CondTools.L1TriggerExt.L1CondEnumExt_cfi import L1CondEnumExt
0056 from CondTools.L1TriggerExt.L1O2OTagsExt_cfi import initL1O2OTagsExt
0057 initL1O2OTagsExt()
0058
0059
0060 if options.tagUpdate :
0061 for type2tagBase in options.tagUpdate.split(',') :
0062 (t,tagBase) = type2tagBase.split(':')
0063 index = L1CondEnumExt.__dict__[t]
0064 initL1O2OTagsExt.tagBaseVec[index] = tagBase
0065
0066
0067 from CondTools.L1TriggerExt.L1CondDBIOVWriterExt_cff import initIOVWriterExt
0068 initIOVWriterExt( process,
0069 outputDBConnect = options.outputDBConnect,
0070 outputDBAuth = options.outputDBAuth,
0071 tagBaseVec = initL1O2OTagsExt.tagBaseVec,
0072 tscKey = options.tscKey,
0073 rsKey = options.rsKey )
0074
0075 if options.forceUpdate == 1:
0076 process.L1CondDBIOVWriterExt.forceUpdate = True
0077
0078 if options.logTransactions == 1:
0079
0080 initIOVWriterExt.outputDB.logconnect = cms.untracked.string('sqlite_file:l1o2o-log.db')
0081 process.L1CondDBIOVWriterExt.logTransactions = True
0082
0083 process.maxEvents = cms.untracked.PSet(
0084 input = cms.untracked.int32(1)
0085 )
0086 process.source = cms.Source("EmptyIOVSource",
0087 timetype = cms.string('runnumber'),
0088 firstValue = cms.uint64(options.runNumber),
0089 lastValue = cms.uint64(options.runNumber),
0090 interval = cms.uint64(1)
0091 )
0092
0093
0094 process.load("CondCore.CondDB.CondDB_cfi")
0095 process.CondDB.connect = cms.string(options.outputDBConnect)
0096
0097 process.outputDB = cms.ESSource("PoolDBESSource",
0098 process.CondDB,
0099 toGet = cms.VPSet(cms.PSet(
0100 record = cms.string('L1TriggerKeyListExtRcd'),
0101 tag = cms.string('L1TriggerKeyListExt_' + initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TriggerKeyListExt ])
0102 )),
0103 RefreshEachRun=cms.untracked.bool(True)
0104 )
0105
0106 process.outputDB.DBParameters.authenticationPath = options.outputDBAuth
0107
0108
0109 process.outputDB.DBParameters.messageLevel = cms.untracked.int32(3)
0110
0111 process.p = cms.Path(process.L1CondDBIOVWriterExt)