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