CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
cuy.py
Go to the documentation of this file.
1 #!/usr/bin/env python3
2 #____________________________________________________________
3 #
4 # cuy
5 #
6 # A very simple way to make plots with ROOT via an XML file
7 #
8 # Francisco Yumiceva
9 # yumiceva@fnal.gov
10 #
11 # Fermilab, 2008
12 #
13 # imported from UserCode/Yumiceva/cuy
14 from __future__ import print_function
15 #
16 # modified by Adrien Caudron to create TGraphErrors for b-tag performance plots
17 # UCLouvain, 2012
18 #_____________________________________________________________
19 
20 """
21  cuy
22 
23  A very simple way to make plots with ROOT via an XML file.
24 
25  usage: %prog -x <XML configuration file>
26  -b, --batch : run in batch mode without graphics.
27  -c, --create = CREATE: create XML configuration file from a ROOT file.
28  -e, --example = EXAMPLE: generate an example xml file.
29  -f, --flag = FLAG: create a baneer
30  -l, --list = LIST: list of objects in the ROOT file.
31  -p, --prt = PRT: print canvas in the format specified png, ps, eps, pdf, etc.
32  -t, --tag = TAG: tag name for XML configuration file.
33  -v, --verbose : verbose output.
34  -w, --wait : Pause script after plotting a new superposition of histograms.
35  -x, --xml = XML: xml configuration file.
36 
37  Francisco Yumiceva (yumiceva@fnal.gov)
38  Fermilab 2008
39 
40 """
41 
42 
43 import os, string, re, sys, math
44 
45 try:
46  import ROOT
47 except:
48  print("\nCannot load PYROOT, make sure you have setup ROOT in the path")
49  print("and pyroot library is also defined in the variable PYTHONPATH, try:\n")
50  if (os.getenv("PYTHONPATH")):
51  print(" setenv PYTHONPATH ${PYTHONPATH}:$ROOTSYS/lib\n")
52  else:
53  print(" setenv PYTHONPATH $ROOTSYS/lib\n")
54  sys.exit()
55 
56 from ROOT import TFile
57 from ROOT import TCanvas
58 from ROOT import TLegend
59 from ROOT import SetOwnership
60 from ROOT import THStack
61 from ROOT import TLatex
62 from ROOT import TH1
63 from ROOT import TH1F
64 from ROOT import TGraphErrors
65 from ROOT import TVectorD
66 from ROOT import std
67 
68 from xml.sax import saxutils, make_parser, handler
69 from xml.sax.handler import feature_namespaces
70 
71 import Inspector
72 import Style
73 
74 #_______________OPTIONS________________
75 import optparse
76 
77 USAGE = re.compile(r'(?s)\s*usage: (.*?)(\n[ \t]*\n|$)')
78 
79 def nonzero(self): # will become the nonzero method of optparse.Values
80  "True if options were given"
81  for v in self.__dict__.values():
82  if v is not None: return True
83  return False
84 
85 optparse.Values.__nonzero__ = nonzero # dynamically fix optparse.Values
86 
87 class ParsingError(Exception): pass
88 
89 optionstring=""
90 
91 def exit(msg=""):
92  raise SystemExit(msg or optionstring.replace("%prog",sys.argv[0]))
93 
94 def parse(docstring, arglist=None):
95  global optionstring
96  optionstring = docstring
97  match = USAGE.search(optionstring)
98  if not match: raise ParsingError("Cannot find the option string")
99  optlines = match.group(1).splitlines()
100  try:
101  p = optparse.OptionParser(optlines[0])
102  for line in optlines[1:]:
103  opt, help=line.split(':')[:2]
104  short,long=opt.split(',')[:2]
105  if '=' in opt:
106  action='store'
107  long=long.split('=')[0]
108  else:
109  action='store_true'
110  p.add_option(short.strip(),long.strip(),
111  action = action, help = help.strip())
112  except (IndexError,ValueError):
113  raise ParsingError("Cannot parse the option string correctly")
114  return p.parse_args(arglist)
115 
116 #______________________________________________________________________
117 
119  def __init__(self):
120  self.type = ""
121  self.filename = ""
122  self.release = ""
123  self.histos = {}
124  self.TH1s = {}
125  self.weight = None
126 
128  def __init__(self):
129  self.name = ""
130  self.numerator = None
131  self.denominator = None
132 
134  def __init__(self):
135  self.name = ""
136  self.title = ""
137  self.color = ""
138 
140  def __init__(self):
141  self.name = ""
142  self.title = ""
143  self.SetLogy = ""
144  self.SetGrid = ""
145  self.histos = []
146  self.weight = []
147 
149  def __init__(self):
150  self.name = ""
151  self.title = ""
152  self.SetLogy = ""
153  self.SetGrid = ""
154  self.histos = []
155  self.color = []
156  self.marker = []
157  self.legend = []
158  self.weight = []
159  #self.flavour = []
160 #**********************************
162  def __init__(self):
163  self.name = ""
164  self.title = ""
165  self.SetLogy = ""
166  self.SetGrid = ""
167  self.histos = []
168  self.color = []
169  self.marker = []
170  self.legend = []
171  self.weight = []
172  self.flavour = []
173 #**********************************
174 
175 class FindIssue(handler.ContentHandler):
176  def __init__(self):
177  self.data = {}
178  self.divide = {}
179  self.addition = {}
180  self.superimpose = {}
181  self.graph = {}
182  self.tmpaddname = ""
183  self.plot = {}
184  self.size = 0
185  self.atype = ""
186  self.tmpsupername = ""
187  self.tmpgraphname = ""
188 
189  def startElement(self, name, attrs):
190  if name == 'validation':
191  self.size = self.size + 1
192  self.atype = attrs.get('type',None)
193  self.data[self.atype] = ValElement()
194  self.data[self.atype].type = attrs.get('type',None)
195  self.data[self.atype].filename = attrs.get('file',None)
196  self.data[self.atype].release = attrs.get('release',None)
197  self.data[self.atype].weight = attrs.get('weight','')
198  if name == 'TH1':
199  self.data[self.atype].histos[attrs.get('name',None)] = attrs.get('source',None)
200  #print attrs.get('name',None)
201  #print attrs.get('source',None)
202  if name == 'divide':
203  aname = attrs.get('name',None)
204  self.divide[aname] = divideElement()
205  self.divide[aname].name = aname
206  self.divide[aname].numerator = attrs.get('numerator',None)
207  self.divide[aname].denominator = attrs.get('denominator',None)
208  self.divide[aname].DivideOption = attrs.get('DivideOption',None)
209  self.divide[aname].Option = attrs.get('Option',None)
210  if name == 'addition':
211  aname = attrs.get('name',None)
212  self.addition[aname] = additionElement()
213  self.tmpaddname = aname
214  self.addition[aname].name = aname
215  self.addition[aname].title = attrs.get('title',None)
216  self.addition[aname].YTitle = attrs.get('YTitle',None)
217  self.addition[aname].XTitle = attrs.get('XTitle',None)
218  self.addition[aname].Option = attrs.get('Option',None)
219  self.addition[aname].Weight = attrs.get('Wight',None)
220  self.addition[aname].Normalize = attrs.get('Normalize',None)
221  self.addition[aname].SetGrid = attrs.get('SetGrid',None)
222  if name == 'additionItem':
223  #print "in element: " + self.tmpsupername
224  self.addition[self.tmpaddname].histos.append(attrs.get('name',None))
225  self.addition[self.tmpaddname].weight.append(attrs.get('weight',None))
226  if name == 'superimpose':
227  aname = attrs.get('name',None)
228  self.superimpose[aname] = superimposeElement()
229  self.superimpose[aname].name = aname
230  self.superimpose[aname].title = attrs.get('title',None)
231  self.superimpose[aname].SetLogy = attrs.get('SetLogy',None)
232  self.superimpose[aname].SetGrid = attrs.get('SetGrid',None)
233  self.superimpose[aname].Normalize = attrs.get('Normalize',None)
234  self.superimpose[aname].Stack = attrs.get('Stack',None)
235  self.superimpose[aname].YTitle = attrs.get('YTitle',None)
236  self.superimpose[aname].XTitle = attrs.get('XTitle',None)
237  self.superimpose[aname].projection = attrs.get('Projection',None)
238  self.superimpose[aname].bin = attrs.get('bin',None)
239  self.superimpose[aname].profile = attrs.get('Profile',None)
240  self.superimpose[aname].Fill = attrs.get('Fill',None)
241  self.superimpose[aname].Option = attrs.get('Option',None)
242  self.superimpose[aname].Weight = attrs.get('Weight',None)
243  self.superimpose[aname].Maximum = attrs.get('Maximum',None)
244  self.superimpose[aname].Minimum = attrs.get('Minimum',None)
245  self.superimpose[aname].Labels = attrs.get('Labels',None)
246  self.superimpose[aname].Rebin = attrs.get('Rebin',None)
247  self.tmpsupername = aname
248  if name == 'graph':
249  aname = attrs.get('name',None)
250  self.graph[aname] = graphElement()
251  self.graph[aname].name = aname
252  self.graph[aname].title = attrs.get('title',None)
253  self.graph[aname].SetLogy = attrs.get('SetLogy',None)
254  self.graph[aname].SetGrid = attrs.get('SetGrid',None)
255  self.graph[aname].Normalize = attrs.get('Normalize',None)
256  self.graph[aname].Stack = attrs.get('Stack',None)
257  self.graph[aname].YTitle = attrs.get('YTitle',None)
258  self.graph[aname].XTitle = attrs.get('XTitle',None)
259  self.graph[aname].projection = attrs.get('Projection',None)
260  self.graph[aname].bin = attrs.get('bin',None)
261  self.graph[aname].profile = attrs.get('Profile',None)
262  self.graph[aname].Fill = attrs.get('Fill',None)
263  self.graph[aname].Option = attrs.get('Option',None)
264  self.graph[aname].Weight = attrs.get('Weight',None)
265  self.graph[aname].Maximum = attrs.get('Maximum',None)
266  self.graph[aname].Minimum = attrs.get('Minimum',None)
267  self.graph[aname].Labels = attrs.get('Labels',None)
268  self.tmpgraphname = aname
269  if name == 'superimposeItem':
270  #print "in element: " + self.tmpsupername
271  self.superimpose[self.tmpsupername].histos.append(attrs.get('name',None))
272  self.superimpose[self.tmpsupername].color.append(attrs.get('color',None))
273  self.superimpose[self.tmpsupername].marker.append(attrs.get('MarkerStyle',None))
274  self.superimpose[self.tmpsupername].legend.append(attrs.get('legend',None))
275  #self.superimpose[self.tmpsupername].flavour.append(attrs.get('flavour',None))
276  #self.superimpose[self.tmpsupername].weight.append(attrs.get('weight',None))
277  if name == 'graphItem':
278  #print "in element: " + self.tmpsupername
279  self.graph[self.tmpgraphname].histos.append(attrs.get('name',None))
280  self.graph[self.tmpgraphname].color.append(attrs.get('color',None))
281  self.graph[self.tmpgraphname].marker.append(attrs.get('MarkerStyle',None))
282  self.graph[self.tmpgraphname].legend.append(attrs.get('legend',None))
283  self.graph[self.tmpgraphname].flavour.append(attrs.get('flavour',None))
284  #self.se[self.tmpsupername].weight.append(attrs.get('weight',None))
285 
286 
287 
288 if __name__ == '__main__':
289 
290 
291 
292  # style
293  thestyle = Style.Style()
294  thestyle.SetStyle()
295 
296  printCanvas = False
297  printFormat = "png"
298  printBanner = False
299  Banner = "CMS Preliminary"
300  verbose = False
301 
302  # check options
303  option,args = parse(__doc__)
304  if not args and not option: exit()
305 
306  if option.batch:
307  ROOT.gROOT.SetBatch()
308 
309  if option.verbose:
310  verbose = True
311 
312  if option.list:
314  ins.Verbose(True)
315  ins.createXML(False)
316  ins.SetFilename(option.list)
317  ins.GetListObjects()
318  sys.exit()
319 
320  if option.create:
321  createXML = Inspector.Inspector()
322  createXML.Verbose(False)
323  createXML.createXML(True)
324  if option.tag:
325  createXML.SetTag(option.tag)
326  createXML.SetFilename(option.create)
327  createXML.GetListObjects()
328  sys.exit()
329 
330  if not option.xml: exit()
331  if option.prt:
332  printCanvas = True
333  printFormat = option.prt
334 
335  if option.flag:
336  printBanner = True
337  Banner = option.flag
338 
339  # check xml file
340  try:
341  xmlfile = open(option.xml)
342  xmlfile.close()
343  except:
344  print(" ERROR: xml file \"" + option.xml + "\" does not exist")
345  sys.exit()
346 
347  # Create a parser
348  parser = make_parser()
349 
350  # Tell the parser we are not interested in XML namespaces
351  parser.setFeature(feature_namespaces, 0)
352 
353  # Create the handler
354  dh = FindIssue()
355 
356  # Tell the parser to use our handler
357  parser.setContentHandler(dh)
358 
359  # Parse the input
360  parser.parse(option.xml)
361 
362  # list of canvas
363  cv = {}
364  afilelist = {}
365  stacklist = {}
366 
367  # root output file
368  outputroot = TFile("cuy.root","RECREATE")
369 
370  # new histograms
371  newTH1list = []
372 
373  # extract histograms
374  thedata = dh.data
375 
376  firstFilename = ''
377 
378  for ikey in thedata:
379  if verbose : print("= Processing set called: " + ikey)
380  afilename = thedata[ikey].filename
381  if firstFilename == '':
382  firstFilename = afilename
383  arelease = ""
384  if thedata[ikey].release != None:
385  arelease = thedata[ikey].release
386  if verbose : print("== filename: " + afilename)
387  if verbose : print("== release: " + arelease)
388  if verbose : print("== weight: " + thedata[ikey].weight)
389  thehistos = thedata[ikey].histos
390  afilelist[afilename] = TFile(afilename)
391  if verbose : print("== get histograms: ")
392  histonamekeys = thehistos.keys()
393  for ihname in histonamekeys:
394  if verbose : print("=== Histogram name: \""+ ihname + "\" source: \""+thehistos[ihname]+"\"")
395  thedata[ikey].TH1s[ihname] = ROOT.gDirectory.Get(thehistos[ihname])
396  #SetOwnership(thedata[ikey].TH1s[ihname], 0)
397  # check if file exists
398  print(thedata[ikey].TH1s[ihname].GetName())
399 
400 
401  # plot superimpose histograms
402  #afilelist['../outputLayer2_ttbarmuonic_all.root'].cd()
403  afilelist[firstFilename].cd()
404  #print thedata['ttbar'].TH1s['gen_eta'].GetEntries()
405 
406 
407  theaddition = dh.addition
408  if verbose : print("= Create addition histograms:")
409 
410  for ikey in theaddition:
411  if verbose : print("== plot name: \""+theaddition[ikey].name+"\" title: \""+theaddition[ikey].title+"\"")
412  listname = theaddition[ikey].histos
413  listweight = theaddition[ikey].weight
414 
415  #create canvas
416  cv[theaddition[ikey].name] = TCanvas(theaddition[ikey].name,theaddition[ikey].name,700,700)
417 
418  isFirst = True
419  ihnameIt = 0
420  for ihname in listname:
421  aweight = 1
422  if listweight[ihnameIt]:
423  #if thedata[jkey].weight != None and theaddition[ikey].Weight == "true":
424  aweight = float(listweight[ihnameIt])
425  #aweight = float(thedata[jkey].weight)
426  for jkey in thedata:
427  tmpkeys = thedata[jkey].histos.keys()
428  for tmpname in tmpkeys:
429  if tmpname == ihname:
430  ath = thedata[jkey].TH1s[tmpname]
431  if ath is None:
432  print("ERROR: histogram name \""+tmpname+"\" does not exist in file "+thedata[jkey].filename)
433  exit(0)
434  if verbose : print("=== add histogram: "+ath.GetName() + " from " + thedata[jkey].filename + " mean = " + "%.2f" % round(ath.GetMean(),2) + " weight= " + str(aweight))
435  #ath.Print("all")
436  if isFirst:
437  newth = ath.Clone(theaddition[ikey].name)
438  newth.Sumw2()
439  if theaddition[ikey].Normalize == "true":
440  newth.Scale(1/newth.Integral())
441  newth.Scale(aweight)
442  isFirst = False
443  else:
444  atmpth = ath.Clone()
445  atmpth.Sumw2()
446  if theaddition[ikey].Normalize == "true":
447  atmpth.Scale(1/atmpth.Integral())
448  atmpth.Scale(aweight)
449  newth.Add( atmpth )
450  ihnameIt = ihnameIt + 1
451 
452  if theaddition[ikey].XTitle != None:
453  newth.SetXTitle(theaddition[ikey].XTitle)
454  if theaddition[ikey].YTitle != None:
455  newth.SetYTitle(theaddition[ikey].YTitle)
456 
457  if theaddition[ikey].Option:
458  newth.Draw(theaddition[ikey].Option)
459  else:
460  newth.Draw()
461 
462  if theaddition[ikey].SetGrid == "true":
463  cv[theaddition[ikey].name].SetGrid()
464 
465  cv[theaddition[ikey].name].Update()
466 
467  # add new histogram to the list
468  newth.SetName(theaddition[ikey].name)
469  newTH1list.append(newth.GetName())
470  thedata[newth.GetName()] = ValElement()
471  thedata[newth.GetName()].TH1s[newth.GetName()] = newth
472  thedata[newth.GetName()].histos[newth.GetName()] = newth.GetName()
473 
474  # write new histograms to file
475  outputroot.cd()
476  newth.Write()
477 
478 
479  if verbose : print("= Create ratio histograms:")
480 
481  thedivition = dh.divide
482  for ikey in thedivition:
483  if verbose : print("== plot name: \""+thedivition[ikey].name+"\" title: \""+"\"")
484  numerator = thedivition[ikey].numerator
485  denominator = thedivition[ikey].denominator
486 
487  #create canvas
488  cv[thedivition[ikey].name] = TCanvas(thedivition[ikey].name,thedivition[ikey].name,700,700)
489 
490  for jkey in thedata:
491  tmpkeys = thedata[jkey].histos.keys()
492  for tmpname in tmpkeys:
493  if tmpname == numerator:
494  numeratorth = thedata[jkey].TH1s[tmpname]
495  if numeratorth is None:
496  print("ERROR: histogram name \""+tmpname+"\" does not exist in file "+thedata[jkey].filename)
497  exit(0)
498  #print "=== numerator histogram: "+numeratorth.GetName() + " from " + thedata[jkey].filename + " mean = " + "%.2f" % round(numeratorth.GetMean(),2) + " weight= " + str(aweight)
499 
500  if tmpname == denominator:
501  denominatorth = thedata[jkey].TH1s[tmpname]
502  if denominatorth is None:
503  print("ERROR: histogram name \""+tmpname+"\" does not exist in file "+thedata[jkey].filename)
504  exit(0)
505  #print "=== denominator histogram: "+denominatorth.GetName() + " from " + thedata[jkey].filename + " mean = " + "%.2f" % round(denominatorth.GetMean(),2) + " weight= " + str(aweight)
506 
507 
508 
509  numeratorth.Sumw2()
510  denominatorth.Sumw2()
511  newth = numeratorth.Clone()
512  newth.Clear()
513  if thedivition[ikey].DivideOption is None:
514  newth.Divide(numeratorth,denominatorth)
515  else:
516  newth.Divide(numeratorth,denominatorth,1.,1.,thedivition[ikey].DivideOption)
517 # if theaddition[ikey].XTitle != None:
518 # newth.SetXTitle(theaddition[ikey].XTitle)
519 # if theaddition[ikey].YTitle != None:
520 # newth.SetYTitle(theaddition[ikey].YTitle)
521 
522  if thedivition[ikey].Option:
523  newth.Draw(thedivition[ikey].Option)
524  else:
525  newth.Draw()
526 
527  cv[thedivition[ikey].name].Update()
528 
529 
530  # pause
531  if option.wait:
532  raw_input( 'Press ENTER to continue\n ' )
533 
534  # add new histogram to the list
535  newth.SetName(thedivition[ikey].name)
536  newTH1list.append(newth.GetName())
537  thedata[newth.GetName()] = ValElement()
538  thedata[newth.GetName()].TH1s[newth.GetName()] = newth
539  thedata[newth.GetName()].histos[newth.GetName()] = newth.GetName()
540 
541  # write new histograms to file
542  outputroot.cd()
543  newth.Write()
544 
545 
546  thesuper = dh.superimpose
547  if verbose : print("= Create superimpose histograms:")
548  for ikey in thesuper:
549  if verbose : print("== plot name: \""+thesuper[ikey].name+"\" title: \""+thesuper[ikey].title+"\"")
550  listname = thesuper[ikey].histos
551  listcolor = thesuper[ikey].color
552  listmarker = thesuper[ikey].marker
553  listlegend = thesuper[ikey].legend
554  #listweight = thesuper[ikey].weight
555  dolegend = False
556  for il in listlegend:
557  if il==None: dolegend = False
558  if verbose : print("dolegend = " +str(dolegend))
559  doNormalize = False
560  doRebin=thesuper[ikey].Rebin
561  if doRebin is not None :
562  doRebin=int(doRebin)
563  if verbose : print("Rebin is ", doRebin)
564  if thesuper[ikey].Normalize == "true":
565  doNormalize = True
566  if verbose : print("normalize = " +str(doNormalize))
567  projectAxis = "no"
568  projectBin = -1 #all
569  if thesuper[ikey].projection == "x": projectAxis = "x"
570  if thesuper[ikey].projection == "y": projectAxis = "y"
571  if thesuper[ikey].bin != None: projectBin = thesuper[ikey].bin
572  profileAxis = "no"
573  if thesuper[ikey].profile == "x": profileAxis = "x"
574  if thesuper[ikey].profile == "y": profileAxis = "y"
575  doFill = False
576  if thesuper[ikey].Fill == "true": doFill = True
577  if verbose : print("fill option:"+ doFill)
578  #create canvas
579  cv[thesuper[ikey].name] = TCanvas(thesuper[ikey].name,thesuper[ikey].title,700,700)
580  #legend
581  aleg = TLegend(0.6,0.4,0.8,0.6)
582  SetOwnership( aleg, 0 )
583  aleg.SetMargin(0.12)
584  aleg.SetTextSize(0.035)
585  aleg.SetFillColor(10)
586  aleg.SetBorderSize(0)
587 
588  isFirst = 1
589  ii = 0
590 
591  stacklist[thesuper[ikey].name] = THStack("astack"+thesuper[ikey].name,thesuper[ikey].title)
592  astack = stacklist[thesuper[ikey].name]
593  for ihname in listname:
594 
595  for jkey in thedata:
596  tmpkeys = thedata[jkey].histos.keys()
597 
598  for tmpname in tmpkeys:
599 
600  if tmpname == ihname:
601  ath = thedata[jkey].TH1s[tmpname]
602  if ath is None:
603  print("ERROR: histogram name \""+tmpname+"\" does not exist in file "+thedata[jkey].filename)
604  exit(0)
605  if verbose : print("=== superimpose histogram: "+ath.GetName() + " mean = " + "%.2f" % round(ath.GetMean(),2))
606  # project 2D histogram if requested
607  if projectAxis == "x":
608  if projectBin == -1:
609  newthpx = ath.ProjectionX(ath.GetName()+"_px",0,-1,"e")
610  else:
611  newthpx = ath.ProjectionX(ath.GetName()+"_px",int(projectBin),int(projectBin),"e")
612  newth = newthpx.Clone()
613  if projectAxis == "y":
614  if projectBin == -1:
615  newthpy = ath.ProjectionY(ath.GetName()+"_py",0,-1,"e")
616  else:
617  newthpx = ath.ProjectionY(ath.GetName()+"_py",int(projectBin),int(projectBin),"e")
618  newth = newthpy.Clone()
619  if profileAxis == "x":
620  newthpx = ath.ProfileX(ath.GetName()+"_px",0,-1,"e")
621  newth = newthpx.Clone()
622  if profileAxis == "y":
623  newthpy = ath.ProfileY(ath.GetName()+"_py",0,-1,"e")
624  newth = newthpy.Clone()
625 
626  # get weight
627  aweight = 1
628  if thedata[jkey].weight != None and thesuper[ikey].Weight=="true":
629  aweight = float( thedata[jkey].weight )
630  if verbose: print(" with weight = " + str(aweight))
631  #if listweight[ii]:
632  # aweight = float( listweight[ii] )
633 
634  # clone original histogram
635  if projectAxis == "no" and profileAxis == "no" :newth = ath.Clone()
636 
637  if doRebin is not None and doRebin>0 :
638  newth.Rebin(doRebin)
639 
640  newth.Sumw2()
641  newth.Scale(aweight)
642 
643  # check if we have color
644  if not listcolor[ii]:
645  listcolor[ii] = 1
646 
647  newth.SetLineColor(int(listcolor[ii]))
648  newth.SetMarkerColor(int(listcolor[ii]))
649 
650  if doFill: newth.SetFillColor(int(listcolor[ii]))
651 
652  if listmarker[ii] != None:
653  newth.SetMarkerStyle(int(listmarker[ii]))
654  # normalize
655  if doNormalize:
656  newth.Scale(1./newth.Integral())
657  #print " "+listlegend[ii]
658 
659  if thesuper[ikey].Labels != None:
660  thelabels = thesuper[ikey].Labels.split(',')
661  ib = 1
662  #print thelabels
663 
664  for ilabel in thelabels:
665  newth.GetXaxis().SetBinLabel(ib,ilabel)
666  #if ib==1:
667  #newth.GetXaxis().SetBinLabel(ib,"")
668  #newth.GetHistogram().GetXaxis().SetBinLabel(ib,ilabel)
669  ib += 1
670  #if aweight==0.0081:
671  # newth.SetBinContent(1, newth.GetBinContent(1) / 0.28756)
672  # if aweight==0.0883:
673  #newth.SetBinContent(1, newth.GetBinContent(1) / 0.01953)
674  #if aweight==0.0731:
675  #newth.SetBinContent(1, newth.GetBinContent(1) / 0.0367)
676  #if aweight==0.4003:
677  #newth.SetBinContent(1, newth.GetBinContent(1) / 0.5683)
678  #if aweight==0.003:
679  #newth.SetBinContent(1, newth.GetBinContent(1) / 0.21173)
680  #if aweight==0.0027:
681  #newth.SetBinContent(1, newth.GetBinContent(1) / 0.26394)
682  #if aweight==0.0034:
683  #newth.SetBinContent(1, newth.GetBinContent(1) / 0.26394)
684 
685 
686  # stack histograms
687  if doFill:
688  if thesuper[ikey].XTitle != None:
689  newth.SetXTitle("")
690  astack.Add(newth,"HIST")
691  elif thesuper[ikey].Option:
692  astack.Add(newth,thesuper[ikey].Option)
693  else:
694  #newth.Fit("landau")
695  astack.Add(newth)
696 
697  astack.SetTitle(thesuper[ikey].title)
698 
699  if isFirst==1:
700  newth.GetPainter().PaintStat(ROOT.gStyle.GetOptStat(),0);
701  isFirst=0
702  tmpsumth = newth.Clone()
703  else:
704  tmpsumth.Add(newth)
705  # newth.SetTitle(thesuper[ikey].title)
706  # if thesuper[ikey].YTitle != None:
707  # newth.SetYTitle(thesuper[ikey].YTitle)
708  # newth.Draw()
709  # isFirst=0
710  #else:
711  # newth.Draw("same")
712  if dolegend and doFill:
713  aleg.AddEntry(newth,listlegend[ii],"F")
714  elif dolegend:
715  aleg.AddEntry(newth,listlegend[ii],"P")
716 
717  newth.SetName(tmpname)
718  outputroot.cd()
719  newth.Write()
720  ii = ii + 1
721 
722 
723  if thesuper[ikey].Maximum != None:
724  astack.SetMaximum( float(thesuper[ikey].Maximum) )
725  if thesuper[ikey].Minimum != None:
726  astack.SetMinimum( float(thesuper[ikey].Minimum) )
727  if thesuper[ikey].Stack == "true":
728  astack.Draw()
729  if thesuper[ikey].Stack == "false" or thesuper[ikey].Stack == None:
730  astack.Draw()
731  astack.Draw("nostack")
732  if thesuper[ikey].XTitle != None:
733  astack.GetHistogram().SetXTitle(thesuper[ikey].XTitle)
734  if thesuper[ikey].YTitle != None:
735  astack.GetHistogram().SetYTitle(thesuper[ikey].YTitle)
736  if doFill:
737  astack.Draw("sameaxis")
738 
739 
740  #thelabels = []
741  #if thesuper[ikey].Labels != None:
742  # thelabels = thesuper[ikey].Labels.split(',')
743  # ib = 1
744  # print thelabels
745 
746  # for ilabel in thelabels:
747  # astack.GetXaxis().SetBinLabel(ib,ilabel)
748  #astack.GetHistogram().GetXaxis().SetBinLabel(ib,ilabel)
749  #ib += 1
750  # astack.Draw()
751  # astack.Draw("sameaxis")
752 
753  if dolegend:
754  aleg.Draw()
755  if thesuper[ikey].SetLogy == "true":
756  cv[thesuper[ikey].name].SetLogy()
757  if thesuper[ikey].SetGrid == "true":
758  cv[thesuper[ikey].name].SetGrid()
759 
760  # test smearing
761  #rn = ROOT.TRandom(12345)
762  #for iibin in range(0,tmpsumth.GetNbinsX()):
763  # tmpsumth.SetBinContent(iibin, rn.Poisson(tmpsumth.GetBinContent(iibin)) )
764  # if tmpsumth.GetBinContent(iibin) == 0:
765  # tmpsumth.SetBinError(iibin, 0 )
766  # else:
767  # tmpsumth.SetBinError(iibin, 1/math.sqrt(tmpsumth.GetBinContent(iibin)) )
768 
769  #tmpsumth.Draw("same E1")
770 
771 
772  if printBanner:
773  tex = TLatex(0.35,0.95,Banner)
774  tex.SetNDC()
775  tex.SetTextSize(0.05)
776  tex.Draw()
777 
778  cv[thesuper[ikey].name].Update()
779  #cv[thesuper[ikey].name].Print("test.png")
780 
781  # pause
782  if option.wait:
783  raw_input( 'Press ENTER to continue\n ' )
784 
785 
786 
787 #**********************************************************************
788 
789 
790  thegraph = dh.graph
791  if verbose : print("= Create graph histograms:")
792  for ikey in thegraph:
793  if verbose : print("== plot name: \""+thegraph[ikey].name+"\" title: \""+thegraph[ikey].title+"\"")
794  listname = thegraph[ikey].histos
795  listcolor = thegraph[ikey].color
796  listmarker = thegraph[ikey].marker
797  listlegend = thegraph[ikey].legend
798  listflavour = thegraph[ikey].flavour
799  #listweight = thegraph[ikey].weight
800  dolegend = False
801  for il in listlegend:
802  if il==None: dolegend = False
803  if verbose : print("dolegend = " +str(dolegend))
804  doNormalize = False
805  if thegraph[ikey].Normalize == "true":
806  doNormalize = True
807  if verbose : print("normalize = " +str(doNormalize))
808  projectAxis = "no"
809  projectBin = -1 #all
810  if thegraph[ikey].projection == "x": projectAxis = "x"
811  if thegraph[ikey].projection == "y": projectAxis = "y"
812  if thegraph[ikey].bin != None: projectBin = thegraph[ikey].bin
813  profileAxis = "no"
814  if thegraph[ikey].profile == "x": profileAxis = "x"
815  if thegraph[ikey].profile == "y": profileAxis = "y"
816  doFill = False
817  if thegraph[ikey].Fill == "true": doFill = True
818  if verbose : print("fill option:"+ doFill)
819  #create canvas
820  cv[thegraph[ikey].name] = TCanvas(thegraph[ikey].name,thegraph[ikey].title,700,700)
821  #legend
822  aleg = TLegend(0.6,0.4,0.8,0.6)
823  SetOwnership( aleg, 0 )
824  aleg.SetMargin(0.12)
825  aleg.SetTextSize(0.035)
826  aleg.SetFillColor(10)
827  aleg.SetBorderSize(0)
828 
829  isFirst = 1
830  ii = 0
831 
832  stacklist[thegraph[ikey].name] = THStack("astack"+thegraph[ikey].name,thegraph[ikey].title)
833  astack = stacklist[thegraph[ikey].name]
834  xVal_val = TVectorD()
835  yVal_val = TVectorD()
836  yBin_val = std.vector(int)()
837  xErr_val = TVectorD()
838  yErr_val = TVectorD()
839  zVal_val = TVectorD()
840  zErr_val = TVectorD()
841  nVal_val = 0
842 
843  xVal_ref = TVectorD()
844  yVal_ref = TVectorD()
845  yBin_ref = std.vector(int)()
846  xErr_ref = TVectorD()
847  yErr_ref = TVectorD()
848  zVal_ref = TVectorD()
849  zErr_ref = TVectorD()
850  nVal_ref = 0
851 
852  RangeMax = 0.005
853  RangeMin = 0.9
854 
855  for ihname in listname:
856 
857  for jkey in thedata:
858  tmpkeys = thedata[jkey].histos.keys()
859 
860  for tmpname in tmpkeys:
861 
862  if tmpname == ihname:
863 
864  ath = thedata[jkey].TH1s[tmpname]
865  if ath is None:
866  print("ERROR: histogram name \""+tmpname+"\" does not exist in file "+thedata[jkey].filename)
867  exit(0)
868  if verbose : print("=== graph histogram: "+ath.GetName() + " mean = " + "%.2f" % round(ath.GetMean(),2))
869  #print listflavour[ii]
870  if listflavour[ii] == "5":
871  #print "iiiiiiiiiii"
872  nBinB = 200 #ath.GetNbinsX()
873  BinWidth = (0.01+ath.GetMaximum())/nBinB
874  BMid = 0.005+BinWidth/2
875  Err = BinWidth
876  for iBinB in range(1,nBinB+1):
877  #BinWidth = (0.01+ath.GetMaximum())/200 #ath.GetBinWidth(iBinB)
878  BMid = BMid+Err #BinWidth #ath.GetBinCenter(iBinB)
879  #newh = TH1(ath)
880  nAthBin = ath.GetNbinsX()-2
881  #newh = TH1(ath)
882  maxInHisto = ath.GetMaximum()
883  minInHisto = ath.GetMinimum()
884  #print minInHisto
885  yClosestInit = 0
886  iBinClosestInit = 0
887  if BMid <= maxInHisto : yClosestInit = maxInHisto + 1
888  else : yClosestInit = minInHisto - 1.0
889  iBinClosest = iBinClosestInit
890  yClosest = yClosestInit
891  for iAthBin in range(1,nAthBin+1):
892  yBin = ath.GetBinContent(iAthBin)
893  dif1 = BMid-yBin
894  if dif1 < 0 : dif1 = yBin-BMid
895  dif2 = yClosest-BMid
896  if dif2 < 0 : dif2 = BMid-yClosest
897  if dif1 < dif2:
898  yClosest = yBin
899  iBinClosest = iAthBin
900  min = BMid-Err/2
901  max = BMid+Err/2
902  #print iBinClosest
903  if yClosest < min or yClosest > max:
904  iBinClosest = 0
905  #print "iji"
906  if iBinClosest > 0 and listmarker[ii] == "8":
907  #print "hhhhhhhhhhhhhhhh"
908  nVal_ref = nVal_ref+1
909  xVal_ref.ResizeTo(nVal_ref)
910  #yBin_ref.ResizeTo(nVal_ref)
911  xErr_ref.ResizeTo(nVal_ref)
912  xVal_ref[nVal_ref-1] = BMid
913  yBin_ref.push_back(iBinClosest)
914  xErr_ref[nVal_ref-1] = ath.GetBinError ( iBinClosest )
915  Err = xErr_ref[nVal_ref-1]
916  if Err < BinWidth : Err = BinWidth
917  elif iBinClosest > 0:
918  nVal_val = nVal_val+1
919  xVal_val.ResizeTo(nVal_val)
920  #yBin_val.ResizeTo(nVal_val)
921  xErr_val.ResizeTo(nVal_val)
922  xVal_val[nVal_val-1] = BMid
923  yBin_val.push_back(iBinClosest)
924  xErr_val[nVal_val-1] = ath.GetBinError ( iBinClosest )
925  Err = xErr_val[nVal_val-1]
926  if Err < BinWidth : Err = BinWidth
927  elif listflavour[ii] == "4" and listmarker[ii] == "8":
928  yVal_ref.ResizeTo(nVal_ref)
929  yErr_ref.ResizeTo(nVal_ref)
930  for iVal in range(0,nVal_ref):
931  yVal_ref[iVal] = ath.GetBinContent (yBin_ref[iVal])
932  if yVal_ref[iVal] > RangeMax : RangeMax = yVal_ref[iVal]
933  yErr_ref[iVal] = ath.GetBinError (yBin_ref[iVal])
934  elif listflavour[ii] == "4":
935  yVal_val.ResizeTo(nVal_val)
936  yErr_val.ResizeTo(nVal_val)
937  for iVal in range(0,nVal_val):
938  yVal_val[iVal] = ath.GetBinContent (yBin_val[iVal])
939  yErr_val[iVal] = ath.GetBinError (yBin_val[iVal])
940  elif listmarker[ii] == "8":
941  zVal_ref.ResizeTo(nVal_ref)
942  zErr_ref.ResizeTo(nVal_ref)
943  for iVal in range(0,nVal_ref):
944  zVal_ref[iVal] = ath.GetBinContent (yBin_ref[iVal])
945  zErr_ref[iVal] = ath.GetBinError (yBin_ref[iVal])
946  if zVal_ref[iVal] < RangeMin : RangeMin = zVal_ref[iVal]
947  else:
948  zVal_val.ResizeTo(nVal_val)
949  zErr_val.ResizeTo(nVal_val)
950  for iVal in range(0,nVal_val):
951  zVal_val[iVal] = ath.GetBinContent (yBin_val[iVal])
952  zErr_val[iVal] = ath.GetBinError (yBin_val[iVal])
953  ii = ii + 1
954 
955  #print xVal_ref.GetNoElements()
956  #print yVal_ref.GetNrows()
957  #print xErr_ref.GetNrows()
958  #print yErr_ref.GetNrows()
959 
960  #graphs = std.vector(TGraphErrors)()
961  graphs = [TGraphErrors(xVal_ref,yVal_ref,xErr_ref,yErr_ref),
962  TGraphErrors(xVal_ref,zVal_ref,xErr_ref,zErr_ref),
963  TGraphErrors(xVal_val,yVal_val,xErr_val,yErr_val),
964  TGraphErrors(xVal_val,zVal_val,xErr_val,zErr_val)]
965  ii = 0
966 
967 
968 
969  for ii in range(0,4):
970 
971  # project 2D histogram if requested
972  #if projectAxis == "x":
973  # if projectBin == -1:
974  # newthpx = ath.ProjectionX(ath.GetName()+"_px",0,-1,"e")
975  # else:
976  # newthpx = ath.ProjectionX(ath.GetName()+"_px",int(projectBin),int(projectBin),"e")
977  # newth = newthpx.Clone()
978  #if projectAxis == "y":
979  # if projectBin == -1:
980  # newthpy = ath.ProjectionY(ath.GetName()+"_py",0,-1,"e")
981  # else:
982  # newthpx = ath.ProjectionY(ath.GetName()+"_py",int(projectBin),int(projectBin),"e")
983  # newth = newthpy.Clone()
984  #if profileAxis == "x":
985  # newthpx = ath.ProfileX(ath.GetName()+"_px",0,-1,"e")
986  # newth = newthpx.Clone()
987  #if profileAxis == "y":
988  # newthpy = ath.ProfileY(ath.GetName()+"_py",0,-1,"e")
989  # newth = newthpy.Clone()
990 
991  # get weight
992  aweight = 1
993  #if thedata[jkey].weight != None and thegraph[ikey].Weight=="true":
994  # aweight = float( thedata[jkey].weight )
995  #if verbose: print " with weight = " + str(aweight)
996  #if listweight[ii]:
997  # aweight = float( listweight[ii] )
998 
999  # clone original histogram
1000  #if projectAxis == "no" and profileAxis == "no" :newth = ath.Clone()
1001 
1002  #newth.Sumw2()
1003  #newth.Scale(aweight)
1004 
1005  # check if we have color
1006  #if not listcolor[ii]:
1007  # listcolor[ii] = 1
1008 
1009  col = 2
1010  mark = 22
1011  if ii == 0 or ii == 2:
1012  col = 1
1013  if ii == 0 or ii == 1:
1014  mark = 8
1015 
1016  graphs[ii].SetLineColor(col)
1017  graphs[ii].SetMarkerStyle(mark)
1018  graphs[ii].SetMarkerColor(col)
1019  graphs[ii].SetTitle(thegraph[ikey].title)
1020  #if doFill: newth.SetFillColor(int(listcolor[ii]))
1021 
1022  #if listmarker[ii] != None:
1023  # newth.SetMarkerStyle(int(listmarker[ii]))
1024  # normalize
1025  #if doNormalize:
1026  # newth.Scale(1./newth.Integral())
1027  #print " "+listlegend[ii]
1028 
1029  #if thegraph[ikey].Labels != None:
1030  # thelabels = thesuper[ikey].Labels.split(',')
1031  # ib = 1
1032  #print thelabels
1033 
1034  # for ilabel in thelabels:
1035  # newth.GetXaxis().SetBinLabel(ib,ilabel)
1036  #if ib==1:
1037  #newth.GetXaxis().SetBinLabel(ib,"")
1038  #newth.GetHistogram().GetXaxis().SetBinLabel(ib,ilabel)
1039  # ib += 1
1040  #if aweight==0.0081:
1041  # newth.SetBinContent(1, newth.GetBinContent(1) / 0.28756)
1042  # if aweight==0.0883:
1043  #newth.SetBinContent(1, newth.GetBinContent(1) / 0.01953)
1044  #if aweight==0.0731:
1045  #newth.SetBinContent(1, newth.GetBinContent(1) / 0.0367)
1046  #if aweight==0.4003:
1047  #newth.SetBinContent(1, newth.GetBinContent(1) / 0.5683)
1048  #if aweight==0.003:
1049  #newth.SetBinContent(1, newth.GetBinContent(1) / 0.21173)
1050  #if aweight==0.0027:
1051  #newth.SetBinContent(1, newth.GetBinContent(1) / 0.26394)
1052  #if aweight==0.0034:
1053  #newth.SetBinContent(1, newth.GetBinContent(1) / 0.26394)
1054 
1055 
1056  # stack histograms
1057  #if doFill:
1058  # if thegraph[ikey].XTitle != None:
1059  # newth.SetXTitle("")
1060  # astack.Add(newth,"HIST")
1061  #elif thegraph[ikey].Option:
1062  # astack.Add(newth,thegraph[ikey].Option)
1063  #else:
1064  #newth.Fit("landau")
1065  # astack.Add(newth)
1066 
1067  #astack.SetTitle(thegraph[ikey].title)
1068 
1069  if isFirst==1:
1070  #graphs[ii].GetPainter().PaintStat(ROOT.gStyle.GetOptStat(),0);
1071  isFirst=0
1072  #tmpsumth = graphs[ii].Clone()
1073  #else:
1074  # tmpsumth.Add(graphs[ii])
1075  # newth.SetTitle(thesuper[ikey].title)
1076  # if thesuper[ikey].YTitle != None:
1077  # newth.SetYTitle(thesuper[ikey].YTitle)
1078  # newth.Draw()
1079  # isFirst=0
1080  #else:
1081  # newth.Draw("same")
1082  #if dolegend and doFill:
1083  # aleg.AddEntry(newth,listlegend[ii],"F")
1084  #elif dolegend:
1085  # aleg.AddEntry(newth,listlegend[ii],"P")
1086 
1087  #graphs[ii].SetName(tmpname)
1088  #if ii == 0 : graphs[ii].Draw()
1089  #else : graphs[ii].Draw("same")
1090  outputroot.cd()
1091  graphs[ii].Write()
1092  ii = ii + 1
1093 
1094 
1095  #if thegraph[ikey].Maximum != None:
1096  # graphs[0].SetMaximum( float(thegraph[ikey].Maximum) )
1097  #if thegraph[ikey].Minimum != None:
1098  # graphs[0].SetMinimum( float(thegraph[ikey].Minimum) )
1099  #if thegraph[ikey].Stack == "true":
1100  # astack.Draw()
1101  #if thegraph[ikey].Stack == "false" or thegraph[ikey].Stack == None:
1102  # astack.Draw()
1103  # astack.Draw("nostack")
1104  if thegraph[ikey].XTitle != None:
1105  graphs[0].GetHistogram().SetXTitle(thegraph[ikey].XTitle)
1106  if thegraph[ikey].YTitle != None:
1107  graphs[0].GetHistogram().SetYTitle(thegraph[ikey].YTitle)
1108  #if doFill:
1109  # astack.Draw("sameaxis")
1110  if RangeMax > 0.5 : RangeMax = 1.5
1111  if RangeMax < 0.5 : RangeMax = RangeMax + 0.05
1112  #RangeMax = 1.1
1113  RangeMin = RangeMin - 0.5*RangeMin
1114  #print RangeMax
1115  #print RangeMin
1116  if RangeMin < 0.00001 : RangeMin = 0.00005
1117  graphs[0].GetYaxis().SetRangeUser(RangeMin,RangeMax)
1118 
1119  #thelabels = []
1120  #if thesuper[ikey].Labels != None:
1121  # thelabels = thesuper[ikey].Labels.split(',')
1122  # ib = 1
1123  # print thelabels
1124 
1125  # for ilabel in thelabels:
1126  # astack.GetXaxis().SetBinLabel(ib,ilabel)
1127  #astack.GetHistogram().GetXaxis().SetBinLabel(ib,ilabel)
1128  #ib += 1
1129  # astack.Draw()
1130  # astack.Draw("sameaxis")
1131 
1132  #h = TH1F()
1133  #h.Draw()
1134  graphs[0].Draw("AP")
1135  graphs[1].Draw("sameP")
1136  graphs[2].Draw("sameP")
1137  graphs[3].Draw("sameP")
1138  if dolegend:
1139  aleg.Draw()
1140  if thegraph[ikey].SetLogy == "true":
1141  cv[thegraph[ikey].name].SetLogy()
1142  if thegraph[ikey].SetGrid == "true":
1143  cv[thegraph[ikey].name].SetGrid()
1144 
1145  # test smearing
1146  #rn = ROOT.TRandom(12345)
1147  #for iibin in range(0,tmpsumth.GetNbinsX()):
1148  # tmpsumth.SetBinContent(iibin, rn.Poisson(tmpsumth.GetBinContent(iibin)) )
1149  # if tmpsumth.GetBinContent(iibin) == 0:
1150  # tmpsumth.SetBinError(iibin, 0 )
1151  # else:
1152  # tmpsumth.SetBinError(iibin, 1/math.sqrt(tmpsumth.GetBinContent(iibin)) )
1153 
1154  #tmpsumth.Draw("same E1")
1155 
1156 
1157  if printBanner:
1158  tex = TLatex(0.35,0.95,Banner)
1159  tex.SetNDC()
1160  tex.SetTextSize(0.05)
1161  tex.Draw()
1162 
1163  cv[thegraph[ikey].name].Update()
1164  save = thegraph[ikey].name
1165  cv[thegraph[ikey].name].Print(save + ".gif")#Print("test.png")
1166 
1167  # pause
1168  if option.wait:
1169  raw_input( 'Press ENTER to continue\n ' )
1170 
1171 
1172 #*********************************************************************
1173 
1174 
1175  if printCanvas:
1176 
1177  for ikey in theaddition:
1178  cv[theaddition[ikey].name].Print(theaddition[ikey].name + "." + printFormat)
1179  for ikey in thesuper:
1180  cv[thesuper[ikey].name].Print(thesuper[ikey].name + "." + printFormat)
1181  for ikey in thegraph:
1182  cv[thegraph[ikey].name].Print(thegraph[ikey].name + "notgood." + printFormat)
1183 
1184 
1185  #outputroot.Write()
1186  #outputroot.Close()
1187 
1188 # if not option.wait:
1189  rep = ''
1190  while not rep in [ 'q', 'Q', '.q', 'qq' 'p']:
1191  rep = raw_input( '\nenter: ["q",".q" to quit] ["p" or "print" to print all canvas]: ' )
1192  if 0<len(rep):
1193  if rep=='quit': rep = 'q'
1194  if rep=='p' or rep=='print':
1195  for ikey in theaddition:
1196  cv[theaddition[ikey].name].Print(theaddition[ikey].name + "." + printFormat)
1197  for ikey in thesuper:
1198  cv[thesuper[ikey].name].Print(thesuper[ikey].name + "." + printFormat)
1199  for ikey in thegraph:
1200  cv[thegraph[ikey].name].Print(thegraph[ikey].name + "." + printFormat)
1201 
1202 
def __init__
Definition: cuy.py:176
def __init__
Definition: cuy.py:128
const uint16_t range(const Frame &aFrame)
def __init__
Definition: cuy.py:162
def startElement
Definition: cuy.py:189
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def exit
Definition: cuy.py:91
tmpgraphname
Definition: cuy.py:187
def parse
Definition: cuy.py:94
def __init__
Definition: cuy.py:119
def __init__
Definition: cuy.py:134
tmpsupername
Definition: cuy.py:186
#define str(s)
def nonzero
Definition: cuy.py:79