File indexing completed on 2024-04-06 12:03:14
0001 '''
0002 Example on how to use this script:
0003 1) prepare the payload with L1ConfigWriteSinglePayloadExt_cfg.py
0004 (as, for example, is done in L1TriggerConfig/Utilities/test/runOneByOne.sh)
0005 2) call this script with first run of the new IOV and system key used above
0006 e.g.:
0007 cmsRun L1ConfigWriteIOVDummyExt_cfg.py runNumber=1 tscKey='EMTF_ALGO_EMPTY' useO2OTags=1
0008 '''
0009 import FWCore.ParameterSet.Config as cms
0010
0011 process = cms.Process("L1ConfigWriteIOVDummyExt")
0012 process.load("FWCore.MessageLogger.MessageLogger_cfi")
0013 process.MessageLogger.cout.enable = cms.untracked.bool(True)
0014 process.MessageLogger.cout.threshold = cms.untracked.string('DEBUG')
0015 process.MessageLogger.debugModules = cms.untracked.vstring('*')
0016
0017 import FWCore.ParameterSet.VarParsing as VarParsing
0018 options = VarParsing.VarParsing()
0019 options.register('tscKey',
0020 'dummy',
0021 VarParsing.VarParsing.multiplicity.singleton,
0022 VarParsing.VarParsing.varType.string,
0023 "TSC key")
0024 options.register('runNumber',
0025 1000,
0026 VarParsing.VarParsing.multiplicity.singleton,
0027 VarParsing.VarParsing.varType.int,
0028 "Run number")
0029 options.register('tagBase',
0030 'IDEAL',
0031 VarParsing.VarParsing.multiplicity.singleton,
0032 VarParsing.VarParsing.varType.string,
0033 "IOV tags = object_{tagBase}")
0034 options.register('useO2OTags',
0035 0,
0036 VarParsing.VarParsing.multiplicity.singleton,
0037 VarParsing.VarParsing.varType.int,
0038 "0 = use uniform tags, 1 = ignore tagBase and use O2O tags")
0039 options.register('outputDBConnect',
0040 'sqlite_file:l1config.db',
0041 VarParsing.VarParsing.multiplicity.singleton,
0042 VarParsing.VarParsing.varType.string,
0043 "Connection string for output DB")
0044 options.register('outputDBAuth',
0045 '.',
0046 VarParsing.VarParsing.multiplicity.singleton,
0047 VarParsing.VarParsing.varType.string,
0048 "Authentication path for output DB")
0049 options.parseArguments()
0050
0051
0052
0053
0054 if options.useO2OTags == 0:
0055 from CondTools.L1TriggerExt.L1CondEnumExt_cfi import L1CondEnumExt
0056 from CondTools.L1TriggerExt.L1UniformTagsExt_cfi import initL1UniformTagsExt
0057 initL1UniformTagsExt( tagBase = options.tagBase )
0058 tagBaseVec = initL1UniformTagsExt.tagBaseVec
0059 else:
0060 from CondTools.L1TriggerExt.L1CondEnumExt_cfi import L1CondEnumExt
0061 from CondTools.L1TriggerExt.L1O2OTagsExt_cfi import initL1O2OTagsExt
0062 initL1O2OTagsExt()
0063 tagBaseVec = initL1O2OTagsExt.tagBaseVec
0064
0065
0066 process.load("CondTools.L1TriggerExt.L1TriggerKeyDummyExt_cff")
0067 process.L1TriggerKeyDummyExt.tscKey = cms.string('dummyTransientKey_' + options.tscKey)
0068 process.L1TriggerKeyDummyExt.objectKeys = cms.VPSet(
0069 cms.PSet(
0070 record = cms.string('L1TMuonEndCapParamsO2ORcd'),
0071 type = cms.string('L1TMuonEndCapParams'),
0072 key = cms.string(options.tscKey)
0073 )
0074 )
0075
0076
0077
0078 from CondTools.L1TriggerExt.L1CondDBIOVWriterExt_cff import initIOVWriterExt
0079 initIOVWriterExt( process,
0080 outputDBConnect = options.outputDBConnect,
0081 outputDBAuth = options.outputDBAuth,
0082 tagBaseVec = tagBaseVec,
0083 tscKey = '' )
0084
0085 process.maxEvents = cms.untracked.PSet(
0086 input = cms.untracked.int32(1)
0087 )
0088 process.source = cms.Source("EmptyIOVSource",
0089 timetype = cms.string('runnumber'),
0090 firstValue = cms.uint64(options.runNumber),
0091 lastValue = cms.uint64(options.runNumber),
0092 interval = cms.uint64(1)
0093 )
0094
0095 process.load("CondCore.CondDB.CondDB_cfi")
0096 process.CondDB.connect = cms.string(options.outputDBConnect)
0097
0098 process.outputDB = cms.ESSource("PoolDBESSource",
0099 process.CondDB,
0100 toGet = cms.VPSet(cms.PSet(
0101 record = cms.string('L1TriggerKeyListExtRcd'),
0102 tag = cms.string('L1TriggerKeyListExt_' + tagBaseVec[ L1CondEnumExt.L1TriggerKeyListExt ])
0103 ))
0104 )
0105
0106 process.outputDB.DBParameters.authenticationPath = options.outputDBAuth
0107
0108 process.p = cms.Path(process.L1CondDBIOVWriterExt)