Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-07-16 02:43:16

0001 ###############################################################################
0002 # Way to use this:
0003 #   cmsRun grunPrintG4Solids_cfg.py geometry=D110 dd4hep=False
0004 #
0005 #   Options for geometry D95, D96, D98, D99, D100, D101, D102, D103, D104,
0006 #                        D105, D106, D107, D108, D109, D110, D111, D112, D113,
0007 #                        D114, D115
0008 #   Options for type DDD, DD4hep
0009 #
0010 ###############################################################################
0011 import FWCore.ParameterSet.Config as cms
0012 import os, sys, importlib, re
0013 import FWCore.ParameterSet.VarParsing as VarParsing
0014 
0015 ####################################################################
0016 ### SETUP OPTIONS
0017 options = VarParsing.VarParsing('standard')
0018 options.register('geometry',
0019                  "D110",
0020                   VarParsing.VarParsing.multiplicity.singleton,
0021                   VarParsing.VarParsing.varType.string,
0022                   "geometry of operations: D95, D96, D98, D99, D100, D101, D102, D103, D104, D105, D106, D107, D108, D109, D110, D111, D112, D113, D114, D115")
0023 options.register('type',
0024                  "DDD",
0025                   VarParsing.VarParsing.multiplicity.singleton,
0026                   VarParsing.VarParsing.varType.string,
0027                   "type of operations: DDD, DD4hep")
0028 
0029 ### get and parse the command line arguments
0030 options.parseArguments()
0031 
0032 print(options)
0033 
0034 ####################################################################
0035 # Use the options
0036 from Configuration.ProcessModifiers.dd4hep_cff import dd4hep
0037 
0038 if (options.type == "DD4hep"):
0039     geomFile = "Configuration.Geometry.GeometryDD4hepExtended2026" + options.geometry + "Reco_cff"
0040     if (options.geometry == "D115"):
0041         from Configuration.Eras.Era_Phase2C20I13M9_cff import Phase2C20I13M9
0042         process = cms.Process('PrintG4Solids',Phase2C20I13M9,dd4hep)
0043     else:
0044         from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0045         process = cms.Process('PrintG4Solids',Phase2C17I13M9,dd4hep)
0046 else:
0047     geomFile = "Configuration.Geometry.GeometryExtended2026" + options.geometry + "Reco_cff"
0048     if (options.geometry == "D115"):
0049         from Configuration.Eras.Era_Phase2C20I13M9_cff import Phase2C20I13M9
0050         process = cms.Process('PrintG4Solids',Phase2C20I13M9)
0051     else:
0052         from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0053         process = cms.Process('PrintG4Solids',Phase2C17I13M9)
0054 
0055 print("Geometry file Name: ", geomFile)
0056 
0057 process.load(geomFile)
0058 process.load('FWCore.MessageService.MessageLogger_cfi')
0059 process.load('SimGeneral.HepPDTESSource.pdt_cfi')
0060 process.load('IOMC.RandomEngine.IOMC_cff')
0061 process.load('IOMC.EventVertexGenerators.VtxSmearedFlat_cfi')
0062 process.load('GeneratorInterface.Core.generatorSmeared_cfi')
0063 process.load('FWCore.MessageService.MessageLogger_cfi')
0064 process.load('SimG4Core.Application.g4SimHits_cfi')
0065 
0066 if hasattr(process,'MessageLogger'):
0067     process.MessageLogger.G4cerr=dict()
0068     process.MessageLogger.G4cout=dict()
0069 
0070 process.source = cms.Source("EmptySource")
0071 
0072 process.generator = cms.EDProducer("FlatRandomEGunProducer",
0073                                    PGunParameters = cms.PSet(
0074                                        PartID = cms.vint32(14),
0075                                        MinEta = cms.double(-3.5),
0076                                        MaxEta = cms.double(3.5),
0077                                        MinPhi = cms.double(-3.14159265359),
0078                                        MaxPhi = cms.double(3.14159265359),
0079                                        MinE   = cms.double(9.99),
0080                                        MaxE   = cms.double(10.01)
0081                                    ),
0082                                    AddAntiParticle = cms.bool(False),
0083                                    Verbosity       = cms.untracked.int32(0),
0084                                    firstRun        = cms.untracked.uint32(1)
0085                                )
0086 
0087 process.maxEvents = cms.untracked.PSet(
0088     input = cms.untracked.int32(1)
0089 )
0090 
0091 
0092 process.g4SimHits.UseMagneticField = False
0093 process.g4SimHits.Physics.type = 'SimG4Core/Physics/DummyPhysics'
0094 process.g4SimHits.Physics.DummyEMPhysics = True
0095 process.g4SimHits.Physics.DefaultCutValue = 10. 
0096 process.g4SimHits.LHCTransport = False
0097 
0098 if (options.type == "DD4hep"):
0099     dd4hep = True
0100 else:
0101     dd4hep = False
0102 
0103 process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
0104     dd4hep         = cms.untracked.bool(dd4hep),
0105     dumpVolumes    = cms.untracked.vstring(),
0106     dumpShapes     = cms.untracked.vstring("G4ExtrudedSolid"),
0107     type           = cms.string('PrintG4Solids')
0108 ))
0109 
0110 process.p1 = cms.Path(process.generator*process.VtxSmeared*process.generatorSmeared*process.g4SimHits)