Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 process = cms.Process("L1ConfigWriteRSPayloadOnline")
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 import FWCore.ParameterSet.VarParsing as VarParsing
0010 options = VarParsing.VarParsing()
0011 options.register('outputDBConnect',
0012                  'sqlite_file:l1config.db', #default value
0013                  VarParsing.VarParsing.multiplicity.singleton,
0014                  VarParsing.VarParsing.varType.string,
0015                  "Connection string for output DB")
0016 options.register('outputDBAuth',
0017                  '.', #default value
0018                  VarParsing.VarParsing.multiplicity.singleton,
0019                  VarParsing.VarParsing.varType.string,
0020                  "Authentication path for outputDB")
0021 options.register('keysFromDB',
0022                  1, #default value
0023                  VarParsing.VarParsing.multiplicity.singleton,
0024                  VarParsing.VarParsing.varType.int,
0025                  "1 = read keys from OMDS, 0 = read keys from command line")
0026 options.register('overwriteKeys',
0027                  0, #default value
0028                  VarParsing.VarParsing.multiplicity.singleton,
0029                  VarParsing.VarParsing.varType.int,
0030                  "Overwrite existing keys")
0031 options.register('logTransactions',
0032                  1, #default value
0033                  VarParsing.VarParsing.multiplicity.singleton,
0034                  VarParsing.VarParsing.varType.int,
0035                  "Record transactions in log DB")
0036 
0037 # arguments for setting object keys by hand
0038 options.register('runNumber',
0039                  0, #default value
0040                  VarParsing.VarParsing.multiplicity.singleton,
0041                  VarParsing.VarParsing.varType.int,
0042                  "Dummy argument")
0043 
0044 options.parseArguments()
0045 
0046 # Define CondDB tags
0047 from CondTools.L1TriggerExt.L1CondEnumExt_cfi import L1CondEnumExt
0048 from CondTools.L1TriggerExt.L1O2OTagsExt_cfi import initL1O2OTagsExt
0049 initL1O2OTagsExt()
0050 
0051 if options.keysFromDB == 1:
0052     process.load("CondTools.L1TriggerExt.L1ConfigRSKeysExt_cff")
0053 else:
0054     process.load("CondTools.L1TriggerExt.L1TriggerKeyDummyExt_cff")
0055     from CondTools.L1TriggerExt.L1RSSubsystemParamsExt_cfi import initL1RSSubsystemsExt
0056     initL1RSSubsystemsExt( tagBaseVec = initL1O2OTagsExt.tagBaseVec )
0057     process.L1TriggerKeyDummyExt.objectKeys = initL1RSSubsystemsExt.params.recordInfo
0058 
0059 # Get L1TriggerKeyListExt from DB
0060 process.load("CondCore.CondDB.CondDB_cfi")
0061 process.CondDB.connect = options.outputDBConnect
0062 
0063 process.outputDB = cms.ESSource("PoolDBESSource",
0064     process.CondDB,
0065     toGet = cms.VPSet(cms.PSet(
0066         record = cms.string('L1TriggerKeyListExtRcd'),
0067         tag = cms.string('L1TriggerKeyListExt_' + initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TriggerKeyListExt ] )
0068     ))
0069 )
0070 
0071 #process.es_prefer_outputDB = cms.ESPrefer("PoolDBESSource","outputDB")
0072 process.outputDB.DBParameters.authenticationPath = options.outputDBAuth
0073 
0074 # Generate configuration data
0075 process.load("CondTools.L1TriggerExt.L1ConfigRSPayloadsExt_cff")
0076 
0077 # writer modules
0078 from CondTools.L1TriggerExt.L1CondDBPayloadWriterExt_cff import initPayloadWriterExt
0079 initPayloadWriterExt( process,
0080                    outputDBConnect = options.outputDBConnect,
0081                    outputDBAuth = options.outputDBAuth,
0082                    tagBaseVec = initL1O2OTagsExt.tagBaseVec,
0083 process.L1CondDBPayloadWriterExt.writeL1TriggerKey = cms.bool(False)
0084 
0085 if options.logTransactions == 1:
0086     initPayloadWriterExt.outputDB.logconnect = cms.untracked.string('oracle://cms_orcon_prod/CMS_COND_31X_POPCONLOG')
0087     process.L1CondDBPayloadWriterExt.logTransactions = True
0088 
0089 if options.overwriteKeys == 0:
0090     process.L1CondDBPayloadWriterExt.overwriteKeys = False
0091 else:
0092     process.L1CondDBPayloadWriterExt.overwriteKeys = True
0093                 
0094 process.maxEvents = cms.untracked.PSet(
0095     input = cms.untracked.int32(1)
0096 )
0097 process.source = cms.Source("EmptySource")
0098 
0099 process.p = cms.Path(process.L1CondDBPayloadWriterExt)