File indexing completed on 2024-11-07 06:13:05
0001
0002
0003
0004
0005
0006
0007
0008
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
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
0030 options.parseArguments()
0031
0032 print(options)
0033
0034
0035
0036 from Configuration.ProcessModifiers.dd4hep_cff import dd4hep
0037
0038 if (options.geometry == "D115"):
0039 from Configuration.Eras.Era_Phase2C20I13M9_cff import Phase2C20I13M9
0040 if (options.type == "DD4hep"):
0041 process = cms.Process('G4PrintGeometry',Phase2C20I13M9,dd4hep)
0042 else:
0043 process = cms.Process('G4PrintGeometry',Phase2C20I13M9)
0044 elif (options.geometry == "D104"):
0045 from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0046 if (options.type == "DD4hep"):
0047 process = cms.Process('G4PrintGeometry',Phase2C22I13M9,dd4hep)
0048 else:
0049 process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0050 elif (options.geometry == "D106"):
0051 from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0052 if (options.type == "DD4hep"):
0053 process = cms.Process('G4PrintGeometry',Phase2C22I13M9,dd4hep)
0054 else:
0055 process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0056 elif (options.geometry == "D109"):
0057 from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0058 if (options.type == "DD4hep"):
0059 process = cms.Process('G4PrintGeometry',Phase2C22I13M9,dd4hep)
0060 else:
0061 process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0062 elif (options.geometry == "D111"):
0063 from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0064 if (options.type == "DD4hep"):
0065 process = cms.Process('G4PrintGeometry',Phase2C22I13M9,dd4hep)
0066 else:
0067 process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0068 elif (options.geometry == "D112"):
0069 from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0070 if (options.type == "DD4hep"):
0071 process = cms.Process('G4PrintGeometry',Phase2C22I13M9,dd4hep)
0072 else:
0073 process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0074 elif (options.geometry == "D113"):
0075 from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0076 if (options.type == "DD4hep"):
0077 process = cms.Process('G4PrintGeometry',Phase2C22I13M9,dd4hep)
0078 else:
0079 process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0080 else:
0081 from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0082 if (options.type == "DD4hep"):
0083 process = cms.Process('G4PrintGeometry',Phase2C17I13M9,dd4hep)
0084 else:
0085 process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0086
0087 if (options.type == "DD4hep"):
0088 geomFile = "Configuration.Geometry.GeometryDD4hepExtendedRun4" + options.geometry + "Reco_cff"
0089 else:
0090 geomFile = "Configuration.Geometry.GeometryExtendedRun4" + options.geometry + "Reco_cff"
0091
0092 print("Geometry file Name: ", geomFile)
0093
0094 process.load(geomFile)
0095 process.load('FWCore.MessageService.MessageLogger_cfi')
0096 process.load('SimGeneral.HepPDTESSource.pdt_cfi')
0097 process.load('IOMC.RandomEngine.IOMC_cff')
0098 process.load('IOMC.EventVertexGenerators.VtxSmearedFlat_cfi')
0099 process.load('GeneratorInterface.Core.generatorSmeared_cfi')
0100 process.load('FWCore.MessageService.MessageLogger_cfi')
0101 process.load('SimG4Core.Application.g4SimHits_cfi')
0102
0103 if hasattr(process,'MessageLogger'):
0104 process.MessageLogger.G4cerr=dict()
0105 process.MessageLogger.G4cout=dict()
0106
0107 process.source = cms.Source("EmptySource")
0108
0109 process.generator = cms.EDProducer("FlatRandomEGunProducer",
0110 PGunParameters = cms.PSet(
0111 PartID = cms.vint32(14),
0112 MinEta = cms.double(-3.5),
0113 MaxEta = cms.double(3.5),
0114 MinPhi = cms.double(-3.14159265359),
0115 MaxPhi = cms.double(3.14159265359),
0116 MinE = cms.double(9.99),
0117 MaxE = cms.double(10.01)
0118 ),
0119 AddAntiParticle = cms.bool(False),
0120 Verbosity = cms.untracked.int32(0),
0121 firstRun = cms.untracked.uint32(1)
0122 )
0123
0124 process.maxEvents = cms.untracked.PSet(
0125 input = cms.untracked.int32(1)
0126 )
0127
0128
0129 process.g4SimHits.UseMagneticField = False
0130 process.g4SimHits.Physics.type = 'SimG4Core/Physics/DummyPhysics'
0131 process.g4SimHits.Physics.DummyEMPhysics = True
0132 process.g4SimHits.Physics.DefaultCutValue = 10.
0133 process.g4SimHits.LHCTransport = False
0134
0135 if (options.type == "DD4hep"):
0136 dd4hep = True
0137 else:
0138 dd4hep = False
0139
0140 process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
0141 dd4hep = cms.untracked.bool(dd4hep),
0142 verbosity = cms.untracked.bool(False),
0143 type = cms.string('PrintG4Touch')
0144 ))
0145
0146 process.p1 = cms.Path(process.generator*process.VtxSmeared*process.generatorSmeared*process.g4SimHits)