Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:01:54

0001 from __future__ import absolute_import
0002 import FWCore.ParameterSet.Config as cms
0003 import FWCore.ParameterSet.VarParsing as VarParsing
0004 from . import popcon2dropbox
0005 
0006 options = VarParsing.VarParsing()
0007 options.register('targetFile',
0008                 'popcon.db',
0009                 VarParsing.VarParsing.multiplicity.singleton,
0010                 VarParsing.VarParsing.varType.string,
0011                 "the target sqlite file name")
0012 options.register('destinationDatabase',
0013                 '',
0014                 VarParsing.VarParsing.multiplicity.singleton,
0015                 VarParsing.VarParsing.varType.string,
0016                 "the destination database connection string")
0017 options.register('destinationTag',
0018                 '',
0019                 VarParsing.VarParsing.multiplicity.singleton,
0020                 VarParsing.VarParsing.varType.string,
0021                 "the destination tag name")
0022 options.parseArguments()
0023 
0024 def setup_popcon( recordName, tagTimeType ):
0025     psetForOutRec = []
0026     psetForOutRec.append( cms.PSet( record = cms.string(str( recordName )),
0027                                     tag = cms.string(str( options.destinationTag )),
0028                                     timetype = cms.untracked.string(str(tagTimeType))
0029                                     )
0030                           )
0031 
0032     sqliteConnect = 'sqlite:%s' %options.targetFile
0033     process = cms.Process("PopCon")
0034     process.load("CondCore.CondDB.CondDB_cfi")
0035     process.CondDB.DBParameters.messageLevel = cms.untracked.int32( 3 )
0036 
0037     process.PoolDBOutputService = cms.Service("PoolDBOutputService",
0038                                               DBParameters = cms.PSet( messageLevel = cms.untracked.int32( 3 ),
0039                                                                        ),
0040                                               connect = cms.string( sqliteConnect ),
0041                                               toPut = cms.VPSet( psetForOutRec )
0042     )
0043     
0044     process.source = cms.Source("EmptyIOVSource",
0045                                 timetype   = cms.string('runnumber'),
0046                                 firstValue = cms.uint64(1),
0047                                 lastValue  = cms.uint64(1),
0048                                 interval   = cms.uint64(1)
0049     )
0050     return process
0051 
0052 def psetForRecord( recordName ):
0053     psetForRec = []
0054     psetForRec.append( cms.PSet( record = cms.string(str(recordName)),
0055                                  tag = cms.string(str( options.destinationTag ))
0056                                  ) 
0057                        )
0058     return psetForRec