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 runMaterialBudgetInfoRun4_cfg.py type=DDD geometry=D110 detector=Tracker
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
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")
0028 options.register('detector',
0029                  "Tracker",
0030                   VarParsing.VarParsing.multiplicity.singleton,
0031                   VarParsing.VarParsing.varType.string)
0032 
0033 ### get and parse the command line arguments
0034 options.parseArguments()
0035 
0036 print(options)
0037 
0038 #####p###############################################################
0039 # Use the options
0040 
0041 from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0042 
0043 if (options.geometry == "D115"):
0044     from Configuration.Eras.Era_Phase2C20I13M9_cff import Phase2C20I13M9
0045     if (options.type == "DD4hep"):
0046         process = cms.Process('G4PrintGeometry',Phase2C20I13M9,dd4hep)
0047     else:
0048         process = cms.Process('G4PrintGeometry',Phase2C20I13M9)
0049 elif (options.geometry == "D104"):
0050     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0051     if (options.type == "DD4hep"):
0052         process = cms.Process('G4PrintGeometry',Phase2C22I13M9,dd4hep)
0053     else:
0054         process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0055 elif (options.geometry == "D106"):
0056     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0057     if (options.type == "DD4hep"):
0058         process = cms.Process('G4PrintGeometry',Phase2C22I13M9,dd4hep)
0059     else:
0060         process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0061 elif (options.geometry == "D109"):
0062     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0063     if (options.type == "DD4hep"):
0064         process = cms.Process('G4PrintGeometry',Phase2C22I13M9,dd4hep)
0065     else:
0066         process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0067 elif (options.geometry == "D111"):
0068     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0069     if (options.type == "DD4hep"):
0070         process = cms.Process('G4PrintGeometry',Phase2C22I13M9,dd4hep)
0071     else:
0072         process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0073 elif (options.geometry == "D112"):
0074     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0075     if (options.type == "DD4hep"):
0076         process = cms.Process('G4PrintGeometry',Phase2C22I13M9,dd4hep)
0077     else:
0078         process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0079 elif (options.geometry == "D113"):
0080     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0081     if (options.type == "DD4hep"):
0082         process = cms.Process('G4PrintGeometry',Phase2C22I13M9,dd4hep)
0083     else:
0084         process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0085 else:
0086     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0087     if (options.type == "DD4hep"):
0088         process = cms.Process('G4PrintGeometry',Phase2C17I13M9,dd4hep)
0089     else:
0090         process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0091 
0092 if (options.type == "DDD"):
0093     geomFile = "Configuration.Geometry.GeometryExtendedRun4" + options.geometry + "Reco_cff"
0094 else:
0095     geomFile = "Configuration.Geometry.GeometryDD4hepExtendedRun4" + options.geometry + "Reco_cff"
0096 
0097 print("Geometry file Name: ", geomFile)
0098 print("Detector          : ", options.detector)
0099 
0100 process.load(geomFile)
0101 process.load('FWCore.MessageService.MessageLogger_cfi')
0102 
0103 process.MessageLogger.cerr.enable = False
0104 process.MessageLogger.files.MatBudget = dict(extension = "txt")
0105 process.MessageLogger.G4cout=dict()
0106 
0107 process.maxEvents = cms.untracked.PSet(
0108     input = cms.untracked.int32(1)
0109 )
0110 
0111 process.load('SimGeneral.HepPDTESSource.pdt_cfi')
0112 process.load('IOMC.EventVertexGenerators.VtxSmearedFlat_cfi')
0113 process.load('GeneratorInterface.Core.generatorSmeared_cfi')
0114 
0115 process.source = cms.Source("EmptySource")
0116 
0117 process.generator = cms.EDProducer("FlatRandomPtGunProducer",
0118     PGunParameters = cms.PSet(
0119         PartID = cms.vint32(13),
0120         MinEta = cms.double(-2.5),
0121         MaxEta = cms.double(2.5),
0122         MinPhi = cms.double(-3.14159265359),
0123         MaxPhi = cms.double(3.14159265359),
0124         MinPt  = cms.double(9.99),
0125         MaxPt  = cms.double(10.01)
0126     ),
0127     AddAntiParticle = cms.bool(False),
0128     Verbosity       = cms.untracked.int32(0),
0129     firstRun        = cms.untracked.uint32(1)
0130 )
0131 
0132 process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService",
0133     generator = cms.PSet(
0134          initialSeed = cms.untracked.uint32(123456789),
0135          engineName = cms.untracked.string('HepJamesRandom')
0136     ),
0137     VtxSmeared = cms.PSet(
0138         engineName = cms.untracked.string('HepJamesRandom'),
0139         initialSeed = cms.untracked.uint32(98765432)
0140     ),
0141     g4SimHits = cms.PSet(
0142          initialSeed = cms.untracked.uint32(11),
0143          engineName = cms.untracked.string('HepJamesRandom')
0144     )
0145 )
0146 
0147 process.load('SimG4Core.Application.g4SimHits_cfi')
0148 
0149 process.p1 = cms.Path(process.generator*process.VtxSmeared*process.generatorSmeared*process.g4SimHits)
0150 
0151 process.g4SimHits.Physics.type            = 'SimG4Core/Physics/DummyPhysics'
0152 process.g4SimHits.UseMagneticField        = False
0153 process.g4SimHits.Physics.DummyEMPhysics  = True
0154 process.g4SimHits.Physics.DefaultCutValue = 10. 
0155 process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
0156     Name           = cms.untracked.string(options.detector),
0157     type           = cms.string('PrintMaterialBudgetInfo')
0158 ))