1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#! /usr/bin/env python3
from builtins import range
from DataFormats.FWLite import Events, Handle
print("starting python test")
files = ['empty_a.root', 'good_a.root', 'empty_a.root', 'good_b.root']
events = Events (files)
thingHandle = Handle ('std::vector<edmtest::Thing>')
indicies = events.fileIndicies()
for event in events:
newIndicies = event.fileIndicies()
if indicies != newIndicies:
print("new file")
indicies = newIndicies
event.getByLabel ('Thing', thingHandle)
thing = thingHandle.product()
for loop in range (thing.size()):
print(thing.at (loop).a)
events.toBegin()
for event in events:
pass
events.toBegin()
for event in events:
event.getByLabel ('Thing', thingHandle)
thing = thingHandle.product()
for loop in range (thing.size()):
print(thing.at (loop).a)
for i in range(events.size()):
if not events.to(i):
print("failed to go to index ",i)
exit(1)
print("Python test succeeded!")
|