Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-02-06 03:42:39

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