Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 process = cms.Process("TESTMODULEDELETE")
0004 
0005 process.maxEvents.input = 8
0006 process.source = cms.Source("EmptySource")
0007 
0008 #process.Tracer = cms.Service("Tracer")
0009 
0010 # Cases to test
0011 # - event/lumi/run product consumed, module kept
0012 # - event/lumi/run product not consumed, module deleted
0013 # - event product not consumed but module in Path, module kept
0014 # - event/lumi/run product with the same module label but different instance name, module deleted
0015 # - event/lumi/run product with the same module label and instance name but with skipCurrentProcess, module deleted
0016 # - DAG of event/lumi/run producers that are not consumed by an always-running module, whole DAG deleted
0017 # - DAG of event(/lumi/run) producers that are partly consumed (kept) and partly non-consumed (delete)
0018 # - EDAlias with one instance consumed (original producer kept) and another non-consumed (original producer deleted)
0019 # - SwitchProducer non-chosen case deleted
0020 
0021 intEventProducer = cms.EDProducer("IntProducer", ivalue = cms.int32(1))
0022 intNonEventProducer = cms.EDProducer("NonEventIntProducer", ivalue = cms.int32(1))
0023 intEventProducerMustRun = cms.EDProducer("edmtest::MustRunIntProducer", ivalue = cms.int32(1))
0024 intEventConsumer = cms.EDAnalyzer("IntTestAnalyzer",
0025     moduleLabel = cms.untracked.InputTag("producerEventConsumed"),
0026     valueMustMatch = cms.untracked.int32(1)
0027 )
0028 def nonEventConsumer(transition, sourcePattern, expected):
0029     transCap = transition[0].upper() + transition[1:]
0030     runOrLumiBlock = transCap
0031     if "Lumi" in runOrLumiBlock:
0032         runOrLumiBlock = runOrLumiBlock+"nosityBlock"
0033     ret = intNonEventProducer.clone()
0034     setattr(ret, "consumes%s"%runOrLumiBlock, cms.InputTag(sourcePattern%transCap, transition))
0035     setattr(ret, "expect%s"%runOrLumiBlock, cms.untracked.int32(expected))
0036     return ret
0037 
0038 process.producerEventConsumed = intEventProducer.clone(ivalue = 1)
0039 process.producerBeginLumiConsumed = intNonEventProducer.clone(ivalue = 2)
0040 process.producerEndLumiConsumed = intNonEventProducer.clone(ivalue = 3)
0041 process.producerBeginRunConsumed = intNonEventProducer.clone(ivalue = 4)
0042 process.producerEndRunConsumed = intNonEventProducer.clone(ivalue = 5)
0043 
0044 process.producerEventNotConsumedInPath = intEventProducerMustRun.clone()
0045 
0046 process.consumerEvent = intEventConsumer.clone(moduleLabel = "producerEventConsumed", valueMustMatch = 1)
0047 process.consumerBeginLumi = nonEventConsumer("beginLumi", "producer%sConsumed", 2)
0048 process.consumerEndLumi = nonEventConsumer("endLumi", "producer%sConsumed", 3)
0049 process.consumerBeginRun = nonEventConsumer("beginRun", "producer%sConsumed", 4)
0050 process.consumerEndRun = nonEventConsumer("endRun", "producer%sConsumed", 5)
0051 
0052 process.producerEventNotConsumed = cms.EDProducer("edmtest::TestModuleDeleteProducer")
0053 process.producerBeginLumiNotConsumed = cms.EDProducer("edmtest::TestModuleDeleteInLumiProducer")
0054 process.producerBeginRunNotConsumed = cms.EDProducer("edmtest::TestModuleDeleteInRunProducer")
0055 process.producerBeginProcessNotConsumed = cms.EDProducer("edmtest::TestModuleDeleteInProcessProducer")
0056 
0057 process.producerEventNotConsumedChain1 = cms.EDProducer("edmtest::TestModuleDeleteProducer")
0058 process.producerEventNotConsumedChain2 = cms.EDProducer("edmtest::TestModuleDeleteProducer",
0059     srcEvent = cms.untracked.VInputTag("producerEventNotConsumedChain1")
0060 )
0061 process.producerEventNotConsumedChain3 = cms.EDProducer("edmtest::TestModuleDeleteProducer",
0062     srcEvent = cms.untracked.VInputTag("producerEventNotConsumedChain1")
0063 )
0064 process.producerEventNotConsumedChain4 = cms.EDProducer("edmtest::TestModuleDeleteProducer",
0065     srcEvent = cms.untracked.VInputTag("producerEventNotConsumedChain2", "producerEventNotConsumedChain3")
0066 )
0067 process.producerEventNotConsumedChain5 = cms.EDProducer("edmtest::TestModuleDeleteInLumiProducer",
0068     srcEvent = cms.untracked.VInputTag("producerEventNotConsumedChain1")
0069 )
0070 process.producerEventNotConsumedChain6 = cms.EDProducer("edmtest::TestModuleDeleteInRunProducer",
0071     srcBeginLumi = cms.untracked.VInputTag("producerEventNotConsumedChain5")
0072 )
0073 process.producerEventNotConsumedChain7 = cms.EDProducer("edmtest::TestModuleDeleteInProcessProducer",
0074     srcBeginRun = cms.untracked.VInputTag("producerEventNotConsumedChain6")
0075 )
0076 process.producerEventNotConsumedChain8 = cms.EDProducer("edmtest::TestModuleDeleteInRunProducer",
0077     srcBeginLumi = cms.untracked.VInputTag("producerEventNotConsumedChain7")
0078 )
0079 process.producerEventNotConsumedChain9 = cms.EDProducer("edmtest::TestModuleDeleteInLumiProducer",
0080     srcBeginRun = cms.untracked.VInputTag("producerEventNotConsumedChain8")
0081 )
0082 process.producerEventNotConsumedChain10 = cms.EDProducer("edmtest::TestModuleDeleteProducer",
0083     srcBeginLumi = cms.untracked.VInputTag("producerEventNotConsumedChain9")
0084 )
0085 
0086 process.producerEventPartiallyConsumedChain1 = intEventProducerMustRun.clone()
0087 process.producerEventPartiallyConsumedChain2 = cms.EDProducer("AddIntsProducer", labels = cms.VInputTag("producerEventPartiallyConsumedChain1"))
0088 process.producerEventPartiallyConsumedChain3 = cms.EDProducer("edmtest::TestModuleDeleteInLumiProducer",
0089     srcEvent = cms.untracked.VInputTag("producerEventPartiallyConsumedChain1")
0090 )
0091 process.producerEventPartiallyConsumedChain4 = cms.EDProducer("edmtest::TestModuleDeleteInLumiProducer",
0092     srcEvent = cms.untracked.VInputTag("producerEventPartiallyConsumedChain2", "producerEventPartiallyConsumedChain4")
0093 )
0094 
0095 process.producerEventAliasNotConsumed = cms.EDProducer("edmtest::TestModuleDeleteProducer")
0096 process.producerEventAliasConsumed = intEventProducerMustRun.clone()
0097 process.producerEventAlias = cms.EDAlias(
0098     producerEventAliasNotConsumed = cms.VPSet(
0099         cms.PSet(
0100             type = cms.string("edmtestIntProduct"),
0101             fromProductInstance = cms.string(""),
0102             toProductInstance = cms.string("notConsumed"),
0103         )
0104     ),
0105     producerEventAliasConsumed = cms.VPSet(
0106         cms.PSet(
0107             type = cms.string("edmtestIntProduct"),
0108             fromProductInstance = cms.string(""),
0109             toProductInstance = cms.string("consumed"),
0110         )
0111     )
0112 )
0113 process.consumerEventAlias = cms.EDAnalyzer("edmtest::GenericIntsAnalyzer",
0114     srcEvent = cms.untracked.VInputTag("producerEventAlias:consumed")
0115 )
0116 
0117 class SwitchProducerTest(cms.SwitchProducer):
0118     def __init__(self, **kargs):
0119         super(SwitchProducerTest,self).__init__(
0120             dict(
0121                 test1 = lambda accelerators: (True, -10),
0122                 test2 = lambda accelerators: (True, -9)
0123             ), **kargs)
0124 process.producerEventSwitchProducerNotConsumed = cms.EDProducer("edmtest::TestModuleDeleteProducer")
0125 process.producerEventSwitchProducerConsumed = intEventProducerMustRun.clone()
0126 process.producerEventSwitchProducer = SwitchProducerTest(
0127     test1 = cms.EDProducer("AddIntsProducer", labels = cms.VInputTag("producerEventSwitchProducerNotConsumed")),
0128     test2 = cms.EDProducer("AddIntsProducer", labels = cms.VInputTag("producerEventSwitchProducerConsumed")),
0129 )
0130 
0131 process.consumerNotExist = cms.EDAnalyzer("edmtest::GenericIntsAnalyzer",
0132     inputShouldBeMissing = cms.untracked.bool(True),
0133     srcBeginProcess = cms.untracked.VInputTag(
0134         "producerBeginProcessNotConsumed:doesNotExist",
0135         cms.InputTag("producerBeginProcessNotConsumed", "", cms.InputTag.skipCurrentProcess())
0136     ),
0137     srcBeginRun = cms.untracked.VInputTag(
0138         "producerBeginRunNotConsumed:doesNotExist",
0139         cms.InputTag("producerBeginRunNotConsumed", "", cms.InputTag.skipCurrentProcess())
0140     ),
0141     srcBeginLumi = cms.untracked.VInputTag(
0142         "producerBeginLumiNotConsumed:doesNotExist",
0143         cms.InputTag("producerBeginLumiNotConsumed", "", cms.InputTag.skipCurrentProcess())
0144     ),
0145     srcEvent = cms.untracked.VInputTag(
0146         "producerEventNotConsumed:doesNotExist",
0147         cms.InputTag("producerEventNotConsumed", "", cms.InputTag.skipCurrentProcess())
0148     ),
0149 )
0150 
0151 process.intAnalyzerDelete = cms.EDAnalyzer("edmtest::TestModuleDeleteAnalyzer")
0152 
0153 process.t = cms.Task(
0154     process.producerEventConsumed,
0155     process.producerBeginLumiConsumed,
0156     process.producerEndLumiConsumed,
0157     process.producerBeginRunConsumed,
0158     process.producerEndRunConsumed,
0159     #
0160     process.producerEventNotConsumed,
0161     process.producerBeginLumiNotConsumed,
0162     process.producerBeginRunNotConsumed,
0163     process.producerBeginProcessNotConsumed,
0164     #
0165     process.producerEventNotConsumedChain1,
0166     process.producerEventNotConsumedChain2,
0167     process.producerEventNotConsumedChain3,
0168     process.producerEventNotConsumedChain4,
0169     process.producerEventNotConsumedChain5,
0170     process.producerEventNotConsumedChain6,
0171     process.producerEventNotConsumedChain7,
0172     process.producerEventNotConsumedChain8,
0173     process.producerEventNotConsumedChain9,
0174     process.producerEventNotConsumedChain10,
0175     #
0176     process.producerEventPartiallyConsumedChain1,
0177     process.producerEventPartiallyConsumedChain3,
0178     process.producerEventPartiallyConsumedChain4,
0179     #
0180     process.producerEventAliasNotConsumed,
0181     process.producerEventAliasConsumed,
0182     #
0183     process.producerEventSwitchProducerNotConsumed,
0184     process.producerEventSwitchProducerConsumed,
0185 )
0186 
0187 process.p = cms.Path(
0188     process.producerEventNotConsumedInPath+
0189     #
0190     process.consumerEvent+
0191     process.consumerBeginLumi+
0192     process.consumerEndLumi+
0193     process.consumerBeginRun+
0194     process.consumerEndRun+
0195     #
0196     process.consumerNotExist+
0197     #
0198     process.producerEventPartiallyConsumedChain2+
0199     #
0200     process.consumerEventAlias+
0201     #
0202     process.producerEventSwitchProducer+
0203     #
0204     process.intAnalyzerDelete
0205     ,
0206     process.t
0207 )