Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-08-30 02:11:00

0001 ###############################################################################
0002 # Way to use this:
0003 #   cmsRun minbias.py geometry=2016
0004 #   Options for geometry 2016, 2017, 2018, 2021, 2026, legacy
0005 # 
0006 ###############################################################################
0007 import FWCore.ParameterSet.Config as cms
0008 import os, sys, imp, re
0009 import FWCore.ParameterSet.VarParsing as VarParsing
0010 
0011 ####################################################################
0012 ### SETUP OPTIONS
0013 options = VarParsing.VarParsing('standard')
0014 options.register('geometry',
0015                  "2021",
0016                   VarParsing.VarParsing.multiplicity.singleton,
0017                   VarParsing.VarParsing.varType.string,
0018                   "geometry of operations: 2016, 2017, 2018, 2021, 2026, legacy")
0019 
0020 ### get and parse the command line arguments
0021  
0022 options.parseArguments()
0023 
0024 print(options)
0025 
0026 ####################################################################
0027 # Use the options
0028 histFile = "minbias" + options.geometry + ".root"
0029 outFile = "simevent_minbias" + options.geometry + ".root"
0030 
0031 if (options.geometry == "2016"):
0032     from Configuration.Eras.Era_Run2_2016_cff import Run2_2016
0033     process = cms.Process('Sim',Run2_2016)
0034     geomFile = "Configuration.Geometry.GeometryExtended" + options.geometry + "Reco_cff"
0035     globalTag = "auto:run2_mc"
0036 elif (options.geometry == "2017"):
0037     from Configuration.Eras.Era_Run2_2017_cff import Run2_2017
0038     process = cms.Process('Sim',Run2_2017)
0039     geomFile = "Configuration.Geometry.GeometryExtended" + options.geometry + "Reco_cff"
0040     globalTag = "auto:phase1_2017_realistic"
0041 elif (options.geometry == "2018"):
0042     from Configuration.Eras.Era_Run2_2018_cff import Run2_2018
0043     process = cms.Process('Sim',Run2_2018)
0044     geomFile = "Configuration.Geometry.GeometryExtended" + options.geometry + "Reco_cff"
0045     globalTag = "auto:phase1_2018_realistic"
0046 elif (options.geometry == "2021"):
0047     from Configuration.Eras.Era_Run3_DDD_cff import Run3_DDD
0048     process = cms.Process('Sim',Run3_DDD)
0049     geomFile = "Configuration.Geometry.GeometryExtended" + options.geometry + "Reco_cff"
0050     globalTag = "auto:phase1_2022_realistic"
0051 elif (options.geometry == "2026"):
0052     from Configuration.Eras.Era_Phase2C11M9_cff import Phase2C11M9
0053     process = cms.Process('Sim',Phase2C11M9)
0054     geomFile = "Configuration.Geometry.GeometryExtended" + options.geometry + "D110Reco_cff"
0055     globalTag = "auto:phase2_realistic"
0056 else:
0057     process = cms.Process('Sim')
0058     geomFile = "Configuration.Geometry.GeometryExtendedReco_cff"
0059     globalTag = "auto:run1_mc"
0060 
0061 print("Geometry file: ", geomFile)
0062 print("Hist file:     ", histFile)
0063 print("Output file:   ", outFile)
0064 print("Gobal Tag:     ", globalTag)
0065 
0066 process.load("SimG4CMS.Calo.PythiaMinBias_cfi")
0067 process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
0068 process.load('FWCore.MessageService.MessageLogger_cfi')
0069 process.load("IOMC.EventVertexGenerators.VtxSmearedGauss_cfi")
0070 process.load(geomFile)
0071 process.load("Configuration.StandardSequences.MagneticField_cff")
0072 process.load("Configuration.EventContent.EventContent_cff")
0073 process.load('Configuration.StandardSequences.Generator_cff')
0074 process.load('Configuration.StandardSequences.SimIdeal_cff')
0075 process.load("SimG4CMS.Calo.CaloSimHitStudy_cfi")
0076 process.load("SimG4CMS.Calo.hcalSimHitDump_cfi")
0077 
0078 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0079 from Configuration.AlCa.GlobalTag import GlobalTag
0080 process.GlobalTag = GlobalTag(process.GlobalTag, globalTag, '')
0081 
0082 if 'MessageLogger' in process.__dict__:
0083     process.MessageLogger.G4cerr=dict()
0084     process.MessageLogger.HitStudy=dict()
0085     process.MessageLogger.HcalSim=dict()
0086 
0087 process.source = cms.Source("EmptySource")
0088 
0089 process.maxEvents = cms.untracked.PSet(
0090     input = cms.untracked.int32(1000)
0091 )
0092 
0093 process.Timing = cms.Service("Timing")
0094 
0095 process.SimpleMemoryCheck = cms.Service("SimpleMemoryCheck",
0096     oncePerEventMode = cms.untracked.bool(True),
0097     showMallocInfo = cms.untracked.bool(True),
0098     dump = cms.untracked.bool(True),
0099     ignoreTotal = cms.untracked.int32(1)
0100 )
0101 
0102 process.load("IOMC.RandomEngine.IOMC_cff")
0103 process.RandomNumberGeneratorService.generator.initialSeed = 456789
0104 process.RandomNumberGeneratorService.g4SimHits.initialSeed = 9876
0105 process.RandomNumberGeneratorService.VtxSmeared.initialSeed = 123456789
0106 process.rndmStore = cms.EDProducer("RandomEngineStateProducer")
0107 
0108 process.TFileService = cms.Service("TFileService",
0109     fileName = cms.string(histFile)
0110 )
0111 
0112 # Event output
0113 process.output = cms.OutputModule("PoolOutputModule",
0114     process.FEVTSIMEventContent,
0115     fileName = cms.untracked.string(outFile)
0116 )
0117 
0118 process.generation_step = cms.Path(process.pgen)
0119 process.simulation_step = cms.Path(process.psim)
0120 process.analysis_step   = cms.Path(process.CaloSimHitStudy+process.hcalSimHitDump)
0121 process.out_step = cms.EndPath(process.output)
0122 
0123 process.generator.pythiaHepMCVerbosity = False
0124 process.generator.pythiaPylistVerbosity = 0
0125 process.g4SimHits.Physics.type = 'SimG4Core/Physics/FTFP_BERT_EMM'
0126 process.g4SimHits.HCalSD.TestNumberingScheme = False
0127 process.CaloSimHitStudy.TestNumbering = False
0128 process.hcalSimHitDump.MaxEvent = 5
0129 
0130 # Schedule definition                                                          
0131 process.schedule = cms.Schedule(process.generation_step,
0132                                 process.simulation_step,
0133                                 process.analysis_step,
0134 #                               process.out_step
0135                                 )
0136 
0137 # filter all path with the production filter sequence                          
0138 for path in process.paths:
0139         getattr(process,path)._seq = process.generator * getattr(process,path)._seq
0140