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

Processing multiple root files #539

@ico1036

Description

@ico1036

What is the most efficient way to deal with multiple root files (~100G) in uproot3 and uproot4?
I cannot find tutorial about this.

I tried the lazy array but it takes a lot of time.

# PATH
dir_path = "/x4/cms/dylee/Delphes/data/root/signal/*/*.root"
file_list = glob.glob(dir_path)

# IO
cache = uproot.ArrayCache("2 GB")
events = uproot.lazyarrays(file_list, "Delphes", ['Electron*',"Muon*","Photon*","MissingET*"],cache=cache)

# Define Particle arrays
Electron = ak.zip(
    {
        "PT": events["Electron.PT"],
        "Eta": events["Electron.Eta"],
        "Phi": events["Electron.Phi"],
        "T": events["Electron.T"],
        "Charge": events["Electron.Charge"],
    }
)

Also, I tried the iterator but I'm not sure this loop-based method is efficient (https://github.com/JW-corp/J.W_Analysis/blob/main/Uproot/test/big_data.py)

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions