Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:52:19

0001 # This script doesn't work yet.  PoolDBESSource does not see the IOV updates made earlier in the
0002 # same event.
0003 
0004 import FWCore.ParameterSet.Config as cms
0005 
0006 process = cms.Process("L1ConfigWriteRSOnline")
0007 process.load("FWCore.MessageLogger.MessageLogger_cfi")
0008 process.MessageLogger.cout.enable = cms.untracked.bool(True)
0009 process.MessageLogger.cout.threshold = cms.untracked.string('DEBUG')
0010 process.MessageLogger.debugModules = cms.untracked.vstring('*')
0011 
0012 import FWCore.ParameterSet.VarParsing as VarParsing
0013 options = VarParsing.VarParsing()
0014 options.register('runNumber',
0015                  0, #default value
0016                  VarParsing.VarParsing.multiplicity.singleton,
0017                  VarParsing.VarParsing.varType.int,
0018                  "Run number")
0019 options.register('outputDBConnect',
0020                  'sqlite_file:l1config.db', #default value
0021                  VarParsing.VarParsing.multiplicity.singleton,
0022                  VarParsing.VarParsing.varType.string,
0023                  "Connection string for output DB")
0024 options.register('outputDBAuth',
0025                  '.', #default value
0026                  VarParsing.VarParsing.multiplicity.singleton,
0027                  VarParsing.VarParsing.varType.string,
0028                  "Authentication path for outputDB")
0029 options.register('keysFromDB',
0030                  1, #default value
0031                  VarParsing.VarParsing.multiplicity.singleton,
0032                  VarParsing.VarParsing.varType.int,
0033                  "1 = read keys from OMDS, 0 = read keys from command line")
0034 options.register('overwriteKeys',
0035                  0, #default value
0036                  VarParsing.VarParsing.multiplicity.singleton,
0037                  VarParsing.VarParsing.varType.int,
0038                  "Overwrite existing keys")
0039 options.register('forceUpdate',
0040                  0, #default value
0041                  VarParsing.VarParsing.multiplicity.singleton,
0042                  VarParsing.VarParsing.varType.int,
0043                  "Check all record IOVs even if L1TriggerKey unchanged")
0044 options.register('logTransactions',
0045                  1, #default value
0046                  VarParsing.VarParsing.multiplicity.singleton,
0047                  VarParsing.VarParsing.varType.int,
0048                  "Record transactions in log DB")
0049 
0050 options.parseArguments()
0051 
0052 # Define CondDB tags
0053 from CondTools.L1TriggerExt.L1CondEnumExt_cfi import L1CondEnumExt
0054 from CondTools.L1TriggerExt.L1O2OTagsExt_cfi import initL1O2OTagsExt
0055 initL1O2OTagsExt()
0056 
0057 if options.keysFromDB == 1:
0058     process.load("CondTools.L1TriggerExt.L1ConfigRSKeysExt_cff")
0059 else:
0060     process.load("CondTools.L1TriggerExt.L1TriggerKeyDummyExt_cff")
0061     from CondTools.L1TriggerExt.L1RSSubsystemParamsExt_cfi import initL1RSSubsystemsExt
0062     initL1RSSubsystemsExt( tagBaseVec = initL1O2OTagsExt.tagBaseVec)
0063     process.L1TriggerKeyDummyExt.objectKeys = initL1RSSubsystemsExt.params.recordInfo                        
0064 
0065 # Get L1TriggerKeyListExt from DB
0066 process.load("CondCore.DBCommon.CondDBCommon_cfi")
0067 process.outputDB = cms.ESSource("PoolDBESSource",
0068                                 process.CondDBCommon,
0069                                 toGet = cms.VPSet(cms.PSet(
0070     record = cms.string('L1TriggerKeyListExtRcd'),
0071     tag = cms.string('L1TriggerKeyListExt_' + initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TriggerKeyListExt ] )
0072     )),
0073                                 RefreshEachRun=cms.untracked.bool(True)
0074                                 )
0075 process.outputDB.connect = options.outputDBConnect
0076 process.outputDB.DBParameters.authenticationPath = options.outputDBAuth
0077 
0078 # Generate configuration data
0079 process.load("CondTools.L1TriggerExt.L1ConfigRSPayloadsExt_cff")
0080 
0081 # writer modules
0082 from CondTools.L1TriggerExt.L1CondDBPayloadWriterExt_cff import initPayloadWriterExt
0083 initPayloadWriterExt( process,
0084                    outputDBConnect = options.outputDBConnect,
0085                    outputDBAuth = options.outputDBAuth,
0086                    tagBaseVec = initL1O2OTagsExt.tagBaseVec )
0087 process.L1CondDBPayloadWriterExt.writeL1TriggerKey = cms.bool(False)
0088 
0089 if options.logTransactions == 1:
0090 #    initPayloadWriterExt.outputDB.logconnect = cms.untracked.string('oracle://cms_orcon_prod/CMS_COND_31X_POPCONLOG')
0091     initPayloadWriterExt.outputDB.logconnect = cms.untracked.string('sqlite_file:l1o2o-log.db')
0092     process.L1CondDBPayloadWriterExt.logTransactions = True
0093 
0094 if options.overwriteKeys == 0:
0095     process.L1CondDBPayloadWriterExt.overwriteKeys = False
0096 else:
0097     process.L1CondDBPayloadWriterExt.overwriteKeys = True
0098 
0099 from CondTools.L1TriggerExt.L1CondDBIOVWriterExt_cff import initIOVWriterExt
0100 initIOVWriterExt( process,
0101                outputDBConnect = options.outputDBConnect,
0102                outputDBAuth = options.outputDBAuth,
0103                tagBaseVec = initL1O2OTagsExt.tagBaseVec,
0104                tscKey = '' )
0105 process.L1CondDBIOVWriterExt.logKeys = True
0106 
0107 if options.forceUpdate == 1:
0108     process.L1CondDBIOVWriterExt.forceUpdate = True
0109 
0110 if options.logTransactions == 1:
0111 #    initIOVWriterExt.outputDB.logconnect = cms.untracked.string('oracle://cms_orcon_prod/CMS_COND_31X_POPCONLOG')
0112     initIOVWriterExt.outputDB.logconnect = cms.untracked.string('sqlite_file:l1o2o-log.db')
0113     process.L1CondDBIOVWriterExt.logTransactions = True
0114 
0115 process.maxEvents = cms.untracked.PSet(
0116     input = cms.untracked.int32(1)
0117 )
0118 process.source = cms.Source("EmptyIOVSource",
0119     timetype = cms.string('runnumber'),
0120     firstValue = cms.uint64(options.runNumber),
0121     lastValue = cms.uint64(options.runNumber),
0122     interval = cms.uint64(1)
0123 )
0124 
0125 # CORAL debugging
0126 #process.outputDB.DBParameters.messageLevel = cms.untracked.int32(3)
0127 
0128 process.p = cms.Path(process.L1CondDBPayloadWriterExt*process.L1CondDBIOVWriterExt)