original_docstring: Returns the maximum value of all bins of all histograms or graphs
      provided, including any errors.
  
      Args:
          drawables: An iterable of drawable objects, each of one of the
              following types:
  
              - A TH1 object
              - A THStack object
              - A tuple of the form (THStack, TGraph) where the latter
                represents error bars
              - A TGraph object
  
      Returns:
          The maximum value than any bin takes on in any of the provided
          drawables.
      
docstring: Returns the maximum value of all bins of all histograms or graphs
  provided, including any errors.
docstring_tokens: Returns the maximum value of all bins of all histograms or graphs provided including any errors .
code: def maximum_value(drawables):
      """Returns the maximum value of all bins of all histograms or graphs
      provided, including any errors.
  
      Args:
          drawables: An iterable of drawable objects, each of one of the
              following types:
  
              - A TH1 object
              - A THStack object
              - A tuple of the form (THStack, TGraph) where the latter
                represents error bars
              - A TGraph object
  
      Returns:
          The maximum value than any bin takes on in any of the provided
          drawables.
      """
      # Create our initial maximum
      result = 0.0
  
      # Loop over histograms
      for drawable in drawables:
          # Unpack things if there is an error band
          if isinstance(drawable, tuple):
              drawable, error_band = drawable
          else:
              error_band = None
  
          # Compute the maximum for this drawable
          if is_histo(drawable) or is_stack(drawable):
              maximum = drawable.GetMaximum()
              #print 'histo max:', maximum
              #print 'min:' , drawable.GetMinimum(0)
          elif is_graph(drawable):
              # http://root.cern.ch/phpBB3/viewtopic.php?t=9070
              maximum = TMath.MaxElement(drawable.GetN(), drawable.GetY())
          elif is_line(drawable):
              maximum = max(drawable.GetY1(), drawable.GetY2())
          else:
              raise ValueError('unsupported drawable type')
  
          # NOTE: Clever math hack.  Since drawable may be a THStack, we can't
          # (easily) do a bin-wise pairing and compute (value + error-high) for
          # each bin when looking for a maximum.  However, the bin which has the
          # maximum value will also have the maximum statistical and systematic
          # normalization uncertainty, so we can assume that the value returned
          # by GetMaximum() corresponds to the bin with the greatest error, and
          # thus we can just scan for the largest error and adding that to the
          # GetMaximum() result gives the answer we would get from bin-wise
          # pairing.  Of course, even if we didn't get the exact answer here,
          # we'd still be at-or-above the true maximum value, which is all we
          # really care about for plotting purposes.
          # If there is no error band, we just add enough room for statistical
          # error.
          if error_band is not None:
              maximum_error = 0.0
              for i in xrange(error_band.GetN()):
                  maximum_error = max(maximum_error, error_band.GetErrorYhigh(i))
              maximum += maximum_error
          else:
              # WJF: messes up plot when errors are small 
              #print maximum
              #maximum += sqrt(maximum)
              pass
  
          # Update the result
          result = max(result, maximum)
  
      return result
code_tokens: def maximum_value ( drawables ) : result = 0.0 for drawable in drawables : if isinstance ( drawable , tuple ) : drawable , error_band = drawable else : error_band = None if is_histo ( drawable ) or is_stack ( drawable ) : maximum = drawable . GetMaximum ( ) elif is_graph ( drawable ) : maximum = TMath . MaxElement ( drawable . GetN ( ) , drawable . GetY ( ) ) elif is_line ( drawable ) : maximum = max ( drawable . GetY1 ( ) , drawable . GetY2 ( ) ) else : raise ValueError ( 'unsupported drawable type' ) if error_band is not None : maximum_error = 0.0 for i in xrange ( error_band . GetN ( ) ) : maximum_error = max ( maximum_error , error_band . GetErrorYhigh ( i ) ) maximum += maximum_error else : pass result = max ( result , maximum ) return result
short_docstring: Returns the maximum value of all bins of all histograms or graphs
  provided, including any errors.
short_docstring_tokens: Returns the maximum value of all bins of all histograms or graphs provided including any errors .
comment: """Returns the maximum value of all bins of all histograms or graphs
      provided, including any errors.
  
      Args:
          drawables: An iterable of drawable objects, each of one of the
              following types:
  
              - A TH1 object
              - A THStack object
              - A tuple of the form (THStack, TGraph) where the latter
                represents error bars
              - A TGraph object
  
      Returns:
          The maximum value than any bin takes on in any of the provided
          drawables.
      """$SEP$# Create our initial maximum$SEP$# Loop over histograms$SEP$# Unpack things if there is an error band$SEP$# Compute the maximum for this drawable$SEP$#print 'histo max:', maximum$SEP$#print 'min:' , drawable.GetMinimum(0)$SEP$# http://root.cern.ch/phpBB3/viewtopic.php?t=9070$SEP$# NOTE: Clever math hack.  Since drawable may be a THStack, we can't$SEP$# (easily) do a bin-wise pairing and compute (value + error-high) for$SEP$# each bin when looking for a maximum.  However, the bin which has the$SEP$# maximum value will also have the maximum statistical and systematic$SEP$# normalization uncertainty, so we can assume that the value returned$SEP$# by GetMaximum() corresponds to the bin with the greatest error, and$SEP$# thus we can just scan for the largest error and adding that to the$SEP$# GetMaximum() result gives the answer we would get from bin-wise$SEP$# pairing.  Of course, even if we didn't get the exact answer here,$SEP$# we'd still be at-or-above the true maximum value, which is all we$SEP$# really care about for plotting purposes.$SEP$# If there is no error band, we just add enough room for statistical$SEP$# error.$SEP$# WJF: messes up plot when errors are small $SEP$#print maximum$SEP$#maximum += sqrt(maximum)$SEP$# Update the result