Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-07 06:13:05

0001 #######################################################9########################
0002 # Way to use this:
0003 #   cmsRun runPrintSolidRun4_cfg.py type=DDD geometry=D110
0004 #
0005 #   Options for type DDD, DD4hep
0006 #   Options for geometry D95, D96, D98, D99, D100, D101, D102, D103, D104,
0007 #                        D105, D106, D107, D108, D109, D110, D111, D112, D113,
0008 #                        D114, D115, D116
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('type',
0019                  "DDD",
0020                   VarParsing.VarParsing.multiplicity.singleton,
0021                   VarParsing.VarParsing.varType.string,
0022                   "type of operations: DDD, DD4hep")
0023 options.register('geometry',
0024                  "D110",
0025                   VarParsing.VarParsing.multiplicity.singleton,
0026                   VarParsing.VarParsing.varType.string,
0027                   "geometry of operations: D95, D96, D98, D99, D100, D101, D102, D103, D104, D105, D106, D107, D108, D109, D110, D111, D112, D113, D114, D115, D116")
0028 
0029 ### get and parse the command line arguments
0030 options.parseArguments()
0031 
0032 print(options)
0033 
0034 #####p###############################################################
0035 # Use the options
0036 
0037 from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0038 
0039 if (options.geometry == "D115"):
0040     from Configuration.Eras.Era_Phase2C20I13M9_cff import Phase2C20I13M9
0041     if (options.type == "DD4hep"):
0042         process = cms.Process('G4PrintGeometry',Phase2C20I13M9,dd4hep)
0043     else:
0044         process = cms.Process('G4PrintGeometry',Phase2C20I13M9)
0045 elif (options.geometry == "D104"):
0046     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0047     if (options.type == "DD4hep"):
0048         process = cms.Process('G4PrintGeometry',Phase2C22I13M9,dd4hep)
0049     else:
0050         process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0051 elif (options.geometry == "D106"):
0052     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0053     if (options.type == "DD4hep"):
0054         process = cms.Process('G4PrintGeometry',Phase2C22I13M9,dd4hep)
0055     else:
0056         process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0057 elif (options.geometry == "D109"):
0058     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0059     if (options.type == "DD4hep"):
0060         process = cms.Process('G4PrintGeometry',Phase2C22I13M9,dd4hep)
0061     else:
0062         process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0063 elif (options.geometry == "D111"):
0064     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0065     if (options.type == "DD4hep"):
0066         process = cms.Process('G4PrintGeometry',Phase2C22I13M9,dd4hep)
0067     else:
0068         process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0069 elif (options.geometry == "D112"):
0070     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0071     if (options.type == "DD4hep"):
0072         process = cms.Process('G4PrintGeometry',Phase2C22I13M9,dd4hep)
0073     else:
0074         process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0075 elif (options.geometry == "D113"):
0076     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0077     if (options.type == "DD4hep"):
0078         process = cms.Process('G4PrintGeometry',Phase2C22I13M9,dd4hep)
0079     else:
0080         process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0081 else:
0082     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0083     if (options.type == "DD4hep"):
0084         process = cms.Process('G4PrintGeometry',Phase2C17I13M9,dd4hep)
0085     else:
0086         process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0087 
0088 if (options.type == "DDD"):
0089     geomFile = "Configuration.Geometry.GeometryExtendedRun4" + options.geometry + "Reco_cff"
0090 else:
0091     geomFile = "Configuration.Geometry.GeometryDD4hepExtendedRun4" + options.geometry + "Reco_cff"
0092 
0093 process.load(geomFile)
0094 
0095 print("Geometry file Name: ", geomFile)
0096 
0097 process.load('SimGeneral.HepPDTESSource.pdt_cfi')
0098 
0099 process.load('IOMC.RandomEngine.IOMC_cff')
0100 process.load('IOMC.EventVertexGenerators.VtxSmearedFlat_cfi')
0101 process.load('GeneratorInterface.Core.generatorSmeared_cfi')
0102 process.load('FWCore.MessageService.MessageLogger_cfi')
0103 process.load('SimG4Core.Application.g4SimHits_cfi')
0104 process.load('SimG4Core.PrintGeomInfo.printGeomSolids_cff')
0105 
0106 if hasattr(process,'MessageLogger'):
0107     process.MessageLogger.G4cout=dict()
0108     process.MessageLogger.G4cerr=dict()
0109     process.MessageLogger.PrintGeom=dict()
0110 
0111 process.source = cms.Source("EmptySource")
0112 
0113 process.generator = cms.EDProducer("FlatRandomEGunProducer",
0114     PGunParameters = cms.PSet(
0115         PartID = cms.vint32(14),
0116         MinEta = cms.double(-3.5),
0117         MaxEta = cms.double(3.5),
0118         MinPhi = cms.double(-3.14159265359),
0119         MaxPhi = cms.double(3.14159265359),
0120         MinE   = cms.double(9.99),
0121         MaxE   = 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.maxEvents = cms.untracked.PSet(
0129     input = cms.untracked.int32(1)
0130 )
0131 
0132 process.g4SimHits.UseMagneticField = False
0133 process.g4SimHits.Physics.type = 'SimG4Core/Physics/DummyPhysics'
0134 process.g4SimHits.Physics.DummyEMPhysics = True
0135 process.g4SimHits.Physics.DefaultCutValue = 10. 
0136 process.g4SimHits.LHCTransport = False
0137 
0138 process.p1 = cms.Path(process.generator*process.VtxSmeared*process.generatorSmeared*process.g4SimHits*process.printGeomSolids)