Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
import FWCore.ParameterSet.Config as cms

def addService(process, multirun=False):
    # remove any instance of the FastTimerService
    if 'FastTimerService' in process.__dict__:
        del process.FastTimerService

    # instrument the menu with the FastTimerService
    process.load("HLTrigger.Timer.FastTimerService_cfi")

    # print a text summary at the end of the job
    process.FastTimerService.printEventSummary        = False
    process.FastTimerService.printRunSummary          = False
    process.FastTimerService.printJobSummary          = True

    # enable DQM plots
    process.FastTimerService.enableDQM                = True

    # enable per-path DQM plots (starting with CMSSW 9.2.3-patch2)
    process.FastTimerService.enableDQMbyPath          = True

    # enable per-module DQM plots
    process.FastTimerService.enableDQMbyModule        = True

    # enable DQM plots vs lumisection
    process.FastTimerService.enableDQMbyLumiSection   = True
    process.FastTimerService.dqmLumiSectionsRange     = 2500    # lumisections (23.31 s)

    # set the time resolution of the DQM plots
    process.FastTimerService.dqmTimeRange             = 1000.   # ms
    process.FastTimerService.dqmTimeResolution        =    5.   # ms
    process.FastTimerService.dqmPathTimeRange         =  100.   # ms
    process.FastTimerService.dqmPathTimeResolution    =    0.5  # ms
    process.FastTimerService.dqmModuleTimeRange       =   40.   # ms
    process.FastTimerService.dqmModuleTimeResolution  =    0.2  # ms

    # set the base DQM folder for the plots
    process.FastTimerService.dqmPath                  = "HLT/TimerService"
    process.FastTimerService.enableDQMbyProcesses     = False

    if multirun:
        # disable the per-lumisection plots
        process.FastTimerService.enableDQMbyLumiSection = False

    return process

def addOutput(process):
    # save the DQM plots in the DQMIO format
    process.dqmOutput = cms.OutputModule("DQMRootOutputModule",
        fileName = cms.untracked.string("DQM.root")
    )
    process.FastTimerOutput = cms.EndPath(process.dqmOutput)
    process.schedule.append(process.FastTimerOutput)

    return process

def addPrint(process):
    # enable text dump
    if not hasattr(process,'MessageLogger'):
        process.load('FWCore.MessageService.MessageLogger_cfi')
    process.MessageLogger.cerr.FastReport = cms.untracked.PSet( limit = cms.untracked.int32( 10000000 ) )
    return process

def addHarvest(process):
    # DQMStore service
    if not hasattr(process,'DQMStore'):
        process.load('DQMServices.Core.DQMStore_cfi')

    # FastTimerService client
    process.load('HLTrigger.Timer.fastTimerServiceClient_cfi')
    process.fastTimerServiceClient.dqmPath = "HLT/TimerService"

    # DQM file saver
    process.load('DQMServices.Components.DQMFileSaver_cfi')
    process.dqmSaver.workflow = "/HLT/FastTimerService/All"

    process.DQMFileSaverOutput = cms.EndPath(process.fastTimerServiceClient + process.dqmSaver)
    process.schedule.append(process.DQMFileSaverOutput)

    return process

# customise functions for cmsDriver

def customise_timer_service(process):
	process = addService(process)
	process = addOutput(process)
	return process

def customise_timer_service_singlejob(process):
	process = addService(process)
	process = addHarvest(process)
	return process

def customise_timer_service_multirun(process):
	process = addService(process,True)
	process = addOutput(process)
	return process

def customise_timer_service_print(process):
	process = addService(process)
	process = addPrint(process)
	return process