Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-28 23:11:15

0001 # In order to produce everything that you need in one go, use the command:
0002 #
0003 # for t in {'BeamPipe','Tracker','PixBar','PixFwdMinus','PixFwdPlus','TIB','TOB','TIDB','TIDF','TEC','TkStrct','InnerServices'}; do cmsRun runP_Tracker_cfg.py geom=XYZ label=$t >& /dev/null &; done
0004 
0005 
0006 import FWCore.ParameterSet.Config as cms
0007 from FWCore.ParameterSet.VarParsing import VarParsing
0008 import sys, re
0009 
0010 from FWCore.PythonFramework.CmsRun import CmsRun
0011 from Configuration.Eras.Era_Phase2_cff import Phase2
0012 
0013 process = cms.Process("PROD", Phase2)
0014 
0015 process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
0016 
0017 # The default geometry is ExtendedRun4D110Reco. If a different geoemtry
0018 # is needed, the appropriate flag has to be passed at command line,
0019 # e.g.: cmsRun runP_HGCal_cfg.py geom="XYZ"
0020 
0021 # The default component to be monitored is the HGCal. If other
0022 # components need to be studied, they must be supplied, one at a time,
0023 # at the command line, e.g.: cmsRun runP_HGCal_cfg.py
0024 # label="XYZ"
0025 
0026 from Validation.Geometry.plot_hgcal_utils import _LABELS2COMPS
0027 
0028 _ALLOWED_LABELS = _LABELS2COMPS.keys()
0029 
0030 options = VarParsing('analysis')
0031 options.register('geom',             #name
0032                  'ExtendedRun4D110',      #default value
0033                  VarParsing.multiplicity.singleton,   # kind of options
0034                  VarParsing.varType.string,           # type of option
0035                  "Select the geometry to be studied"  # help message
0036                 )
0037 
0038 options.register('label',         #name
0039                  'HGCal',              #default value
0040                  VarParsing.multiplicity.singleton,   # kind of options
0041                  VarParsing.varType.string,           # type of option
0042                  "Select the label to be used to create output files. Default to HGCal. If multiple components are selected, it defaults to the join of all components, with '_' as separator."  # help message
0043                 )
0044 
0045 options.setDefault('inputFiles', ['file:single_neutrino_random.root'])
0046 
0047 options.parseArguments()
0048 # Option validation
0049 
0050 if options.label not in _ALLOWED_LABELS:
0051     print("\n*** Error, '%s' not registered as a valid components to monitor." % options.label)
0052     print("Allowed components:", _ALLOWED_LABELS)
0053     print()
0054     raise RuntimeError("Unknown label")
0055 
0056 _components = _LABELS2COMPS[options.label]
0057 
0058 # Load geometry either from the Database of from files
0059 process.load("Configuration.Geometry.Geometry%sReco_cff" % options.geom)
0060 
0061 #
0062 #Magnetic Field
0063 #
0064 process.load("Configuration.StandardSequences.MagneticField_38T_cff")
0065 
0066 # Output of events, etc...
0067 #
0068 # Explicit note : since some histos/tree might be dumped directly,
0069 #                 better NOT use PoolOutputModule !
0070 # Detector simulation (Geant4-based)
0071 #
0072 process.load("SimG4Core.Application.g4SimHits_cfi")
0073 
0074 process.load("IOMC.RandomEngine.IOMC_cff")
0075 process.RandomNumberGeneratorService.g4SimHits.initialSeed = 9876
0076 
0077 process.source = cms.Source("PoolSource",
0078     fileNames = cms.untracked.vstring(options.inputFiles)
0079 )
0080 
0081 process.maxEvents = cms.untracked.PSet(
0082     input = cms.untracked.int32(-1)
0083 )
0084 '''
0085 process.Timing = cms.Service("Timing")
0086 
0087 process.SimpleMemoryCheck = cms.Service("SimpleMemoryCheck",
0088   ignoreTotal          = cms.untracked.int32(1),
0089   oncePerEventMode     = cms.untracked.bool(True),
0090   moduleMemorySummary  = cms.untracked.bool(True),
0091   showMallocInfo       = cms.untracked.bool(True),
0092   monitorPssAndPrivate = cms.untracked.bool(True),
0093 )
0094 '''
0095 process.p1 = cms.Path(process.g4SimHits)
0096 process.g4SimHits.StackingAction.TrackNeutrino = cms.bool(True)
0097 process.g4SimHits.UseMagneticField = False
0098 process.g4SimHits.Physics.type = 'SimG4Core/Physics/DummyPhysics'
0099 process.g4SimHits.Physics.DummyEMPhysics = True
0100 process.g4SimHits.Physics.CutsPerRegion = False
0101 process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
0102     type = cms.string('MaterialBudgetAction'),
0103     MaterialBudgetAction = cms.PSet(
0104         HistosFile = cms.string('matbdg_%s.root' % options.label),
0105         AllStepsToTree = cms.bool(True),
0106         HistogramList = cms.string('HGCal'),
0107         SelectedVolumes = cms.vstring(_components),
0108         TreeFile = cms.string('None'), ## is NOT requested
0109 
0110         StopAfterProcess = cms.string('None'),
0111         #        TextFile = cms.string("matbdg_HGCal.txt")
0112         TextFile = cms.string('None'), 
0113         #Setting ranges for histos
0114         #Make z 1mm per bin. Be careful this could lead to memory crashes if too low. 
0115         minZ = cms.double(-5500.),
0116         maxZ = cms.double(5500.),
0117         nintZ = cms.int32(11000), 
0118         # Make r 1cm per bin
0119         rMin = cms.double(-50.), 
0120         rMax = cms.double(3400.),
0121         nrbin = cms.int32(345),
0122         # eta
0123         etaMin = cms.double(-5.), 
0124         etaMax = cms.double(5.),
0125         netabin = cms.int32(250),
0126         # phi
0127         phiMin = cms.double(-3.2), 
0128         phiMax = cms.double(3.2),
0129         nphibin = cms.int32(180),
0130         # R for profile histos
0131         RMin =  cms.double(0.), 
0132         RMax =  cms.double(3000.), 
0133         nRbin = cms.int32(300)
0134 
0135      )
0136 ))
0137 
0138 
0139 cmsRun = CmsRun(process)
0140 cmsRun.run()
0141 
0142