Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-31 04:19:32

0001 import FWCore.ParameterSet.Config as cms
0002 from argparse import ArgumentParser
0003 
0004 parser = ArgumentParser(description='Test GlobalEvFOutputModule')
0005 parser.add_argument("--numEvents", help="number of events to process", type=int, default=10)
0006 parser.add_argument("--startEvent", help="start event number", type=int, default=1)
0007 parser.add_argument("--runNumber", help="run number to use", type=int, default=100101)
0008 parser.add_argument("--numThreads", help="number of threads to use", type=int, default=3)
0009 parser.add_argument("--numFwkStreams", help="number of cmsRun streams", type=int, default=2)
0010 parser.add_argument("--changeBranchIDLists", help="modify the branchIDLists", type=bool, default=False)
0011 
0012 parser.add_argument("--buBaseDir", help="BU base directory", type=str, default="ramdisk")
0013 parser.add_argument("--fuBaseDir", help="FU base directory", type=str, default="data")
0014 parser.add_argument("--fffBaseDir", help="FFF base directory", type=str, default=".")
0015 
0016 args = parser.parse_args()
0017 
0018 #try to create 'ramdisk' directory
0019 try:
0020     os.makedirs(args.fffBaseDir+"/"+args.buBaseDir+"/run"+str(args.runNumber).zfill(6))
0021 except:pass
0022 #try to create 'data' directory
0023 try:
0024   os.makedirs(args.fffBaseDir+"/"+args.fuBaseDir+"/run"+str(args.runNumber).zfill(6))
0025 except Exception as ex:
0026   print(str(ex))
0027   pass
0028 
0029 
0030 process = cms.Process("WRITE")
0031 
0032 process.source = cms.Source("EmptySource",
0033                             firstRun=cms.untracked.uint32(args.runNumber),
0034                             firstEvent=cms.untracked.uint32(args.startEvent)
0035 )
0036 
0037 if args.numEvents != 0:
0038     process.maxEvents.input = args.numEvents
0039 else:
0040     process.maxEvents.input = 1
0041 
0042 process.options = dict(numberOfThreads = args.numThreads,
0043                        numberOfStreams = args.numFwkStreams)
0044 
0045 process.intprod = cms.EDProducer("BranchIDListsModifierProducer",
0046                                  makeExtraProduct=cms.untracked.bool(args.changeBranchIDLists))
0047 
0048 process.thing = cms.EDProducer("ThingProducer")
0049 
0050 process.otherThing = cms.EDProducer("OtherThingProducer",
0051                                    thingTag=cms.InputTag("thing"))
0052 
0053 process.t = cms.Task(
0054     process.intprod,
0055     process.thing,
0056     process.otherThing
0057 )
0058 
0059 
0060 process.filter = cms.EDFilter("PrescaleEventFilter", offset = cms.uint32(0), prescale=cms.uint32(1))
0061 if args.numEvents == 0:
0062     process.filter.offset = 2
0063     process.filter.prescale = 4
0064 process.p = cms.Path(process.filter)
0065 
0066 process.streamA = cms.OutputModule("GlobalEvFOutputModule",
0067                                    SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring("p")),
0068                                    outputCommands = cms.untracked.vstring("keep *")
0069 )
0070 
0071 process.ep = cms.EndPath(process.streamA, process.t)
0072 
0073 process.EvFDaqDirector = cms.Service("EvFDaqDirector",
0074     useFileBroker = cms.untracked.bool(False),
0075     fileBrokerHostFromCfg = cms.untracked.bool(True),
0076     fileBrokerHost = cms.untracked.string("htcp40.cern.ch"),
0077     runNumber = cms.untracked.uint32(args.runNumber),
0078     baseDir = cms.untracked.string(args.fffBaseDir+"/"+args.fuBaseDir),
0079     buBaseDir = cms.untracked.string(args.fffBaseDir+"/"+args.buBaseDir),
0080     directorIsBU = cms.untracked.bool(False),
0081 )
0082 
0083 process.FastMonitoringService = cms.Service("FastMonitoringService",
0084     sleepTime = cms.untracked.int32(1)
0085 )