00001
00002 '''
00003 A simple looper to test external looping
00004
00005 nuwa.py -E ExternalLooper.Test ....
00006
00007 eg:
00008
00009 nuwa.py -E EventLooper.Test --raw-load=both --no-history -n 10 -m Quickstart.PrintRawData file.data
00010 '''
00011
00012 def start(app):
00013 'Start the test looper'
00014 import time, ROOT
00015
00016 canvas = ROOT.TCanvas('canvas','gaussian')
00017 hist = ROOT.TH1D("gaussian","gaussian",200,-10,10)
00018
00019 from DybPython.Control import nuwa
00020 ind = nuwa.opts.executions
00021 while ind:
00022 ind -= 1
00023 print 'executingRun(1)',ind
00024 app.run(1)
00025
00026 hist.FillRandom("gaus")
00027 hist.Draw()
00028 canvas.Modified()
00029 canvas.Update()
00030
00031 evt = app.evtsvc()
00032 rs = evt['/Event/RegistrationSequence']
00033 print 'Found %d registered HeaderObjects'%rs.size()
00034 rslist = rs.registrations()
00035 for irs in range(rs.size()):
00036 print rslist[irs]
00037
00038 print 'Z' + ind*'z'
00039 time.sleep(1)
00040 continue