Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 process = cms.Process('SIM')
0004 
0005 # import of standard configurations
0006 process.load('Configuration/StandardSequences/Services_cff')
0007 process.load('FWCore/MessageService/MessageLogger_cfi')
0008 process.load('SimG4CMS.Forward.zdcGeometryXML_cfi')
0009 process.load('Configuration/StandardSequences/MagneticField_38T_cff')
0010 process.load('Configuration/StandardSequences/Generator_cff')
0011 process.load('Configuration/StandardSequences/VtxSmearedNoSmear_cff')
0012 process.load('Configuration/StandardSequences/Sim_cff')
0013 process.load('Configuration/StandardSequences/EndOfProcess_cff')
0014 process.load('Configuration/EventContent/EventContent_cff')
0015 
0016 process.maxEvents = cms.untracked.PSet(
0017     input = cms.untracked.int32(10)
0018 )
0019 
0020 # Input source
0021 process.source = cms.Source("EmptySource")
0022 
0023 process.generator = cms.EDProducer("FlatRandomEGunProducer",
0024     PGunParameters = cms.PSet(
0025         PartID = cms.vint32(2112),
0026         MinEta = cms.double(7.0),
0027         MaxEta = cms.double(7.0),
0028         MinPhi = cms.double(-3.14159265359), ## in radians
0029         MaxPhi = cms.double(3.14159265359),
0030         MinE = cms.double(99.99),
0031         MaxE = cms.double(100.01)
0032     ),
0033     Verbosity = cms.untracked.int32(0), ## set to 1 (or greater)  for printouts
0034 
0035     psethack = cms.string('single neutron E 100'),
0036     AddAntiParticle = cms.bool(True),
0037     firstRun = cms.untracked.uint32(1)
0038 )
0039 
0040 process.ProductionFilterSequence = cms.Sequence(process.generator)
0041 
0042 # Output definition
0043 process.output = cms.OutputModule("PoolOutputModule",
0044     outputCommands = process.FEVTDEBUGEventContent.outputCommands,
0045     fileName = cms.untracked.string('simevent.root'),
0046     dataset = cms.untracked.PSet(
0047         dataTier = cms.untracked.string('GEN-SIM'),
0048         filterName = cms.untracked.string('')
0049     ),
0050     SelectEvents = cms.untracked.PSet(
0051         SelectEvents = cms.vstring('generation_step')
0052     )
0053 )
0054 
0055 # Special settings
0056 process.g4SimHits.UseMagneticField = cms.bool(False)
0057 process.g4SimHits.Physics.DefaultCutValue = cms.double(10.)
0058 process.g4SimHits.Generator.MinEtaCut = cms.double(-9.0)
0059 process.g4SimHits.Generator.MaxEtaCut =  cms.double(9.0)
0060 process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
0061     type = cms.string('ZdcTestAnalysis'),
0062     ZdcTestAnalysis = cms.PSet(
0063         Verbosity = cms.int32(0),
0064         StepNtupleFlag = cms.int32(0),
0065         EventNtupleFlag = cms.int32(1),
0066         StepNtupleFileName = cms.string('stepNtuple.root'),
0067         EventNtupleFileName = cms.string('eventNtuple.root')
0068     )       
0069 ))
0070 process.g4SimHits.ZdcSD.UseShowerLibrary = cms.bool(True)
0071 process.g4SimHits.StackingAction.MaxTrackTime = cms.double(10000.)
0072 process.g4SimHits.CaloSD.TmaxHit = cms.double(10000.)
0073 
0074 # Path and EndPath definitions
0075 process.generation_step = cms.Path(process.ProductionFilterSequence+process.pgen)
0076 process.simulation_step = cms.Path(process.psim)
0077 process.endjob_step = cms.Path(process.endOfProcess)
0078 process.out_step = cms.EndPath(process.output)
0079 
0080 # Schedule definition
0081 process.schedule = cms.Schedule(process.generation_step,process.simulation_step,process.endjob_step,process.out_step)
0082 
0083 def customise(process):
0084     #Adding SimpleMemoryCheck service:
0085     process.SimpleMemoryCheck=cms.Service("SimpleMemoryCheck",
0086                                           ignoreTotal=cms.untracked.int32(1),
0087                                           oncePerEventMode=cms.untracked.bool(True))
0088     #Adding Timing service:
0089     process.Timing=cms.Service("Timing")
0090     
0091     #Tweak Message logger to dump G4cout and G4cerr messages in G4msg.log
0092     #print process.MessageLogger.__dict__
0093     process.MessageLogger.debugModules=cms.untracked.vstring('g4SimHits')
0094                                                            
0095     #Configuring the G4msg.log output
0096     process.MessageLogger.files = dict(G4msg =  cms.untracked.PSet(
0097         noTimeStamps = cms.untracked.bool(True)
0098         #First eliminate unneeded output
0099         ,threshold = cms.untracked.string('INFO')
0100         ,INFO = cms.untracked.PSet(limit = cms.untracked.int32(0))
0101         ,DEBUG = cms.untracked.PSet(limit = cms.untracked.int32(0))
0102         ,FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(0))
0103         ,FwkSummary = cms.untracked.PSet(limit = cms.untracked.int32(0))
0104         ,Root_NoDictionary = cms.untracked.PSet(limit = cms.untracked.int32(0))
0105         ,FwkJob = cms.untracked.PSet(limit = cms.untracked.int32(0))
0106         ,TimeReport = cms.untracked.PSet(limit = cms.untracked.int32(0))
0107         ,TimeModule = cms.untracked.PSet(limit = cms.untracked.int32(0))
0108         ,TimeEvent = cms.untracked.PSet(limit = cms.untracked.int32(0))
0109         ,MemoryCheck = cms.untracked.PSet(limit = cms.untracked.int32(0))
0110         #TimeModule, TimeEvent, TimeReport are written to LogAsbolute instead of LogInfo with a category
0111         #so they cannot be eliminated from any destination (!) unless one uses the summaryOnly option
0112         #in the Timing Service... at the price of silencing the output needed for the TimingReport profiling
0113         #
0114         #Then add the wanted ones:
0115         ,PhysicsList = cms.untracked.PSet(limit = cms.untracked.int32(-1))
0116         ,G4cout = cms.untracked.PSet(limit = cms.untracked.int32(-1))
0117         ,G4cerr = cms.untracked.PSet(limit = cms.untracked.int32(-1))
0118         ,CaloSim = cms.untracked.PSet(limit = cms.untracked.int32(-1))
0119         ,ForwardSim = cms.untracked.PSet(limit = cms.untracked.int32(-1))
0120         )
0121 )
0122 
0123     #Add these 3 lines to put back the summary for timing information at the end of the logfile
0124     #(needed for TimeReport report)
0125     process.options = cms.untracked.PSet(
0126         wantSummary = cms.untracked.bool(True)
0127         )
0128 
0129 #    process.g4SimHits.G4Commands = cms.vstring('/tracking/verbose 1')
0130 
0131     return(process)
0132 
0133 # End of customisation function definition
0134 
0135 process = customise(process)