ATLAS Offline Software
Classes | Functions | Variables
python.pydraw Namespace Reference

Classes

class  _Bins
 
class  _Loopvar
 
class  AthenaLoopWrapper
 
class  Draw_Cmd
 
class  TreeLoopWrapper
 

Functions

def _setCanRebin (h)
 
def _hasCanRebin (h)
 
def _sanitize_hname (s)
 
def _untokenize (tokens)
 
def _find_outer (haystack, needle, ignore_delim=False)
 
def _split_outer (haystack, needle)
 
def _get_bins (args, ndim, axis)
 
def _get_hist (ndim, args, hname, htitle)
 
def draw (arg)
 
def _scan_print (i, *args)
 
def scan (arg)
 
def loop (arg)
 
def cmd (s)
 
def _excepthook (exctype, value, traceb)
 
def cmdhook ()
 

Variables

 ScatterH2 = ROOT.RootUtils.ScatterH2
 
 last_hist = None
 
 _globals = sys.modules['__main__'].__dict__
 
string _idchars = string.ascii_letters + string.digits + '_'
 
string _evtvar = '_ev'
 
bool _debug = False
 
dictionary _cmddict
 
 _orig_ehook = None
 The stuff here sets things up so that after calling cmdhook(), the user can enter drawing commands directly at the python prompt. More...
 

Function Documentation

◆ _excepthook()

def python.pydraw._excepthook (   exctype,
  value,
  traceb 
)
private
Exception hook used by pydraw to process drawing commands.

Definition at line 1315 of file pydraw.py.

1315 def _excepthook (exctype, value, traceb):
1316  """Exception hook used by pydraw to process drawing commands."""
1317 
1318  # If it's a syntax error, try interpreting as a drawing command.
1319  if isinstance (value, SyntaxError):
1320  val = value.text
1321  if val[-1] == '\n':
1322  val = val[:-1] #pragma: NO COVER
1323  if cmd (val):
1324  # Success --- update root stuff and return.
1325  # (This will swallow the original syntax error.)
1326  ROOT.gInterpreter.EndOfLineAction()
1327  return
1328 
1329  # No luck --- pass it on to the original exception handler.
1330  _orig_ehook (exctype, value, traceb)
1331 
1332 

◆ _find_outer()

