Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:51:43

0001 import socket
0002 import FWCore.ParameterSet.Config as cms
0003 import FWCore.ParameterSet.VarParsing as VarParsing
0004 process = cms.Process("BeamSpotOnlineStartRun")
0005 from CondCore.CondDB.CondDB_cfi import *
0006 
0007 options = VarParsing.VarParsing()
0008 options.register( 'destinationConnection'
0009                 , 'sqlite_file:beamspot_test.db' #default value
0010                 , VarParsing.VarParsing.multiplicity.singleton
0011                 , VarParsing.VarParsing.varType.string
0012                 , "Connection string to the DB where payloads will be possibly written."
0013                   )
0014 options.register( 'targetConnection'
0015                 , '' #default value
0016                 , VarParsing.VarParsing.multiplicity.singleton
0017                 , VarParsing.VarParsing.varType.string
0018                 , """Connection string to the target DB:
0019                      if not empty (default), this provides the latest IOV and payloads to compare;
0020                      it is the DB where payloads should be finally uploaded."""
0021                   )
0022 options.register( 'tag'
0023                 , 'beamspot_test'
0024                 , VarParsing.VarParsing.multiplicity.singleton
0025                 , VarParsing.VarParsing.varType.string
0026                 , "Tag written in destinationConnection and finally appended in targetConnection."
0027                   )
0028 options.register( 'sourceTag'
0029                 , ''
0030                 , VarParsing.VarParsing.multiplicity.singleton
0031                 , VarParsing.VarParsing.varType.string
0032                 , "Tag used to retrieve the source payload from the targetConnection."
0033                   )
0034 options.register( 'runNumber'
0035                 , 1 #default value                                                                                                                                                          
0036                 , VarParsing.VarParsing.multiplicity.singleton
0037                 , VarParsing.VarParsing.varType.int
0038                 , "Run number for the target since."
0039                   )
0040 options.register( 'messageLevel'
0041                 , 0 #default value
0042                 , VarParsing.VarParsing.multiplicity.singleton
0043                 , VarParsing.VarParsing.varType.int
0044                 , "Message level; default to 0"
0045                   )
0046 options.parseArguments()
0047 
0048 CondDBConnection = CondDB.clone( connect = cms.string( options.destinationConnection ) )
0049 CondDBConnection.DBParameters.messageLevel = cms.untracked.int32( options.messageLevel )
0050 
0051 process.MessageLogger = cms.Service("MessageLogger",
0052                                     cout = cms.untracked.PSet(threshold = cms.untracked.string('INFO')),
0053                                     destinations = cms.untracked.vstring('cout')
0054                                     )
0055 
0056 process.source = cms.Source("EmptyIOVSource",
0057                             lastValue = cms.uint64(1),
0058                             timetype = cms.string('runnumber'),
0059                             firstValue = cms.uint64(1),
0060                             interval = cms.uint64(1)
0061                             )
0062 
0063 process.PoolDBOutputService = cms.Service("PoolDBOutputService",
0064                                           CondDBConnection,
0065                                           timetype = cms.untracked.string('lumiid'),
0066                                           toPut = cms.VPSet(cms.PSet(record = cms.string('BeamSpotRcd'),
0067                                                                      tag = cms.string( options.tag )
0068                                                                      )
0069                                                             )
0070                                           )
0071 
0072 process.PopCon = cms.EDAnalyzer("BeamSpotOnlinePopConAnalyzer",
0073                                 SinceAppendMode = cms.bool(True),
0074                                 record = cms.string('BeamSpotRcd'),
0075                                 name = cms.untracked.string('BeamSpotOnline'),
0076                                 Source = cms.PSet(
0077                                     runNumber = cms.untracked.uint32( options.runNumber ),
0078                                     sourcePayloadTag = cms.untracked.string( options.sourceTag ),
0079                                     # maxAge = one day in seconds
0080                                     maxAge = cms.untracked.uint32( 86400 ),
0081                                     debug=cms.untracked.bool(False)
0082                                 ),
0083                                loggingOn = cms.untracked.bool(True),
0084                                IsDestDbCheckedInQueryLog = cms.untracked.bool(False)
0085                                )
0086 
0087 process.p = cms.Path(process.PopCon)