Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-08 00:35:16

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 parser.add_argument("--testConsumesMany", help="use ConsumesMany", action="store_true")
0014 
0015 argv = sys.argv[:]
0016 if '--' in argv:
0017     argv.remove("--")
0018 args, unknown = parser.parse_known_args(argv)
0019 
0020 process = cms.Process("Test")
0021 
0022 process.source = cms.Source("EmptySource")
0023 
0024 process.maxEvents.input = 1
0025 
0026 process.a = cms.EDProducer("IntProducer", ivalue = cms.int32(1))
0027 process.b = cms.EDProducer("AddIntsProducer", labels = cms.VInputTag(cms.InputTag("a")))
0028 
0029 process.f1 = cms.EDFilter("IntProductFilter", label = cms.InputTag("b"))
0030 
0031 process.c = cms.EDProducer("IntProducer", ivalue = cms.int32(2))
0032 process.d = cms.EDProducer("AddIntsProducer", labels = cms.VInputTag(cms.InputTag("c")))
0033 process.e = cms.EDProducer("AddIntsProducer", labels = cms.VInputTag(cms.InputTag("d")))
0034 
0035 process.prodOnPath = cms.EDProducer("AddIntsProducer", labels = cms.VInputTag(cms.InputTag("d"), cms.InputTag("e")))
0036 
0037 if args.testConsumesMany:
0038   process.prodOnPath = cms.EDProducer("AddAllIntsProducer")
0039 
0040 if args.filterSucceeds:
0041     threshold = 1
0042 else:
0043     threshold = 3
0044 
0045 process.f2 = cms.EDFilter("IntProductFilter", label = cms.InputTag("e"), threshold = cms.int32(threshold))
0046 
0047 if args.reverseDependencies:
0048     process.d.labels[0]=cms.InputTag("e")
0049     process.e.labels[0]=cms.InputTag("c")
0050     process.f2.label = cms.InputTag("d")
0051 
0052 if args.testView:
0053   process.f3 = cms.EDAnalyzer("SimpleViewAnalyzer",
0054     label = cms.untracked.InputTag("f"),
0055     sizeMustMatch = cms.untracked.uint32(10),
0056     checkSize = cms.untracked.bool(False)
0057   )
0058   process.f = cms.EDProducer("OVSimpleProducer", size = cms.int32(10))
0059   producttype = "edmtestSimplesOwned"
0060 else:
0061   process.f= cms.EDProducer("IntProducer", ivalue = cms.int32(3))
0062   process.f3 = cms.EDFilter("IntProductFilter", label = cms.InputTag("f"))
0063   producttype = "edmtestIntProduct"
0064 
0065 if args.testAlias:
0066   if args.aliasWithStar:
0067     producttype = "*"
0068 
0069   process.f3.label = "aliasToF"
0070   process.aliasToF = cms.EDAlias(
0071       f = cms.VPSet(
0072           cms.PSet(
0073               type = cms.string(producttype),
0074           )
0075       )
0076   )
0077 
0078 
0079 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))
0080 
0081 process.tst = cms.EDAnalyzer("IntTestAnalyzer", moduleLabel = cms.untracked.InputTag("f"), valueMustMatch = cms.untracked.int32(3), 
0082                                                        valueMustBeMissing = cms.untracked.bool(not args.filterSucceeds and not args.testConsumesMany))
0083 
0084 process.endp = cms.EndPath(process.tst)
0085 
0086 #process.add_(cms.Service("Tracer"))
0087 #process.options.wantSummary=True