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 grunPrintG4Touch_cfg.py geometry=2023
0004 #
0005 #   Options for geometry 2016, 2017, 2018, 2021, 2023, 2024
0006 #
0007 ###############################################################################
0008 import FWCore.ParameterSet.Config as cms
0009 import os, sys, importlib, re
0010 import FWCore.ParameterSet.VarParsing as VarParsing
0011 
0012 ####################################################################
0013 ### SETUP OPTIONS
0014 options = VarParsing.VarParsing('standard')
0015 options.register('geometry',
0016                  "2024",
0017                   VarParsing.VarParsing.multiplicity.singleton,
0018                   VarParsing.VarParsing.varType.string,
0019                   "geometry of operations: 2016, 2017, 2018, 2021, 2023, 2024")
0020 
0021 ### get and parse the command line arguments
0022 options.parseArguments()
0023 
0024 print(options)
0025 
0026 ####################################################################
0027 # Use the options
0028 
0029 geomFile = "Configuration.Geometry.GeometryExtended" + options.geometry + "Reco_cff"
0030 
0031 if (options.geometry == "2016"):
0032     from Configuration.Eras.Era_Run2_2016_cff import Run2_2016
0033     process = cms.Process('PrintG4Touch',Run2_2016)
0034 elif (options.geometry == "2017"):
0035     from Configuration.Eras.Era_Run2_2017_cff import Run2_2017
0036     process = cms.Process('PrintG4Touch',Run2_2017)
0037 elif (options.geometry == "2018"):
0038     from Configuration.Eras.Era_Run2_2018_cff import Run2_2018
0039     process = cms.Process('PrintG4Touch',Run2_2018)
0040 else:
0041     from Configuration.Eras.Era_Run3_DDD_cff import Run3_DDD
0042     process = cms.Process('PrintG4Touch',Run3_DDD)
0043 
0044 print("Geometry file Name: ", geomFile)
0045 
0046 process.load(geomFile)
0047 process.load('FWCore.MessageService.MessageLogger_cfi')
0048 process.load('SimGeneral.HepPDTESSource.pdt_cfi')
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 
0055 if hasattr(process,'MessageLogger'):
0056     process.MessageLogger.G4cerr=dict()
0057     process.MessageLogger.G4cout=dict()
0058 
0059 process.source = cms.Source("EmptySource")
0060 
0061 process.generator = cms.EDProducer("FlatRandomEGunProducer",
0062                                    PGunParameters = cms.PSet(
0063                                        PartID = cms.vint32(14),
0064                                        MinEta = cms.double(-3.5),
0065                                        MaxEta = cms.double(3.5),
0066                                        MinPhi = cms.double(-3.14159265359),
0067                                        MaxPhi = cms.double(3.14159265359),
0068                                        MinE   = cms.double(9.99),
0069                                        MaxE   = cms.double(10.01)
0070                                    ),
0071                                    AddAntiParticle = cms.bool(False),
0072                                    Verbosity       = cms.untracked.int32(0),
0073                                    firstRun        = cms.untracked.uint32(1)
0074                                )
0075 
0076 process.maxEvents = cms.untracked.PSet(
0077     input = cms.untracked.int32(1)
0078 )
0079 
0080 
0081 process.g4SimHits.UseMagneticField = False
0082 process.g4SimHits.Physics.type = 'SimG4Core/Physics/DummyPhysics'
0083 process.g4SimHits.Physics.DummyEMPhysics = True
0084 process.g4SimHits.Physics.DefaultCutValue = 10. 
0085 process.g4SimHits.LHCTransport = False
0086 
0087 process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
0088     dd4hep         = cms.untracked.bool(False),
0089     verbosity      = cms.untracked.bool(False),
0090     type           = cms.string('PrintG4Touch')
0091 ))
0092 
0093 process.p1 = cms.Path(process.generator*process.VtxSmeared*process.generatorSmeared*process.g4SimHits)