Ejemplo n.º 1
0
    def __call__(self):
        if len(self.config.inputPaths) != 1:
            # TODO - support multiple inputPaths
            raise AttributeError("Multiple inputPaths not yet supported")

        # Try to open the tree - some machines have configured limitations
        # which prevent memmaps from begin created. Use a fallback - the
        # localsource option
        try:
            rootfile = uproot.open(self.config.inputPaths[0])
            tree = rootfile[self.config.treeName]
        except mmap.error:
            def localsource(path):
                return uproot.FileSource(path, **uproot.FileSource.defaults)
            rootfile = uproot.open(
                self.config.inputPaths[0],
                localsource = lambda p: uproot.FileSource(p, **uproot.FileSource.defaults),
            )
            tree = rootfile [self.config.treeName]

        events = BEvents(
            tree, self.config.nevents_per_block, self.config.start_block,
            self.config.stop_block, branch_cache=self.config.branch_cache,
        )
        events.config = self.config
        return events
Ejemplo n.º 2
0
 def localsource(path):
     return uproot.FileSource(path, **opts)
Ejemplo n.º 3
0
 def localsource(path):
     return uproot.FileSource(path, **uproot.FileSource.defaults)
Ejemplo n.º 4
0
 def OpenFile(self, path):
     return uproot.open(path,
                        localsource=lambda f: uproot.FileSource(
                            f, chunkbytes=8 * 1024, limitbytes=1024**2))