parameters: (in_tfile, options, full_path='/')
docstring: Recursive function to find all contents in a given ROOT file
docstring_summary: Recursive function to find all contents in a given ROOT file
docstring_tokens: Recursive function to find all contents in a given ROOT file
function: def recurse_thru_file(in_tfile, options, full_path='/'):
      '''Recursive function to find all contents in a given ROOT file'''
      keys = in_tfile.GetDirectory(full_path).GetListOfKeys()
      for key in keys:
          name = key.GetName()
          classname = key.GetClassName()
          if 'TDirectory' in classname:
              gDirectory.cd(name)
              recurse_thru_file(in_tfile, options, '/'.join([full_path,name]))
              gDirectory.cd("..")
          else:
              if options.name and name != options.name: continue
              full_name = '/'.join([full_path,name])
              obj = in_tfile.Get(full_name)
              if not obj:
                  continue
              simple_name = full_name[2:]
              print("%s" % simple_name, end=' ')
              for arg in [x[2:] for x in sys.argv if x.startswith("--")]:
                  if "classname" == arg:
                      print("%s" % classname, end=' ')
                  if obj.InheritsFrom('TH1'):
                      if "entries" == arg:
                          print(" %i" % obj.GetEntries(), end=' ')
                      if "contents" == arg:
                          if obj.InheritsFrom('TH2'):
                              # Print contents as they would look on the 2D graph
                              # Left to right, top to bottom.  Start in upper left corner.
                              for j in reversed(list(range(obj.GetNbinsY()))):
                                  print()
                                  print(" %s" % ' '.join(
                                      [str(obj.GetBinContent(i+1, j+1)) for i in range(obj.GetNbinsX())]), end=' ')
                          else:
                              print(" %s" % ' '.join(
                                  [str(obj.GetBinContent(i+1)) for i in range(obj.GetNbinsX())]), end=' ')
                      if "errors" == arg:
                          if obj.InheritsFrom('TH2'):
                              for j in reversed(list(range(obj.GetNbinsY()))):
                                  print()
                                  print(" %s" % ' '.join(
                                      [str(obj.GetBinError(i+1, j+1)) for i in range(obj.GetNbinsX())]), end=' ')
                          else:
                              print(" %s" % ' '.join(
                                  [str(obj.GetBinError(i+1)) for i in range(obj.GetNbinsX())]), end=' ')
                      if "bincenter" == arg:
                          print(" %s" % ' '.join(
                              [str(obj.GetBinCenter(i+1)) for i in range(obj.GetNbinsX())]), end=' ')
                      if "max" == arg:
                          print(" %i" % obj.GetMaximum(), end=' ')
                      if "min" == arg:
                          print(" %i" % obj.GetMinimum(), end=' ')
                      if "overflow" == arg:
                          print(" %i" % obj.GetBinContent(obj.GetNbinsX()), end=' ')
                      if "underflow" == arg:
                          print(" %i" % obj.GetBinContent(0), end=' ')
                  if obj.InheritsFrom('TGraph'):
                      if "contents" == arg:
                          x, y = Double(0), Double(0)
                          xvals = []
                          yvals = []
                          for i in range(obj.GetN()):
                              obj.GetPoint(i, x, y)
                              xvals.append(copy.copy(x))
                              yvals.append(copy.copy(y))
                          for point in zip(xvals,yvals):
                              print(" (%d, %d)" % point, end=' ')
              print("")
function_tokens: def recurse_thru_file ( in_tfile , options , full_path = '/' ) : keys = in_tfile . GetDirectory ( full_path ) . GetListOfKeys ( ) for key in keys : name = key . GetName ( ) classname = key . GetClassName ( ) if 'TDirectory' in classname : gDirectory . cd ( name ) recurse_thru_file ( in_tfile , options , '/' . join ( [ full_path , name ] ) ) gDirectory . cd ( ".." ) else : if options . name and name != options . name : continue full_name = '/' . join ( [ full_path , name ] ) obj = in_tfile . Get ( full_name ) if not obj : continue simple_name = full_name [ 2 : ] print ( "%s" % simple_name , end = ' ' ) for arg in [ x [ 2 : ] for x in sys . argv if x . startswith ( "--" ) ] : if "classname" == arg : print ( "%s" % classname , end = ' ' ) if obj . InheritsFrom ( 'TH1' ) : if "entries" == arg : print ( " %i" % obj . GetEntries ( ) , end = ' ' ) if "contents" == arg : if obj . InheritsFrom ( 'TH2' ) : # Print contents as they would look on the 2D graph # Left to right, top to bottom.  Start in upper left corner. for j in reversed ( list ( range ( obj . GetNbinsY ( ) ) ) ) : print ( ) print ( " %s" % ' ' . join ( [ str ( obj . GetBinContent ( i + 1 , j + 1 ) ) for i in range ( obj . GetNbinsX ( ) ) ] ) , end = ' ' ) else : print ( " %s" % ' ' . join ( [ str ( obj . GetBinContent ( i + 1 ) ) for i in range ( obj . GetNbinsX ( ) ) ] ) , end = ' ' ) if "errors" == arg : if obj . InheritsFrom ( 'TH2' ) : for j in reversed ( list ( range ( obj . GetNbinsY ( ) ) ) ) : print ( ) print ( " %s" % ' ' . join ( [ str ( obj . GetBinError ( i + 1 , j + 1 ) ) for i in range ( obj . GetNbinsX ( ) ) ] ) , end = ' ' ) else : print ( " %s" % ' ' . join ( [ str ( obj . GetBinError ( i + 1 ) ) for i in range ( obj . GetNbinsX ( ) ) ] ) , end = ' ' ) if "bincenter" == arg : print ( " %s" % ' ' . join ( [ str ( obj . GetBinCenter ( i + 1 ) ) for i in range ( obj . GetNbinsX ( ) ) ] ) , end = ' ' ) if "max" == arg : print ( " %i" % obj . GetMaximum ( ) , end = ' ' ) if "min" == arg : print ( " %i" % obj . GetMinimum ( ) , end = ' ' ) if "overflow" == arg : print ( " %i" % obj . GetBinContent ( obj . GetNbinsX ( ) ) , end = ' ' ) if "underflow" == arg : print ( " %i" % obj . GetBinContent ( 0 ) , end = ' ' ) if obj . InheritsFrom ( 'TGraph' ) : if "contents" == arg : x , y = Double ( 0 ) , Double ( 0 ) xvals = [ ] yvals = [ ] for i in range ( obj . GetN ( ) ) : obj . GetPoint ( i , x , y ) xvals . append ( copy . copy ( x ) ) yvals . append ( copy . copy ( y ) ) for point in zip ( xvals , yvals ) : print ( " (%d, %d)" % point , end = ' ' ) print ( "" )