Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:49:52

0001 #! /usr/bin/env python3
0002 
0003 from __future__ import print_function
0004 from builtins import range
0005 from DataFormats.FWLite import Events, Handle
0006 import optparse
0007 
0008 print("starting python test")
0009 
0010 files = ['empty_a.root', 'good_a.root', 'empty_a.root', 'good_b.root']
0011 events = Events (files)
0012 
0013 thingHandle = Handle ('std::vector<edmtest::Thing>')
0014 indicies = events.fileIndicies()
0015 for event in events:
0016     newIndicies = event.fileIndicies()
0017     if indicies != newIndicies:
0018         print("new file")
0019     indicies = newIndicies
0020     event.getByLabel ('Thing', thingHandle)
0021     thing = thingHandle.product()
0022     for loop in range (thing.size()):
0023         print(thing.at (loop).a)
0024 
0025 events.toBegin()
0026 
0027 for event in events:
0028     pass
0029 
0030 events.toBegin()
0031 
0032 for event in events:
0033     event.getByLabel ('Thing', thingHandle)
0034     thing = thingHandle.product()
0035     for loop in range (thing.size()):
0036         print(thing.at (loop).a)
0037 
0038 for i in range(events.size()):
0039     if not events.to(i):
0040         print("failed to go to index ",i)
0041         exit(1)
0042 
0043 print("Python test succeeded!")
0044