22 A very simple way to make plots with ROOT via an XML file. 24 usage: %prog -x <XML configuration file> 25 -b, --batch : run in batch mode without graphics. 26 -c, --create = CREATE: create XML configuration file from a ROOT file. 27 -e, --example = EXAMPLE: generate an example xml file. 28 -f, --flag = FLAG: create a baneer 29 -l, --list = LIST: list of objects in the ROOT file. 30 -p, --prt = PRT: print canvas in the format specified png, ps, eps, pdf, etc. 31 -t, --tag = TAG: tag name for XML configuration file. 32 -v, --verbose : verbose output. 33 -w, --wait : Pause script after plotting a new superposition of histograms. 34 -x, --xml = XML: xml configuration file. 36 Francisco Yumiceva (yumiceva@fnal.gov) 42 import os, string, re, sys, math
47 print "\nCannot load PYROOT, make sure you have setup ROOT in the path" 48 print "and pyroot library is also defined in the variable PYTHONPATH, try:\n" 49 if (os.getenv(
"PYTHONPATH")):
50 print " setenv PYTHONPATH ${PYTHONPATH}:$ROOTSYS/lib\n" 52 print " setenv PYTHONPATH $ROOTSYS/lib\n" 55 from ROOT
import TFile
56 from ROOT
import TCanvas
57 from ROOT
import TLegend
58 from ROOT
import SetOwnership
59 from ROOT
import THStack
60 from ROOT
import TLatex
63 from ROOT
import TGraphErrors
64 from ROOT
import TVectorD
67 from xml.sax
import saxutils, make_parser, handler
68 from xml.sax.handler
import feature_namespaces
76 USAGE = re.compile(
r'(?s)\s*usage: (.*?)(\n[ \t]*\n|$)')
79 "True if options were given" 80 for v
in self.__dict__.itervalues():
81 if v
is not None:
return True 84 optparse.Values.__nonzero__ = nonzero
91 raise SystemExit(msg
or optionstring.replace(
"%prog",sys.argv[0]))
93 def parse(docstring, arglist=None):
95 optionstring = docstring
96 match = USAGE.search(optionstring)
97 if not match:
raise ParsingError(
"Cannot find the option string")
98 optlines = match.group(1).splitlines()
100 p = optparse.OptionParser(optlines[0])
101 for line
in optlines[1:]:
102 opt, help=line.split(
':')[:2]
103 short,long=opt.split(
',')[:2]
106 long=long.split(
'=')[0]
109 p.add_option(short.strip(),long.strip(),
110 action = action, help = help.strip())
111 except (IndexError,ValueError):
112 raise ParsingError(
"Cannot parse the option string correctly")
113 return p.parse_args(arglist)
189 if name ==
'validation':
191 self.
atype = attrs.get(
'type',
None)
193 self.
data[self.
atype].type = attrs.get(
'type',
None)
194 self.
data[self.
atype].filename = attrs.get(
'file',
None)
195 self.
data[self.
atype].release = attrs.get(
'release',
None)
196 self.
data[self.
atype].weight = attrs.get(
'weight',
'')
198 self.
data[self.
atype].histos[attrs.get(
'name',
None)] = attrs.get(
'source',
None)
202 aname = attrs.get(
'name',
None)
205 self.
divide[aname].numerator = attrs.get(
'numerator',
None)
206 self.
divide[aname].denominator = attrs.get(
'denominator',
None)
207 self.
divide[aname].DivideOption = attrs.get(
'DivideOption',
None)
208 self.
divide[aname].Option = attrs.get(
'Option',
None)
209 if name ==
'addition':
210 aname = attrs.get(
'name',
None)
214 self.
addition[aname].title = attrs.get(
'title',
None)
215 self.
addition[aname].YTitle = attrs.get(
'YTitle',
None)
216 self.
addition[aname].XTitle = attrs.get(
'XTitle',
None)
217 self.
addition[aname].Option = attrs.get(
'Option',
None)
218 self.
addition[aname].Weight = attrs.get(
'Wight',
None)
219 self.
addition[aname].Normalize = attrs.get(
'Normalize',
None)
220 self.
addition[aname].SetGrid = attrs.get(
'SetGrid',
None)
221 if name ==
'additionItem':
225 if name ==
'superimpose':
226 aname = attrs.get(
'name',
None)
229 self.
superimpose[aname].title = attrs.get(
'title',
None)
231 self.
superimpose[aname].SetGrid = attrs.get(
'SetGrid',
None)
232 self.
superimpose[aname].Normalize = attrs.get(
'Normalize',
None)
234 self.
superimpose[aname].YTitle = attrs.get(
'YTitle',
None)
235 self.
superimpose[aname].XTitle = attrs.get(
'XTitle',
None)
240 self.
superimpose[aname].Option = attrs.get(
'Option',
None)
241 self.
superimpose[aname].Weight = attrs.get(
'Weight',
None)
248 aname = attrs.get(
'name',
None)
250 self.
graph[aname].name = aname
251 self.
graph[aname].title = attrs.get(
'title',
None)
252 self.
graph[aname].SetLogy = attrs.get(
'SetLogy',
None)
253 self.
graph[aname].SetGrid = attrs.get(
'SetGrid',
None)
254 self.
graph[aname].Normalize = attrs.get(
'Normalize',
None)
255 self.
graph[aname].Stack = attrs.get(
'Stack',
None)
256 self.
graph[aname].YTitle = attrs.get(
'YTitle',
None)
257 self.
graph[aname].XTitle = attrs.get(
'XTitle',
None)
258 self.
graph[aname].projection = attrs.get(
'Projection',
None)
259 self.
graph[aname].bin = attrs.get(
'bin',
None)
260 self.
graph[aname].profile = attrs.get(
'Profile',
None)
261 self.
graph[aname].Fill = attrs.get(
'Fill',
None)
262 self.
graph[aname].Option = attrs.get(
'Option',
None)
263 self.
graph[aname].Weight = attrs.get(
'Weight',
None)
264 self.
graph[aname].Maximum = attrs.get(
'Maximum',
None)
265 self.
graph[aname].Minimum = attrs.get(
'Minimum',
None)
266 self.
graph[aname].Labels = attrs.get(
'Labels',
None)
268 if name ==
'superimposeItem':
276 if name ==
'graphItem':
287 if __name__ ==
'__main__':
298 Banner =
"CMS Preliminary" 303 if not args
and not option:
exit()
306 ROOT.gROOT.SetBatch()
315 ins.SetFilename(option.list)
321 createXML.Verbose(
False)
322 createXML.createXML(
True)
324 createXML.SetTag(option.tag)
325 createXML.SetFilename(option.create)
326 createXML.GetListObjects()
329 if not option.xml:
exit()
332 printFormat = option.prt
340 xmlfile = open(option.xml)
343 print " ERROR: xml file \"" + option.xml +
"\" does not exist" 347 parser = make_parser()
350 parser.setFeature(feature_namespaces, 0)
356 parser.setContentHandler(dh)
359 parser.parse(option.xml)
367 outputroot = TFile(
"cuy.root",
"RECREATE")
378 if verbose :
print "= Processing set called: " + ikey
379 afilename = thedata[ikey].filename
380 if firstFilename ==
'':
381 firstFilename = afilename
383 if thedata[ikey].release !=
None:
384 arelease = thedata[ikey].release
385 if verbose :
print "== filename: " + afilename
386 if verbose :
print "== release: " + arelease
387 if verbose :
print "== weight: " + thedata[ikey].weight
388 thehistos = thedata[ikey].histos
389 afilelist[afilename] = TFile(afilename)
390 if verbose :
print "== get histograms: " 391 histonamekeys = thehistos.keys()
392 for ihname
in histonamekeys:
393 if verbose :
print "=== Histogram name: \""+ ihname +
"\" source: \""+thehistos[ihname]+
"\"" 394 thedata[ikey].TH1s[ihname] = ROOT.gDirectory.Get(thehistos[ihname])
397 print thedata[ikey].TH1s[ihname].GetName()
402 afilelist[firstFilename].cd()
406 theaddition = dh.addition
407 if verbose :
print "= Create addition histograms:" 409 for ikey
in theaddition:
410 if verbose :
print "== plot name: \""+theaddition[ikey].name+
"\" title: \""+theaddition[ikey].title+
"\"" 411 listname = theaddition[ikey].histos
412 listweight = theaddition[ikey].weight
415 cv[theaddition[ikey].name] = TCanvas(theaddition[ikey].name,theaddition[ikey].name,700,700)
419 for ihname
in listname:
421 if listweight[ihnameIt]:
423 aweight =
float(listweight[ihnameIt])
426 tmpkeys = thedata[jkey].histos.keys()
427 for tmpname
in tmpkeys:
428 if tmpname == ihname:
429 ath = thedata[jkey].TH1s[tmpname]
431 print "ERROR: histogram name \""+tmpname+
"\" does not exist in file "+thedata[jkey].filename
433 if verbose :
print "=== add histogram: "+ath.GetName() +
" from " + thedata[jkey].filename +
" mean = " +
"%.2f" % round(ath.GetMean(),2) +
" weight= " +
str(aweight)
436 newth = ath.Clone(theaddition[ikey].name)
438 if theaddition[ikey].Normalize ==
"true":
439 newth.Scale(1/newth.Integral())
445 if theaddition[ikey].Normalize ==
"true":
446 atmpth.Scale(1/atmpth.Integral())
447 atmpth.Scale(aweight)
449 ihnameIt = ihnameIt + 1
451 if theaddition[ikey].XTitle !=
None:
452 newth.SetXTitle(theaddition[ikey].XTitle)
453 if theaddition[ikey].YTitle !=
None:
454 newth.SetYTitle(theaddition[ikey].YTitle)
456 if theaddition[ikey].Option:
457 newth.Draw(theaddition[ikey].Option)
461 if theaddition[ikey].SetGrid ==
"true":
462 cv[theaddition[ikey].name].SetGrid()
464 cv[theaddition[ikey].name].Update()
467 newth.SetName(theaddition[ikey].name)
468 newTH1list.append(newth.GetName())
470 thedata[newth.GetName()].TH1s[newth.GetName()] = newth
471 thedata[newth.GetName()].histos[newth.GetName()] = newth.GetName()
478 if verbose :
print "= Create ratio histograms:" 480 thedivition = dh.divide
481 for ikey
in thedivition:
482 if verbose :
print "== plot name: \""+thedivition[ikey].name+
"\" title: \""+
"\"" 483 numerator = thedivition[ikey].numerator
484 denominator = thedivition[ikey].denominator
487 cv[thedivition[ikey].name] = TCanvas(thedivition[ikey].name,thedivition[ikey].name,700,700)
490 tmpkeys = thedata[jkey].histos.keys()
491 for tmpname
in tmpkeys:
492 if tmpname == numerator:
493 numeratorth = thedata[jkey].TH1s[tmpname]
494 if numeratorth
is None:
495 print "ERROR: histogram name \""+tmpname+
"\" does not exist in file "+thedata[jkey].filename
499 if tmpname == denominator:
500 denominatorth = thedata[jkey].TH1s[tmpname]
501 if denominatorth
is None:
502 print "ERROR: histogram name \""+tmpname+
"\" does not exist in file "+thedata[jkey].filename
509 denominatorth.Sumw2()
510 newth = numeratorth.Clone()
512 if thedivition[ikey].DivideOption
is None:
513 newth.Divide(numeratorth,denominatorth)
515 newth.Divide(numeratorth,denominatorth,1.,1.,thedivition[ikey].DivideOption)
521 if thedivition[ikey].Option:
522 newth.Draw(thedivition[ikey].Option)
526 cv[thedivition[ikey].name].Update()
531 raw_input(
'Press ENTER to continue\n ' )
534 newth.SetName(thedivition[ikey].name)
535 newTH1list.append(newth.GetName())
537 thedata[newth.GetName()].TH1s[newth.GetName()] = newth
538 thedata[newth.GetName()].histos[newth.GetName()] = newth.GetName()
545 thesuper = dh.superimpose
546 if verbose :
print "= Create superimpose histograms:" 547 for ikey
in thesuper:
548 if verbose :
print "== plot name: \""+thesuper[ikey].name+
"\" title: \""+thesuper[ikey].title+
"\"" 549 listname = thesuper[ikey].histos
550 listcolor = thesuper[ikey].color
551 listmarker = thesuper[ikey].marker
552 listlegend = thesuper[ikey].legend
555 for il
in listlegend:
556 if il==
None: dolegend =
False 557 if verbose :
print "dolegend = " +
str(dolegend)
559 doRebin=thesuper[ikey].Rebin
560 if doRebin
is not None :
562 if verbose :
print "Rebin is ", doRebin
563 if thesuper[ikey].Normalize ==
"true":
565 if verbose :
print "normalize = " +
str(doNormalize)
568 if thesuper[ikey].projection ==
"x": projectAxis =
"x" 569 if thesuper[ikey].projection ==
"y": projectAxis =
"y" 570 if thesuper[ikey].bin !=
None: projectBin = thesuper[ikey].bin
572 if thesuper[ikey].profile ==
"x": profileAxis =
"x" 573 if thesuper[ikey].profile ==
"y": profileAxis =
"y" 575 if thesuper[ikey].Fill ==
"true": doFill =
True 576 if verbose :
print "fill option:"+ doFill
578 cv[thesuper[ikey].name] = TCanvas(thesuper[ikey].name,thesuper[ikey].title,700,700)
580 aleg = TLegend(0.6,0.4,0.8,0.6)
581 SetOwnership( aleg, 0 )
583 aleg.SetTextSize(0.035)
584 aleg.SetFillColor(10)
585 aleg.SetBorderSize(0)
590 stacklist[thesuper[ikey].name] = THStack(
"astack"+thesuper[ikey].name,thesuper[ikey].title)
591 astack = stacklist[thesuper[ikey].name]
592 for ihname
in listname:
595 tmpkeys = thedata[jkey].histos.keys()
597 for tmpname
in tmpkeys:
599 if tmpname == ihname:
600 ath = thedata[jkey].TH1s[tmpname]
602 print "ERROR: histogram name \""+tmpname+
"\" does not exist in file "+thedata[jkey].filename
604 if verbose :
print "=== superimpose histogram: "+ath.GetName() +
" mean = " +
"%.2f" % round(ath.GetMean(),2)
606 if projectAxis ==
"x":
608 newthpx = ath.ProjectionX(ath.GetName()+
"_px",0,-1,
"e")
610 newthpx = ath.ProjectionX(ath.GetName()+
"_px",
int(projectBin),
int(projectBin),
"e")
611 newth = newthpx.Clone()
612 if projectAxis ==
"y":
614 newthpy = ath.ProjectionY(ath.GetName()+
"_py",0,-1,
"e")
616 newthpx = ath.ProjectionY(ath.GetName()+
"_py",
int(projectBin),
int(projectBin),
"e")
617 newth = newthpy.Clone()
618 if profileAxis ==
"x":
619 newthpx = ath.ProfileX(ath.GetName()+
"_px",0,-1,
"e")
620 newth = newthpx.Clone()
621 if profileAxis ==
"y":
622 newthpy = ath.ProfileY(ath.GetName()+
"_py",0,-1,
"e")
623 newth = newthpy.Clone()
627 if thedata[jkey].weight !=
None and thesuper[ikey].Weight==
"true":
628 aweight =
float( thedata[jkey].weight )
629 if verbose:
print " with weight = " +
str(aweight)
634 if projectAxis ==
"no" and profileAxis ==
"no" :newth = ath.Clone()
636 if doRebin
is not None and doRebin>0 :
643 if not listcolor[ii]:
646 newth.SetLineColor(
int(listcolor[ii]))
647 newth.SetMarkerColor(
int(listcolor[ii]))
649 if doFill: newth.SetFillColor(
int(listcolor[ii]))
651 if listmarker[ii] !=
None:
652 newth.SetMarkerStyle(
int(listmarker[ii]))
655 newth.Scale(1./newth.Integral())
658 if thesuper[ikey].Labels !=
None:
659 thelabels = thesuper[ikey].Labels.split(
',')
663 for ilabel
in thelabels:
664 newth.GetXaxis().SetBinLabel(ib,ilabel)
687 if thesuper[ikey].XTitle !=
None:
689 astack.Add(newth,
"HIST")
690 elif thesuper[ikey].Option:
691 astack.Add(newth,thesuper[ikey].Option)
696 astack.SetTitle(thesuper[ikey].title)
699 newth.GetPainter().PaintStat(ROOT.gStyle.GetOptStat(),0);
701 tmpsumth = newth.Clone()
711 if dolegend
and doFill:
712 aleg.AddEntry(newth,listlegend[ii],
"F")
714 aleg.AddEntry(newth,listlegend[ii],
"P")
716 newth.SetName(tmpname)
722 if thesuper[ikey].Maximum !=
None:
723 astack.SetMaximum(
float(thesuper[ikey].Maximum) )
724 if thesuper[ikey].Minimum !=
None:
725 astack.SetMinimum(
float(thesuper[ikey].Minimum) )
726 if thesuper[ikey].Stack ==
"true":
728 if thesuper[ikey].Stack ==
"false" or thesuper[ikey].Stack ==
None:
730 astack.Draw(
"nostack")
731 if thesuper[ikey].XTitle !=
None:
732 astack.GetHistogram().SetXTitle(thesuper[ikey].XTitle)
733 if thesuper[ikey].YTitle !=
None:
734 astack.GetHistogram().SetYTitle(thesuper[ikey].YTitle)
736 astack.Draw(
"sameaxis")
754 if thesuper[ikey].SetLogy ==
"true":
755 cv[thesuper[ikey].name].SetLogy()
756 if thesuper[ikey].SetGrid ==
"true":
757 cv[thesuper[ikey].name].SetGrid()
772 tex = TLatex(0.35,0.95,Banner)
774 tex.SetTextSize(0.05)
777 cv[thesuper[ikey].name].Update()
782 raw_input(
'Press ENTER to continue\n ' )
790 if verbose :
print "= Create graph histograms:" 791 for ikey
in thegraph:
792 if verbose :
print "== plot name: \""+thegraph[ikey].name+
"\" title: \""+thegraph[ikey].title+
"\"" 793 listname = thegraph[ikey].histos
794 listcolor = thegraph[ikey].color
795 listmarker = thegraph[ikey].marker
796 listlegend = thegraph[ikey].legend
797 listflavour = thegraph[ikey].flavour
800 for il
in listlegend:
801 if il==
None: dolegend =
False 802 if verbose :
print "dolegend = " +
str(dolegend)
804 if thegraph[ikey].Normalize ==
"true":
806 if verbose :
print "normalize = " +
str(doNormalize)
809 if thegraph[ikey].projection ==
"x": projectAxis =
"x" 810 if thegraph[ikey].projection ==
"y": projectAxis =
"y" 811 if thegraph[ikey].bin !=
None: projectBin = thegraph[ikey].bin
813 if thegraph[ikey].profile ==
"x": profileAxis =
"x" 814 if thegraph[ikey].profile ==
"y": profileAxis =
"y" 816 if thegraph[ikey].Fill ==
"true": doFill =
True 817 if verbose :
print "fill option:"+ doFill
819 cv[thegraph[ikey].name] = TCanvas(thegraph[ikey].name,thegraph[ikey].title,700,700)
821 aleg = TLegend(0.6,0.4,0.8,0.6)
822 SetOwnership( aleg, 0 )
824 aleg.SetTextSize(0.035)
825 aleg.SetFillColor(10)
826 aleg.SetBorderSize(0)
831 stacklist[thegraph[ikey].name] = THStack(
"astack"+thegraph[ikey].name,thegraph[ikey].title)
832 astack = stacklist[thegraph[ikey].name]
833 xVal_val = TVectorD()
834 yVal_val = TVectorD()
835 yBin_val = std.vector(int)()
836 xErr_val = TVectorD()
837 yErr_val = TVectorD()
838 zVal_val = TVectorD()
839 zErr_val = TVectorD()
842 xVal_ref = TVectorD()
843 yVal_ref = TVectorD()
844 yBin_ref = std.vector(int)()
845 xErr_ref = TVectorD()
846 yErr_ref = TVectorD()
847 zVal_ref = TVectorD()
848 zErr_ref = TVectorD()
854 for ihname
in listname:
857 tmpkeys = thedata[jkey].histos.keys()
859 for tmpname
in tmpkeys:
861 if tmpname == ihname:
863 ath = thedata[jkey].TH1s[tmpname]
865 print "ERROR: histogram name \""+tmpname+
"\" does not exist in file "+thedata[jkey].filename
867 if verbose :
print "=== graph histogram: "+ath.GetName() +
" mean = " +
"%.2f" % round(ath.GetMean(),2)
869 if listflavour[ii] ==
"5":
872 BinWidth = (0.01+ath.GetMaximum())/nBinB
873 BMid = 0.005+BinWidth/2
875 for iBinB
in range(1,nBinB+1):
879 nAthBin = ath.GetNbinsX()-2
881 maxInHisto = ath.GetMaximum()
882 minInHisto = ath.GetMinimum()
886 if BMid <= maxInHisto : yClosestInit = maxInHisto + 1
887 else : yClosestInit = minInHisto - 1.0
888 iBinClosest = iBinClosestInit
889 yClosest = yClosestInit
890 for iAthBin
in range(1,nAthBin+1):
891 yBin = ath.GetBinContent(iAthBin)
893 if dif1 < 0 : dif1 = yBin-BMid
895 if dif2 < 0 : dif2 = BMid-yClosest
898 iBinClosest = iAthBin
902 if yClosest < min
or yClosest > max:
905 if iBinClosest > 0
and listmarker[ii] ==
"8":
907 nVal_ref = nVal_ref+1
908 xVal_ref.ResizeTo(nVal_ref)
910 xErr_ref.ResizeTo(nVal_ref)
911 xVal_ref[nVal_ref-1] = BMid
912 yBin_ref.push_back(iBinClosest)
913 xErr_ref[nVal_ref-1] = ath.GetBinError ( iBinClosest )
914 Err = xErr_ref[nVal_ref-1]
915 if Err < BinWidth : Err = BinWidth
916 elif iBinClosest > 0:
917 nVal_val = nVal_val+1
918 xVal_val.ResizeTo(nVal_val)
920 xErr_val.ResizeTo(nVal_val)
921 xVal_val[nVal_val-1] = BMid
922 yBin_val.push_back(iBinClosest)
923 xErr_val[nVal_val-1] = ath.GetBinError ( iBinClosest )
924 Err = xErr_val[nVal_val-1]
925 if Err < BinWidth : Err = BinWidth
926 elif listflavour[ii] ==
"4" and listmarker[ii] ==
"8":
927 yVal_ref.ResizeTo(nVal_ref)
928 yErr_ref.ResizeTo(nVal_ref)
929 for iVal
in range(0,nVal_ref):
930 yVal_ref[iVal] = ath.GetBinContent (yBin_ref[iVal])
931 if yVal_ref[iVal] > RangeMax : RangeMax = yVal_ref[iVal]
932 yErr_ref[iVal] = ath.GetBinError (yBin_ref[iVal])
933 elif listflavour[ii] ==
"4":
934 yVal_val.ResizeTo(nVal_val)
935 yErr_val.ResizeTo(nVal_val)
936 for iVal
in range(0,nVal_val):
937 yVal_val[iVal] = ath.GetBinContent (yBin_val[iVal])
938 yErr_val[iVal] = ath.GetBinError (yBin_val[iVal])
939 elif listmarker[ii] ==
"8":
940 zVal_ref.ResizeTo(nVal_ref)
941 zErr_ref.ResizeTo(nVal_ref)
942 for iVal
in range(0,nVal_ref):
943 zVal_ref[iVal] = ath.GetBinContent (yBin_ref[iVal])
944 zErr_ref[iVal] = ath.GetBinError (yBin_ref[iVal])
945 if zVal_ref[iVal] < RangeMin : RangeMin = zVal_ref[iVal]
947 zVal_val.ResizeTo(nVal_val)
948 zErr_val.ResizeTo(nVal_val)
949 for iVal
in range(0,nVal_val):
950 zVal_val[iVal] = ath.GetBinContent (yBin_val[iVal])
951 zErr_val[iVal] = ath.GetBinError (yBin_val[iVal])
960 graphs = [TGraphErrors(xVal_ref,yVal_ref,xErr_ref,yErr_ref),
961 TGraphErrors(xVal_ref,zVal_ref,xErr_ref,zErr_ref),
962 TGraphErrors(xVal_val,yVal_val,xErr_val,yErr_val),
963 TGraphErrors(xVal_val,zVal_val,xErr_val,zErr_val)]
968 for ii
in range(0,4):
1010 if ii == 0
or ii == 2:
1012 if ii == 0
or ii == 1:
1015 graphs[ii].SetLineColor(col)
1016 graphs[ii].SetMarkerStyle(mark)
1017 graphs[ii].SetMarkerColor(col)
1018 graphs[ii].SetTitle(thegraph[ikey].title)
1103 if thegraph[ikey].XTitle !=
None:
1104 graphs[0].GetHistogram().SetXTitle(thegraph[ikey].XTitle)
1105 if thegraph[ikey].YTitle !=
None:
1106 graphs[0].GetHistogram().SetYTitle(thegraph[ikey].YTitle)
1109 if RangeMax > 0.5 : RangeMax = 1.5
1110 if RangeMax < 0.5 : RangeMax = RangeMax + 0.05
1112 RangeMin = RangeMin - 0.5*RangeMin
1115 if RangeMin < 0.00001 : RangeMin = 0.00005
1116 graphs[0].GetYaxis().SetRangeUser(RangeMin,RangeMax)
1133 graphs[0].Draw(
"AP")
1134 graphs[1].Draw(
"sameP")
1135 graphs[2].Draw(
"sameP")
1136 graphs[3].Draw(
"sameP")
1139 if thegraph[ikey].SetLogy ==
"true":
1140 cv[thegraph[ikey].name].SetLogy()
1141 if thegraph[ikey].SetGrid ==
"true":
1142 cv[thegraph[ikey].name].SetGrid()
1157 tex = TLatex(0.35,0.95,Banner)
1159 tex.SetTextSize(0.05)
1162 cv[thegraph[ikey].name].Update()
1163 save = thegraph[ikey].name
1164 cv[thegraph[ikey].name].Print(save +
".gif")
1168 raw_input(
'Press ENTER to continue\n ' )
1176 for ikey
in theaddition:
1177 cv[theaddition[ikey].name].Print(theaddition[ikey].name +
"." + printFormat)
1178 for ikey
in thesuper:
1179 cv[thesuper[ikey].name].Print(thesuper[ikey].name +
"." + printFormat)
1180 for ikey
in thegraph:
1181 cv[thegraph[ikey].name].Print(thegraph[ikey].name +
"notgood." + printFormat)
1189 while not rep
in [
'q',
'Q',
'.q',
'qq' 'p']:
1190 rep = raw_input(
'\nenter: ["q",".q" to quit] ["p" or "print" to print all canvas]: ' )
1192 if rep==
'quit': rep =
'q' 1193 if rep==
'p' or rep==
'print':
1194 for ikey
in theaddition:
1195 cv[theaddition[ikey].name].Print(theaddition[ikey].name +
"." + printFormat)
1196 for ikey
in thesuper:
1197 cv[thesuper[ikey].name].Print(thesuper[ikey].name +
"." + printFormat)
1198 for ikey
in thegraph:
1199 cv[thegraph[ikey].name].Print(thegraph[ikey].name +
"." + printFormat)
def parse(docstring, arglist=None)
def startElement(self, name, attrs)