def _get_next_events(self, material):
        """Get next events from Genie ROOT file

        Looks over the generator"""

        f = ROOT.TFile(self.filenames[material])
        try:
            t = f.Get('gst')
            n = t.GetEntries()
        except:
            self.log.critical('Could not open the ROOT file with Genie events')
            raise

        for i in range(n):
            t.GetEntry(i)
            next_events = []

            position = convert_3vector_to_dict([self.particle['position']['x'].get_cache(),
                                                self.particle['position']['y'].get_cache(),
                                                self.particle['position']['z'].get_cache()])

            lepton_event = {}
            if t.El ** 2 - (t.pxl ** 2 + t.pyl ** 2 + t.pzl ** 2) < 1e-7:
                lepton_event['pid'] = self.particle[
                                      'pid'].get()  # Either NC or ES
            else:
                lepton_event['pid'] = lookup_cc_partner(
                    self.particle['pid'].get())

            # units: GeV -> MeV
            momentum_vector = [1000 * x for x in [t.pxl, t.pyl, t.pzl]]

            lepton_event['momentum'] = convert_3vector_to_dict(momentum_vector)

            lepton_event['position'] = position

            next_events.append(lepton_event)

            for j in range(t.nf):  # nf, number final hadronic states
                hadron_event = {}
                hadron_event['pid'] = t.pdgf[j]
                hadron_event['position'] = position

                # units: GeV -> MeV
                momentum_vector = [1000 * x for x in [t.pxf[j], t.pyf[j], t.pzf[j]]]

                hadron_event['momentum'] = convert_3vector_to_dict(momentum_vector)

                next_events.append(hadron_event)

            event_type = {}

            event_type['vertex'] = position

            to_save = {} # maps our names to Genie gst names
            to_save['incoming_neutrino'] = 'neu'
            to_save['neutrino_energy'] = 'Ev'
            to_save['target_material'] = 'tgt'

            for key, value in to_save.iteritems():
                self.log.info('%s : %s' % (key, str(t.__getattr__(value))))
                event_type[key] = t.__getattr__(value)

            self.log.debug('Event type:')
            for my_type in ['qel', 'res', 'dis', 'coh', 'dfr',
                            'imd', 'nuel', 'em']:
                if t.__getattr__(my_type) == 1:
                    self.log.debug('\t%s', my_type)
                event_type[my_type] = t.__getattr__(my_type)

            self.log.debug('Propogator:')
            for prop in ['nc', 'cc']:
                if t.__getattr__(prop) == 1:
                    self.log.debug('\t%s', prop)
                event_type[prop] = t.__getattr__(prop)

            yield next_events, event_type

        f.Close()
        os.remove(self.filenames[material])
Get next events from Genie ROOT file

        Looks over the generator