def runmaster(args,nClients): hd = hitdata() inith5(args) initHist('DropSize',100,0,2000) initHist('TOFhits',1000,-2,2) while nClients > 0: # Remove client if the run ended if hd.recv(): # print "end run called" nClients -= 1 else: # print "Calling plot?" plot(hd) comp = hd.myobj['comp'] size=(comp['drop']['a']+comp['drop']['b'])/2.0 pushToHist('DropSize',size) pushToHist('TOFhits',comp['tofsum']) writeh5(hd) closeh5()
def runmaster(args,nClients, mask): hd = hitdata() inith5(args) initHist('DropSize',50,500,2000) initHist('TOFhits',1000,-500,1000) initHist('IMGhits',1000,0,5000) bkgTOF = np.empty(10000) nTOF = 0 startTime = time.time() while nClients > 0: # Remove client if the run ended if hd.recv(): # print "end run called" nClients -= 1 bkgTOF += hd.myobj['tof'] nTOF = nTOF+hd.myobj['ntof'] else: # print "Calling plot?" if hd.myobj['diodeDrop']: print 'master detected drop' plotDDrop = Image(0,"Diode Drop Image",hd.myobj['img']) publish.send('DDROP',plotDDrop) continue comp = hd.myobj['comp'] size=(comp['drop']['a']+comp['drop']['b'])/2.0 plot(hd, args) pushToHist('DropSize',size) pushToHist('TOFhits',comp['tofsum']) pushToHist('IMGhits',comp['imgsum']) writeh5(hd) endTime = time.time() hitRate = nHits / (endTime - startTime) print('Hitrate = ', hitRate) closeh5(mask, bkgTOF/nTOF, hitRate)