original_docstring: Plots a collection of plottables to the main plot pad.  All TH1
          objects are drawn with error bars.  THStack elements are only drawn
          with an error band if one is provided.
  
          This method may only be called once
  
          Args:
              drawables_options: Each argument of this function must be of the
                  form (object, options), where object is one of the following:
  
                  - A TH1 object
                  - A THStack object
                  - A tuple of the form (THStack, TGraph) where the latter
                    represents error bars
                  - A TGraph object
                  - A TLine object
  
                  and options is a string which will be used for the options
                  argument of the object's Draw method.  Plottables will be
                  rendered in the order provided.  Axes drawing options (e.g.
                  'a' or 'same' should not be provided and will be set
                  automatically).  A TLine may not be the first drawable element.
          
docstring: Plots a collection of plottables to the main plot pad.  All TH1
  objects are drawn with error bars.  THStack elements are only drawn
  with an error band if one is provided.
  
  This method may only be called once
docstring_tokens: Plots a collection of plottables to the main plot pad . All TH1 objects are drawn with error bars . THStack elements are only drawn with an error band if one is provided . This method may only be called once
code: def draw(self, *drawables_options):
          """Plots a collection of plottables to the main plot pad.  All TH1
          objects are drawn with error bars.  THStack elements are only drawn
          with an error band if one is provided.
  
          This method may only be called once
  
          Args:
              drawables_options: Each argument of this function must be of the
                  form (object, options), where object is one of the following:
  
                  - A TH1 object
                  - A THStack object
                  - A tuple of the form (THStack, TGraph) where the latter
                    represents error bars
                  - A TGraph object
                  - A TLine object
  
                  and options is a string which will be used for the options
                  argument of the object's Draw method.  Plottables will be
                  rendered in the order provided.  Axes drawing options (e.g.
                  'a' or 'same' should not be provided and will be set
                  automatically).  A TLine may not be the first drawable element.
          """
          # Make sure there are drawables
          if len(drawables_options) == 0:
              raise ValueError('must provide at least one plottable')
  
          # Check if we've already drawn
          if self._drawn:
              raise RuntimeError('cannot draw twice to a plot')
          self._drawn = True
  
          # Extract drawables
          drawables, _ = zip(*drawables_options)
  
          # Check if there is a minimum value set, and if not, set it
          if self._get_minimum_value() is None:
              self._set_minimum_value(minimum_value(drawables))
  
          # Check if there is a maximum value set, and if not, set it
          if self._get_maximum_value() is None:
              self._set_maximum_value(maximum_value(drawables))
  
          # Move to the context of the plot pad
          self._plot.cd()
  
          # Iterate through and draw drawables based on type
          first = True
          for drawable, option in drawables_options:
              # Check if this a tuple of histogram, error_band
              if isinstance(drawable, tuple):
                  drawable, error_band = drawable
              else:
                  error_band = None
  
              # Make a clone of the drawable so we don't modify it
              drawable = drawable.Clone(drawable.GetName()+'_clone') #_rand_uuid())
              SetOwnership(drawable, False)
  
              # Set the maximum value of the drawable if supported
              # HACK: I wish this could go into _handle_axes, but apparently it
              # can't because ROOT sucks and this has to be set on EVERY
              # drawable, not just the one with the axes.
              if not is_line(drawable):
                  drawable.SetMaximum(self._get_maximum_value())
  
              #if not is_line(drawable):
              #drawable.SetMinimum(self._get_minimum_value())
              #drawable.SetMinimum(10**(-2))
              
  
              # Include axes if we need
              if first:
                  if is_line(drawable):
                      raise ValueError('TLine may not be first drawable')
                  if is_graph(drawable):
                      option += 'a'
              else:
                  option += 'same'
              first = False
  
              # Draw the histogram
              drawable.Draw(option)
  
              # Handle axes
              if not is_line(drawable):
                  self._handle_axes(drawable, option)
  
              # If there is an error band, draw it
              if error_band is not None:
                  self._draw_error_band(error_band)
  
          # HACK: Need to force a redraw of plot axes due to issue with ROOT:
          # http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=14034
          self._plot.RedrawAxis()
code_tokens: def draw ( self , * drawables_options ) : if len ( drawables_options ) == 0 : raise ValueError ( 'must provide at least one plottable' ) if self . _drawn : raise RuntimeError ( 'cannot draw twice to a plot' ) self . _drawn = True drawables , _ = zip ( * drawables_options ) if self . _get_minimum_value ( ) is None : self . _set_minimum_value ( minimum_value ( drawables ) ) if self . _get_maximum_value ( ) is None : self . _set_maximum_value ( maximum_value ( drawables ) ) self . _plot . cd ( ) first = True for drawable , option in drawables_options : if isinstance ( drawable , tuple ) : drawable , error_band = drawable else : error_band = None drawable = drawable . Clone ( drawable . GetName ( ) + '_clone' ) SetOwnership ( drawable , False ) if not is_line ( drawable ) : drawable . SetMaximum ( self . _get_maximum_value ( ) ) if first : if is_line ( drawable ) : raise ValueError ( 'TLine may not be first drawable' ) if is_graph ( drawable ) : option += 'a' else : option += 'same' first = False drawable . Draw ( option ) if not is_line ( drawable ) : self . _handle_axes ( drawable , option ) if error_band is not None : self . _draw_error_band ( error_band ) self . _plot . RedrawAxis ( )
short_docstring: Plots a collection of plottables to the main plot pad.
short_docstring_tokens: Plots a collection of plottables to the main plot pad .
comment: """Plots a collection of plottables to the main plot pad.  All TH1
          objects are drawn with error bars.  THStack elements are only drawn
          with an error band if one is provided.
  
          This method may only be called once
  
          Args:
              drawables_options: Each argument of this function must be of the
                  form (object, options), where object is one of the following:
  
                  - A TH1 object
                  - A THStack object
                  - A tuple of the form (THStack, TGraph) where the latter
                    represents error bars
                  - A TGraph object
                  - A TLine object
  
                  and options is a string which will be used for the options
                  argument of the object's Draw method.  Plottables will be
                  rendered in the order provided.  Axes drawing options (e.g.
                  'a' or 'same' should not be provided and will be set
                  automatically).  A TLine may not be the first drawable element.
          """$SEP$# Make sure there are drawables$SEP$# Check if we've already drawn$SEP$# Extract drawables$SEP$# Check if there is a minimum value set, and if not, set it$SEP$# Check if there is a maximum value set, and if not, set it$SEP$# Move to the context of the plot pad$SEP$# Iterate through and draw drawables based on type$SEP$# Check if this a tuple of histogram, error_band$SEP$# Make a clone of the drawable so we don't modify it$SEP$#_rand_uuid())$SEP$# Set the maximum value of the drawable if supported$SEP$# HACK: I wish this could go into _handle_axes, but apparently it$SEP$# can't because ROOT sucks and this has to be set on EVERY$SEP$# drawable, not just the one with the axes.$SEP$#if not is_line(drawable):$SEP$#drawable.SetMinimum(self._get_minimum_value())$SEP$#drawable.SetMinimum(10**(-2))$SEP$# Include axes if we need$SEP$# Draw the histogram$SEP$# Handle axes$SEP$# If there is an error band, draw it$SEP$# HACK: Need to force a redraw of plot axes due to issue with ROOT:$SEP$# http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=14034