1 |
#! /usr/bin/env python2
|
2 |
# -*- coding: utf-8 -*-
|
3 |
import ROOT
|
4 |
ROOT.gSystem.Load("libTreeObjects.so")
|
5 |
import argparse
|
6 |
from multiplot import *
|
7 |
from treeFunctions import *
|
8 |
import Styles
|
9 |
Styles.tdrStyle()
|
10 |
|
11 |
import ConfigParser
|
12 |
axisConf = ConfigParser.SafeConfigParser()
|
13 |
axisConf.read("axis.cfg")
|
14 |
|
15 |
if __name__ == "__main__":
|
16 |
arguments = argparse.ArgumentParser( description="Simple EWK" )
|
17 |
arguments.add_argument( "--plot", default="met" )
|
18 |
arguments.add_argument( "--dataset", default="EWK" )
|
19 |
opts = arguments.parse_args()
|
20 |
|
21 |
version = "07"
|
22 |
fileName = "slim%s_V01.%s_tree.root"%(opts.dataset, version )
|
23 |
|
24 |
genE = Dataset( fileName, "genElectronTree", "abs(genElectron.eta) < 1.479", "e_{gen}", 1 )
|
25 |
recE = Dataset( fileName, "photonElectronTree", "@genElectron.size()>0 && photon[0].pixelseed < 0", "e", 2 )
|
26 |
gamma = Dataset( fileName, "photonTree", "@genElectron.size()>0 && photon[0].pixelseed < 0", "#gamma", 3 )
|
27 |
|
28 |
multihisto = Multihisto()
|
29 |
|
30 |
label, unit = readAxisConf( opts.plot, axisConf)
|
31 |
|
32 |
for dataset in [genE, recE, gamma]:
|
33 |
if dataset.label == "e_{gen}":
|
34 |
try:
|
35 |
plot = opts.plot.replace("photon","genElectron")
|
36 |
except:
|
37 |
plot = opts.plot
|
38 |
else:
|
39 |
plot = opts.plot
|
40 |
|
41 |
hist = createHistoFromTree( dataset.tree, plot, "weight*(%s)"%(dataset.additionalCut), firstBin=10, lastBin=200 )
|
42 |
hist.SetTitle(";%s%s;Entries"%(label,unit))
|
43 |
hist.SetLineColor( dataset.color )
|
44 |
hist.SetLineWidth(2)
|
45 |
multihisto.addHisto( hist, dataset.label )
|
46 |
|
47 |
can = ROOT.TCanvas()
|
48 |
can.cd()
|
49 |
multihisto.Draw("hist")
|
50 |
can.SaveAs("pt_%s_new.pdf"%opts.dataset)
|
51 |
|
52 |
|