Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 from __future__ import print_function
0002 # Example using L1RCTParameters
0003 
0004 import FWCore.ParameterSet.Config as cms
0005 
0006 process = cms.Process("L1ConfigWritePayloadDummy")
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('objectKey',
0015                  'dummy', #default value
0016                  VarParsing.VarParsing.multiplicity.singleton,
0017                  VarParsing.VarParsing.varType.string,
0018                  "object key")
0019 options.register('objectType',
0020                  'L1RCTParameters', #default value
0021                  VarParsing.VarParsing.multiplicity.singleton,
0022                  VarParsing.VarParsing.varType.string,
0023                  "object C++ type")
0024 options.register('recordName',
0025                  'L1RCTParametersRcd', #default value
0026                  VarParsing.VarParsing.multiplicity.singleton,
0027                  VarParsing.VarParsing.varType.string,
0028                  "Name of EventSetup record")
0029 options.register('tagBase',
0030                  'IDEAL', #default value
0031                  VarParsing.VarParsing.multiplicity.singleton,
0032                  VarParsing.VarParsing.varType.string,
0033                  "IOV tags = object_{tagBase}")
0034 options.register('useO2OTags',
0035                  0, #default value
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('genFromOMDS',
0040                  0, #default value
0041                  VarParsing.VarParsing.multiplicity.singleton,
0042                  VarParsing.VarParsing.varType.int,
0043                  "0 = use dummy payloads, 1 = generate payloads from OMDS")
0044 options.register('outputDBConnect',
0045                  'sqlite_file:l1config.db', #default value
0046                  VarParsing.VarParsing.multiplicity.singleton,
0047                  VarParsing.VarParsing.varType.string,
0048                  "Connection string for output DB")
0049 options.register('outputDBAuth',
0050                  '.', #default value
0051                  VarParsing.VarParsing.multiplicity.singleton,
0052                  VarParsing.VarParsing.varType.string,
0053                  "Authentication path for outputDB")
0054 options.register('overwriteKey',
0055                  0, #default value
0056                  VarParsing.VarParsing.multiplicity.singleton,
0057                  VarParsing.VarParsing.varType.int,
0058                  "Overwrite existing key")
0059 options.register('startup',
0060                  0, #default value
0061                  VarParsing.VarParsing.multiplicity.singleton,
0062                  VarParsing.VarParsing.varType.int,
0063                  "Use L1StartupConfig_cff instead of L1DummyConfig_cff")
0064 options.register('rpcFileDir',
0065                  '', #default value
0066                  VarParsing.VarParsing.multiplicity.singleton,
0067                  VarParsing.VarParsing.varType.string,
0068                  "Replacement value of rpcconf.filedir; no replacement by default")
0069 options.register('rpcPACsPerTower',
0070                  -999, #default value
0071                  VarParsing.VarParsing.multiplicity.singleton,
0072                  VarParsing.VarParsing.varType.int,
0073                  "Replacement value of rpcconf.PACsPerTower; no replacement by default")
0074 options.register('rpcBxOrFirstBx',
0075                  -999, #default value
0076                  VarParsing.VarParsing.multiplicity.singleton,
0077                  VarParsing.VarParsing.varType.int,
0078                  "Replacement value of l1RPCBxOrConfig.firstBX; no replacement by default")
0079 options.register('rpcBxOrLastBx',
0080                  -999, #default value
0081                  VarParsing.VarParsing.multiplicity.singleton,
0082                  VarParsing.VarParsing.varType.int,
0083                  "Replacement value of l1RPCBxOrConfig.lastBX; no replacement by default")
0084 options.register('rpcHsb0Mask',
0085                  [-999], #default value
0086                  VarParsing.VarParsing.multiplicity.list,
0087                  VarParsing.VarParsing.varType.int,
0088                  "Replacement value of l1RPCHsbConfig.hsb0Mask; no replacement by default")
0089 options.register('rpcHsb1Mask',
0090                  [-999], #default value
0091                  VarParsing.VarParsing.multiplicity.list,
0092                  VarParsing.VarParsing.varType.int,
0093                  "Replacement value of l1RPCHsbConfig.hsb1Mask; no replacement by default")
0094 options.register('gmtVersionSortRankEtaQLUT',
0095                  -999, #default value
0096                  VarParsing.VarParsing.multiplicity.singleton,
0097                  VarParsing.VarParsing.varType.int,
0098                  "Replacement value of L1MuGMTParameters.VersionSortRankEtaQLUT; no replacement by default")
0099 options.parseArguments()
0100 
0101 # Define CondDB tags
0102 if options.useO2OTags == 0:
0103     from CondTools.L1Trigger.L1CondEnum_cfi import L1CondEnum
0104     from CondTools.L1Trigger.L1UniformTags_cfi import initL1UniformTags
0105     initL1UniformTags( tagBase = options.tagBase )
0106     tagBaseVec = initL1UniformTags.tagBaseVec
0107 else:
0108     from CondTools.L1Trigger.L1CondEnum_cfi import L1CondEnum
0109     from CondTools.L1Trigger.L1O2OTags_cfi import initL1O2OTags
0110     initL1O2OTags()
0111     tagBaseVec = initL1O2OTags.tagBaseVec
0112 
0113 # Generate L1TriggerKey
0114 process.load("CondTools.L1Trigger.L1TriggerKeyDummy_cff")
0115 process.L1TriggerKeyDummy.objectKeys = cms.VPSet(cms.PSet(
0116     record = cms.string(options.recordName),
0117     type = cms.string(options.objectType),
0118     key = cms.string(options.objectKey)
0119 ))
0120 
0121 # Get L1TriggerKeyList from DB
0122 process.load("CondCore.DBCommon.CondDBCommon_cfi")
0123 process.outputDB = cms.ESSource("PoolDBESSource",
0124     process.CondDBCommon,
0125     toGet = cms.VPSet(cms.PSet(
0126         record = cms.string('L1TriggerKeyListRcd'),
0127         tag = cms.string('L1TriggerKeyList_' + tagBaseVec[ L1CondEnum.L1TriggerKeyList ])
0128     ))
0129 )
0130 process.es_prefer_outputDB = cms.ESPrefer("PoolDBESSource","outputDB")
0131 process.outputDB.connect = cms.string(options.outputDBConnect)
0132 process.outputDB.DBParameters.authenticationPath = cms.untracked.string(options.outputDBAuth)
0133 
0134 if options.genFromOMDS == 0:
0135     # Generate dummy configuration data
0136     if options.startup == 0:
0137         process.load("L1Trigger.Configuration.L1DummyConfig_cff")
0138         process.load("L1TriggerConfig.L1GtConfigProducers.Luminosity.lumi1031.L1Menu_MC2009_v2_L1T_Scales_20090624_Imp0_Unprescaled_cff")
0139     else:
0140         process.load("L1Trigger.Configuration.L1StartupConfig_cff")
0141         process.load("L1TriggerConfig.L1GtConfigProducers.Luminosity.startup.L1Menu_Commissioning2009_v3_L1T_Scales_20080926_startup_Imp0_Unprescaled_cff")
0142 
0143     process.l1CSCTFConfig.ptLUT_path = '/afs/cern.ch/cms/MUON/csc/fast1/track_finder/luts/PtLUT.dat'
0144     
0145     # Optional customization for RPC objects
0146     if options.rpcFileDir != "":
0147         process.rpcconf.filedir = options.rpcFileDir
0148         print("New rpcconf.filedir =", process.rpcconf.filedir)
0149     if options.rpcPACsPerTower != -999:
0150         process.rpcconf.PACsPerTower = options.rpcPACsPerTower
0151         print("New rpcconf.PACsPerTower =", process.rpcconf.PACsPerTower)
0152     if options.rpcBxOrFirstBx != -999:
0153         process.l1RPCBxOrConfig.firstBX = options.rpcBxOrFirstBx
0154         print("New l1RPCBxOrConfig.firstBX =", process.l1RPCBxOrConfig.firstBX)
0155     if options.rpcBxOrLastBx != -999:
0156         process.l1RPCBxOrConfig.lastBX = options.rpcBxOrLastBx
0157         print("New l1RPCBxOrConfig.lastBX =", process.l1RPCBxOrConfig.lastBX)
0158     if options.rpcHsb0Mask != [[-999]]:
0159         process.l1RPCHsbConfig.hsb0Mask = options.rpcHsb0Mask
0160         print("New l1RPCHsbConfig.hsb0Mask =", process.l1RPCHsbConfig.hsb0Mask)
0161     if options.rpcHsb1Mask != [[-999]]:
0162         process.l1RPCHsbConfig.hsb1Mask = options.rpcHsb1Mask
0163         print("New l1RPCHsbConfig.hsb1Mask =", process.l1RPCHsbConfig.hsb1Mask)
0164     if options.gmtVersionSortRankEtaQLUT != -999:
0165         process.L1MuGMTParameters.VersionSortRankEtaQLUT = options.gmtVersionSortRankEtaQLUT
0166         print("New L1MuGMTParameters.VersionSortRankEtaQLUT =", options.gmtVersionSortRankEtaQLUT)
0167 else:
0168     # Generate configuration data from OMDS
0169     process.load("CondTools.L1Trigger.L1ConfigTSCPayloads_cff")
0170     process.load("CondTools.L1Trigger.L1ConfigRSPayloads_cff")
0171 
0172 # writer modules
0173 from CondTools.L1Trigger.L1CondDBPayloadWriter_cff import initPayloadWriter
0174 initPayloadWriter( process,
0175                    outputDBConnect = options.outputDBConnect,
0176                    outputDBAuth = options.outputDBAuth,
0177                    tagBaseVec = tagBaseVec )
0178 process.L1CondDBPayloadWriter.writeL1TriggerKey = False
0179 
0180 if options.overwriteKey == 0:
0181     process.L1CondDBPayloadWriter.overwriteKeys = False
0182 else:
0183     process.L1CondDBPayloadWriter.overwriteKeys = True
0184     if options.genFromOMDS != 0:
0185         process.CSCTFConfigOnline.forceGeneration = True
0186         process.L1MuCSCPtLutConfigOnline.forceGeneration = True
0187         process.L1MuDTEtaPatternLutOnline.forceGeneration = True
0188         process.L1MuDTExtLutOnline.forceGeneration = True
0189         process.L1MuDTPhiLutOnline.forceGeneration = True
0190         process.L1MuDTPtaLutOnline.forceGeneration = True
0191         process.L1MuDTQualPatternLutOnline.forceGeneration = True
0192         process.L1RPCConfigOnline.forceGeneration = True
0193         process.L1RPCConeDefinitionOnline.forceGeneration = True
0194         process.L1RPCHsbConfigOnline.forceGeneration = True
0195         process.L1RPCBxOrConfigOnline.forceGeneration = True
0196         process.L1MuGMTParametersOnlineProducer.forceGeneration = True
0197         process.L1MuTriggerPtScaleOnlineProducer.forceGeneration = True
0198         process.L1MuTriggerScalesOnlineProducer.forceGeneration = True
0199         process.L1RCTParametersOnline.forceGeneration = True
0200         process.L1EmEtScaleConfigOnline.forceGeneration = True
0201         process.L1CaloEcalScaleConfigOnline.forceGeneration = True
0202         process.L1CaloHcalScaleConfigOnline.forceGeneration = True
0203         process.L1GctJetFinderParamsOnline.forceGeneration = True
0204         process.L1HtMissScaleOnline.forceGeneration = True
0205         process.L1HfRingEtScaleOnline.forceGeneration = True
0206         process.L1JetEtScaleOnline.forceGeneration = True
0207         process.l1GtParametersOnline.forceGeneration = True
0208         process.l1GtPsbSetupOnline.forceGeneration = True
0209         process.l1GtTriggerMenuOnline.forceGeneration = True
0210         process.L1MuDTTFMasksOnline.forceGeneration = True
0211         process.L1RCTChannelMaskOnline.forceGeneration = True
0212         process.L1GctChannelMaskOnline.forceGeneration = True
0213         process.L1MuGMTChannelMaskConfigOnline.forceGeneration = True
0214         process.l1GtPrescaleFactorsAlgoTrigOnline.forceGeneration = True
0215         process.l1GtPrescaleFactorsTechTrigOnline.forceGeneration = True
0216         process.l1GtTriggerMaskAlgoTrigOnline.forceGeneration = True
0217         process.l1GtTriggerMaskTechTrigOnline.forceGeneration = True
0218         process.l1GtTriggerMaskVetoTechTrigOnline.forceGeneration = True
0219 
0220 process.maxEvents = cms.untracked.PSet(
0221     input = cms.untracked.int32(1)
0222 )
0223 process.source = cms.Source("EmptySource")
0224 
0225 process.p = cms.Path(process.L1CondDBPayloadWriter)