Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:30:49

0001 #
0002 # An example configuration for production of
0003 # a SIM level sample of neutron hits in muon systems
0004 #
0005 
0006 import FWCore.ParameterSet.Config as cms
0007 
0008 process = cms.Process('SIM')
0009 
0010 ################################################################################
0011 # Basic running parameters (modify to your needs)
0012 
0013 # name of the output file
0014 theFileName = 'out_n.root'
0015 
0016 # GEANT physics list:
0017 physicsList = 'SimG4Core/Physics/QGSP_BERT_HP'
0018 #physicsList = 'SimG4Core/Physics/QGSP_BERT_HP_EML'
0019 #physicsList = 'SimG4Core/Physics/QGSP_BERT_EMLSN'
0020 #physicsList = 'SimG4Core/Physics/QGSP_BERT_EML'
0021 
0022 # run number
0023 theRun = 30000
0024 
0025 
0026 # CRAB overwrites the following:
0027 # number of events to generate
0028 theNumberOfEvents = 5
0029 
0030 ################################################################################
0031 # some runtime config
0032 
0033 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(theNumberOfEvents) )
0034 
0035 process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) )
0036 
0037 #process.Timing = cms.Service("Timing")
0038 #process.Tracer = cms.Service("Tracer")
0039 
0040 ################################################################################
0041 # standard configuration imports
0042 
0043 process.load('Configuration.StandardSequences.Services_cff')
0044 process.load('FWCore.MessageService.MessageLogger_cfi')
0045 process.load('Configuration.StandardSequences.Geometry_cff')
0046 process.load('Configuration.StandardSequences.MagneticField_38T_cff')
0047 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0048 process.load('Configuration.StandardSequences.EndOfProcess_cff')
0049 process.load('Configuration.EventContent.EventContent_cff')
0050 
0051 
0052 ################################################################################
0053 # Special neutrons-related imports
0054 
0055 process.load('SimMuon.Neutron.GeneratorNeutrons_cff')
0056 
0057 process.load('SimMuon.Neutron.SimIdealNeutrons_cff')
0058 #process.load('SimMuon.Neutron.SimIdealNeutrons_NoQuads_cff')
0059 
0060 process.g4SimHitsNeutrons.Physics.type = physicsList
0061 
0062 process.load('SimMuon.Neutron.MinBias_7TeV_Neutrons_cfi')
0063 #process.load('SimMuon.Neutron.MinBias_14TeV_Neutrons_cfi')
0064 
0065 process.load('SimMuon.Neutron.VtxSmearedRealistic7TeVCollision_Neutrons_cff')
0066 #process.load('SimMuon.Neutron.VtxSmearedGauss_Neutrons_cff')
0067 
0068 # this one should be loaded last from the neutron-related imports:
0069 process.load('SimMuon.Neutron.neutronSimHitsProcessing_cff')
0070 
0071 
0072 ################################################################################
0073 # Global conditions tag
0074 # https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideFrontierConditions#Global_Tags_for_Monte_Carlo_Prod
0075 
0076 #process.GlobalTag.globaltag = 'MC_36Y_V10::All'
0077 process.GlobalTag.globaltag = 'MC_38Y_V9::All'
0078 
0079 
0080 ################################################################################
0081 # seeding the random engine
0082 
0083 from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
0084 randSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
0085 #randSvc.resetSeeds(theRun)
0086 randSvc.populate()
0087 
0088 #print "random service:", process.RandomNumberGeneratorService
0089 #print "source:", process.source
0090 
0091 
0092 ################################################################################
0093 # Source definition
0094 
0095 process.source = cms.Source("EmptySource",firstRun = cms.untracked.uint32(theRun))
0096 
0097 
0098 ################################################################################
0099 # Output definition
0100 # - keep the original g4SimHitsNeutrons muon simhits 
0101 #   which have "g4SimHitsNeutrons" module labels
0102 # - keep all the output of NeutronHitsCollector and EmptyHepMCProducer
0103 #   which has module labels "g4SimHits" and generator respectively
0104 # the latter should be enough to make MixingModule happy with this input
0105 
0106 #process.load("Configuration.EventContent.EventContent_cff")
0107 process.output = cms.OutputModule("PoolOutputModule",
0108     splitLevel = cms.untracked.int32(0),
0109     outputCommands = cms.untracked.vstring('drop *',
0110         #'keep PSimHits_*NeutronWriter_*_*',
0111         'keep *_g4SimHits_*_*',
0112         'keep *_generator_*_*',
0113         'keep *_*_Muon*Hits_*'),
0114     fileName = cms.untracked.string(theFileName),
0115     SelectEvents = cms.untracked.PSet(
0116         SelectEvents = cms.vstring('simulation_step')
0117     )
0118 )
0119 
0120 
0121 ################################################################################
0122 # Path and EndPath definitions
0123 
0124 process.generation_step = cms.Path(process.pgen_neutrons)
0125 process.simulation_step = cms.Path(process.psim_neutrons)
0126 process.neutron_simhits_step = cms.Path(process.neutron_simhits_seq)
0127 process.endjob_step = cms.Path(process.endOfProcess)
0128 process.out_step = cms.EndPath(process.output)
0129 
0130 
0131 ################################################################################
0132 # Schedule definition
0133 
0134 process.schedule = cms.Schedule(
0135     process.generation_step,
0136     process.simulation_step,
0137     process.neutron_simhits_step,
0138     process.endjob_step,
0139     process.out_step
0140 )
0141 
0142 # special treatment in case of production filter sequence
0143 for path in process.paths:
0144     getattr(process,path)._seq = process.generatorNeutrons*getattr(process,path)._seq