Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 # Example using L1RCTParameters
0002 
0003 import FWCore.ParameterSet.Config as cms
0004 
0005 process = cms.Process("L1ConfigWritePayloadDummy")
0006 process.load("FWCore.MessageLogger.MessageLogger_cfi")
0007 process.MessageLogger.cout.enable = cms.untracked.bool(True)
0008 process.MessageLogger.cout.threshold = cms.untracked.string('DEBUG')
0009 process.MessageLogger.debugModules = cms.untracked.vstring('*')
0010 
0011 import FWCore.ParameterSet.VarParsing as VarParsing
0012 options = VarParsing.VarParsing()
0013 options.register('objectKey',
0014                  'dummy', #default value
0015                  VarParsing.VarParsing.multiplicity.singleton,
0016                  VarParsing.VarParsing.varType.string,
0017                  "object key")
0018 options.register('objectType',
0019                  'L1TMuonOverlapParams', #default value
0020                  VarParsing.VarParsing.multiplicity.singleton,
0021                  VarParsing.VarParsing.varType.string,
0022                  "object C++ type")
0023 options.register('recordName',
0024                  'L1TMuonOverlapParamsO2ORcd', #default value
0025                  VarParsing.VarParsing.multiplicity.singleton,
0026                  VarParsing.VarParsing.varType.string,
0027                  "Name of EventSetup record")
0028 options.register('tagBase',
0029                  'IDEAL', #default value
0030                  VarParsing.VarParsing.multiplicity.singleton,
0031                  VarParsing.VarParsing.varType.string,
0032                  "IOV tags = object_{tagBase}")
0033 options.register('useO2OTags',
0034                  0, #default value
0035                  VarParsing.VarParsing.multiplicity.singleton,
0036                  VarParsing.VarParsing.varType.int,
0037                  "0 = use uniform tags, 1 = ignore tagBase and use O2O tags")
0038 options.register('genFromOMDS',
0039                  0, #default value
0040                  VarParsing.VarParsing.multiplicity.singleton,
0041                  VarParsing.VarParsing.varType.int,
0042                  "0 = use dummy payloads, 1 = generate payloads from OMDS")
0043 options.register('outputDBConnect',
0044                  'sqlite_file:l1config.db', #default value
0045                  VarParsing.VarParsing.multiplicity.singleton,
0046                  VarParsing.VarParsing.varType.string,
0047                  "Connection string for output DB")
0048 options.register('outputDBAuth',
0049                  '.', #default value
0050                  VarParsing.VarParsing.multiplicity.singleton,
0051                  VarParsing.VarParsing.varType.string,
0052                  "Authentication path for output DB")
0053 options.register('protoDBConnect',
0054                  'oracle://cms_orcon_prod/CMS_CONDITIONS', #default value
0055                  VarParsing.VarParsing.multiplicity.singleton,
0056                  VarParsing.VarParsing.varType.string,
0057                  "Authentication path for proto DB")
0058 options.register('protoDBAuth',
0059                  '.', #default value
0060                  VarParsing.VarParsing.multiplicity.singleton,
0061                  VarParsing.VarParsing.varType.string,
0062                  "Authentication path for proto DB")
0063 options.register('overwriteKey',
0064                  0, #default value
0065                  VarParsing.VarParsing.multiplicity.singleton,
0066                  VarParsing.VarParsing.varType.int,
0067                  "Overwrite existing key")
0068 
0069 options.parseArguments()
0070 
0071 # Define CondDB tags
0072 if options.useO2OTags == 0:
0073     from CondTools.L1TriggerExt.L1CondEnumExt_cfi import L1CondEnumExt
0074     from CondTools.L1TriggerExt.L1UniformTagsExt_cfi import initL1UniformTagsExt
0075     initL1UniformTagsExt( tagBase = options.tagBase )
0076     tagBaseVec = initL1UniformTagsExt.tagBaseVec
0077 else:
0078     from CondTools.L1TriggerExt.L1CondEnumExt_cfi import L1CondEnumExt
0079     from CondTools.L1TriggerExt.L1O2OTagsExt_cfi import initL1O2OTagsExt
0080     initL1O2OTagsExt()
0081     tagBaseVec = initL1O2OTagsExt.tagBaseVec
0082 
0083 # Generate L1TriggerKey
0084 process.load("CondTools.L1TriggerExt.L1TriggerKeyDummyExt_cff")
0085 process.L1TriggerKeyDummyExt.objectKeys = cms.VPSet(cms.PSet(
0086     record = cms.string(options.recordName),
0087     type = cms.string(options.objectType),
0088     key = cms.string(options.objectKey)
0089 ))
0090 
0091 # Get L1TriggerKeyListExt from DB
0092 process.load("CondCore.CondDB.CondDB_cfi")
0093 process.CondDB.connect = cms.string(options.outputDBConnect)
0094 
0095 process.outputDB = cms.ESSource("PoolDBESSource",
0096     process.CondDB,
0097     toGet = cms.VPSet(cms.PSet(
0098         record = cms.string('L1TriggerKeyListExtRcd'),
0099         tag = cms.string('L1TriggerKeyListExt_' + tagBaseVec[ L1CondEnumExt.L1TriggerKeyListExt ])
0100     ))
0101 )
0102 
0103 process.es_prefer_outputDB = cms.ESPrefer("PoolDBESSource","outputDB")
0104 process.outputDB.DBParameters.authenticationPath = cms.untracked.string(options.outputDBAuth)
0105 
0106 if options.genFromOMDS == 0:
0107     # Generate dummy configuration data
0108     if options.objectType == 'L1TMuonEndCapForest' :
0109         process.load('L1TriggerConfig.L1TConfigProducers.L1TMuonEndCapForestOnlineProxy_cfi')
0110         process.l1emtfForestProtodb.DBParameters.connect            = cms.untracked.string(options.protoDBConnect)
0111         process.l1emtfForestProtodb.DBParameters.authenticationPath = cms.untracked.string(options.protoDBAuth)
0112     else :
0113         process.load('L1TriggerConfig.L1TConfigProducers.L1TMuonOverlapParamsOnlineProxy_cfi')
0114 else:
0115     # Generate configuration data from OMDS
0116     process.load("CondTools.L1TriggerExt.L1ConfigTSCPayloadsExt_cff")
0117     #process.load("CondTools.L1TriggerExt.L1ConfigRSPayloadsExt_cff")
0118 
0119 # writer modules
0120 from CondTools.L1TriggerExt.L1CondDBPayloadWriterExt_cff import initPayloadWriterExt
0121 initPayloadWriterExt( process,
0122                    outputDBConnect = options.outputDBConnect,
0123                    outputDBAuth = options.outputDBAuth,
0124                    tagBaseVec = tagBaseVec )
0125 process.L1CondDBPayloadWriterExt.writeL1TriggerKeyExt = False
0126 
0127 if options.overwriteKey == 0:
0128     process.L1CondDBPayloadWriterExt.overwriteKeys = False
0129 else:
0130     process.L1CondDBPayloadWriterExt.overwriteKeys = True
0131 #    if options.genFromOMDS != 0:
0132 
0133 process.maxEvents = cms.untracked.PSet(
0134     input = cms.untracked.int32(1)
0135 )
0136 process.source = cms.Source("EmptySource")
0137 
0138 process.p = cms.Path(process.L1CondDBPayloadWriterExt)