Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

TChain like behavior? #347

Closed
HDembinski opened this issue Sep 27, 2019 · 5 comments
Closed

TChain like behavior? #347

HDembinski opened this issue Sep 27, 2019 · 5 comments

Comments

@HDembinski
Copy link
Member

tl;dr: It would be nice if the docs could elaborate a bit on how to best replace a TChain to process several files at once with uproot facilities. I found the note regarding lazyarrays, but I was wondering whether there is more.

I wanted to process several files in a TChain-like way with uproot. From the reading the docs it was not clear to me how achieve this. It seems like uproot.open can only open one file. I found the lazyarray(s), which are great, but I would still like to know whether TChain-like processing of several files is possible with uproot or not.

@HDembinski
Copy link
Member Author

Ok, now I have read the full tutorial. Basically, what I want is uproot.iterate. So all that is needed then is an additional sentence in that section of the tutorial, that uproot.iterate is the closest to TChain-like processing.

@HDembinski
Copy link
Member Author

If there is a sentence that mentions TChain explicitly, then the note can be found with ctrl+f

@jpivarski
Copy link
Member

Since the interface is array-at-a-time, rather than event-at-a-time, there isn't a direct analogue, but most users replace TChain with uproot.iterate.

The unbound functions in the uproot namespace (as opposed to the bound methods of TTree) can operate on lists and globs of files. None of them automatically concatenate across files (except, in a sense, lazyarrays) because branches and types can differ, but awkward.concatenate can do that.

@jpivarski
Copy link
Member

Good point. TODO: add a note about TChain in the readme.

@HDembinski
Copy link
Member Author

One thing I find difficult with uproot.iterate is that I cannot apply event-level cuts on tracks, because the information is lost which tracks belong to which event. I will open another issue about this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants