4 from ROOT
import gROOT, TCanvas, TFile, gStyle, TLegend, TH1F
8 for part
in required.split(
'*'):
9 if got.find(part) == -1:
13 gROOT.SetStyle(
'Plain')
16 gStyle.SetPadGridX(
True)
17 gStyle.SetPadGridY(
True)
20 testFile = TFile(sys.argv[1])
21 refFile = TFile(sys.argv[2])
23 if ylabel !=
'Efficiency' and ylabel !=
'Fake rate':
24 print 'Please specify in the third arg "Efficiency" or "Fake rate". Exiting...'
30 if(option.find(
'maxLog=') != -1):
31 maxLog= float(option[option.find(
'=')+1:])
36 parList = [
'pt',
'eta',
'phi',
'energy']
37 for attr
in dir(validation.TauEfficiencies.plots):
38 if type(getattr(validation.TauEfficiencies.plots,attr))
is cms.PSet:
39 pset = getattr(validation.TauEfficiencies.plots,attr)
40 effPlot = pset.efficiency.value()
42 plotList.append(
'DQMData/'+effPlot.replace(
'#PAR#',par))
47 if Match(plot.lower(),path.lower()):
48 histoList.append(path)
51 legend = TLegend(0.6,0.82,0.6+0.39,0.82+0.17)
53 canvas = TCanvas(
'MultiPlot',
'MultiPlot',validation.standardDrawingStuff.canvasSizeX.value(),validation.standardDrawingStuff.canvasSizeY.value())
54 colors = [2,3,4,6,5,7,28,1,2,3,4,6,5,7,28,1,2,3,4,6,5,7,28,1,2,3,4,6,5,7,28,1,2,3,4,6,5,7,28,1]
56 for histoPath,color
in zip(histoList,colors):
57 testH = testFile.Get(histoPath)
58 if type(testH) != TH1F:
59 print 'Looking for '+histoPath
60 print 'Test plot now found! What the hell are you doing? Exiting...'
62 xAx = histoPath[histoPath.find(
'Eff')+len(
'Eff'):]
63 if hasattr(validation.standardDrawingStuff.xAxes,xAx):
64 testH.GetXaxis().SetTitle( getattr(validation.standardDrawingStuff.xAxes,xAx).xAxisTitle.value())
65 testH.GetYaxis().SetTitle(ylabel)
66 testH.SetMarkerSize(1)
67 testH.SetMarkerStyle(20)
68 testH.SetMarkerColor(color)
69 legend.AddEntry(testH,histoPath[histoPath.rfind(
'/')+1:histoPath.find(
'Eff')],
'p')
73 if ylabel==
'Fake rate':
74 testH.GetYaxis().SetRangeUser(0.001,maxLog)
78 testH.Draw(
'same ex0 l')
79 refH = refFile.Get(histoPath)
80 if type(refH) != TH1F:
81 print 'Ref plot not found! It will not be plotted!'
83 refH.SetLineColor(color)
85 refH.DrawCopy(
'same hist')
86 refH.SetFillColor(color)
87 refH.SetFillStyle(3001)
90 canvas.Print(
'MultipleCompare.pdf')
perl if(1 lt scalar(@::datatypes))