Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 10:04:36

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