CMS 3D CMS Logo

TimeMemoryG4Info.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 def customise(process):
3 
4  #Adding SimpleMemoryCheck service:
5  process.SimpleMemoryCheck=cms.Service("SimpleMemoryCheck",
6  ignoreTotal=cms.untracked.int32(1),
7  oncePerEventMode=cms.untracked.bool(True))
8  #Adding Timing service:
9  process.Timing=cms.Service("Timing")
10 
11  #Tweak Message logger to dump G4cout and G4cerr messages in G4msg.log
12  #print process.MessageLogger.__dict__
13  process.MessageLogger.destinations=cms.untracked.vstring('cout'
14  ,'cerr'
15  ,'G4msg'
16  )
17  process.MessageLogger.categories=cms.untracked.vstring('FwkJob'
18  ,'FwkReport'
19  ,'FwkSummary'
20  ,'Root_NoDictionary'
21  ,'TimeReport'
22  ,'TimeModule'
23  ,'TimeEvent'
24  ,'MemoryCheck'
25  ,'PhysicsList'
26  ,'G4cout'
27  ,'G4cerr'
28  )
29  #Configuring the G4msg.log output
30  process.MessageLogger.G4msg = cms.untracked.PSet(
31  noTimeStamps = cms.untracked.bool(True)
32  #First eliminate unneeded output
33  ,threshold = cms.untracked.string('INFO')
34  ,INFO = cms.untracked.PSet(limit = cms.untracked.int32(0))
35  ,FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(0))
36  ,FwkSummary = cms.untracked.PSet(limit = cms.untracked.int32(0))
37  ,Root_NoDictionary = cms.untracked.PSet(limit = cms.untracked.int32(0))
38  ,FwkJob = cms.untracked.PSet(limit = cms.untracked.int32(0))
39  ,TimeReport = cms.untracked.PSet(limit = cms.untracked.int32(0))
40  ,TimeModule = cms.untracked.PSet(limit = cms.untracked.int32(0))
41  ,TimeEvent = cms.untracked.PSet(limit = cms.untracked.int32(0))
42  ,MemoryCheck = cms.untracked.PSet(limit = cms.untracked.int32(0))
43  #TimeModule, TimeEvent, TimeReport are written to LogAsbolute instead of LogInfo with a category
44  #so they cannot be eliminated from any destination (!) unless one uses the summaryOnly option
45  #in the Timing Service... at the price of silencing the output needed for the TimingReport profiling
46  #
47  #Then add the wanted ones:
48  ,PhysicsList = cms.untracked.PSet(limit = cms.untracked.int32(-1))
49  ,G4cout = cms.untracked.PSet(limit = cms.untracked.int32(-1))
50  ,G4cerr = cms.untracked.PSet(limit = cms.untracked.int32(-1))
51  )
52 
53  #Add these 3 lines to put back the summary for timing information at the end of the logfile
54  #(needed for TimeReport report)
55  if hasattr(process,'options'):
56  process.options.wantSummary = cms.untracked.bool(True)
57  else:
58  process.options = cms.untracked.PSet(
59  wantSummary = cms.untracked.bool(True)
60  )
61 
62  return(process)
def customise(process)
return(e1-e2)*(e1-e2)+dp *dp