File indexing completed on 2024-04-06 12:12:30
0001 import FWCore.ParameterSet.Config as cms
0002
0003 import argparse
0004 import sys
0005
0006 parser = argparse.ArgumentParser(prog=sys.argv[0], description='Test ConditionalTasks.')
0007
0008 parser.add_argument("--filterSucceeds", help="Have filter succeed", action="store_true")
0009 parser.add_argument("--reverseDependencies", help="Switch the order of dependencies", action="store_true")
0010 parser.add_argument("--testAlias", help="Get data from an alias", action="store_true")
0011 parser.add_argument("--testView", help="Get data via a view", action="store_true")
0012 parser.add_argument("--aliasWithStar", help="when using testAlias use '*' as type", action="store_true")
0013
0014 args = parser.parse_args()
0015
0016 process = cms.Process("Test")
0017
0018 process.source = cms.Source("EmptySource")
0019
0020 process.maxEvents.input = 1
0021
0022 process.a = cms.EDProducer("IntProducer", ivalue = cms.int32(1))
0023 process.b = cms.EDProducer("AddIntsProducer", labels = cms.VInputTag(cms.InputTag("a")))
0024
0025 process.f1 = cms.EDFilter("IntProductFilter", label = cms.InputTag("b"))
0026
0027 process.c = cms.EDProducer("IntProducer", ivalue = cms.int32(2))
0028 process.d = cms.EDProducer("AddIntsProducer", labels = cms.VInputTag(cms.InputTag("c")))
0029 process.e = cms.EDProducer("AddIntsProducer", labels = cms.VInputTag(cms.InputTag("d")))
0030
0031 process.prodOnPath = cms.EDProducer("AddIntsProducer", labels = cms.VInputTag(cms.InputTag("d"), cms.InputTag("e")))
0032
0033 if args.filterSucceeds:
0034 threshold = 1
0035 else:
0036 threshold = 3
0037
0038 process.f2 = cms.EDFilter("IntProductFilter", label = cms.InputTag("e"), threshold = cms.int32(threshold))
0039
0040 if args.reverseDependencies:
0041 process.d.labels[0]=cms.InputTag("e")
0042 process.e.labels[0]=cms.InputTag("c")
0043 process.f2.label = cms.InputTag("d")
0044
0045 if args.testView:
0046 process.f3 = cms.EDAnalyzer("SimpleViewAnalyzer",
0047 label = cms.untracked.InputTag("f"),
0048 sizeMustMatch = cms.untracked.uint32(10),
0049 checkSize = cms.untracked.bool(False)
0050 )
0051 process.f = cms.EDProducer("OVSimpleProducer", size = cms.int32(10))
0052 producttype = "edmtestSimplesOwned"
0053 else:
0054 process.f= cms.EDProducer("IntProducer", ivalue = cms.int32(3))
0055 process.f3 = cms.EDFilter("IntProductFilter", label = cms.InputTag("f"))
0056 producttype = "edmtestIntProduct"
0057
0058 if args.testAlias:
0059 if args.aliasWithStar:
0060 producttype = "*"
0061
0062 process.f3.label = "aliasToF"
0063 process.aliasToF = cms.EDAlias(
0064 f = cms.VPSet(
0065 cms.PSet(
0066 type = cms.string(producttype),
0067 )
0068 )
0069 )
0070
0071
0072 process.p = cms.Path(process.f1+process.prodOnPath+process.f2+process.f3, cms.ConditionalTask(process.a, process.b, process.c, process.d, process.e, process.f))
0073
0074 process.tst = cms.EDAnalyzer("IntTestAnalyzer", moduleLabel = cms.untracked.InputTag("f"), valueMustMatch = cms.untracked.int32(3),
0075 valueMustBeMissing = cms.untracked.bool(not args.filterSucceeds))
0076
0077 process.endp = cms.EndPath(process.tst)
0078
0079
0080