12 if 'DISPLAY' in os.environ:
 
   13     del os.environ[
'DISPLAY']
 
   14 os.environ[
'TERM'] = 
'dumb' 
   24 cppyy.load_library(
'libAtlasSTLAddReflexDict')
 
   25 ROOT.TClass(
'vector<float>')
 
   26 ROOT.TClass(
'vector<vector<unsigned int> >')
 
   27 from ordereddict 
import OrderedDict
 
   31 ROOT.D3PDTest.MapDumper
 
   34     if type(o).__name__ 
in [
'map<string,string>',
 
   37         keys = ROOT.D3PDTest.MapDumper.keys (o)
 
   38         values = ROOT.D3PDTest.MapDumper.values (o)
 
   39         return OrderedDict (sorted (zip (keys, values), key=
lambda t: t[0]))
 
   40     if (
type(o).__name__.startswith (
'vector<char') 
or 
   41         type(o).__name__.startswith (
'vector<unsigned char')):
 
   43         lens = [len(x) 
for x 
in ll]
 
   44         if lens 
and min(lens) == 1 
and max(lens) == 1:
 
   45             ll = [ord(x) 
for x 
in ll]
 
   47     if type(o).__name__.startswith (
'vector<'):
 
   48         return [
topy(x) 
for x 
in o]
 
   49     if type(o).__name__ 
in [
'PyFloatBuffer',
 
   56     if len(l) == 0: 
return True 
   57     for i 
in range(1, len(l)):
 
   58         if l[i] != l[0]: 
return False 
   71     if not isinstance(l, list):
 
   73     return '[' + 
','.
join(l) + 
']' 
   80         if i < len(l)-1 
and l[i] == l[i+1]:
 
   81             if nextfrag: frags.append(nextfrag)
 
   84             while j < len(l) 
and l[i] == l[j]:
 
   86             frags.append (
'%d*[%s]' % (j-i, l[i]))
 
   98             nextfrag.append (l[i])
 
  100     if nextfrag: frags.append (nextfrag)
 
  102     return '+'.join (frags)
 
  107     if isinstance(o, list):
 
  108         l = [
tostr(x) 
for x 
in o]
 
  111         return '[' + 
', '.join (l) + 
']' 
  112     if isinstance(o, str):
 
  116     if s.endswith (
'.0'): s = s[:-2]
 
  122     while i < len(s1) 
and i < len(s2) 
and s1[i] == s2[i]:
 
  129     for (i,b) 
in enumerate(blist):
 
  134         comm1 = common_length (lasttag, b)
 
  135         comm2 = common_length (b, b2)
 
  137             if comm1 != len(lasttag):
 
  138                 while comm1 > 0 
and b[comm1-1] != 
'_':
 
  140                 if b[:comm1] != lasttag:
 
  142                     out.append (
':' + lasttag) 
 
  144             while comm2 > 0 
and b[comm2-1] != 
'_':
 
  146             if b[:comm2] != lasttag:
 
  148                 out.append (
':' + lasttag)
 
  150         nm = b[len(lasttag):]
 
  151         if len(nm) == 0: nm = 
'$' 
  159     if tt.GetName().startswith (
'dum_') 
and n > 10000000:
 
  160         print (
'[Dummy tree skipped]')
 
  162     bb = [b.GetName() 
for b 
in tt.GetListOfBranches()]
 
  165         bb = merge_names (bb)
 
  167         print (
'-----------')
 
  178             br = tt.GetBranch(bname)
 
  182                 data.append (topy (getattr(tt, bname)))
 
  183             print (b, tostr (data))
 
  188             print (
'-----------')
 
  190                 print (b, tostr (topy (getattr (tt, b))))
 
  195     print (
'bins: ', [h.GetBinContent(i) 
for i 
in range(h.GetSize())])
 
  197         print (
'errs: ', [h.GetBinError(i) 
for i 
in range(h.GetSize())])
 
  204     kk = [k.GetName() 
for k 
in f.GetListOfKeys()]
 
  210         elif isinstance (o, ROOT.TTree):
 
  211             print (
'\n\n\nTree', pref+k)
 
  212             dumptree (o, by_branch)
 
  213         elif isinstance (o, ROOT.TH1):
 
  214             print (
'\n\n\nTH1', pref+k)
 
  216         elif isinstance (o, ROOT.TDirectory):
 
  217             dumpdir (o, by_branch, pref + k + 
'/')
 
  218         elif isinstance (o, ROOT.TObjString):
 
  219             print (
'\n\n\nString', pref+k)
 
  221                 print (
'[pickle data skipped]')
 
  224             print (
'__END_OF_STRING__')
 
  226             print (
'\n\n\nKey', pref+k)
 
  234     dumpdir (f, by_branch=by_branch)
 
  238 if __name__ == 
'__main__':
 
  242     if len(sys.argv) > 1 
and sys.argv[1] == 
'--by-branch':
 
  245     if len(sys.argv) > 1:
 
  247     dumpit (file, by_branch)