Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 # This script doesn't work yet.  PoolDBESSource does not see the IOV updates made earlier in the
0002 # same event.
0003 
0004 import FWCore.ParameterSet.Config as cms
0005 
0006 process = cms.Process("L1ConfigWriteRSOnline")
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('runNumber',
0015                  0, #default value
0016                  VarParsing.VarParsing.multiplicity.singleton,
0017                  VarParsing.VarParsing.varType.int,
0018                  "Run number")
0019 options.register('outputDBConnect',
0020                  'sqlite_file:l1config.db', #default value
0021                  VarParsing.VarParsing.multiplicity.singleton,
0022                  VarParsing.VarParsing.varType.string,
0023                  "Connection string for output DB")
0024 options.register('outputDBAuth',
0025                  '.', #default value
0026                  VarParsing.VarParsing.multiplicity.singleton,
0027                  VarParsing.VarParsing.varType.string,
0028                  "Authentication path for outputDB")
0029 options.register('keysFromDB',
0030                  1, #default value
0031                  VarParsing.VarParsing.multiplicity.singleton,
0032                  VarParsing.VarParsing.varType.int,
0033                  "1 = read keys from OMDS, 0 = read keys from command line")
0034 options.register('overwriteKeys',
0035                  0, #default value
0036                  VarParsing.VarParsing.multiplicity.singleton,
0037                  VarParsing.VarParsing.varType.int,
0038                  "Overwrite existing keys")
0039 options.register('forceUpdate',
0040                  0, #default value
0041                  VarParsing.VarParsing.multiplicity.singleton,
0042                  VarParsing.VarParsing.varType.int,
0043                  "Check all record IOVs even if L1TriggerKey unchanged")
0044 options.register('logTransactions',
0045                  1, #default value
0046                  VarParsing.VarParsing.multiplicity.singleton,
0047                  VarParsing.VarParsing.varType.int,
0048                  "Record transactions in log DB")
0049 
0050 # arguments for setting object keys by hand
0051 options.register('L1MuDTTFMasksRcdKey',
0052                  '', #default value
0053                  VarParsing.VarParsing.multiplicity.singleton,
0054                  VarParsing.VarParsing.varType.string,
0055                  "Object key")
0056 options.register('L1MuGMTChannelMaskRcdKey',
0057                  '', #default value
0058                  VarParsing.VarParsing.multiplicity.singleton,
0059                  VarParsing.VarParsing.varType.string,
0060                  "Object key")
0061 options.register('L1RCTChannelMaskRcdKey',
0062                  '', #default value
0063                  VarParsing.VarParsing.multiplicity.singleton,
0064                  VarParsing.VarParsing.varType.string,
0065                  "Object key")
0066 options.register('L1GctChannelMaskRcdKey',
0067                  '', #default value
0068                  VarParsing.VarParsing.multiplicity.singleton,
0069                  VarParsing.VarParsing.varType.string,
0070                  "Object key")
0071 options.register('L1GtPrescaleFactorsAlgoTrigRcdKey',
0072                  '', #default value
0073                  VarParsing.VarParsing.multiplicity.singleton,
0074                  VarParsing.VarParsing.varType.string,
0075                  "Object key")
0076 options.register('L1GtPrescaleFactorsTechTrigRcdKey',
0077                  '', #default value
0078                  VarParsing.VarParsing.multiplicity.singleton,
0079                  VarParsing.VarParsing.varType.string,
0080                  "Object key")
0081 options.register('L1GtTriggerMaskAlgoTrigRcdKey',
0082                  '', #default value
0083                  VarParsing.VarParsing.multiplicity.singleton,
0084                  VarParsing.VarParsing.varType.string,
0085                  "Object key")
0086 options.register('L1GtTriggerMaskTechTrigRcdKey',
0087                  '', #default value
0088                  VarParsing.VarParsing.multiplicity.singleton,
0089                  VarParsing.VarParsing.varType.string,
0090                  "Object key")
0091 options.register('L1GtTriggerMaskVetoTechTrigRcdKey',
0092                  '', #default value
0093                  VarParsing.VarParsing.multiplicity.singleton,
0094                  VarParsing.VarParsing.varType.string,
0095                  "Object key")
0096 
0097 options.parseArguments()
0098 
0099 # Define CondDB tags
0100 from CondTools.L1Trigger.L1CondEnum_cfi import L1CondEnum
0101 from CondTools.L1Trigger.L1O2OTags_cfi import initL1O2OTags
0102 initL1O2OTags()
0103 
0104 if options.keysFromDB == 1:
0105     process.load("CondTools.L1Trigger.L1ConfigRSKeys_cff")
0106 else:
0107     process.load("CondTools.L1Trigger.L1TriggerKeyDummy_cff")
0108     from CondTools.L1Trigger.L1RSSubsystemParams_cfi import initL1RSSubsystems
0109     initL1RSSubsystems( tagBaseVec = initL1O2OTags.tagBaseVec,
0110                         L1MuDTTFMasksRcdKey = options.L1MuDTTFMasksRcdKey,
0111                         L1MuGMTChannelMaskRcdKey = options.L1MuGMTChannelMaskRcdKey,
0112                         L1RCTChannelMaskRcdKey = options.L1RCTChannelMaskRcdKey,
0113                         L1GctChannelMaskRcdKey = options.L1GctChannelMaskRcdKey,
0114                         L1GtPrescaleFactorsAlgoTrigRcdKey = options.L1GtPrescaleFactorsAlgoTrigRcdKey,
0115                         L1GtPrescaleFactorsTechTrigRcdKey = options.L1GtPrescaleFactorsTechTrigRcdKey,
0116                         L1GtTriggerMaskAlgoTrigRcdKey = options.L1GtTriggerMaskAlgoTrigRcdKey,
0117                         L1GtTriggerMaskTechTrigRcdKey = options.L1GtTriggerMaskTechTrigRcdKey,
0118                         L1GtTriggerMaskVetoTechTrigRcdKey = options.L1GtTriggerMaskVetoTechTrigRcdKey,
0119                         includeL1RCTNoisyChannelMask = False )
0120     process.L1TriggerKeyDummy.objectKeys = initL1RSSubsystems.params.recordInfo                        
0121 
0122 # Get L1TriggerKeyList from DB
0123 process.load("CondCore.DBCommon.CondDBCommon_cfi")
0124 process.outputDB = cms.ESSource("PoolDBESSource",
0125                                 process.CondDBCommon,
0126                                 toGet = cms.VPSet(cms.PSet(
0127     record = cms.string('L1TriggerKeyListRcd'),
0128     tag = cms.string('L1TriggerKeyList_' + initL1O2OTags.tagBaseVec[ L1CondEnum.L1TriggerKeyList ] )
0129     )),
0130                                 RefreshEachRun=cms.untracked.bool(True)
0131                                 )
0132 process.outputDB.connect = options.outputDBConnect
0133 process.outputDB.DBParameters.authenticationPath = options.outputDBAuth
0134 
0135 # Generate configuration data
0136 process.load("CondTools.L1Trigger.L1ConfigRSPayloads_cff")
0137 
0138 # writer modules
0139 from CondTools.L1Trigger.L1CondDBPayloadWriter_cff import initPayloadWriter
0140 initPayloadWriter( process,
0141                    outputDBConnect = options.outputDBConnect,
0142                    outputDBAuth = options.outputDBAuth,
0143                    tagBaseVec = initL1O2OTags.tagBaseVec )
0144 process.L1CondDBPayloadWriter.writeL1TriggerKey = cms.bool(False)
0145 
0146 if options.logTransactions == 1:
0147 #    initPayloadWriter.outputDB.logconnect = cms.untracked.string('oracle://cms_orcon_prod/CMS_COND_31X_POPCONLOG')
0148     initPayloadWriter.outputDB.logconnect = cms.untracked.string('sqlite_file:l1o2o-log.db')
0149     process.L1CondDBPayloadWriter.logTransactions = True
0150 
0151 if options.overwriteKeys == 0:
0152     process.L1CondDBPayloadWriter.overwriteKeys = False
0153 else:
0154     process.L1CondDBPayloadWriter.overwriteKeys = True
0155 
0156 if options.forceUpdate == 1:
0157     process.L1CondDBIOVWriter.forceUpdate = True
0158 
0159 from CondTools.L1Trigger.L1CondDBIOVWriter_cff import initIOVWriter
0160 initIOVWriter( process,
0161                outputDBConnect = options.outputDBConnect,
0162                outputDBAuth = options.outputDBAuth,
0163                tagBaseVec = initL1O2OTags.tagBaseVec,
0164                tscKey = '' )
0165 process.L1CondDBIOVWriter.logKeys = True
0166 
0167 if options.logTransactions == 1:
0168 #    initIOVWriter.outputDB.logconnect = cms.untracked.string('oracle://cms_orcon_prod/CMS_COND_31X_POPCONLOG')
0169     initIOVWriter.outputDB.logconnect = cms.untracked.string('sqlite_file:l1o2o-log.db')
0170     process.L1CondDBIOVWriter.logTransactions = True
0171 
0172 process.maxEvents = cms.untracked.PSet(
0173     input = cms.untracked.int32(1)
0174 )
0175 process.source = cms.Source("EmptyIOVSource",
0176     timetype = cms.string('runnumber'),
0177     firstValue = cms.uint64(options.runNumber),
0178     lastValue = cms.uint64(options.runNumber),
0179     interval = cms.uint64(1)
0180 )
0181 
0182 # CORAL debugging
0183 #process.outputDB.DBParameters.messageLevel = cms.untracked.int32(3)
0184 
0185 process.p = cms.Path(process.L1CondDBPayloadWriter*process.L1CondDBIOVWriter)