Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-27 03:17:58

0001 # to test the communication with DBS and produce the csctf configuration
0002 import FWCore.ParameterSet.Config as cms
0003 
0004 process = cms.Process("QWE")
0005 process.load("FWCore.MessageLogger.MessageLogger_cfi")
0006 process.MessageLogger.cout.enable = cms.untracked.bool(True)
0007 process.MessageLogger.cout.threshold = cms.untracked.string('INFO')
0008 process.MessageLogger.debugModules = cms.untracked.vstring('*')
0009 
0010 import FWCore.ParameterSet.VarParsing as VarParsing
0011 options = VarParsing.VarParsing()
0012 options.register('topKey',
0013                  '', # empty default value
0014                  VarParsing.VarParsing.multiplicity.singleton,
0015                  VarParsing.VarParsing.varType.string,
0016                  "object key")
0017 options.register('systemKey',
0018                  '', # empty default value
0019                  VarParsing.VarParsing.multiplicity.singleton,
0020                  VarParsing.VarParsing.varType.string,
0021                  "object key")
0022 options.register('outputDBConnect',
0023                  'sqlite_file:./l1config.db', # default value
0024                  VarParsing.VarParsing.multiplicity.singleton,
0025                  VarParsing.VarParsing.varType.string,
0026                  "Connection string for output DB")
0027 options.register('DBConnect',
0028                  'oracle://cms_omds_adg/CMS_TRG_R', # default value
0029                  VarParsing.VarParsing.multiplicity.singleton,
0030                  VarParsing.VarParsing.varType.string,
0031                  "OMDS connect string")
0032 options.register('DBAuth',
0033                  '.', # default value
0034                  VarParsing.VarParsing.multiplicity.singleton,
0035                  VarParsing.VarParsing.varType.string,
0036                  "Authentication path for the DB")
0037 options.parseArguments()
0038 
0039 # sanity checks
0040 if ( len(options.topKey) and len(options.systemKey) ) or ( len(options.topKey)==0 and len(options.systemKey)==0 ) :
0041     print("Specify either the topKey (top-level tsc:rs key) or systemKey (system specific tsc:rs key), but not both")
0042     exit(1)
0043 
0044 # standard CMSSW stuff
0045 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) )
0046 process.source = cms.Source("EmptySource")
0047 
0048 # add dummy L1TriggerKeyList so as to suppress framework related warning
0049 process.load("CondTools.L1TriggerExt.L1TriggerKeyListDummyExt_cff")
0050 
0051 # produce L1TriggerKey for the subsystem online producers
0052 if len(options.topKey) :
0053     # parent L1TriggerKey that will seed system-specific key to be automatically generated below
0054     process.load("CondTools.L1TriggerExt.L1TriggerKeyRcdSourceExt_cfi")
0055     process.load("CondTools.L1TriggerExt.L1SubsystemKeysOnlineExt_cfi")
0056     process.L1SubsystemKeysOnlineExt.tscKey = cms.string( options.topKey.split(':')[0] )
0057     process.L1SubsystemKeysOnlineExt.rsKey  = cms.string( options.topKey.split(':')[1] )
0058     process.L1SubsystemKeysOnlineExt.onlineAuthentication = cms.string( options.DBAuth )
0059     process.L1SubsystemKeysOnlineExt.forceGeneration = cms.bool(True)
0060     # using the parent L1TriggerKey above start generation of system-specific (labeled) L1TriggerKeys and pack them the main (unlabeled) L1TriggerKey (just one subsystem here)
0061     process.load("CondTools.L1TriggerExt.L1TriggerKeyOnlineExt_cfi")
0062     process.L1TriggerKeyOnlineExt.subsystemLabels = cms.vstring('OMTF')
0063     # include the system-specific subkeys ESProducer (generates OMTF labeled L1TriggerKey)
0064     process.load("L1TriggerConfig.L1TConfigProducers.L1TMuonOverlapObjectKeysOnline_cfi")
0065     process.L1TMuonOverlapObjectKeysOnline.onlineAuthentication = cms.string( options.DBAuth    )
0066     process.L1TMuonOverlapObjectKeysOnline.onlineDB             = cms.string( options.DBConnect )
0067 else :
0068     # instantiate manually the system-specific L1TriggerKey using the subsystemKey option
0069     process.load("CondTools.L1TriggerExt.L1TriggerKeyDummyExt_cff")
0070     process.L1TriggerKeyDummyExt.tscKey = cms.string('dummyL1TMuonOverlap')
0071     process.L1TriggerKeyDummyExt.objectKeys = cms.VPSet(
0072         cms.PSet(
0073             record = cms.string('L1TMuonOverlapParamsO2ORcd'),
0074             type = cms.string('L1TMuonOverlapParams'),
0075             key = cms.string(options.systemKey)
0076         )
0077     )
0078 
0079 # This online produced should never be called if the rest of the O2O machinery works as expected
0080 process.load("L1TriggerConfig.L1TConfigProducers.L1TMuonOverlapParamsOnline_cfi")
0081 
0082 process.load('CondTools.L1TriggerExt.L1CondDBPayloadWriterExt_cfi')
0083 process.L1TMuonOverlapParamsOnlineProd.onlineAuthentication = cms.string( options.DBAuth )
0084 process.L1TMuonOverlapParamsOnlineProd.onlineDB             = cms.string( options.DBConnect )
0085 
0086 
0087 from CondCore.CondDB.CondDB_cfi import CondDB
0088 CondDB.connect = cms.string(options.outputDBConnect)
0089 
0090 # Suppress warnings, not actually used, except for copyNonO2OPayloads
0091 process.refDB = cms.ESSource("PoolDBESSource",
0092                                 CondDB,
0093                                 toGet = cms.VPSet(cms.PSet(
0094                                       record = cms.string('L1TriggerKeyListExtRcd'),
0095                                       tag = cms.string('L1TriggerKeyListExt_Stage2v0_hlt')
0096                                 )),
0097                                 RefreshEachRun=cms.untracked.bool(True)
0098                                 )
0099 
0100 outputDB = cms.Service("PoolDBOutputService",
0101     CondDB,
0102     toPut   = cms.VPSet(
0103         cms.PSet(
0104             record = cms.string('L1TMuonOverlapParamsO2ORcd'),
0105             tag = cms.string('L1TMuonOverlapParams_Stage2v0_hlt')
0106         ),
0107         cms.PSet(
0108             record = cms.string("L1TriggerKeyListExtRcd"),
0109             tag = cms.string("L1TriggerKeyListExt_Stage2v0_hlt")
0110         )
0111     )
0112 )
0113 
0114 outputDB.DBParameters.authenticationPath = options.DBAuth
0115 process.add_(outputDB)
0116 
0117 
0118 process.p = cms.Path(process.L1CondDBPayloadWriterExt)