In [1]:
import ROOT
# %jsroot on
%load_ext autoreload
%autoreload 2
from utils import HistCollection as HC
import plotter
Welcome to JupyROOT 6.08/02
In [2]:
rebuild_hists=False
hists_TTTT = HC("TTTT", "../data/TTTT_ext_treeProducerSusyMultilepton_tree.root", rebuild_hists=rebuild_hists)
hists_TTZ = HC("TTZ", "../data/TTZToLLNuNu_treeProducerSusyMultilepton_tree.root", rebuild_hists=rebuild_hists)
hists_TTW = HC("TTW", "../data/TTWToLNu_treeProducerSusyMultilepton_tree.root", rebuild_hists=rebuild_hists)
collection added: TTTT
collections present: TTTT
collection added: TTZ
collections present: TTTT, TTZ
collection added: TTW
collections present: TTTT, TTZ, TTW
In [3]:
for id_, count in list(hists_TTTT.GenTop_pdg_id):
    print(id_,"=>",count)
6 => 23966
In [4]:
hists_TTTT.draw()
cannot draw object <ROOT.map<int,int> object at 0x4ed7310>
Warning in <TROOT::Append>: Replacing existing TH1: TTTT:nLepvsnJet (Potential memory leak).
In [5]:
hists_TTZ.draw()
cannot draw object <ROOT.map<int,int> object at 0x5044140>
Warning in <TROOT::Append>: Replacing existing TH1: TTZ:nLepvsnJet (Potential memory leak).
In [6]:
hists_TTW.draw()
Warning in <TROOT::Append>: Replacing existing TH1: TTW:nLepvsnJet (Potential memory leak).
cannot draw object <ROOT.map<int,int> object at 0x5053400>
In [11]:
HC._canvas.Clear()
HC.stack_hist("b_jet_count", title="B-Jet Multiplicity",
              enable_fill=True, normalize_to=1, make_legend=True, draw=True)
HC._canvas.Draw()
In [12]:
HC._canvas.Clear()
HC.stack_hist("lepton_count", title="Lepton Multiplicity",
              enable_fill=True, normalize_to=1, make_legend=True, draw=True)
HC._canvas.Draw()
In [13]:
HC._canvas.Clear()
HC.stack_hist_array(*zip(('jet_count_os_dilepton','Jet Multiplicity for Opposite-Sign Dilepton Events'),
                         ('jet_count_ss_dilepton','Jet Multiplicity for Same-Sign Dilepton Events'),
                         ('jet_count_trilepton', 'Jet Multiplicity for Trilepton Events')
                        ),
                       normalize_to=1,
                       enable_fill=True)
HC._canvas.Draw()
In [14]:
HC._canvas.Clear()
HC.stack_hist_array(*zip(('lepton_count','Count of leptons passing pre-selection'),
                         ('lepton_count_pass_miniiso','Count of leptons passing mini-iso Requirement'),
                        ),
                    normalize_to=1,
                    shape=(1,2),
                    enable_fill=True)
HC._canvas.Draw()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-14-ceb14ae01531> in <module>()
      5                     normalize_to=1,
      6                     shape=(1,2),
----> 7                     enable_fill=True)
      8 HC._canvas.Draw()

/home/caleb/Sources/TTTT/python/utils.py in stack_hist_array(cls, hist_names, titles, shape, **kwargs)
    197         for i, hist_name, title in zip(bin_range(n_hists), hist_names, titles):
    198             cls._canvas.cd(i)
--> 199             hists, labels = cls.get_hist_set(hist_name)
    200             cls.stack_hist(hist_name, title=title, draw=True, **kwargs)
    201         cls._canvas.cd(1).BuildLegend(0.75, 0.75, 0.95, 0.95, "")

/home/caleb/Sources/TTTT/python/utils.py in get_hist_set(cls, attrname)
    122     def get_hist_set(cls, attrname):
    123         labels, hists = zip(*[(sample_name, getattr(h, attrname))
--> 124                               for sample_name, h in cls.collections.items()])
    125         return labels, hists
    126 

/home/caleb/Sources/TTTT/python/utils.py in <listcomp>(.0)
    122     def get_hist_set(cls, attrname):
    123         labels, hists = zip(*[(sample_name, getattr(h, attrname))
--> 124                               for sample_name, h in cls.collections.items()])
    125         return labels, hists
    126 

AttributeError: 'HistCollection' object has no attribute 'lepton_count_pass_miniiso'
In [ ]: