File indexing completed on 2025-01-21 01:39:47
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 Processes with inconsistent data products.')
0007
0008 parser.add_argument("--dropThing2", help="drop Thing2 from output", action="store_true")
0009 parser.add_argument("--fileName", help="name of output file")
0010 parser.add_argument("--noThing2Prod", help="do not include Thing2's producer", action="store_true")
0011 parser.add_argument("--startEvent", help="starting event number", type=int, default=1)
0012 parser.add_argument("--addAndStoreOther2", help='add the OtherThingProducer consuming thing2 and store it', action='store_true')
0013 parser.add_argument("--thing2DependsOnThing1", help="have thing2 depend on thing1", action='store_true')
0014
0015 args = parser.parse_args()
0016
0017
0018 process = cms.Process("PROD")
0019
0020 nEvents = 10
0021 from FWCore.Modules.modules import EmptySource
0022 process.source = EmptySource(firstEvent = args.startEvent)
0023
0024 process.maxEvents.input = nEvents
0025
0026 from FWCore.Framework.modules import IntProducer, AddIntsProducer
0027 process.thing1 = IntProducer(ivalue=1)
0028
0029 process.t = cms.Task(process.thing1)
0030 if not args.noThing2Prod:
0031 if args.thing2DependsOnThing1:
0032 process.thing2 = AddIntsProducer(labels=['thing1'])
0033 else:
0034 process.thing2 = IntProducer(ivalue=2)
0035 process.t.add(process.thing2)
0036 if args.addAndStoreOther2:
0037 process.other2 = AddIntsProducer(labels=['thing2'])
0038 process.t.add(process.other2)
0039 elif args.addAndStoreOther2:
0040 process.other2 = AddIntsProducer(labels=['thing1'])
0041 process.t.add(process.other2)
0042
0043 outputs = []
0044 if args.dropThing2:
0045 outputs = ["keep *",
0046 "drop *_thing2_*_*"]
0047
0048
0049 from IOPool.Output.modules import PoolOutputModule
0050 process.o = PoolOutputModule(outputCommands = outputs,
0051 fileName = args.fileName
0052 )
0053
0054 process.out = cms.EndPath(process.o, process.t)
0055
0056
0057
0058
0059