Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 # Example using L1RCTParameters
0002 
0003 import FWCore.ParameterSet.Config as cms
0004 
0005 process = cms.Process("L1ConfigWriteIOVDummy")
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                  'L1RCTParameters', #default value
0020                  VarParsing.VarParsing.multiplicity.singleton,
0021                  VarParsing.VarParsing.varType.string,
0022                  "object C++ type")
0023 options.register('recordName',
0024                  'L1RCTParametersRcd', #default value
0025                  VarParsing.VarParsing.multiplicity.singleton,
0026                  VarParsing.VarParsing.varType.string,
0027                  "Name of EventSetup record")
0028 options.register('tagName',
0029                  'L1RCTParameters', #default value
0030                  VarParsing.VarParsing.multiplicity.singleton,
0031                  VarParsing.VarParsing.varType.string,
0032                  "IOV tags = {tagName}_{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('condIndex',
0039                  -999, #default value
0040                  VarParsing.VarParsing.multiplicity.singleton,
0041                  VarParsing.VarParsing.varType.int,
0042                  "Index in L1CondEnum of record")
0043 options.register('runNumber',
0044                  1000, #default value
0045                  VarParsing.VarParsing.multiplicity.singleton,
0046                  VarParsing.VarParsing.varType.int,
0047                  "Run number")
0048 options.register('tagBase',
0049                  'IDEAL', #default value
0050                  VarParsing.VarParsing.multiplicity.singleton,
0051                  VarParsing.VarParsing.varType.string,
0052                  "IOV tags = {tagName}_{tagBase}")
0053 options.register('outputDBConnect',
0054                  'sqlite_file:l1config.db', #default value
0055                  VarParsing.VarParsing.multiplicity.singleton,
0056                  VarParsing.VarParsing.varType.string,
0057                  "Connection string for output DB")
0058 options.register('outputDBAuth',
0059                  '.', #default value
0060                  VarParsing.VarParsing.multiplicity.singleton,
0061                  VarParsing.VarParsing.varType.string,
0062                  "Authentication path for outputDB")
0063 options.parseArguments()
0064 
0065 # Define CondDB tags
0066 if options.useO2OTags == 0:
0067     from CondTools.L1Trigger.L1CondEnum_cfi import L1CondEnum
0068     from CondTools.L1Trigger.L1UniformTags_cfi import initL1UniformTags
0069     initL1UniformTags( tagBase = options.tagBase )
0070     tagBaseVec = initL1UniformTags.tagBaseVec
0071     options.condIndex = 0 # Doesn't matter what index is used with uniform tags
0072 else:
0073     from CondTools.L1Trigger.L1CondEnum_cfi import L1CondEnum
0074     from CondTools.L1Trigger.L1O2OTags_cfi import initL1O2OTags
0075     initL1O2OTags()
0076     tagBaseVec = initL1O2OTags.tagBaseVec
0077 
0078 # Get L1TriggerKeyList from DB
0079 process.load("CondCore.DBCommon.CondDBCommon_cfi")
0080 process.outputDB = cms.ESSource("PoolDBESSource",
0081     process.CondDBCommon,
0082     toGet = cms.VPSet(cms.PSet(
0083         record = cms.string('L1TriggerKeyListRcd'),
0084         tag = cms.string('L1TriggerKeyList_' + tagBaseVec[ L1CondEnum.L1TriggerKeyList ])
0085     ))
0086 )
0087 process.outputDB.connect = cms.string(options.outputDBConnect)
0088 process.outputDB.DBParameters.authenticationPath = options.outputDBAuth
0089 
0090 # writer modules
0091 from CondTools.L1Trigger.L1CondDBIOVWriter_cff import initIOVWriter
0092 initIOVWriter( process,
0093                outputDBConnect = options.outputDBConnect,
0094                outputDBAuth = options.outputDBAuth,
0095                tagBaseVec = tagBaseVec,
0096                tscKey = options.objectKey )
0097 process.L1CondDBIOVWriter.ignoreTriggerKey = cms.bool(True)
0098 process.L1CondDBIOVWriter.toPut = cms.VPSet(cms.PSet(
0099     record = cms.string(options.recordName),
0100     type = cms.string(options.objectType),
0101     tag = cms.string(options.tagName + '_' + tagBaseVec[ options.condIndex ])
0102 ))
0103 
0104 process.maxEvents = cms.untracked.PSet(
0105     input = cms.untracked.int32(1)
0106 )
0107 process.source = cms.Source("EmptyIOVSource",
0108     timetype = cms.string('runnumber'),
0109     firstValue = cms.uint64(options.runNumber),
0110     lastValue = cms.uint64(options.runNumber),
0111     interval = cms.uint64(1)
0112 )
0113 
0114 process.p = cms.Path(process.L1CondDBIOVWriter)