Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:58

0001 ###############################################################################
0002 # Way to use this:
0003 #   cmsRun SimRun3_cfg.py geometry=Default type=DDD data=Muon
0004 #
0005 #   Options for geometry: Default, Other
0006 #               type: DDD, DD4hep
0007 #               data: Muon, MinBias
0008 #
0009 ###############################################################################
0010 import FWCore.ParameterSet.Config as cms
0011 import os, sys, imp, re, random
0012 import FWCore.ParameterSet.VarParsing as VarParsing
0013 
0014 ####################################################################
0015 ### SETUP OPTIONS
0016 options = VarParsing.VarParsing('standard')
0017 options.register('geometry',
0018                  "Default",
0019                   VarParsing.VarParsing.multiplicity.singleton,
0020                   VarParsing.VarParsing.varType.string,
0021                   "type of operations: Default, Other")
0022 options.register('type',
0023                  "DDD",
0024                   VarParsing.VarParsing.multiplicity.singleton,
0025                   VarParsing.VarParsing.varType.string,
0026                   "type of operations: DDD, DD4hep")
0027 options.register('data',
0028                  "Muon",
0029                  VarParsing.VarParsing.multiplicity.singleton,
0030                  VarParsing.VarParsing.varType.string,
0031                  "data of operations: Muon, MinBias")
0032 
0033 ### get and parse the command line arguments
0034 options.parseArguments()
0035 
0036 print(options)
0037 
0038 ####################################################################
0039 # Use the options
0040 
0041 if (options.type == "DDD"):
0042     from Configuration.Eras.Era_Run3_DDD_cff import Run3_DDD
0043     process = cms.Process('SimRun3',Run3_DDD)
0044     if (options.geometry == "Default"):
0045         geomFile = "Configuration.Geometry.GeometryExtended2021Reco_cff"
0046     else:
0047         geomFile = "Geometry.HcalCommonData.GeometryExtended2021Reco_cff"
0048 else:
0049     from Configuration.Eras.Era_Run3_cff import Run3
0050     process = cms.Process('SimRun3',Run3)
0051     if (options.geometry == "Default"):
0052         geomFile = "Configuration.Geometry.GeometryDD4hepExtended2021Reco_cff"
0053     else:
0054         geomFile = "Geometry.HcalCommonData.GeometryDD4hepExtended2021Reco_cff"
0055 
0056 globalTag = "auto:phase1_2022_realistic"
0057 inFile = "file:step0" + options.data + ".root"
0058 outFile = "file:step1" + "Run3" + options.geometry + options.type + options.data + ".root"
0059 tFile = "file:" + "Run3" + options.geometry + options.type + options.data + ".root"
0060 
0061 print("Geometry file: ", geomFile)
0062 print("Global Tag:    ", globalTag)
0063 print("Input file:    ", inFile)
0064 print("Output file:   ", outFile)
0065 print("Histogram file:", tFile)
0066 
0067 process.load(geomFile)
0068 process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
0069 process.load("FWCore.MessageService.MessageLogger_cfi")
0070 process.load("IOMC.EventVertexGenerators.VtxSmearedGauss_cfi")
0071 process.load("Configuration.StandardSequences.MagneticField_cff")
0072 process.load("Configuration.EventContent.EventContent_cff")
0073 process.load("Configuration.StandardSequences.SimIdeal_cff")
0074 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0075 from Configuration.AlCa.GlobalTag import GlobalTag
0076 process.GlobalTag = GlobalTag(process.GlobalTag, globalTag, '')
0077 
0078 process.source = cms.Source("PoolSource",
0079     dropDescendantsOfDroppedBranches = cms.untracked.bool(False),
0080     fileNames = cms.untracked.vstring(inFile),
0081     secondaryFileNames = cms.untracked.vstring()
0082 )
0083 
0084 process.maxEvents = cms.untracked.PSet(
0085     input = cms.untracked.int32(-1),
0086     output = cms.optional.untracked.allowed(cms.int32,cms.PSet)
0087 )
0088 
0089 if 'MessageLogger' in process.__dict__:
0090     process.MessageLogger.G4cerr=dict()
0091     process.MessageLogger.HitStudy=dict()
0092 #   process.MessageLogger.SensitiveDetector=dict()
0093 
0094 process.Timing = cms.Service("Timing")
0095 
0096 process.load("IOMC.RandomEngine.IOMC_cff")
0097 process.RandomNumberGeneratorService.generator.initialSeed = 456789
0098 process.RandomNumberGeneratorService.g4SimHits.initialSeed = 9876
0099 process.RandomNumberGeneratorService.VtxSmeared.initialSeed = 123456789
0100 process.rndmStore = cms.EDProducer("RandomEngineStateProducer")
0101 
0102 # Event output
0103 process.output = cms.OutputModule("PoolOutputModule",
0104     process.FEVTSIMEventContent,
0105     fileName = cms.untracked.string(outFile)
0106 )
0107 
0108 process.load("SimG4CMS.Calo.CaloSimHitStudy_cfi")
0109 process.TFileService = cms.Service("TFileService",
0110                                    fileName = cms.string(tFile)
0111 )
0112 
0113 process.simulation_step = cms.Path(process.psim)
0114 process.out_step = cms.EndPath(process.output)
0115 process.analysis_step = cms.EndPath(process.CaloSimHitStudy)
0116 
0117 process.g4SimHits.Physics.type = 'SimG4Core/Physics/FTFP_BERT_EMM'
0118 process.g4SimHits.LHCTransport = False
0119 
0120 # Schedule definition
0121 process.schedule = cms.Schedule(process.simulation_step,
0122                                 process.out_step,
0123                                 process.analysis_step,
0124                                 )