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 ttbar.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 = "ttbar" + options.geometry + ".root"
0029 outFile = "simevent_ttbar" + 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.PythiaTT_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 
0077 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0078 from Configuration.AlCa.GlobalTag import GlobalTag
0079 process.GlobalTag = GlobalTag(process.GlobalTag, globalTag, '')
0080 
0081 process.source = cms.Source("EmptySource")
0082 
0083 process.maxEvents = cms.untracked.PSet(
0084     input = cms.untracked.int32(500)
0085 )
0086 
0087 if 'MessageLogger' in process.__dict__:
0088     process.MessageLogger.G4cerr=dict()
0089     process.MessageLogger.HitStudy=dict()
0090     process.MessageLogger.HcalSim=dict()
0091 
0092 process.Timing = cms.Service("Timing")
0093 
0094 process.SimpleMemoryCheck = cms.Service("SimpleMemoryCheck",
0095     oncePerEventMode = cms.untracked.bool(True),
0096     showMallocInfo = cms.untracked.bool(True),
0097     dump = cms.untracked.bool(True),
0098     ignoreTotal = cms.untracked.int32(1)
0099 )
0100 
0101 process.load("IOMC.RandomEngine.IOMC_cff")
0102 process.RandomNumberGeneratorService.generator.initialSeed = 456789
0103 process.RandomNumberGeneratorService.g4SimHits.initialSeed = 9876
0104 process.RandomNumberGeneratorService.VtxSmeared.initialSeed = 123456789
0105 process.rndmStore = cms.EDProducer("RandomEngineStateProducer")
0106 
0107 process.TFileService = cms.Service("TFileService",
0108     fileName = cms.string(histFile)
0109 )
0110 
0111 # Event output
0112 process.output = cms.OutputModule("PoolOutputModule",
0113     process.FEVTSIMEventContent,
0114     fileName = cms.untracked.string(outFile)
0115 )
0116 
0117 process.generation_step = cms.Path(process.pgen)
0118 process.simulation_step = cms.Path(process.psim)
0119 process.analysis_step   = cms.Path(process.CaloSimHitStudy)
0120 process.out_step = cms.EndPath(process.output)
0121 
0122 process.generator.pythiaHepMCVerbosity = False
0123 process.generator.pythiaPylistVerbosity = 0
0124 process.g4SimHits.Physics.type = 'SimG4Core/Physics/FTFP_BERT_EMM'
0125 #process.g4SimHits.HCalSD.TestNumberingScheme = False
0126 process.CaloSimHitStudy.TestNumbering = True
0127 
0128 # Schedule definition
0129 process.schedule = cms.Schedule(process.generation_step,
0130                                 process.simulation_step,
0131                                 process.analysis_step,
0132 #                               process.out_step
0133                                 )
0134 
0135 # filter all path with the production filter sequence
0136 for path in process.paths:
0137         getattr(process,path)._seq = process.generator * getattr(process,path)._seq