|
| 1 | +import FWCore.ParameterSet.Config as cms |
| 2 | + |
| 3 | +import argparse |
| 4 | +import sys |
| 5 | + |
| 6 | +parser = argparse.ArgumentParser(prog=sys.argv[0], description='Test ConditionalTasks.') |
| 7 | + |
| 8 | +parser.add_argument("--extraProducers", help="Add extra producers to configuration", action="store_true") |
| 9 | +parser.add_argument("--fileName", help="name of output file") |
| 10 | +parser.add_argument("--firstLumi", help="LuminosityBlock number for first lumi", type = int, default=1) |
| 11 | +parser.add_argument("--firstRun", help="LuminosityBlock number for first run", type = int, default=1) |
| 12 | +parser.add_argument("--keepAllProducts", help="Keep all products made in the job", action="store_true") |
| 13 | +parser.add_argument("--dropThings", help="drop the Things collections so the refs will not function", action="store_true") |
| 14 | + |
| 15 | +args = parser.parse_args() |
| 16 | + |
| 17 | + |
| 18 | +process = cms.Process("PROD") |
| 19 | + |
| 20 | +nEvents = 10 |
| 21 | +from FWCore.Modules.modules import EmptySource |
| 22 | +process.source = EmptySource(firstRun = args.firstRun, |
| 23 | + firstLuminosityBlock = args.firstLumi, |
| 24 | + firstEvent = nEvents*(args.firstLumi-1)+1 |
| 25 | +) |
| 26 | + |
| 27 | +process.maxEvents.input = nEvents |
| 28 | + |
| 29 | +if args.extraProducers: |
| 30 | + from FWCore.Framework.modules import IntProducer |
| 31 | + process.a = IntProducer(ivalue = 1) |
| 32 | + |
| 33 | + process.b = IntProducer(ivalue = 2) |
| 34 | + |
| 35 | +from FWCore.Integration.modules import ThingProducer, OtherThingProducer, OtherThingAnalyzer |
| 36 | +process.c = ThingProducer() |
| 37 | + |
| 38 | +process.d = OtherThingProducer(thingTag="c") |
| 39 | + |
| 40 | +outputs = [] |
| 41 | +if not args.keepAllProducts: |
| 42 | + outputs = ["drop *", |
| 43 | + "keep edmtestOtherThings_*_*_*"] |
| 44 | + if not args.dropThings: |
| 45 | + outputs.append("keep edmtestThings_*_*_*") |
| 46 | + |
| 47 | + |
| 48 | +from IOPool.Streamer.modules import EventStreamFileWriter |
| 49 | +process.o = EventStreamFileWriter(outputCommands = outputs, |
| 50 | + fileName = args.fileName |
| 51 | + ) |
| 52 | +if args.extraProducers: |
| 53 | + process.p = cms.Path(process.a+process.b+process.c*process.d) |
| 54 | +else: |
| 55 | + process.p = cms.Path(process.c*process.d) |
| 56 | + |
| 57 | +process.tester = OtherThingAnalyzer(other = ("d","testUserTag")) |
| 58 | + |
| 59 | +process.out = cms.EndPath(process.o+process.tester) |
0 commit comments