#!/usr/bin/env python # Quick example of how to use numpy together with aanet import numpy from ROOT import * from aa import aanumpy import aa f = EventFile("../data/mc5.1.numuCC.ps10.aa.root") for evt in f : print evt # The following function turns a c++ vector into a structured numpy # array. ROOT RTTI is used to give the fields of the vector their names hits = aanumpy.npfy( evt.hits ) # turn hits vector into numpy array (no copying) print '-- hits --' print hits print '-- hit times --' print hits.t print ' mean tot ', numpy.mean( hits.tot ) break # one event is enough aa.i() # interactive