18def EventLoop(tree, outputhistfile, nDarkPhotons):
19
21 nBadOnes = 0
22 nEvents = tree.GetEntries()
23
24
25 toolbar_width = 50
26 sys.stdout.write("Process: [%s]" % (" " * toolbar_width))
27 sys.stdout.flush()
28 sys.stdout.write("\b" * (toolbar_width+1))
29
30 nEvents = tree.GetEntries()
31 nEventsForUpdate = int(nEvents/toolbar_width)
32
33 for (nevent,event) in enumerate(tree):
34 if (nevent %nEventsForUpdate) == 0:
35 sys.stdout.write('#')
36 sys.stdout.flush()
37 pass
38 if not eventanalyzer.processEvent(event):
39 nBadOnes += 1
40 pass
41 pass
42
43 sys.stdout.write("\n")
44
45 print 'Total events:', nEvents
46 print 'Total bad events:', nBadOnes
47
48 eventanalyzer.finalize()
49
50