Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:11

0001 #! /usr/bin/env python
0002 
0003 from builtins import range
0004 import ROOT
0005 import sys
0006 from DataFormats.FWLite import Events, Handle
0007 events = Events (['avtester.root'])
0008 
0009 handle  = Handle ("edm::AssociationVector<edm::RefProd<std::vector<edmtest::Simple> >,std::vector<edmtest::Simple>,edm::Ref<std::vector<edmtest::Simple>,edmtest::Simple,edm::refhelper::FindUsingAdvance<std::vector<edmtest::Simple>,edmtest::Simple> >,unsigned int,edm::helper::AssociationIdenticalKeyReference>")
0010 
0011 label = ("tester","","TEST")
0012 
0013 
0014 # loop over events
0015 count= 0
0016 for event in events:
0017     #print "###################### ", count
0018     event.getByLabel (label, handle)
0019     cont = handle.product()
0020     values = [ cont.value(i).value for i in range(len(cont))]
0021     for i,v in enumerate(handle.product()):
0022       #print v.second.value, values[i]
0023       if v.second.value != values[i]:
0024         raise RuntimeError("Values do not match for event index:{0}  from data:{1} from ref:{2}".format(count, v.second.value,values[i]))
0025     count+=1