Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:12:42

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