Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:28:33

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 process = cms.Process("TEST")
0004 
0005 from FWCore.ParameterSet.VarParsing import VarParsing
0006 options = VarParsing()
0007 options.register("includeAliasToFoo", 1,
0008                  VarParsing.multiplicity.singleton,
0009                  VarParsing.varType.int,
0010                  "Include case Foo in EDAlias")
0011 options.register("includeAliasToBar", 1,
0012                  VarParsing.multiplicity.singleton,
0013                  VarParsing.varType.int,
0014                  "Include case Bar in EDAlias")
0015 options.register("consumerGets", 1,
0016                  VarParsing.multiplicity.singleton,
0017                  VarParsing.varType.int,
0018                  "Consumer gets event product")
0019 options.register("explicitProcessName", 0,
0020                  VarParsing.multiplicity.singleton,
0021                  VarParsing.varType.int,
0022                  "Use explicit process name in consumer InputTag")
0023 options.parseArguments()
0024 
0025 process.maxEvents.input = 1
0026 process.source = cms.Source("EmptySource")
0027 
0028 
0029 process.simpleProducerFoo = cms.EDProducer("OVSimpleProducer", size = cms.int32(10))
0030 process.simpleProducerBar = cms.EDProducer("OVSimpleProducer", size = cms.int32(5))
0031 
0032 process.simpleProducer = cms.EDAlias()
0033 if options.includeAliasToFoo != 0:
0034     process.simpleProducer.simpleProducerFoo = cms.VPSet(
0035         cms.PSet(
0036             type = cms.string("edmtestSimplesOwned")
0037         )
0038     )
0039 if options.includeAliasToBar != 0:
0040     process.simpleProducer.simpleProducerBar = cms.VPSet(
0041         cms.PSet(
0042             type = cms.string("edmtestSimpleDerivedsOwned"),
0043             fromProductInstance = cms.string("derived"),
0044             toProductInstance = cms.string("")
0045         )
0046     )
0047 
0048 process.simpleViewConsumer = cms.EDAnalyzer("SimpleViewAnalyzer",
0049     label = cms.untracked.InputTag("simpleProducer"),
0050     sizeMustMatch = cms.untracked.uint32(10),
0051     checkSize = cms.untracked.bool(options.consumerGets != 0)
0052 )
0053 if options.includeAliasToFoo == 0:
0054     process.simpleViewConsumer.sizeMustMatch = 5
0055 if options.explicitProcessName != 0:
0056     process.simpleViewConsumer.label.setProcessName("TEST")
0057 
0058 dependsOn = []
0059 if options.includeAliasToFoo != 0:
0060     dependsOn.append("simpleProducerFoo")
0061 if options.includeAliasToBar != 0:
0062     dependsOn.append("simpleProducerBar")
0063 process.PathsAndConsumesOfModulesTestService = cms.Service("PathsAndConsumesOfModulesTestService",
0064     modulesAndConsumes = cms.VPSet(
0065         cms.PSet(
0066             key = cms.string("simpleViewConsumer"),
0067             value = cms.vstring(dependsOn)
0068         ),
0069     )
0070 )
0071 
0072 process.t = cms.Task(
0073     process.simpleProducerFoo,
0074     process.simpleProducerBar
0075 )
0076 
0077 process.p = cms.Path(
0078     process.simpleViewConsumer,
0079     process.t
0080 )