Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:23:16

0001 import FWCore.ParameterSet.Config as cms
0002 import FWCore.ParameterSet.VarParsing as VarParsing
0003 
0004 options = VarParsing.VarParsing()
0005 options.register('unitTest',
0006                  False, # default value
0007                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0008                  VarParsing.VarParsing.varType.bool, # string, int, or float
0009                  "are we running the unit test?")
0010 options.register('inputFile',
0011                  "EarlyCollision.db", # default value
0012                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0013                  VarParsing.VarParsing.varType.string, # string, int, or float
0014                  "location of the input data")
0015 options.parseArguments()
0016 
0017 process = cms.Process("readDB")
0018 process.load("FWCore.MessageLogger.MessageLogger_cfi")
0019 process.load("CondCore.CondDB.CondDB_cfi")
0020 
0021 if(options.unitTest):
0022     #in case you want to read from sqlite file
0023     print(options.inputFile)
0024     process.CondDB.connect = cms.string('sqlite_file:'+options.inputFile)
0025 else:
0026     process.CondDB.connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS')
0027 
0028 process.BeamSpotDBSource = cms.ESSource("PoolDBESSource",process.CondDB,
0029                                         toGet = cms.VPSet(cms.PSet(
0030                                             record = cms.string('BeamSpotObjectsRcd'),
0031                                             # change the else clause in case with your favourite BeamSpot
0032                                             tag = cms.string('EarlyCollision') if options.unitTest else cms.string('BeamSpotObjects_Realistic25ns_13TeV2016Collisions_v1_mc'))
0033                                             )
0034                                         )
0035 
0036 process.source = cms.Source("EmptySource")
0037 
0038 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))
0039 process.beamspot = cms.EDAnalyzer("BeamSpotFromDB")
0040 process.p = cms.Path(process.beamspot)
0041