Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:42

0001 import FWCore.ParameterSet.Config as cms
0002 import FWCore.ParameterSet.VarParsing as VarParsing
0003 
0004 process = cms.Process("READ")
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('inputTag',
0013                  "myTagName", # default value
0014                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0015                  VarParsing.VarParsing.varType.string, # string, int, or float
0016                  "output tag name")
0017 options.register('startRun',
0018                  1, # default value
0019                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0020                  VarParsing.VarParsing.varType.int, # string, int, or float
0021                  "location of the input data")
0022 options.register('startLumi',
0023                  1, # default value
0024                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0025                  VarParsing.VarParsing.varType.int, # string, int, or float
0026                  "IOV Start Lumi")
0027 options.parseArguments()
0028 
0029 process.load("FWCore.MessageService.MessageLogger_cfi")
0030 process.MessageLogger.cerr.FwkReport.reportEvery = 1000000                 # do not clog output with IO
0031 
0032 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) )   # large number of events is needed since we probe 5000LS for run (see below)
0033 
0034 ####################################################################
0035 # Empty source 
0036 ####################################################################
0037 
0038 process.source = cms.Source("EmptySource",
0039                             firstRun = cms.untracked.uint32(options.startRun),
0040                             firstLuminosityBlock = cms.untracked.uint32(options.startRun),  # probe one LS after the other
0041                             numberEventsInLuminosityBlock = cms.untracked.uint32(1),        # probe one event per LS
0042                             numberEventsInRun = cms.untracked.uint32(1),                    # a number of events > the number of LS possible in a real run (5000 s ~ 32 h)
0043                             )
0044 
0045 ####################################################################
0046 # Connect to conditions DB
0047 ####################################################################
0048 
0049 if options.unitTest:
0050     tag_name = 'simBS_tag'
0051 else:
0052     tag_name = options.inputTag
0053 
0054 # either from Global Tag
0055 # process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cfi")
0056 # from Configuration.AlCa.GlobalTag import GlobalTag
0057 # process.GlobalTag = GlobalTag(process.GlobalTag,"auto:phase1_2023_realistic")
0058 
0059 # ...or specify database connection and tag...
0060 # from CondCore.CondDB.CondDB_cfi import *
0061 # CondDBSimBeamSpot = CondDB.clone(connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS'))
0062 # process.dbInput = cms.ESSource("PoolDBESSource",
0063 #                                CondDBSimBeamSpot,
0064 #                                toGet = cms.VPSet(cms.PSet(record = cms.string('SimBeamSpotObjectsRcd'),
0065 #                                                           tag = cms.string(tag_name)  # customize with input tag name
0066 #                                                           )
0067 #                                                  )
0068 #                                )
0069 
0070 # ...or specify local db file:
0071 from CondCore.CondDB.CondDB_cfi import *
0072 CondDBSimBeamSpot = CondDB.clone(connect = cms.string("sqlite_file:test_%s.db" % tag_name)) # customize with input db file
0073 process.PoolDBESSource = cms.ESSource("PoolDBESSource",
0074     CondDBSimBeamSpot,
0075     DumpStat=cms.untracked.bool(True),
0076     toGet = cms.VPSet(cms.PSet(
0077         record = cms.string('SimBeamSpotObjectsRcd'),
0078         tag = cms.string(tag_name)  # customize with input tag name
0079     ))
0080 )
0081 
0082 ####################################################################
0083 # Load and configure analyzer
0084 ####################################################################
0085 from CondTools.BeamSpot.beamProfile2DBReader_cfi import beamProfile2DBReader
0086 process.BeamProfile2DBRead = beamProfile2DBReader.clone(rawFileName = 'reference_SimBeamSpotObjects.txt')
0087 
0088 ####################################################################
0089 # Output file
0090 ####################################################################
0091 process.TFileService = cms.Service("TFileService",
0092                                    fileName=cms.string("reference_SimBeamSpotObjects.root")
0093                                    ) 
0094 
0095 # Put module in path:
0096 process.p = cms.Path(process.BeamProfile2DBRead)