Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-10 01:50:09

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 process = cms.Process("ProcessOne")
0004 
0005 ##
0006 ## MessageLogger
0007 ##
0008 process.load('FWCore.MessageService.MessageLogger_cfi')   
0009 process.MessageLogger.cerr.enable = False
0010 process.MessageLogger.AlignPCLThresholdsReader=dict()  
0011 process.MessageLogger.AlignPCLThresholds=dict()  
0012 process.MessageLogger.cout = cms.untracked.PSet(
0013     enable    = cms.untracked.bool(True),
0014     enableStatistics = cms.untracked.bool(True),
0015     threshold = cms.untracked.string("INFO"),
0016     default   = cms.untracked.PSet(limit = cms.untracked.int32(0)),                       
0017     FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(-1),
0018                                    reportEvery = cms.untracked.int32(1000)
0019                                    ),                                                      
0020     AlignPCLThresholdsReader = cms.untracked.PSet( limit = cms.untracked.int32(-1)),
0021     AlignPCLThresholds       = cms.untracked.PSet( limit = cms.untracked.int32(-1)),
0022     AlignPCLThresholdsHG     = cms.untracked.PSet( limit = cms.untracked.int32(-1))
0023     )
0024 
0025 ##
0026 ## Var Parsing
0027 ##
0028 import FWCore.ParameterSet.VarParsing as VarParsing
0029 options = VarParsing.VarParsing()
0030 options.register('readLGpayload',
0031                 False,
0032                 VarParsing.VarParsing.multiplicity.singleton,
0033                 VarParsing.VarParsing.varType.bool,
0034                 "Read old payload type used for LG thresholds")
0035 options.parseArguments()
0036 
0037 ##
0038 ## Define record, class and module based on option
0039 ##
0040 [rcdName, className, moduleName] = ["AlignPCLThresholdsRcd","AlignPCLThresholds","AlignPCLThresholdsLGReader"] \
0041                                    if (options.readLGpayload) else ["AlignPCLThresholdsHGRcd","AlignPCLThresholdsHG","AlignPCLThresholdsHGReader"]
0042 
0043 print("using %s %s %s" % (rcdName, className, moduleName))
0044 ##
0045 ## Empty Source
0046 ##
0047 process.source = cms.Source("EmptyIOVSource",
0048                             timetype = cms.string('runnumber'),
0049                             firstValue = cms.uint64(1),
0050                             lastValue = cms.uint64(1),
0051                             interval = cms.uint64(1)
0052                             )
0053 ##
0054 ## Get the payload
0055 ##
0056 from CondCore.CondDB.CondDB_cfi import *
0057 inputDBfile = 'sqlite_file:mythresholds_%s.db' % ("LG" if(options.readLGpayload) else "HG") 
0058 
0059 CondDBThresholds = CondDB.clone(connect = cms.string(inputDBfile))
0060 
0061 process.dbInput = cms.ESSource("PoolDBESSource",
0062                                CondDBThresholds,
0063                                toGet = cms.VPSet(cms.PSet(record = cms.string(rcdName),
0064                                                           tag = cms.string('PCLThresholds_express_v0') # choose tag you want
0065                                                           )
0066                                                  )
0067                                )
0068 ##
0069 ## Retrieve it and check it's available in the ES
0070 ##
0071 process.get = cms.EDAnalyzer("EventSetupRecordDataGetter",
0072                              toGet = cms.VPSet(cms.PSet(record = cms.string(rcdName),
0073                                                         data = cms.vstring(className)
0074                                                         )
0075                                                ),
0076                              verbose = cms.untracked.bool(True)
0077                              )
0078 
0079 ##
0080 ## Read it back
0081 ##
0082 from CondFormats.PCLConfig.edmtestAlignPCLThresholdsReaderAlignPCLThresholdsAlignPCLThresholdsRcd_cfi import *
0083 from CondFormats.PCLConfig.edmtestAlignPCLThresholdsReaderAlignPCLThresholdsHGAlignPCLThresholdsHGRcd_cfi import *
0084 
0085 if(options.readLGpayload):
0086     process.ReadDB = edmtestAlignPCLThresholdsReaderAlignPCLThresholdsAlignPCLThresholdsRcd.clone(
0087         printDebug = True,
0088         outputFile = 'AlignPCLThresholds_%s.log' % ("LG" if(options.readLGpayload) else "HG")
0089     )
0090 else:
0091     process.ReadDB = edmtestAlignPCLThresholdsReaderAlignPCLThresholdsHGAlignPCLThresholdsHGRcd.clone(
0092         printDebug = True,
0093         outputFile = 'AlignPCLThresholds_%s.log' % ("LG" if(options.readLGpayload) else "HG")
0094     )
0095 
0096 process.p = cms.Path(process.get+process.ReadDB)