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, D116")
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 dd4hep = True
0090 else:
0091 geomFile = "Configuration.Geometry.GeometryExtendedRun4" + options.geometry + "Reco_cff"
0092 dd4hep = False
0093
0094 print("Geometry file Name: ", geomFile)
0095 print("dd4hep: ", dd4hep)
0096
0097 process.load(geomFile)
0098 process.load('FWCore.MessageService.MessageLogger_cfi')
0099
0100 process.MessageLogger.G4cout=dict()
0101
0102
0103 process.maxEvents = cms.untracked.PSet(
0104 input = cms.untracked.int32(1)
0105 )
0106
0107 process.load('SimGeneral.HepPDTESSource.pdt_cfi')
0108 process.load('IOMC.EventVertexGenerators.VtxSmearedFlat_cfi')
0109 process.load('GeneratorInterface.Core.generatorSmeared_cfi')
0110
0111 process.source = cms.Source("EmptySource")
0112
0113 process.generator = cms.EDProducer("FlatRandomPtGunProducer",
0114 PGunParameters = cms.PSet(
0115 PartID = cms.vint32(13),
0116 MinEta = cms.double(-2.5),
0117 MaxEta = cms.double(2.5),
0118 MinPhi = cms.double(-3.14159265359),
0119 MaxPhi = cms.double(3.14159265359),
0120 MinPt = cms.double(9.99),
0121 MaxPt = cms.double(10.01)
0122 ),
0123 AddAntiParticle = cms.bool(False),
0124 Verbosity = cms.untracked.int32(0),
0125 firstRun = cms.untracked.uint32(1)
0126 )
0127
0128 process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService",
0129 generator = cms.PSet(
0130 initialSeed = cms.untracked.uint32(123456789),
0131 engineName = cms.untracked.string('HepJamesRandom')
0132 ),
0133 VtxSmeared = cms.PSet(
0134 engineName = cms.untracked.string('HepJamesRandom'),
0135 initialSeed = cms.untracked.uint32(98765432)
0136 ),
0137 g4SimHits = cms.PSet(
0138 initialSeed = cms.untracked.uint32(11),
0139 engineName = cms.untracked.string('HepJamesRandom')
0140 )
0141 )
0142
0143 process.load('SimG4Core.Application.g4SimHits_cfi')
0144
0145 process.p1 = cms.Path(process.generator*process.VtxSmeared*process.generatorSmeared*process.g4SimHits)
0146
0147 process.g4SimHits.UseMagneticField = False
0148 process.g4SimHits.Physics.DefaultCutValue = 10.
0149 process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
0150 Name = cms.string('*'),
0151 DD4hep = cms.bool(dd4hep),
0152 type = cms.string('PrintSensitive')
0153 ))