Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
import FWCore.ParameterSet.Config as cms

import argparse
import sys

parser = argparse.ArgumentParser(prog=sys.argv[0], description='Test ConditionalTasks.')

parser.add_argument("--extraProducers", help="Add extra producers to configuration", action="store_true")
parser.add_argument("--fileName", help="name of output file")
parser.add_argument("--firstLumi", help="LuminosityBlock number for first lumi", type = int, default=1)
parser.add_argument("--keepAllProducts", help="Keep all products made in the job", action="store_true")
parser.add_argument("--dropThings", help="drop the Things collections so the refs will not function", action="store_true")

args = parser.parse_args()


process = cms.Process("PROD")

nEvents = 10
from FWCore.Modules.modules import EmptySource
process.source = EmptySource(
                                firstLuminosityBlock = args.firstLumi,
                                firstEvent = nEvents*(args.firstLumi-1)+1
)

process.maxEvents.input = nEvents

if args.extraProducers:
    from FWCore.Framework.modules import IntProducer
    process.a = IntProducer(ivalue = 1)

    process.b = IntProducer(ivalue = 2)

from FWCore.Integration.modules import ThingProducer, OtherThingProducer, OtherThingAnalyzer
process.c = ThingProducer()

process.d = OtherThingProducer(thingTag="c")

outputs = []
if not args.keepAllProducts:
    outputs = ["drop *",
                "keep edmtestOtherThings_*_*_*"]
    if not args.dropThings:
        outputs.append("keep edmtestThings_*_*_*")
    

from IOPool.Output.modules import PoolOutputModule
process.o = PoolOutputModule(outputCommands = outputs,
                             fileName = args.fileName
                             )
if args.extraProducers:
    process.p = cms.Path(process.a+process.b+process.c*process.d)
else:
    process.p = cms.Path(process.c*process.d)

process.tester = OtherThingAnalyzer(other = ("d","testUserTag"))

process.out = cms.EndPath(process.o+process.tester)