Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-03 19:40:28

0001 import FWCore.ParameterSet.Config as cms
0002 import FWCore.ParameterSet.VarParsing as VarParsing
0003 
0004 process = cms.Process("write2DB")
0005 
0006 options = VarParsing.VarParsing()
0007 options.register('unitTest',
0008                  False, # default value
0009                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0010                  VarParsing.VarParsing.varType.bool, # string, int, or float
0011                  "are we running the unit test?")
0012 options.register('inputFile',
0013                  "BeamFitResults_Run306171.txt", # default value
0014                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0015                  VarParsing.VarParsing.varType.string, # string, int, or float
0016                  "location of the input data")
0017 options.register('inputTag',
0018                  "myTagName", # default value
0019                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0020                  VarParsing.VarParsing.varType.string, # string, int, or float
0021                  "output tag name")
0022 options.register('inputRecord',
0023                  "BeamSpotOnlineLegacyObjectsRcd", # default value
0024                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0025                  VarParsing.VarParsing.varType.string, # string, int, or float
0026                  "type of record")
0027 options.register('startRun',
0028                  306171, # default value
0029                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0030                  VarParsing.VarParsing.varType.int, # string, int, or float
0031                  "location of the input data")
0032 options.register('startLumi',
0033                  497, # default value
0034                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0035                  VarParsing.VarParsing.varType.int, # string, int, or float
0036                  "IOV Start Lumi")
0037 options.parseArguments()
0038 
0039 
0040 process.load("FWCore.MessageLogger.MessageLogger_cfi")
0041 from CondCore.CondDB.CondDB_cfi import *
0042 
0043 if options.unitTest :
0044     if options.inputRecord ==  "BeamSpotOnlineLegacyObjectsRcd" : 
0045         tag_name = 'BSLegacy_tag'
0046     else:
0047         tag_name = 'BSHLT_tag'
0048 else:
0049     tag_name = options.inputTag
0050 
0051 #################################
0052 # Produce a SQLITE FILE
0053 #################################
0054 CondDBBeamSpotObjects = CondDB.clone(connect = cms.string('sqlite_file:test_%s.db' % tag_name)) # choose an output name
0055 process.PoolDBOutputService = cms.Service("PoolDBOutputService",
0056                                           CondDBBeamSpotObjects,
0057                                           timetype = cms.untracked.string('lumiid'), #('lumiid'), #('runnumber')
0058                                           toPut = cms.VPSet(cms.PSet(record = cms.string(options.inputRecord), # BeamSpotOnline record
0059                                                                      tag = cms.string(tag_name))),             # choose your favourite tag
0060                                           loadBlobStreamer = cms.untracked.bool(False)
0061                                           )
0062 
0063 process.source = cms.Source("EmptySource")
0064 
0065 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))
0066 
0067 process.beamspotonlinewriter = cms.EDAnalyzer("BeamSpotOnlineRecordsWriter",
0068                                               isHLT = cms.bool((options.inputRecord ==  "BeamSpotOnlineHLTObjectsRcd")),
0069                                               InputFileName = cms.untracked.string(options.inputFile), # choose your input file
0070                                               )
0071 
0072 if(options.startRun>0 and options.startLumi>0):
0073     process.beamspotonlinewriter.IOVStartRun = cms.untracked.uint32(options.startRun)    # Customize your Run
0074     process.beamspotonlinewriter.IOVStartLumi = cms.untracked.uint32(options.startLumi)  # Customize your Lumi
0075 
0076 
0077 process.p = cms.Path(process.beamspotonlinewriter)