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("writeBeamProfile2DB")
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.parseArguments()
0018 
0019 
0020 process.load("FWCore.MessageLogger.MessageLogger_cfi")
0021 from CondCore.CondDB.CondDB_cfi import *
0022 
0023 if options.unitTest :
0024     tag_name = 'simBS_tag'
0025 else:
0026     tag_name = options.inputTag
0027 
0028 #################################
0029 # Produce a SQLITE FILE
0030 #################################
0031 CondDBSimBeamSpotObjects = CondDB.clone(connect = cms.string('sqlite_file:test_%s.db' % tag_name)) # choose an output name
0032 process.PoolDBOutputService = cms.Service("PoolDBOutputService",
0033                                           CondDBSimBeamSpotObjects,
0034                                           timetype = cms.untracked.string('runnumber'),
0035                                           toPut = cms.VPSet(cms.PSet(record = cms.string("SimBeamSpotObjectsRcd"), # SimBeamSpot record
0036                                                                      tag = cms.string(tag_name))),                 # choose your favourite tag
0037                                           loadBlobStreamer = cms.untracked.bool(False)
0038                                           )
0039 
0040 process.source = cms.Source("EmptySource")
0041 
0042 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))
0043 
0044 from CondTools.BeamSpot.beamProfile2DBWriter_cfi import beamProfile2DBWriter
0045 # For the BetaFunc smearing (realistic Beamspot) set the following parameters:
0046 # - X0, Y0, Z0, SigmaZ, BetaStar, Emittance
0047 process.BeamProfile2DBWriter = beamProfile2DBWriter.clone(X0        = 0.0458532,
0048                                                           Y0        = -0.016966,
0049                                                           Z0        = -0.074992,
0050                                                           SigmaZ    = 3.6,
0051                                                           BetaStar  = 30.0,
0052                                                           Emittance = 3.931e-8,)
0053 
0054 # For the Gaussian smearing (ideal Beamspot) set the following parameters:
0055 # - MeanX, MeanY, MeanZ, SigmaX, SigmaY, SigmaZ
0056 #process.BeamProfile2DBWriter = beamProfile2DBWriter.clone(MeanX     = 0.0,
0057 #                                                          MeanY     = 0.0,
0058 #                                                          MeanZ     = 0.0,
0059 #                                                          SigmaX    = 0.0015,
0060 #                                                          SigmaY    = 0.0015,
0061 #                                                          SigmaZ    = 3.6,)
0062 
0063 process.p = cms.Path(process.BeamProfile2DBWriter)