Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:27

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