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