Skip to content

Instantly share code, notes, and snippets.

@simonspa
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonspa/ab43c39edef994caa91b to your computer and use it in GitHub Desktop.
Save simonspa/ab43c39edef994caa91b to your computer and use it in GitHub Desktop.
wbcScan
@arity(0,3,[int, int, int])
def do_wbcScan(self, minWBC = 90, maxWBC = 200, nTrigger = 50):
""" do_wbcScan [minWBC] [maxWBC] [nTrigger]: sets the values of wbc from minWBC until it finds the wbc which has more than 90% filled events or it reaches 255 (default minWBC 90)"""
self.api.daqTriggerSource("extern")
print "wbc \t#Events \texample Event"
wbcScan = []
for wbc in range (minWBC,maxWBC):
self.api.setDAC("wbc", wbc)
self.api.daqStart()
nEvents = 0
j = 0
while j < nTrigger:
try:
data = self.api.daqGetEvent()
if len(data.pixels) > 0:
nEvents += 1
j += 1
except RuntimeError:
pass
nEvents = 100*nEvents/nTrigger
wbcScan.append(nEvents)
print '{0:03d}'.format(wbc),"\t", '{0:3.0f}%'.format(nEvents),"\t\t"
self.api.daqStop()
def complete_wbcScan(self, text, line, start_index, end_index):
# return help for the cmd
return [self.do_wbcScan.__doc__, '']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment