Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-30 04:10:44

0001 ###############################################################################
0002 # Way to use this:
0003 #   cmsRun runPrintSolid_cfg.py type=DDD geometry=2023
0004 #
0005 #   Options for geometry 2021, 2023, 2024
0006 #   Options for type DDD, DD4hep
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('geometry',
0017                  "2024",
0018                   VarParsing.VarParsing.multiplicity.singleton,
0019                   VarParsing.VarParsing.varType.string,
0020                   "geometry of operations: 2021, 2023, 2024")
0021 options.register('type',
0022                  "DDD",
0023                   VarParsing.VarParsing.multiplicity.singleton,
0024                   VarParsing.VarParsing.varType.string,
0025                   "type of operations: DDD, DD4hep")
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 if (options.type == "DDD"):
0036     from Configuration.Eras.Era_Run3_DDD_cff import Run3_DDD
0037     process = cms.Process('G4PrintGeometry',Run3_DDD)
0038     geomFile = "Configuration.Geometry.GeometryExtended" + options.geometry + "Reco_cff"
0039 else:
0040     from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep
0041     process = cms.Process('G4PrintGeometry',Run3_dd4hep)
0042     geomFile = "Configuration.Geometry.GeometryDD4hepExtended" + options.geometry + "Reco_cff"
0043 
0044 print("Geometry file: ", geomFile)
0045 
0046 process.load('SimGeneral.HepPDTESSource.pdt_cfi')
0047 process.load(geomFile)
0048 
0049 process.load('IOMC.RandomEngine.IOMC_cff')
0050 process.load('IOMC.EventVertexGenerators.VtxSmearedFlat_cfi')
0051 process.load('GeneratorInterface.Core.generatorSmeared_cfi')
0052 process.load('FWCore.MessageService.MessageLogger_cfi')
0053 process.load('SimG4Core.Application.g4SimHits_cfi')
0054 process.load('SimG4Core.PrintGeomInfo.printGeomSolids_cff')
0055 
0056 if hasattr(process,'MessageLogger'):
0057     process.MessageLogger.G4cout=dict()
0058     process.MessageLogger.G4cerr=dict()
0059     process.MessageLogger.PrintGeom=dict()
0060 
0061 process.source = cms.Source("EmptySource")
0062 
0063 process.generator = cms.EDProducer("FlatRandomEGunProducer",
0064     PGunParameters = cms.PSet(
0065         PartID = cms.vint32(14),
0066         MinEta = cms.double(-3.5),
0067         MaxEta = cms.double(3.5),
0068         MinPhi = cms.double(-3.14159265359),
0069         MaxPhi = cms.double(3.14159265359),
0070         MinE   = cms.double(9.99),
0071         MaxE   = cms.double(10.01)
0072     ),
0073     AddAntiParticle = cms.bool(False),
0074     Verbosity       = cms.untracked.int32(0),
0075     firstRun        = cms.untracked.uint32(1)
0076 )
0077 
0078 process.maxEvents = cms.untracked.PSet(
0079     input = cms.untracked.int32(1)
0080 )
0081 
0082 process.g4SimHits.UseMagneticField = False
0083 process.g4SimHits.Physics.type = 'SimG4Core/Physics/DummyPhysics'
0084 process.g4SimHits.Physics.DummyEMPhysics = True
0085 process.g4SimHits.Physics.DefaultCutValue = 10. 
0086 process.g4SimHits.LHCTransport = False
0087 
0088 process.p1 = cms.Path(process.generator*process.VtxSmeared*process.generatorSmeared*process.g4SimHits*process.printGeomSolids)