Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-07-27 22:26:59

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 process = cms.Process("TEST")
0004 
0005 process.load("FWCore.MessageService.MessageLogger_cfi")
0006 process.MessageLogger.cerr.FwkReport.reportEvery = 1
0007 
0008 from FWCore.Modules.modules import EmptySource
0009 process.source = EmptySource()
0010 
0011 process.maxEvents.input = 20
0012 
0013 # accept one event out of two
0014 from FWCore.Modules.modules import Prescaler
0015 process.filter = Prescaler(
0016     prescaleFactor = 2,
0017     prescaleOffset = 0
0018 )
0019 
0020 # produce a PathStateToken when run, to indicate that its path is active for the current event
0021 from FWCore.Modules.modules import PathStateCapture
0022 process.pathStateCapture = PathStateCapture()
0023 
0024 # try to consume a PathStateToken: if it is found accept the event, otherwise reject it
0025 from FWCore.Modules.modules import PathStateRelease
0026 process.pathStateRelease = PathStateRelease(
0027     state = 'pathStateCapture'
0028 )
0029 
0030 # select one event out of two and record the path's activity
0031 process.captured = cms.Path(
0032     process.filter +
0033     process.pathStateCapture
0034 )
0035 
0036 # replicate the activity of the original path
0037 process.released = cms.Path(
0038     process.pathStateRelease
0039 )
0040 
0041 # compare the results of the "captured" and "released" paths
0042 from FWCore.Modules.modules import PathStatusFilter
0043 process.compare = PathStatusFilter(
0044     logicalExpression = '(captured and released) or (not captured and not released)'
0045 )
0046 
0047 # schedule the comparison
0048 process.correct = cms.Path(
0049     process.compare
0050 )
0051 
0052 # require that the comparison has been successful for every event
0053 from FWCore.Framework.modules import SewerModule
0054 process.require = SewerModule(
0055     name = cms.string('require'),
0056     shouldPass = process.maxEvents.input.value(),
0057     SelectEvents = dict(
0058         SelectEvents = 'correct'
0059     )
0060 )
0061 
0062 process.endpath = cms.EndPath(
0063     process.require
0064 )