Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:30:30

0001 #######################################################9########################
0002 # Way to use this:
0003 #   cmsRun runPrintSolid2026D98_cfg.py type=DDD detector=Tracker
0004 #
0005 #   Options for type DDD, DD4hep
0006 #   Options for detector Tracker, Calo, MTD, Muon
0007 #
0008 ################################################################################
0009 import FWCore.ParameterSet.Config as cms
0010 import os, sys, importlib, re
0011 import FWCore.ParameterSet.VarParsing as VarParsing
0012 
0013 ####################################################################
0014 ### SETUP OPTIONS
0015 options = VarParsing.VarParsing('standard')
0016 options.register('type',
0017                  "DDD",
0018                   VarParsing.VarParsing.multiplicity.singleton,
0019                   VarParsing.VarParsing.varType.string,
0020                   "type of operations: DDD, DD4hep")
0021 options.register('detector',
0022                  "Tracker",
0023                   VarParsing.VarParsing.multiplicity.singleton,
0024                   VarParsing.VarParsing.varType.string,
0025                   "detector of operations: Tracker, Calo, MTD, Muon")
0026 
0027 ### get and parse the command line arguments
0028 options.parseArguments()
0029 
0030 print(options)
0031 
0032 #####p###############################################################
0033 # Use the options
0034 
0035 from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0036 
0037 if (options.type == "DDD"):
0038     process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0039     geomFile = "Geometry.CMSCommonData.GeometryExtended2026D98" + options.detector + "Reco_cff"
0040     process.load(geomFile)
0041 else:
0042     from Configuration.ProcessModifiers.dd4hep_cff import dd4hep
0043     process = cms.Process('G4PrintGeometry',Phase2C17I13M9,dd4hep)
0044     geomFile = "Geometry.CMSCommonData.GeometryDD4hepExtended2026D98" + options.detector + "Reco_cff"
0045     process.load(geomFile)
0046 
0047 print("Geometry file Name: ", geomFile)
0048 
0049 process.load('SimGeneral.HepPDTESSource.pdt_cfi')
0050 
0051 process.load('IOMC.RandomEngine.IOMC_cff')
0052 process.load('IOMC.EventVertexGenerators.VtxSmearedFlat_cfi')
0053 process.load('GeneratorInterface.Core.generatorSmeared_cfi')
0054 process.load('FWCore.MessageService.MessageLogger_cfi')
0055 process.load('SimG4Core.Application.g4SimHits_cfi')
0056 process.load('SimG4Core.PrintGeomInfo.printGeomSolids_cff')
0057 
0058 if hasattr(process,'MessageLogger'):
0059     process.MessageLogger.G4cout=dict()
0060     process.MessageLogger.G4cerr=dict()
0061     process.MessageLogger.PrintGeom=dict()
0062 
0063 process.source = cms.Source("EmptySource")
0064 
0065 process.generator = cms.EDProducer("FlatRandomEGunProducer",
0066     PGunParameters = cms.PSet(
0067         PartID = cms.vint32(14),
0068         MinEta = cms.double(-3.5),
0069         MaxEta = cms.double(3.5),
0070         MinPhi = cms.double(-3.14159265359),
0071         MaxPhi = cms.double(3.14159265359),
0072         MinE   = cms.double(9.99),
0073         MaxE   = cms.double(10.01)
0074     ),
0075     AddAntiParticle = cms.bool(False),
0076     Verbosity       = cms.untracked.int32(0),
0077     firstRun        = cms.untracked.uint32(1)
0078 )
0079 
0080 process.maxEvents = cms.untracked.PSet(
0081     input = cms.untracked.int32(1)
0082 )
0083 
0084 process.g4SimHits.UseMagneticField = False
0085 process.g4SimHits.Physics.type = 'SimG4Core/Physics/DummyPhysics'
0086 process.g4SimHits.Physics.DummyEMPhysics = True
0087 process.g4SimHits.Physics.DefaultCutValue = 10. 
0088 process.g4SimHits.LHCTransport = False
0089 
0090 if (options.detector == "Tracker"):
0091     process.g4SimHits.OnlySDs = ['TkAccumulatingSensitiveDetector']
0092 elif (options.detector == "MTD"):
0093     process.g4SimHits.OnlySDs = ['MtdSensitiveDetector']
0094 elif (options.detector == "Muon"):
0095     process.g4SimHits.OnlySDs = ['MuonSensitiveDetector']
0096 else:
0097     process.g4SimHits.OnlySDs = ['CaloTrkProcessing', 'EcalSensitiveDetector', 'HcalSensitiveDetector', 'HGCalSensitiveDetector', 'HFNoseSensitiveDetector', 'HGCScintillatorSensitiveDetector', 'ZdcSensitiveDetector']
0098 
0099 process.p1 = cms.Path(process.generator*process.VtxSmeared*process.generatorSmeared*process.g4SimHits*process.printGeomSolids)