Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-01-12 23:41:56

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("--extraProducers", help="Add extra producers to configuration", action="store_true")
0009 parser.add_argument("--fileName", help="name of output file")
0010 parser.add_argument("--firstLumi", help="LuminosityBlock number for first lumi", type = int, default=1)
0011 parser.add_argument("--firstRun", help="LuminosityBlock number for first run", type = int, default=1)
0012 parser.add_argument("--keepAllProducts", help="Keep all products made in the job", action="store_true")
0013 parser.add_argument("--dropThings", help="drop the Things collections so the refs will not function", 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(firstRun = args.firstRun,
0023                                 firstLuminosityBlock = args.firstLumi,
0024                                 firstEvent = nEvents*(args.firstLumi-1)+1
0025 )
0026 
0027 process.maxEvents.input = nEvents
0028 
0029 if args.extraProducers:
0030     from FWCore.Framework.modules import IntProducer
0031     process.a = IntProducer(ivalue = 1)
0032 
0033     process.b = IntProducer(ivalue = 2)
0034 
0035 from FWCore.Integration.modules import ThingProducer, OtherThingProducer, OtherThingAnalyzer
0036 process.c = ThingProducer()
0037 
0038 process.d = OtherThingProducer(thingTag="c")
0039 
0040 outputs = []
0041 if not args.keepAllProducts:
0042     outputs = ["drop *",
0043                 "keep edmtestOtherThings_*_*_*"]
0044     if not args.dropThings:
0045         outputs.append("keep edmtestThings_*_*_*")
0046     
0047 
0048 from IOPool.Streamer.modules import EventStreamFileWriter
0049 process.o = EventStreamFileWriter(outputCommands = outputs,
0050                              fileName = args.fileName
0051                              )
0052 if args.extraProducers:
0053     process.p = cms.Path(process.a+process.b+process.c*process.d)
0054 else:
0055     process.p = cms.Path(process.c*process.d)
0056 
0057 process.tester = OtherThingAnalyzer(other = ("d","testUserTag"))
0058 
0059 process.out = cms.EndPath(process.o+process.tester)