def runLoop( comp, outDir, config, options): fullName = '/'.join( [outDir, comp.name ] ) # import pdb; pdb.set_trace() config.components = [comp] loop = Looper( fullName, config, options.nevents, 0, nPrint = options.nprint, timeReport = options.timeReport, quiet = options.quiet) # print loop if options.iEvent is None: loop.loop() loop.write() # print loop else: # loop.InitOutput() iEvent = int(options.iEvent) loop.process( iEvent ) return loop
def runLoop( comp, outDir, config, options): fullName = '/'.join( [outDir, comp.name ] ) config.components = [comp] memcheck = 2 if getattr(options,'memCheck',False) else -1 loop = Looper( fullName, config, options.nevents, 0, nPrint = options.nprint, timeReport = options.timeReport, quiet = options.quiet, memCheckFromEvent = memcheck, stopFlag = _globalGracefulStopFlag) # print loop if options.iEvent is None: loop.loop() loop.write() # print loop else: # loop.InitOutput() iEvent = int(options.iEvent) loop.process( iEvent ) return loop
logging.basicConfig(level=logging.INFO) import random random.seed(0xdeadbeef) def process(iev=None): if iev is None: iev = loop.iEvent loop.process(iev) if display: display.draw() def next(): loop.process(loop.iEvent + 1) if display: display.draw() iev = None if len(sys.argv) == 2: iev = int(sys.argv[1]) loop = Looper('looper', config, nEvents=500, nPrint=5, timeReport=True) pfsim = loop.analyzers[1] display = getattr(pfsim, 'display', None) simulator = pfsim.simulator detector = simulator.detector if iev is not None: process(iev) else: loop.loop() loop.write()
if s.skip.value() == False: inputSamples.append(inputSample) #finalization of the configuration object. from PhysicsTools.HeppyCore.framework.chain import Chain as Events config = cfg.Config( #Run across these inputs components = inputSamples, #Using this sequence sequence = sequence, #save output to these services services = [output_service], #This defines how events are loaded events_class = Events ) from PhysicsTools.HeppyCore.framework.looper import Looper looper = Looper('Loop', config, nPrint = 0, firstEvent=firstEvent, nEvents = nEvents ) looper.loop() looper.write()
puFileDataMinus="puDataMinus.root", splitFactor=5) sample.isMC = True # the following is declared in case this cfg is used in input to the heppy.py script selectedComponents = [sample] from PhysicsTools.HeppyCore.framework.eventsfwlite import Events config = cfg.Config(components=selectedComponents, sequence=sequence, services=[output_service], events_class=Events) class TestFilter(logging.Filter): def filter(self, record): print record # and the following runs the process directly if __name__ == '__main__': from PhysicsTools.HeppyCore.framework.looper import Looper looper = Looper('Loop', config, nPrint=1, nEvents=1000) import time import cProfile p = cProfile.Profile(time.clock) p.runcall(looper.loop) p.print_stats() looper.write()
def process(iev=None): if iev is None: iev = loop.iEvent loop.process(iev) if display: display.draw() def next(): loop.process(loop.iEvent+1) if display: display.draw() iev = None if len(sys.argv)==2: iev = int(sys.argv[1]) loop = Looper( 'looper', config, nEvents=500, nPrint=5, timeReport=True) pfsim = loop.analyzers[1] display = getattr(pfsim, 'display', None) simulator = pfsim.simulator detector = simulator.detector if iev is not None: process(iev) else: loop.loop() loop.write()