ATLAS Offline Software
Loading...
Searching...
No Matches
dump-event-from-file.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2
3# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
4
5""" Dump a pythonized version of the event content using RootFileDumper.
6 The main logic is similar to what's being done in diff-root.
7 Therefore, this can be used in conjunction w/ diff-root for further
8 debugging. """
9def dumpEvent(fname, idx):
10 # import ROOT via RootUtils
11 import PyUtils.RootUtils as ru
12 ru.import_root()
13
14 # file dumper: file, tree
15 data = ru.RootFileDumper(fname, "CollectionTree")
16
17 # iterator: tree, idx
18 values = data.dump("CollectionTree", [int(idx)])
19
20 # loop over the iterator and print the values
21 try:
22 while True:
23 val = next(values)
24 print(val)
25 except StopIteration:
26 pass
27
28if __name__ == "__main__":
29 import sys
30 if len(sys.argv)!=3:
31 print("dump-event-from-file.py: A script to dump event information from a file")
32 print("Usage:")
33 print(f"{sys.argv[0]} <file> <TTree index of the event>")
34 else:
35 dumpEvent(sys.argv[1], sys.argv[2])
void print(char *figname, TCanvas *c1)