def python.pydraw._find_outer (   haystack,
  needle,
  ignore_delim = False 
)
private
Look for NEEDLE in HAYSTACK (token-based.  Return pair (HEAD, TAIL).

HAYSTACK and NEEDLE are both strings.  Look for a token in HAYSTACK with
a value matching NEEDLE that is outside of any paired delimiters.
Also ignores things in strings.
If IGNORE_DELIM is True, then we do find things inside delimiters
(strings are still ignored).

Returns a pair (HEAD, TAIL) of the pieces of the string before and
after NEEDLE.  If there is no match, returns (HAYSTACK, None).
Note that whitespace and formatting in HEAD and TAIL may differ
from the original string.

Examples:
>>> _find_outer ("head.tail1.tail2", ".")
('head', 'tail1.tail2')
>>> _find_outer ("(head.tail1).tail2", ".")
('(head.tail1)', 'tail2')
>>> _find_outer ("[a for a in foo if good(a)] if bar", "if")
('[a for a in foo if good(a)]', 'bar')
>>> _find_outer ("(a [b {c . d } ] ) . e", ".")
('(a [b {c . d } ] )', 'e')
>>> _find_outer ("a.b", ";")
('a.b', None)
>>> _find_outer ("a '$' b", '$')
("a '$' b", None)
>>> _find_outer ("a $ b", '$')
('a', 'b')
>>> _find_outer ("(head.tail1).tail2", ".", True)
('(head', 'tail1).tail2')
>>> _find_outer ('a; 1 -1 1', ';')
('a', '1 -1 1')

Definition at line 434 of file pydraw.py.

434 def _find_outer (haystack, needle, ignore_delim = False):
435  """Look for NEEDLE in HAYSTACK (token-based. Return pair (HEAD, TAIL).
436 
437  HAYSTACK and NEEDLE are both strings. Look for a token in HAYSTACK with
438  a value matching NEEDLE that is outside of any paired delimiters.
439  Also ignores things in strings.
440  If IGNORE_DELIM is True, then we do find things inside delimiters
441  (strings are still ignored).
442 
443  Returns a pair (HEAD, TAIL) of the pieces of the string before and
444  after NEEDLE. If there is no match, returns (HAYSTACK, None).
445  Note that whitespace and formatting in HEAD and TAIL may differ
446  from the original string.
447 
448  Examples:
449  >>> _find_outer ("head.tail1.tail2", ".")
450  ('head', 'tail1.tail2')
451  >>> _find_outer ("(head.tail1).tail2", ".")
452  ('(head.tail1)', 'tail2')
453  >>> _find_outer ("[a for a in foo if good(a)] if bar", "if")
454  ('[a for a in foo if good(a)]', 'bar')
455  >>> _find_outer ("(a [b {c . d } ] ) . e", ".")
456  ('(a [b {c . d } ] )', 'e')
457  >>> _find_outer ("a.b", ";")
458  ('a.b', None)
459  >>> _find_outer ("a '$' b", '$')
460  ("a '$' b", None)
461  >>> _find_outer ("a $ b", '$')
462  ('a', 'b')
463  >>> _find_outer ("(head.tail1).tail2", ".", True)
464  ('(head', 'tail1).tail2')
465  >>> _find_outer ('a; 1 -1 1', ';')
466  ('a', '1 -1 1')
467 """
468  tlist = tokenize.generate_tokens (StringIO(haystack).readline)
469  pend = []
470  head = []
471  for (i, (tnum, val, a, b, c)) in enumerate (tlist):
472  if tnum != token.STRING and not pend and val == needle:
473  col1 = a[1]
474  col2 = b[1]
475  return (haystack[:col1].strip(),
476  haystack[col2:].strip())
477  if not ignore_delim:
478  if val == '(':
479  pend.append (')')
480  elif val == '[':
481  pend.append (']')
482  elif val == '{':
483  pend.append ('}')
484  elif pend and val == pend[-1]:
485  pend.pop()
486  head.append ((tnum, val))
487  return (haystack, None)
488 
489 

◆ _get_bins()

def python.pydraw._get_bins (   args,
  ndim,
  axis 
)
private
Parse bin specifications from split list of arguments ARGS.
NDIM is 1 or 2, and AXIS is 0 or 1, for the x or y axis.

Examples:
>>> from PyAnalysisUtils import pydraw
>>> pydraw._globals = globals()
>>> import ROOT
>>> ROOT.gPad.Range(0, 1,2,3)
>>> b = _get_bins (["50", "10", "100"], 1, 0)
>>> print (b.nbins, b.lo, b.hi, b.rebin)
50 10.0 100.0 0
>>> b = _get_bins ([], 1, 0)
>>> print (b.nbins, b.lo, b.hi, b.rebin)
50 0 1 1
>>> b = _get_bins (["!", "10"], 1, 0)
>>> print (b.nbins, b.lo, b.hi, b.rebin)
50 10.0 11.0 1
>>> b = _get_bins (["!", "!", "10"], 1, 0)
>>> print (b.nbins, b.lo, b.hi, b.rebin)
50 0 10.0 0
>>> scale = 10
>>> b = _get_bins (["50", "0", "2*scale"], 1, 0)
>>> print (b.nbins, b.lo, b.hi, b.rebin)
50 0.0 20.0 0
>>> b = _get_bins ([], 2, 0)
>>> print (b.nbins, b.lo, b.hi, b.rebin)
50 0.0 2.0 1
>>> b = _get_bins ([], 2, 1)
>>> print (b.nbins, b.lo, b.hi, b.rebin)
50 1.0 3.0 1
>>> b = _get_bins ([], 2, 2)
Traceback (most recent call last):
    ...
AssertionError

Definition at line 1004 of file pydraw.py.

1004 def _get_bins (args, ndim, axis):
1005  """Parse bin specifications from split list of arguments ARGS.
1006  NDIM is 1 or 2, and AXIS is 0 or 1, for the x or y axis.
1007 
1008  Examples:
1009  >>> from PyAnalysisUtils import pydraw
1010  >>> pydraw._globals = globals()
1011  >>> import ROOT
1012  >>> ROOT.gPad.Range(0, 1,2,3)
1013  >>> b = _get_bins (["50", "10", "100"], 1, 0)
1014  >>> print (b.nbins, b.lo, b.hi, b.rebin)
1015  50 10.0 100.0 0
1016  >>> b = _get_bins ([], 1, 0)
1017  >>> print (b.nbins, b.lo, b.hi, b.rebin)
1018  50 0 1 1
1019  >>> b = _get_bins (["!", "10"], 1, 0)
1020  >>> print (b.nbins, b.lo, b.hi, b.rebin)
1021  50 10.0 11.0 1
1022  >>> b = _get_bins (["!", "!", "10"], 1, 0)
1023  >>> print (b.nbins, b.lo, b.hi, b.rebin)
1024  50 0 10.0 0
1025  >>> scale = 10
1026  >>> b = _get_bins (["50", "0", "2*scale"], 1, 0)
1027  >>> print (b.nbins, b.lo, b.hi, b.rebin)
1028  50 0.0 20.0 0
1029  >>> b = _get_bins ([], 2, 0)
1030  >>> print (b.nbins, b.lo, b.hi, b.rebin)
1031  50 0.0 2.0 1
1032  >>> b = _get_bins ([], 2, 1)
1033  >>> print (b.nbins, b.lo, b.hi, b.rebin)
1034  50 1.0 3.0 1
1035  >>> b = _get_bins ([], 2, 2)
1036  Traceback (most recent call last):
1037  ...
1038  AssertionError
1039  """
1040 
1041  g = copy.copy (_globals)
1042 
1043  bins = _Bins()
1044 
1045  bins.nbins = 0
1046  if len(args) >= 1 and args[0] != '!' and len(args[0]) > 0:
1047  bins.nbins = int (eval (args[0], g))
1048  if bins.nbins <= 0:
1049  bins.nbins = 50
1050 
1051  bins.lo = 0
1052  if len(args) >= 2 and args[1] != '!' and len(args[1]) > 0:
1053  bins.lo = float (eval (args[1], g))
1054 
1055  bins.hi = 0
1056  if len(args) >= 3 and args[2] != '!' and len(args[2]) > 0:
1057  bins.hi = float (eval (args[2], g))
1058 
1059  bins.rebin = 0
1060  if bins.hi <= bins.lo:
1061  bins.rebin = 1
1062  if ndim == 1:
1063  bins.hi = bins.lo + 1
1064  elif axis == 0:
1065  bins.lo = ROOT.gPad.GetUxmin()
1066  bins.hi = ROOT.gPad.GetUxmax()
1067  elif axis == 1:
1068  bins.lo = ROOT.gPad.GetUymin()
1069  bins.hi = ROOT.gPad.GetUymax()
1070  else:
1071  assert 0
1072 
1073  return bins
1074 
1075 

◆ _get_hist()

def python.pydraw._get_hist (   ndim,
  args,
  hname,
  htitle 
)
private
Create a new histogram from options.

NDIM is the dimensionality of the histogram (1 or 2).
ARGS is a list of the arguments given to specify the histogram.
HNAME and HTITLE are the histogram name and title, respectively.

Definition at line 1076 of file pydraw.py.

1076 def _get_hist (ndim, args, hname, htitle):
1077  """Create a new histogram from options.
1078 
1079  NDIM is the dimensionality of the histogram (1 or 2).
1080  ARGS is a list of the arguments given to specify the histogram.
1081  HNAME and HTITLE are the histogram name and title, respectively.
1082  """
1083  get_canvas()
1084 
1085  # Get the x-axis bin specifications.
1086  xbins = _get_bins (args, ndim, 0)
1087  rebin = xbins.rebin
1088 
1089  # Get the y-axis bin specifications.
1090  if ndim >= 2:
1091  ybins = _get_bins (args[3:], ndim, 1)
1092  rebin = rebin or ybins.rebin
1093 
1094  profile = 0
1095  # Look for drawing options.
1096  options = ''
1097  for i in range (0, len(args)):
1098  if args[i][0] in string.ascii_letters:
1099  for j in range (i, len(args)):
1100  if ndim == 2 and args[j].lower() == "prof":
1101  profile = 1
1102  args[j] = ''
1103  options = ' '.join (args[i:])
1104  break
1105 
1106  # Delete any old object of the same name.
1107  hold = ROOT.gROOT.FindObject (hname)
1108  if hold:
1109  ROOT.gROOT.Remove (hold)
1110 
1111  # Create the histogram.
1112  if profile:
1113  hist = ROOT.TProfile (hname, htitle, xbins.nbins, xbins.lo, xbins.hi)
1114  if not ybins.rebin:
1115  hist.SetMinimum (ybins.lo)
1116  hist.SetMaximum (ybins.hi)
1117  elif ndim == 1:
1118  hist = ROOT.TH1F (hname, htitle, xbins.nbins, xbins.lo, xbins.hi)
1119  elif ndim == 2:
1120  hist = ScatterH2 (hname, htitle,
1121  xbins.nbins, xbins.lo, xbins.hi,
1122  ybins.nbins, ybins.lo, ybins.hi)
1123  if hasattr (hist, 'scatter'):
1124  hist.scatter (1)
1125 
1126  # Automatic rebinning?
1127  if rebin:
1128  _setCanRebin (hist)
1129 
1130  return (hist, options)
1131 
1132 

◆ _hasCanRebin()

def python.pydraw._hasCanRebin (   h)
private

Definition at line 350 of file pydraw.py.

350  def _hasCanRebin (h): #pragma: NO COVER
351  return h.TestBit (ROOT.TH1.kCanRebin) #pragma: NO COVER

◆ _sanitize_hname()

def python.pydraw._sanitize_hname (   s)
private
Name a string safe to use as a histogram name.

Root does bad things if you put / in a histogram name, so we remove them.
Examples:
>>> print (_sanitize_hname('foo'))
foo
>>> print (_sanitize_hname('foo/bar'))
foo DIV bar

Definition at line 376 of file pydraw.py.

376 def _sanitize_hname(s):
377  """Name a string safe to use as a histogram name.
378 
379  Root does bad things if you put / in a histogram name, so we remove them.
380  Examples:
381  >>> print (_sanitize_hname('foo'))
382  foo
383  >>> print (_sanitize_hname('foo/bar'))
384  foo DIV bar
385  """
386  return s.replace ('/', ' DIV ')
387 
388 

◆ _scan_print()

def python.pydraw._scan_print (   i,
args 
)
private
Helper to print out one row of a scan.

I is the row number and ARGS is a tuple of the column values.

Definition at line 1198 of file pydraw.py.

1198 def _scan_print (i, *args):
1199  """Helper to print out one row of a scan.
1200 
1201  I is the row number and ARGS is a tuple of the column values."""
1202 
1203  s = '%6d' % i
1204  for a in args:
1205  if isinstance(a, six.integer_types):
1206  s += ' %8d' % a
1207  else:
1208  s += ' %8g' % a
1209  print (s)
1210  return
1211 
1212 

◆ _setCanRebin()

def python.pydraw._setCanRebin (   h)
private

Definition at line 348 of file pydraw.py.

348  def _setCanRebin (h): #pragma: NO COVER
349  h.SetBit (ROOT.TH1.kCanRebin) #pragma: NO COVER

◆ _split_outer()

def python.pydraw._split_outer (   haystack,
  needle 
)
private
Split HAYSTACK at the delimiters NEEDLE, as in _find_outer.

Examples:
>>> _split_outer ("a,(b,c),d", ",")
['a', '(b,c)', 'd']
>>> _split_outer ("a,,b", ",")
['a', '', 'b']
>>> _split_outer ("a", ",")
['a']
>>> #_split_outer ("", ",")
[]

Definition at line 490 of file pydraw.py.

490 def _split_outer (haystack, needle):
491  """Split HAYSTACK at the delimiters NEEDLE, as in _find_outer.
492 
493  Examples:
494  >>> _split_outer ("a,(b,c),d", ",")
495  ['a', '(b,c)', 'd']
496  >>> _split_outer ("a,,b", ",")
497  ['a', '', 'b']
498  >>> _split_outer ("a", ",")
499  ['a']
500  >>> #_split_outer ("", ",")
501  []
502 """
503  out = []
504  while True:
505  (head, tail) = _find_outer (haystack, needle)
506  head = head.strip()
507  out.append (head)
508  if tail is None:
509  break
510  else:
511  haystack = tail
512  return out
513 
514 

◆ _untokenize()

def python.pydraw._untokenize (   tokens)
private
Transform tokens back into Python source code.

Each element returned by the iterable must be a token sequence
with at least two elements, a token number and token value.

Unlike tokenize.untokenize(), this does not handle multiple lines.
It also tries not to add unneeded spaces.

Examples:
>>> from tokenize import generate_tokens, untokenize
>>> import six
>>> if six.PY2:
...     from StringIO import StringIO
... else:
...     from io import StringIO
>>> def untokenize1(tt):
...   tt=list(tt)
...   if tt[-1][0]==0: tt=tt[:-1]
...   return untokenize(tt)
>>> untokenize1(generate_tokens(StringIO('1+1').readline))
'1+1'
>>> _untokenize(generate_tokens(StringIO('1+1').readline))
'1+1'
>>> untokenize1(generate_tokens(StringIO('foo$i>2*h').readline))
'foo$i>2*h'
>>> _untokenize(generate_tokens(StringIO('foo$i>2*h').readline))
'foo$i>2*h'

Definition at line 389 of file pydraw.py.

389 def _untokenize (tokens):
390  """Transform tokens back into Python source code.
391 
392  Each element returned by the iterable must be a token sequence
393  with at least two elements, a token number and token value.
394 
395  Unlike tokenize.untokenize(), this does not handle multiple lines.
396  It also tries not to add unneeded spaces.
397 
398  Examples:
399  >>> from tokenize import generate_tokens, untokenize
400  >>> import six
401  >>> if six.PY2:
402  ... from StringIO import StringIO
403  ... else:
404  ... from io import StringIO
405  >>> def untokenize1(tt):
406  ... tt=list(tt)
407  ... if tt[-1][0]==0: tt=tt[:-1]
408  ... return untokenize(tt)
409  >>> untokenize1(generate_tokens(StringIO('1+1').readline))
410  '1+1'
411  >>> _untokenize(generate_tokens(StringIO('1+1').readline))
412  '1+1'
413  >>> untokenize1(generate_tokens(StringIO('foo$i>2*h').readline))
414  'foo$i>2*h'
415  >>> _untokenize(generate_tokens(StringIO('foo$i>2*h').readline))
416  'foo$i>2*h'
417  """
418  lastname = False
419  toks = []
420  toks_append = toks.append
421  for tok in tokens:
422  toknum, tokval = tok[:2]
423  tokval = tokval.strip()
424  if toknum in (token.NAME, token.NUMBER):
425  if lastname:
426  tokval = ' ' + tokval
427  lastname = True
428  else:
429  lastname = False
430  toks_append (tokval)
431  return ''.join(toks)
432 
433 

◆ cmd()

def python.pydraw.cmd (   s)
Process a command S.

Returns True if the command was handled, False otherwise.
See the header comments for the command syntax.

Definition at line 1278 of file pydraw.py.

1278 def cmd (s):
1279  """Process a command S.
1280 
1281  Returns True if the command was handled, False otherwise.
1282  See the header comments for the command syntax.
1283  """
1284 
1285  ssplit = s.split (None, 1)
1286 
1287  if len(ssplit) < 2:
1288  return False
1289 
1290  cmd, args = ssplit
1291 
1292  func = _cmddict.get (cmd)
1293  if func:
1294  return func (args)
1295 
1296  return False
1297 
1298 
1299 

◆ cmdhook()

def python.pydraw.cmdhook ( )
Enable entering drawing commands directly at the python prompt.

Definition at line 1333 of file pydraw.py.

1333 def cmdhook():
1334  """Enable entering drawing commands directly at the python prompt."""
1335 
1336  # Store the old value of the exception hook (only if we haven't
1337  # done so already).
1338  global _orig_ehook
1339  if _orig_ehook is None:
1340  _orig_ehook = sys.excepthook
1341 
1342  # Install our handler.
1343  sys.excepthook = _excepthook
1344  return
1345 
1346 

◆ draw()

def python.pydraw.draw (   arg)
Process a draw command.

ARG is the command arguments (without the command word itself).
See the header comments for the command syntax.

Definition at line 1133 of file pydraw.py.

1133 def draw (arg):
1134  """Process a draw command.
1135 
1136  ARG is the command arguments (without the command word itself).
1137  See the header comments for the command syntax.
1138  """
1139 
1140  global last_hist
1141 
1142  # Initial parsing of the arguments.
1143  c = Draw_Cmd (arg)
1144  if c.errstr:
1145  print (c.errstr)
1146  return False
1147 
1148  # Construct the expression to use to fill the histogram.
1149  if len (c.exprs) == 1:
1150  ndim = 1
1151  payload = "_hfill (%s)" % c.exprs[0]
1152  else:
1153  ndim = 2
1154  payload = "_hfill ((%s),(%s))" % (c.exprs[0], c.exprs[1])
1155 
1156  # Construct the histogram title.
1157  htitle = "%s.%s" % (c.tuple, c.expr_orig)
1158  if c.sel_orig:
1159  htitle = htitle + '{%s}' % c.sel_orig
1160 
1161  # Make the histogram.
1162  # If it's `!', then we just use the last one.
1163  if len(c.histspec) >= 1 and c.histspec[0] == "!" and last_hist is not None:
1164  hist = last_hist
1165  options = ' '.join (c.histspec[1:])
1166  elif len(c.histspec) >= 1 and c.histspec[0][:2] == '>>':
1167  hname = c.histspec[0][2:]
1168  hist = _globals.get (hname)
1169  options = ' '.join (c.histspec[1:])
1170  else:
1171  (hist, options) = _get_hist (ndim, c.histspec,
1172  _sanitize_hname(c.tuple+'.'+c.expr_orig), htitle)
1173 
1174  # Remember it.
1175  last_hist = hist
1176 
1177  # Generate the function.
1178  # It will be defined as _loopfunc in g.
1179  g = copy.copy (_globals)
1180  g['_hfill'] = hist.Fill
1181  ftext = c._make_func (payload, ', _hfill = _hfill')
1182  exec (ftext, g)
1183 
1184  # Execute the loop over the data.
1185  c.tuple_o.loop (g['_loopfunc'], c.lo, c.hi)
1186 
1187  # Adjust binning, if requested.
1188  if _hasCanRebin (hist):
1189  hist.LabelsDeflate ("X")
1190  if ndim > 1:
1191  hist.LabelsDeflate ("Y")
1192 
1193  # Draw the histogram.
1194  draw_obj (hist, options)
1195  return True
1196 
1197 

◆ loop()

def python.pydraw.loop (   arg)
Process a loop command.

ARG is the command arguments (without the command word itself).
See the header comments for the command syntax.

Definition at line 1242 of file pydraw.py.

1242 def loop (arg):
1243  """Process a loop command.
1244 
1245  ARG is the command arguments (without the command word itself).
1246  See the header comments for the command syntax.
1247  """
1248 
1249  # Initial parsing of the arguments.
1250  c = Draw_Cmd (arg)
1251  if c.errstr:
1252  print (c.errstr)
1253  return False
1254 
1255  payload = "(%s,)" % ','.join (c.exprs)
1256 
1257  # Generate the function.
1258  # It will be defined as _loopfunc in g.
1259  g = copy.copy (_globals)
1260  ftext = c._make_func (payload)
1261  exec (ftext, g)
1262 
1263  # Execute the loop over the data.
1264  c.tuple_o.loop (g['_loopfunc'], c.lo, c.hi)
1265 
1266  return True
1267 
1268 
1269 # Dictionary of command handlers.
1270 # Should return True if cmd was handled.

◆ scan()

def python.pydraw.scan (   arg)
Process a scan command.

ARG is the command arguments (without the command word itself).
See the header comments for the command syntax.

Definition at line 1213 of file pydraw.py.

1213 def scan (arg):
1214  """Process a scan command.
1215 
1216  ARG is the command arguments (without the command word itself).
1217  See the header comments for the command syntax.
1218  """
1219 
1220  # Initial parsing of the arguments.
1221  c = Draw_Cmd (arg)
1222  if c.errstr:
1223  print (c.errstr)
1224  return False
1225 
1226  payload = "_print (_i, %s)" % \
1227  ','.join (['(%s)'%e for e in c.exprs])
1228 
1229  # Generate the function.
1230  # It will be defined as _loopfunc in g.
1231  g = copy.copy (_globals)
1232  g['_print'] = _scan_print
1233  ftext = c._make_func (payload, ', _print = _print')
1234  exec (ftext, g)
1235 
1236  # Execute the loop over the data.
1237  c.tuple_o.loop (g['_loopfunc'], c.lo, c.hi)
1238 
1239  return True
1240 
1241 

Variable Documentation

◆ _cmddict

dictionary python.pydraw._cmddict
private
Initial value:
1 = {'d': draw,
2  'draw' : draw,
3  'scan' : scan,
4  'loop' : loop,
5  }

Definition at line 1271 of file pydraw.py.

◆ _debug

bool python.pydraw._debug = False
private

Definition at line 374 of file pydraw.py.

◆ _evtvar

string python.pydraw._evtvar = '_ev'
private

Definition at line 371 of file pydraw.py.

◆ _globals

python.pydraw._globals = sys.modules['__main__'].__dict__
private

Definition at line 364 of file pydraw.py.

◆ _idchars

string python.pydraw._idchars = string.ascii_letters + string.digits + '_'
private

Definition at line 368 of file pydraw.py.

◆ _orig_ehook

python.pydraw._orig_ehook = None
private

The stuff here sets things up so that after calling cmdhook(), the user can enter drawing commands directly at the python prompt.

We do this by catching syntax errors; when we get a syntax error, we try to parse the input as one of our commands.

Definition at line 1312 of file pydraw.py.

◆ last_hist

python.pydraw.last_hist = None

Definition at line 360 of file pydraw.py.

◆ ScatterH2

python.pydraw.ScatterH2 = ROOT.RootUtils.ScatterH2

Definition at line 340 of file pydraw.py.

python.pydraw.draw
def draw(arg)
Definition: pydraw.py:1133
python.pydraw._get_hist
def _get_hist(ndim, args, hname, htitle)
Definition: pydraw.py:1076
python.pydraw._untokenize
def _untokenize(tokens)
Definition: pydraw.py:389
python.pydraw._excepthook
def _excepthook(exctype, value, traceb)
Definition: pydraw.py:1315
python.pydraw._scan_print
def _scan_print(i, *args)
Definition: pydraw.py:1198
python.draw_obj.get_canvas
def get_canvas(cname="c1")
Definition: draw_obj.py:273
python.pydraw.cmdhook
def cmdhook()
Definition: pydraw.py:1333
python.pydraw._sanitize_hname
def _sanitize_hname(s)
Definition: pydraw.py:376
python.pydraw.loop
def loop(arg)
Definition: pydraw.py:1242
python.pydraw._hasCanRebin
def _hasCanRebin(h)
Definition: pydraw.py:350
python.pydraw._setCanRebin
def _setCanRebin(h)
Definition: pydraw.py:348
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.pydraw._find_outer
def _find_outer(haystack, needle, ignore_delim=False)
Definition: pydraw.py:434
scan
void scan(TDirectory *td=0, int depth=0)
Definition: listroot.cxx:440
python.pydraw._get_bins
def _get_bins(args, ndim, axis)
Definition: pydraw.py:1004
python.pydraw.cmd
def cmd(s)
Definition: pydraw.py:1278
python.pydraw._split_outer
def _split_outer(haystack, needle)
Definition: pydraw.py:490