示例#1
0
import re
import os
import copy

from math import log10, floor, pow

from ROOT import TCanvas, TPaveText, TBox, gStyle
from CMGTools.RootTools.DataMC.Stack import Stack

from CMGTools.H2TauTau.proto.plotter.CMS_lumi import CMS_lumi

from CMGTools.H2TauTau.proto.plotter.officialStyle import officialStyle
officialStyle(gStyle)
gStyle.SetLegendBorderSize(0)


def ensureDir(directory):
    if not os.path.exists(directory):
        os.makedirs(directory)


class HistDrawer:
    ocan = None
    can = None
    pad = None
    padr = None

    @classmethod
    def buildCanvas(cls):
        can = cls.can
        pad = cls.pad
        print 'Factor OS', w_mt_ratio_os/w_mt_ratio_os_tight
        fwos *= w_mt_ratio_os/w_mt_ratio_os_tight

    # import pdb; pdb.set_trace()
    print 'FWSS, FWOS', fwss, fwos
    print 'W MT Ratios (SS, OS, all)', w_mt_ratio_ss, w_mt_ratio_os, w_mt_ratio
    return fwss, fwos, w_mt_ratio_ss, w_mt_ratio_os, w_mt_ratio


if __name__ == '__main__':

    import copy
    from optparse import OptionParser
    from CMGTools.RootTools.RootInit import *
    from CMGTools.H2TauTau.proto.plotter.officialStyle import officialStyle
    officialStyle(gStyle)


    parser = OptionParser()
    parser.usage = '''
    %prog <anaDir> <cfgFile>

    cfgFile: analysis configuration file, see CMGTools.H2TauTau.macros.MultiLoop
    anaDir: analysis directory containing all components, see CMGTools.H2TauTau.macros.MultiLoop.
    hist: histogram you want to plot
    '''
    parser.add_option("-H", "--hist", 
                      dest="hist", 
                      help="histogram list",
                      default=None)
    parser.add_option("-C", "--cut", 
示例#3
0
import ROOT, os, numpy
#from officialStyle import officialStyle
from ROOT import TLegend, TCanvas
from CMGTools.RootTools.DataMC.DataMCPlot import DataMCPlot
from CMGTools.H2TauTau.proto.plotter.officialStyle import officialStyle
from ROOT import TColor, kMagenta, kOrange, kRed, kBlue, kGray, kBlack

ROOT.gROOT.SetBatch(True)
officialStyle(ROOT.gStyle)
#ROOT.gStyle.SetOptTitle(1)
#ROOT.gStyle.SetPadLeftMargin(0.18)
#ROOT.gStyle.SetPadBottomMargin(0.15)

col_qcd = TColor.GetColor(250,202,255)
col_tt  = TColor.GetColor(155,152,204)
col_ttv  = TColor.GetColor(155,182,204)
col_ewk = TColor.GetColor(222,90,106)
col_zll = TColor.GetColor(100,182,232)
col_red = TColor.GetColor(248,206,104)

colours = [2, 3, 4, 6, 7, 8]
nbin=20

variables = {
    'bdt_muon_pt': {'nbin':nbin, 'xtitle':'muon pT (GeV)', 'xmin':0, 'xmax':200},
    'bdt_tau_pt': {'nbin':nbin, 'xtitle':'tau pT (GeV)', 'xmin':0, 'xmax':200},
    'bdt_evt_nbjet': {'nbin':5, 'xtitle':'Number of bjet', 'xmin':0, 'xmax':5},
    'bdt_evt_LT': {'nbin':nbin, 'xtitle':'M(#tau, sub leading lepton)', 'xmin':0, 'xmax':400},
    'bdt_evt_njet_or30': {'nbin':10, 'xtitle':'Number of jets (p_{T} > 30GeV)', 'xmin':0, 'xmax':10},
    'bdt_evt_max_jet_eta':{'nbin':10, 'xtitle':'Max. jet #eta', 'xmin':0, 'xmax':5},
    'bdt_evt_sphericity':{'nbin':10, 'xtitle':'Sphericity', 'xmin':0, 'xmax':1},