ATLAS Offline Software
Functions | Variables
python.scripts.dump_root_file Namespace Reference

Functions

def main (args)
 

Variables

 __doc__
 
 __author__
 
 name
 
 help
 
 default
 
 action
 

Function Documentation

◆ main()

def python.scripts.dump_root_file.main (   args)
dump the content of a ROOT file into an ASCII format.

Definition at line 36 of file dump_root_file.py.

36 def main(args):
37  """dump the content of a ROOT file into an ASCII format.
38  """
39 
40  import PyUtils.RootUtils as ru
41  root = ru.import_root()
42 
43  _inspect = root.RootUtils.PyROOTInspector.pyroot_inspect2 # noqa: F841
44 
45  import PyUtils.Logging as L
46  msg = L.logging.getLogger('dump-root')
47  msg.setLevel(L.logging.INFO)
48 
49  msg.info('fname: [%s]', args.fname)
50  root_file = root.TFile.Open(args.fname)
51  if (root_file is None or
52  not isinstance(root_file, root.TFile) or not root_file.IsOpen()):
53  msg.error('could not open [%s]', args.fname)
54  return 1
55 
56  tree_names = []
57  if args.tree_name:
58  tree_names = args.tree_name.split(',')
59  else:
60  tree_names = []
61  keys = [k.GetName() for k in root_file.GetListOfKeys()]
62  for k in keys:
63  o = root_file.Get(k)
64  if isinstance(o, root.TTree):
65  tree_names.append(k)
66 
67  msg.info('dumping trees: %s', tree_names)
68 
69  for tree_name in tree_names:
70  f = ru.RootFileDumper(args.fname, tree_name)
71  nentries = f.tree.GetEntries()
72  if args.entries:
73  nentries = args.entries
74  for d in f.dump(tree_name, nentries):
75  tree_name, ientry, name, data = d
76  n = '.'.join(map(str, [tree_name,"%03i"%ientry]+name))
77  print ('%s %r' %(n, data))
78  return 0

Variable Documentation

◆ __author__

python.scripts.dump_root_file.__author__
private

Definition at line 11 of file dump_root_file.py.

◆ __doc__

python.scripts.dump_root_file.__doc__
private

Definition at line 10 of file dump_root_file.py.

◆ action

python.scripts.dump_root_file.action

Definition at line 33 of file dump_root_file.py.

◆ default

python.scripts.dump_root_file.default

Definition at line 21 of file dump_root_file.py.

◆ help

python.scripts.dump_root_file.help

Definition at line 19 of file dump_root_file.py.

◆ name

python.scripts.dump_root_file.name

Definition at line 17 of file dump_root_file.py.

python.scripts.dump_root_file.main
def main(args)
Definition: dump_root_file.py:36
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10