Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:32:36

0001 ###############################################################################
0002 # Way to use this:
0003 #   cmsRun testHGCalSingleMuonPt100_cfg.py geometry=D92 type=DDD
0004 #
0005 #   Options for geometry: D88, D92, D93, V17Shift, V18
0006 #               type: DDD, DD4hep
0007 #
0008 ###############################################################################
0009 import FWCore.ParameterSet.Config as cms
0010 import os, sys, imp, re, random
0011 import FWCore.ParameterSet.VarParsing as VarParsing
0012 
0013 ####################################################################
0014 ### SETUP OPTIONS
0015 options = VarParsing.VarParsing('standard')
0016 options.register('geometry',
0017                  "D92",
0018                   VarParsing.VarParsing.multiplicity.singleton,
0019                   VarParsing.VarParsing.varType.string,
0020                   "geometry of operations: D88, D92, D93, V17Shift, V18")
0021 options.register('type',
0022                  "DDD",
0023                   VarParsing.VarParsing.multiplicity.singleton,
0024                   VarParsing.VarParsing.varType.string,
0025                   "type of operations: DDD, DD4hep")
0026 
0027 ### get and parse the command line arguments
0028 options.parseArguments()
0029 
0030 print(options)
0031 
0032 ####################################################################
0033 # Use the options
0034 
0035 from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0036 if (options.type == "DD4hep"):
0037     from Configuration.ProcessModifiers.dd4hep_cff import dd4hep
0038     process = cms.Process('SingleMuonSim',Phase2C17I13M9,dd4hep)
0039     if (options.geometry == "V17Shift"):
0040         geomFile = "Geometry.HGCalCommonData.testHGCal" + options.type + options.geometry + "Reco_cff"
0041     elif (options.geometry == "V18"):
0042         geomFile = "Geometry.HGCalCommonData.testHGCal" + options.type + options.geometry + "Reco_cff"
0043     else:
0044         geomFile = "Configuration.Geometry.Geometry" + options.type +"Extended2026" + options.geometry + "Reco_cff"
0045 else:
0046     process = cms.Process('SingleMuonSim',Phase2C17I13M9)
0047     if (options.geometry == "V17Shift"):
0048         geomFile = "Geometry.HGCalCommonData.testHGCal" + options.geometry + "Reco_cff"
0049     elif (options.geometry == "V18"):
0050         geomFile = "Geometry.HGCalCommonData.testHGCal" + options.geometry + "Reco_cff"
0051     else:
0052         geomFile = "Configuration.Geometry.GeometryExtended2026" + options.geometry + "Reco_cff"
0053 
0054 globalTag = "auto:phase2_realistic_T21"
0055 outFile = "file:step1" + options.type + options.geometry + "mu.root"
0056 
0057 print("Geometry file: ", geomFile)
0058 print("Global Tag:    ", globalTag)
0059 print("Output file:   ", outFile)
0060 
0061 # import of standard configurations
0062 process.load(geomFile)
0063 process.load('Configuration.StandardSequences.Services_cff')
0064 process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
0065 process.load('FWCore.MessageService.MessageLogger_cfi')
0066 process.load('Configuration.EventContent.EventContent_cff')
0067 process.load('SimGeneral.MixingModule.mixNoPU_cfi')
0068 process.load('Configuration.StandardSequences.MagneticField_cff')
0069 process.load('Configuration.StandardSequences.Generator_cff')
0070 process.load('IOMC.EventVertexGenerators.VtxSmearedRealistic50ns13TeVCollision_cfi')
0071 process.load('GeneratorInterface.Core.genFilterSummary_cff')
0072 process.load('Configuration.StandardSequences.SimIdeal_cff')
0073 process.load('Configuration.StandardSequences.EndOfProcess_cff')
0074 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0075 process.load('Configuration.StandardSequences.EndOfProcess_cff')
0076 process.load('SimG4CMS.Calo.hgcalHitPartial_cff')
0077 process.load("IOMC.RandomEngine.IOMC_cff")
0078 
0079 rndm = random.randint(0,200000)
0080 process.RandomNumberGeneratorService.generator.initialSeed = rndm
0081 print("Processing with random number seed: ", rndm)
0082 
0083 process.maxEvents = cms.untracked.PSet(
0084     input = cms.untracked.int32(5000)
0085 )
0086 
0087 process.MessageLogger.cerr.FwkReport.reportEvery = 1
0088 if hasattr(process,'MessageLogger'):
0089     process.MessageLogger.HGCalError=dict()
0090 #   process.MessageLogger.HGCSim=dict()
0091 #   process.MessageLogger.HGCalSim=dict()
0092 
0093 # Input source
0094 process.source = cms.Source("EmptySource")
0095 
0096 process.options = cms.untracked.PSet(
0097     wantSummary = cms.untracked.bool(True),
0098     numberOfConcurrentRuns = cms.untracked.uint32(1),
0099     numberOfStreams = cms.untracked.uint32(0),
0100     numberOfThreads = cms.untracked.uint32(1),
0101     printDependencies = cms.untracked.bool(False),
0102     sizeOfStackForThreadsInKB = cms.optional.untracked.uint32,
0103 )
0104 
0105 # Production Info
0106 process.configurationMetadata = cms.untracked.PSet(
0107     version = cms.untracked.string(''),
0108     annotation = cms.untracked.string(''),
0109     name = cms.untracked.string('Applications')
0110 )
0111 
0112 # Output definition
0113 process.output = cms.OutputModule("PoolOutputModule",
0114     SelectEvents = cms.untracked.PSet(
0115         SelectEvents = cms.vstring('generation_step')
0116     ),
0117     dataset = cms.untracked.PSet(
0118         filterName = cms.untracked.string(''),
0119         dataTier = cms.untracked.string('GEN-SIM-DIGI-RAW-RECO')
0120     ),
0121     fileName = cms.untracked.string(outFile),
0122     outputCommands = process.FEVTDEBUGEventContent.outputCommands,
0123     eventAutoFlushCompressedSize = cms.untracked.int32(5242880),
0124     splitLevel = cms.untracked.int32(0)
0125 )
0126 
0127 # Additional output definition
0128 
0129 # Other statements
0130 process.genstepfilter.triggerConditions=cms.vstring("generation_step")
0131 from Configuration.AlCa.GlobalTag import GlobalTag
0132 process.GlobalTag = GlobalTag(process.GlobalTag, globalTag, '')
0133 
0134 process.generator = cms.EDFilter("Pythia8PtGun",
0135     PGunParameters = cms.PSet(
0136         MaxPt = cms.double(100.01),
0137         MinPt = cms.double(99.99),
0138         ParticleID = cms.vint32(-13),
0139         AddAntiParticle = cms.bool(True),
0140         MaxEta = cms.double(3.1),
0141         MaxPhi = cms.double(3.14159265359),
0142         MinEta = cms.double(2.8),
0143         MinPhi = cms.double(-3.14159265359) ## in radians
0144         ),
0145         Verbosity = cms.untracked.int32(0), ## set to 1 (or greater)  for printouts
0146         psethack = cms.string('single mu pt 100'),
0147         firstRun = cms.untracked.uint32(1),
0148         PythiaParameters = cms.PSet(parameterSets = cms.vstring())
0149 )
0150 
0151 
0152 #Modified to produce hgceedigis
0153 process.ProductionFilterSequence = cms.Sequence(process.generator)
0154 
0155 process.g4SimHits.HGCSD.CheckID = True
0156 process.g4SimHits.HGCScintSD.CheckID = True
0157 
0158 # Path and EndPath definitions
0159 process.generation_step = cms.Path(process.pgen)
0160 process.simulation_step = cms.Path(process.psim)
0161 process.genfiltersummary_step = cms.EndPath(process.genFilterSummary)
0162 process.endjob_step = cms.EndPath(process.endOfProcess)
0163 process.analysis_step = cms.Path(process.hgcalHitPartialEE+process.hgcalHitPartialHE+process.hgcalHitPartialHEB)
0164 process.out_step = cms.EndPath(process.output)
0165 
0166 # Schedule definition
0167 process.schedule = cms.Schedule(process.generation_step,
0168                                 process.genfiltersummary_step,
0169                 process.simulation_step,
0170                                 process.endjob_step,
0171                                 process.analysis_step,
0172                 process.out_step
0173                 )
0174 
0175 from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask
0176 associatePatAlgosToolsTask(process)
0177 # filter all path with the production filter sequence
0178 for path in process.paths:
0179         getattr(process,path).insert(0, process.ProductionFilterSequence)
0180 
0181 
0182 # Customisation from command line
0183 
0184 # Add early deletion of temporary data products to reduce peak memory need
0185 from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete
0186 process = customiseEarlyDelete(process)
0187 # End adding early deletion