Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-30 04:10:44

0001 #######################################################9########################
0002 # Way to use this:
0003 #   cmsRun runMaterialBudgetInfo_cfg.py type=DDD detector=Tracker geometry=2023
0004 #
0005 #   Options for type DDD, DD4hep
0006 #           for geometry 2021, 2023, 2024
0007 #
0008 ################################################################################
0009 import FWCore.ParameterSet.Config as cms
0010 import os, sys, importlib, re
0011 import FWCore.ParameterSet.VarParsing as VarParsing
0012 
0013 ####################################################################
0014 ### SETUP OPTIONS
0015 options = VarParsing.VarParsing('standard')
0016 options.register('type',
0017                  "DDD",
0018                   VarParsing.VarParsing.multiplicity.singleton,
0019                   VarParsing.VarParsing.varType.string,
0020                   "type of operations: DDD, DD4hep")
0021 options.register('geometry',
0022                  "2024",
0023                   VarParsing.VarParsing.multiplicity.singleton,
0024                   VarParsing.VarParsing.varType.string,
0025                   "geometry of operations: 2021, 2023, 2024")
0026 options.register('detector',
0027                  "Tracker",
0028                   VarParsing.VarParsing.multiplicity.singleton,
0029                   VarParsing.VarParsing.varType.string)
0030 
0031 ### get and parse the command line arguments
0032 options.parseArguments()
0033 
0034 print(options)
0035 
0036 #####p###############################################################
0037 # Use the options
0038 
0039 if (options.type == "DDD"):
0040     from Configuration.Eras.Era_Run3_DDD_cff import Run3_DDD
0041     process = cms.Process("PrintMaterialBudget",Run3_DDD)
0042     geomFile = "Configuration.Geometry.GeometryExtended" + options.geometry + "Reco_cff"
0043 else:
0044     from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep
0045     process = cms.Process("PrintMaterialBudget",Run3_dd4hep)
0046     geomFile = "Configuration.Geometry.GeometryDD4hepExtended" + options.geometry + "Reco_cff"
0047 
0048 print("Geometry file Name: ", geomFile)
0049 print("Detector          : ", options.detector)
0050 
0051 process.load(geomFile)
0052 process.load('FWCore.MessageService.MessageLogger_cfi')
0053 
0054 process.MessageLogger.cerr.enable = False
0055 process.MessageLogger.files.MatBudget = dict(extension = "txt")
0056 process.MessageLogger.G4cout=dict()
0057 
0058 process.maxEvents = cms.untracked.PSet(
0059     input = cms.untracked.int32(1)
0060 )
0061 
0062 process.load('SimGeneral.HepPDTESSource.pdt_cfi')
0063 process.load('IOMC.EventVertexGenerators.VtxSmearedFlat_cfi')
0064 process.load('GeneratorInterface.Core.generatorSmeared_cfi')
0065 
0066 process.source = cms.Source("EmptySource")
0067 
0068 process.generator = cms.EDProducer("FlatRandomPtGunProducer",
0069     PGunParameters = cms.PSet(
0070         PartID = cms.vint32(13),
0071         MinEta = cms.double(-2.5),
0072         MaxEta = cms.double(2.5),
0073         MinPhi = cms.double(-3.14159265359),
0074         MaxPhi = cms.double(3.14159265359),
0075         MinPt  = cms.double(9.99),
0076         MaxPt  = cms.double(10.01)
0077     ),
0078     AddAntiParticle = cms.bool(False),
0079     Verbosity       = cms.untracked.int32(0),
0080     firstRun        = cms.untracked.uint32(1)
0081 )
0082 
0083 process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService",
0084     generator = cms.PSet(
0085          initialSeed = cms.untracked.uint32(123456789),
0086          engineName = cms.untracked.string('HepJamesRandom')
0087     ),
0088     VtxSmeared = cms.PSet(
0089         engineName = cms.untracked.string('HepJamesRandom'),
0090         initialSeed = cms.untracked.uint32(98765432)
0091     ),
0092     g4SimHits = cms.PSet(
0093          initialSeed = cms.untracked.uint32(11),
0094          engineName = cms.untracked.string('HepJamesRandom')
0095     )
0096 )
0097 
0098 process.load('SimG4Core.Application.g4SimHits_cfi')
0099 
0100 process.p1 = cms.Path(process.generator*process.VtxSmeared*process.generatorSmeared*process.g4SimHits)
0101 
0102 process.g4SimHits.Physics.type            = 'SimG4Core/Physics/DummyPhysics'
0103 process.g4SimHits.UseMagneticField        = False
0104 process.g4SimHits.Physics.DummyEMPhysics  = True
0105 process.g4SimHits.Physics.DefaultCutValue = 10. 
0106 process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
0107     Name           = cms.untracked.string(options.detector),
0108     type           = cms.string('PrintMaterialBudgetInfo')
0109 ))