ATLAS Offline Software
Loading...
Searching...
No Matches
ReadHiveDataObjs.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3import ROOT
4
5file = ROOT.TFile.Open("myExampleStream.pool.root")
6
7# CollectionTree is the default TTree name for Event Data
8tree = file.Get("CollectionTree")
9tree.GetEntry(0)
10
11# Find the branches containing HiveDataObj
12brNames = [
13 b.GetName()
14 for b in tree.GetListOfBranches()
15 if b.GetName().startswith("HiveDataObj")
16]
17
18print(" ---- ".join([" Event"] + [name[12:] for name in brNames]))
19# Loop over all rows (events) - get objects from the HiveDataObj branches with "getattr(tree,b)"
20lineformat = "{:>8}" * (len(brNames) + 1)
21for evt in range(tree.GetEntries()):
22 tree.GetEntry(evt)
23 print(lineformat.format(evt + 1, *[getattr(tree, b).val() for b in brNames]))
void print(char *figname, TCanvas *c1)