Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-24 02:12:43

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 import sys
0004 enableTest2 = (sys.argv[-1] != "disableTest2")
0005 class SwitchProducerTest(cms.SwitchProducer):
0006     def __init__(self, **kargs):
0007         super(SwitchProducerTest,self).__init__(
0008             dict(
0009                 test1 = lambda accelerators: (True, -10),
0010                 test2 = lambda accelerators: (enableTest2, -9)
0011             ), **kargs)
0012 
0013 process = cms.Process("PROD1")
0014 
0015 process.options = cms.untracked.PSet(
0016     numberOfStreams = cms.untracked.uint32(1),
0017     numberOfConcurrentRuns = cms.untracked.uint32(1),
0018     numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(1)
0019 )
0020 
0021 process.source = cms.Source("EmptySource")
0022 if enableTest2:
0023     process.source.firstLuminosityBlock = cms.untracked.uint32(2)
0024 
0025 process.maxEvents = cms.untracked.PSet(
0026     input = cms.untracked.int32(3)
0027 )
0028 
0029 process.out = cms.OutputModule("PoolOutputModule",
0030     fileName = cms.untracked.string('testSwitchProducerPathFilter%d.root' % (1 if enableTest2 else 2,)),
0031     outputCommands = cms.untracked.vstring(
0032         'keep *_intProducer_*_*',
0033         'keep *_intProducerAlias_*_*',
0034     )
0035 )
0036 
0037 process.intProducer1 = cms.EDProducer("FailingProducer")
0038 process.intProducer2 = cms.EDProducer("FailingProducer")
0039 process.intProducer3 = cms.EDProducer("ManyIntProducer",
0040     ivalue = cms.int32(3),
0041     values = cms.VPSet(cms.PSet(instance=cms.string("foo"),value=cms.int32(31))),
0042     throw = cms.untracked.bool(True)
0043 )
0044 
0045 process.intProducer = SwitchProducerTest(
0046     test1 = cms.EDProducer("AddIntsProducer", labels = cms.VInputTag("intProducer1")),
0047     test2 = cms.EDProducer("AddIntsProducer", labels = cms.VInputTag("intProducer2"))
0048 )
0049 # SwitchProducer with an alias
0050 process.intProducerAlias = SwitchProducerTest(
0051     test1 = cms.EDProducer("AddIntsProducer", labels = cms.VInputTag("intProducer1")),
0052     test2 = cms.EDAlias(intProducer3 = cms.VPSet(cms.PSet(type = cms.string("edmtestIntProduct"), fromProductInstance = cms.string(""), toProductInstance = cms.string("")),
0053                                                  cms.PSet(type = cms.string("edmtestIntProduct"), fromProductInstance = cms.string("foo"), toProductInstance = cms.string("other"))))
0054 )
0055 
0056 
0057 process.f = cms.EDFilter("TestFilterModule", acceptValue = cms.untracked.int32(-1))
0058 
0059 process.t = cms.Task(process.intProducer1, process.intProducer2, process.intProducer3)
0060 process.p = cms.Path(process.f+process.intProducer+process.intProducerAlias, process.t)
0061 
0062 process.e = cms.EndPath(process.out)