Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-02 05:09:42

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 import argparse
0004 import sys
0005 parser = argparse.ArgumentParser(prog=sys.argv[0], description='Test OutputModule SelectEvents referring to a non-existent Path and/or Process ')
0006 parser.add_argument("--missingPath", type=str, required=True, help="Specify how the specified Path is missing. Can be 'sameProcess', 'earlierProcess', 'missingProcess'")
0007 parser.add_argument("--anotherModule", type=str, default="", help="Specify placement of another producer. Can be empty (default), 'before', 'after")
0008 args = parser.parse_args()
0009 
0010 process = cms.Process("TEST")
0011 
0012 process.source = cms.Source("EmptySource")
0013 if args.missingPath == "earlierProcess":
0014     process.source = cms.Source("PoolSource", fileNames=cms.untracked.vstring("file:testOutputModuleSelectEventsMissingPath.root"))
0015 process.maxEvents.input = 3
0016 
0017 selectEvents = {
0018     "sameProcess" : "nonexistent_path:TEST",
0019     "earlierProcess" : "nonexistent_path:EARLIER",
0020     "missingProcess" : "nonexistent_path:NONEXISTENT_PROCESS",
0021 }
0022 
0023 process.out = cms.OutputModule("SewerModule",
0024     SelectEvents = cms.untracked.PSet(
0025         SelectEvents = cms.vstring(selectEvents[args.missingPath])
0026     ),
0027     name = cms.string("out"),
0028     shouldPass = cms.int32(1)
0029 )
0030 
0031 process.ep = cms.EndPath(process.out)
0032 
0033 process.intprod = cms.EDProducer("IntProducer", ivalue=cms.int32(3))
0034 if args.anotherModule == "before":
0035     process.ep.insert(0, process.intprod)
0036 elif args.anotherModule == "after":
0037     process.ep += process.intprod
0038 elif args.anotherModule != "":
0039     raise Exception("Invalid value for anotherModule '{}'".format(args.anotherModule))
0040 
0041 process.add_(cms.Service('ZombieKillerService', secondsBetweenChecks=cms.untracked.uint32(2)))