@@ -0,0 +1,2029 @@
+#!/usr/bin/env python%0A# Tai Sakuma %3Ctai.sakuma@cern.ch%3E%0A%0A##__________________________________________________________________%7C%7C%0Aimport array%0Aimport ROOT%0A%0A##__________________________________________________________________%7C%7C%0AinputPath = '/Users/sakuma/work/cms/c150130_RA1_data/c150130_01_PHYS14/20150331_SingleMu/TTJets/treeProducerSusyAlphaT/tree.root'%0AtreeName = 'tree'%0A%0A##__________________________________________________________________%7C%7C%0Adef IsROOTNullPointer(tobject):%0A    try:%0A        tobject.GetName()%0A        return False%0A    except ReferenceError:%0A        return True%0A%0A##__________________________________________________________________%7C%7C%0A# https://root.cern.ch/root/html/Rtypes.h%0A# https://docs.python.org/2/library/array.html%0Atypedic = dict(%0A    Double_t = 'd',%0A    Int_t = 'i',%0A    )%0A%0A##__________________________________________________________________%7C%7C%0AinputFile = ROOT.TFile.Open(inputPath)%0Atree = inputFile.Get(treeName)%0A%0Aresults = %5B %5D%0Aresults.append(('name', 'ROOTtype', 'arraytype', 'isarray', 'countname', 'countROOTtype', 'countarraytype', 'countmax'))%0A%0Afor leaf in tree.GetListOfLeaves():%0A    leafcount = leaf.GetLeafCount()%0A    isArray = not IsROOTNullPointer(leafcount)%0A    row = %5B %5D%0A    row.append(leaf.GetName())%0A    row.append(leaf.GetTypeName())%0A    row.append(typedic%5Bleaf.GetTypeName()%5D)%0A    row.append('yes ' if isArray else 'no')%0A    row.append(leafcount.GetName() if isArray else None)%0A    row.append(leafcount.GetTypeName() if isArray else None)%0A    row.append(typedic%5Bleafcount.GetTypeName()%5D if isArray else None)%0A    row.append(leafcount.GetMaximum() if isArray else None)%0A    results.append(row)%0A%0Atransposed = %5B%5Br%5Bi%5D for r in results%5D for i in range(len(results%5B0%5D))%5D%0Atransposed = %5B%5Bstr(e) for e in r%5D for r in transposed%5D%0AcolumnWidths = %5Bmax(%5Blen(e) for e in r%5D) for r in transposed%5D%0Aformat = %22 %7B:%3E%22 + %22s%7D %7B:%3E%22.join(%5Bstr(e) for e in columnWidths%5D) + %22s%7D%22%0Afor row in zip(*transposed):%0A    print format.format(*row)%0A%0A##__________________________________________________________________%7C%7C%0A

add inspect_tree.py in examples/ROOT