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