Example #1
0
def makeSVMassPlots(histodict):
	ratplot = RatioPlot('SVMass')
	ratplot.normalized = True
	ratplot.ratiorange = (0.5,1.5)
	ratplot.legpos = (0.65, 0.60)
	ratplot.ratiotitle = 'Data/MC'
	ratplot.extratext = '' #Work in Progress'
	ratplot.tag = "Inclusive"
	# ratplot.tag = "e#mu channel"
	ratplot.tagpos = (0.80,0.55)
	ratplot.add(histodict[('nominal','SVMass',3)], 'N_{trk}=3 t#bar{t} MC', includeInRatio=False)
	ratplot.add(histodict[('data',   'SVMass',3)], 'N_{trk}=3 Data',        includeInRatio=True)
	ratplot.add(histodict[('nominal','SVMass',4)], 'N_{trk}=4 t#bar{t} MC', includeInRatio=False)
	ratplot.add(histodict[('data',   'SVMass',4)], 'N_{trk}=4 Data',        includeInRatio=True)
	ratplot.add(histodict[('nominal','SVMass',5)], 'N_{trk}=5 t#bar{t} MC', includeInRatio=False)
	ratplot.add(histodict[('data',   'SVMass',5)], 'N_{trk}=5 Data',        includeInRatio=True)

	ratplot.reference =     [histodict[('nominal','SVMass',3)]]
	ratplot.reference.append(histodict[('nominal','SVMass',4)])
	ratplot.reference.append(histodict[('nominal','SVMass',5)])

	ratplot.colors = [ROOT.kMagenta+1, ROOT.kMagenta+1,
	                  ROOT.kViolet+2, ROOT.kViolet+2,
	                  ROOT.kAzure+7, ROOT.kAzure+7]

	ratplot.drawoptions =  ['hist', 'PE', 'hist', 'PE', 'hist', 'PE']
	ratplot.markerstyles = [24, 24, 25, 25, 26, 26]
	ratplot.markersizes = len(ratplot.histos)*[1.4]
	ratplot.show('svmassplot',opt.outDir)
	ratplot.saveRatios('svmass_weights',opt.outDir,['SVMass_weight_3','SVMass_weight_4','SVMass_weight_5'])
def makeMassPlot(histos, outname, tag='', subtag=''):
	ratplot = RatioPlot('ratioplot')
	ratplot.normalized = False
	ratplot.ratiotitle = "Ratio wrt 172.5 GeV"
	ratplot.extratext = ''
	ratplot.tag = tag
	ratplot.subtag = subtag
	ratplot.legpos = (0.65, 0.62)
	ratplot.ratiorange = (0.7, 1.3)
	ratplot.titlex = 'm_{svl} [GeV]'
	ratplot.xlabelsize = 28
	ratplot.xtitlesize = 34
	ratplot.ylabelsize = 28
	ratplot.ytitlesize = 34
	ratplot.ytitleoffset = 1.8
	ratplot.xtitleoffset = 3
	ratplot.legendtextsize = 28
	ratplot.legendrowsize = 0.08
	ratplot.reference = [histos[172.5]]
        ratplot.titley = "Combinations / %3.1f GeV" %histos['data'].GetXaxis().GetBinWidth(1)

	####################################################
	# Construct dummy data for now
	# dummy = histos[172.5].Clone('dummy_data')
	# dummy.Reset('ICE')
	# dummy.FillRandom(histos[173.5], ROOT.gRandom.Poisson(histos[172.5].Integral()))
	# ratplot.add(dummy,'Pseudo Data (@173.5 GeV)')
	####################################################

	####################################################
	# REAL DATA:
	ratplot.add(histos['data'], 'Data')
	####################################################

	# histos[MASSESTOPLOT[0]].SetLineStyle(2)
	# histos[MASSESTOPLOT[-1]].SetLineStyle(3)


	for mass in MASSESTOPLOT:
		legentry = 'm_{t} = %5.1f GeV' % mass
		try:
			histo = histos[mass]
			ratplot.add(histo, legentry, includeInRatio=(mass != 172.5))
		except KeyError: pass

	# ratplot.colors = [ROOT.kBlack, ROOT.kAzure-4, ROOT.kAzure+1, ROOT.kAzure-6]

	# ratplot.colors = [ROOT.kBlack, ROOT.kAzure-2, ROOT.kGray, ROOT.kOrange+9]
	ratplot.colors = [ROOT.kBlack, ROOT.kSpring-8, ROOT.kGray+1, ROOT.kOrange+9]

	# ratplot.colors = [ROOT.kBlack, ROOT.kOrange-4, ROOT.kOrange-3, ROOT.kOrange+9]

	ratplot.drawoptions = ['PE', 'hist', 'hist', 'hist']
	ratplot.markerstyles = [20,1,1,1]
	ratplot.markersizes =  [1.5,1,1,1]
	ratplot.ratioydivisions = 405
	ratplot.show("massscan_paper_%s"%outname, opt.outDir)
