Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This example shows how one uses "idx" (or "index") mode to iterate over events randomly and learn the total number of events in a run:

Code Block
from psana import *
ds = DataSource('exp=xpptut15:run=54:idx')
run = ds.runs().next()
times = run.times()
print 'Found',len(times),'events in run'
for nevt,t in enumerate(times):
    evt = run.event(t)
    if nevt==2: break

Note that for technical reasons the number of events in a run can be different in idx and the more-common smd mode.