Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-28 03:10:25

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