Example #3
0
def makeSVMassPlots(histodict):
    ratplot = RatioPlot('SVMass')
    ratplot.normalized = True
    ratplot.ratiorange = (0.5, 1.5)
    ratplot.legpos = (0.65, 0.60)
    ratplot.ratiotitle = 'Data/MC'
    ratplot.extratext = ''  #Work in Progress'
    ratplot.tag = "Inclusive"
    # ratplot.tag = "e#mu channel"
    ratplot.tagpos = (0.80, 0.55)
    ratplot.add(histodict[('nominal', 'SVMass', 3)],
                'N_{trk}=3 t#bar{t} MC',
                includeInRatio=False)
    ratplot.add(histodict[('data', 'SVMass', 3)],
                'N_{trk}=3 Data',
                includeInRatio=True)
    ratplot.add(histodict[('nominal', 'SVMass', 4)],
                'N_{trk}=4 t#bar{t} MC',
                includeInRatio=False)
    ratplot.add(histodict[('data', 'SVMass', 4)],
                'N_{trk}=4 Data',
                includeInRatio=True)
    ratplot.add(histodict[('nominal', 'SVMass', 5)],
                'N_{trk}=5 t#bar{t} MC',
                includeInRatio=False)
    ratplot.add(histodict[('data', 'SVMass', 5)],
                'N_{trk}=5 Data',
                includeInRatio=True)

    ratplot.reference = [histodict[('nominal', 'SVMass', 3)]]
    ratplot.reference.append(histodict[('nominal', 'SVMass', 4)])
    ratplot.reference.append(histodict[('nominal', 'SVMass', 5)])

    ratplot.colors = [
        ROOT.kMagenta + 1, ROOT.kMagenta + 1, ROOT.kViolet + 2,
        ROOT.kViolet + 2, ROOT.kAzure + 7, ROOT.kAzure + 7
    ]

    ratplot.drawoptions = ['hist', 'PE', 'hist', 'PE', 'hist', 'PE']
    ratplot.markerstyles = [24, 24, 25, 25, 26, 26]
    ratplot.markersizes = len(ratplot.histos) * [1.4]
    ratplot.show('svmassplot', opt.outDir)
    ratplot.saveRatios(
        'svmass_weights', opt.outDir,
        ['SVMass_weight_3', 'SVMass_weight_4', 'SVMass_weight_5'])
def main(args, opt):
	os.system('mkdir -p %s'%opt.outDir)
	ROOT.gStyle.SetOptTitle(0)
	ROOT.gStyle.SetOptStat(0)
	ROOT.gROOT.SetBatch(1)

	# Construct histograms
	peInputFile = ROOT.TFile.Open(args[0], 'READ')
	masshistos = {}
	for mass in ALLMASSES+['data']:
		masshist = None
		masstag = mass
		if type(mass) == float:
			masstag = 'nominal_'+str(mass).replace('.','v')

		for trk,_ in NTRKBINS:
			ihist = peInputFile.Get('%s/SVLMass_inclusive_optmrank_%s_%d'%(masstag,masstag,trk))
			try:
				masshist.Add(ihist)
			except AttributeError:
				try:
					masshist = ihist.Clone(masstag)
				except ReferenceError:
					print "Histogram not found: %s/SVLMass_inclusive_optmrank_%s_%d"%(masstag,masstag,trk)
					continue
		masshistos[mass] = masshist

	ratplot = RatioPlot('ratioplot')
	ratplot.normalized = False
	ratplot.ratiotitle = "Ratio wrt 172.5 GeV"
	ratplot.tag = 'All channels combined'
	ratplot.extratext = 'Preliminary'
	ratplot.rebin = 1
	ratplot.legpos = (0.55, 0.15)
	ratplot.ratiorange = (0.5, 1.5)
	ratplot.reference = [masshistos[172.5]]

	# Construct dummy data for now
	dummy = masshistos[172.5].Clone('dummy_data')
	dummy.Reset('ICE')
	dummy.FillRandom(masshistos[173.5], ROOT.gRandom.Poisson(masshistos[172.5].Integral()))
	ratplot.add(dummy,'Pseudo Data (@173.5 GeV)')

	####################################################
	# REAL DATA:
	# ratplot.add(masshistos['data'], 'Data')
	####################################################

	for mass in MASSESTOPLOT:
		legentry = 'MC (m_{top} = %5.1f GeV)' % mass
		try:
			histo = masshistos[mass]
			ratplot.add(histo, legentry, includeInRatio=(mass != 172.5))
		except KeyError: pass

	ratplot.colors = [ROOT.kBlack, ROOT.kAzure-4, ROOT.kAzure+1, ROOT.kAzure-6]
	# ratplot.colors = [ROOT.kBlack, ROOT.kOrange-4, ROOT.kOrange-3, ROOT.kOrange+9]

	ratplot.drawoptions = ['PE', 'hist', 'hist', 'hist']
	ratplot.markerstyles = [20,1,1,1]
	ratplot.markersizes =  [1.5,1,1,1]
	ratplot.show("massscan_paper_optmrank", opt.outDir)

	return 0