Exemplo n.º 1
0
 def __init__(self):
     dataset_axis = hist.Cat('dataset', 'dataset')
     lxy_axis = hist.Bin('lxy', 'lxy [cm]', 100, 0, 700)
     reso_axis = hist.Bin('reso', '($p_T$(reco)-$p_T$(gen))/$p_T$(gen)',
                          100, -1, 2)
     reco_axis = hist.Cat('reco', 'reco type')
     self._accumulator = processor.dict_accumulator({
         'lxy':
         hist.Hist('Counts', dataset_axis, lxy_axis, reco_axis),
         'lxy-pf':
         hist.Hist('Counts', dataset_axis, lxy_axis, reco_axis),
         'lxy-dsa':
         hist.Hist('Counts', dataset_axis, lxy_axis, reco_axis),
         'reso':
         hist.Hist('Norm. Frequency/0.03', dataset_axis, reso_axis,
                   reco_axis),
     })
Exemplo n.º 2
0
def test_fill_none():
    dummy = hist.Hist("Dummy", hist.Bin("x", "asdf", 1, 0, 1))
    with pytest.raises(ValueError):
        # attempt to fill with none
        dummy.fill(x=ak.Array([0.1, None, 0.3]))

    # allow fill when masked type but no Nones remain
    dummy.fill(x=ak.Array([0.1, None, 0.3])[[True, False, True]])
Exemplo n.º 3
0
    def __init__(self):
        dataset_axis = hist.Cat("dataset", "Primary dataset")
        mass_axis = hist.Bin("mass", r"$m_{\mu\mu}$ [GeV]", 30000, 0.25, 300)

        self._accumulator = processor.dict_accumulator({
                                                       'mass': hist.Hist("Counts", dataset_axis, mass_axis),
                                                       'cutflow': processor.defaultdict_accumulator(int),
                                                       })
Exemplo n.º 4
0
    def __init__(self, data_type='bkg'):
        self.data_type = data_type

        dataset_axis = hist.Cat('dataset', 'dataset')
        dphi_axis = hist.Bin('dphi', '$\Delta\phi$', 8, 0, np.pi)
        categ_axis = hist.Bin('categ', 'categ', 4, 1, 5)
        self._accumulator = processor.dict_accumulator({
            'chan-4mu':
            hist.Hist('Counts', dataset_axis, dphi_axis, categ_axis),
            'chan-2mu2e':
            hist.Hist('Counts', dataset_axis, dphi_axis, categ_axis),
        })

        self.pucorrs = get_pu_weights_function()
        ## NOT applied for now
        self.nlo_w = get_nlo_weight_function('w')
        self.nlo_z = get_nlo_weight_function('z')
    def __init__(self, data_type='sig-2mu2e', lj_type='neutral'):
        self.data_type = data_type
        self.lj_type = lj_type

        dataset_axis = hist.Cat('dataset', 'dataset')
        channel_axis = hist.Bin('channel', 'channel', 3, 0, 3)
        dist_axis = hist.Bin('dist', 'two track min distance [cm]', 50, 0, 200)
        self._accumulator = processor.dict_accumulator({
            'mindist':
            hist.Hist('Counts', dataset_axis, dist_axis, channel_axis),
            'maxdist':
            hist.Hist('Counts', dataset_axis, dist_axis, channel_axis),
        })
        self.pucorrs = get_pu_weights_function()
        ## NOT applied for now
        self.nlo_w = get_nlo_weight_function('w')
        self.nlo_z = get_nlo_weight_function('z')
Exemplo n.º 6
0
    def __init__(self, columns=[], canaries=[]):
        self._columns = columns
        self._canaries = canaries
        dataset_axis = hist.Cat("dataset", "Primary dataset")
        mass_axis = hist.Bin("mass", r"$m_{\mu\mu}$ [GeV]", 30000, 0.25, 300)
        pt_axis = hist.Bin("pt", r"$p_{T}$ [GeV]", 30000, 0.25, 300)

        self._accumulator = processor.dict_accumulator({
            'mass':
            hist.Hist("Counts", dataset_axis, mass_axis),
            'pt':
            hist.Hist("Counts", dataset_axis, pt_axis),
            'cutflow':
            processor.defaultdict_accumulator(int),
            'worker':
            processor.set_accumulator(),
        })
    def gentops_comparison_hists(self):
        histo_dict = {}
        histo_dict["pt"] = hist.Hist("Events", self.dataset_axis,
                                     self.object_axis, self.flag_axis,
                                     self.pt_axis)
        histo_dict["eta"] = hist.Hist("Events", self.dataset_axis,
                                      self.object_axis, self.flag_axis,
                                      self.eta_axis)
        histo_dict["phi"] = hist.Hist("Events", self.dataset_axis,
                                      self.object_axis, self.flag_axis,
                                      self.phi_axis)
        histo_dict["mass"] = hist.Hist("Events", self.dataset_axis,
                                       self.object_axis, self.flag_axis,
                                       self.mass_axis)
        histo_dict["energy"] = hist.Hist("Events", self.dataset_axis,
                                         self.object_axis, self.flag_axis,
                                         self.energy_axis)
        histo_dict["ctstar"] = hist.Hist("Events", self.dataset_axis,
                                         self.object_axis, self.flag_axis,
                                         self.ctstar_axis)
        histo_dict["ctstar_abs"] = hist.Hist("Events", self.dataset_axis,
                                             self.object_axis, self.flag_axis,
                                             self.ctstar_abs_axis)

        return histo_dict
Exemplo n.º 8
0
    def __init__(self, data_type='bkg'):
        dataset_axis = hist.Cat('dataset', 'dataset')
        dphi_axis = hist.Bin('dphi', '$\Delta\phi$', 20, 0, np.pi)
        channel_axis = hist.Bin('channel', 'channel', 3, 0, 3)
        self._accumulator = processor.dict_accumulator({
            'dphi-neu': hist.Hist('Counts', dataset_axis, dphi_axis, channel_axis),
            'dphi-cha': hist.Hist('Counts', dataset_axis, dphi_axis, channel_axis),
            'dphi-0mucha': hist.Hist('Counts', dataset_axis, dphi_axis, channel_axis),
            'dphi-1mucha': hist.Hist('Counts', dataset_axis, dphi_axis, channel_axis),
            'dphi-01mucha': hist.Hist('Counts', dataset_axis, dphi_axis, channel_axis),
        })

        self.pucorrs = get_pu_weights_function()
        ## NOT applied for now
        self.nlo_w = get_nlo_weight_function('w')
        self.nlo_z = get_nlo_weight_function('z')

        self.data_type = data_type
Exemplo n.º 9
0
 def __init__(self):
     self._accumulator = processor.dict_accumulator({
         "sumw": processor.defaultdict_accumulator(float),
         "mass": hist.Hist(
             "Events",
             hist.Cat("dataset", "Dataset"),
             hist.Bin("mass", "$m_{\mu\mu}$ [GeV]", 60, 60, 120),
         ),
     })
Exemplo n.º 10
0
 def __init__(self):
     self._accumulator = processor.dict_accumulator({
         "sumw": processor.defaultdict_accumulator(float),
         "nTracksHist": hist.Hist(
             "Events",
             hist.Cat("dataset", "Dataset"),
             hist.Bin("nTracks", "multiplicity", 50, 0, 250),
         ),
     })
Exemplo n.º 11
0
    def __init__(self):
        dataset_axis = hist.Cat("dataset", "Primary dataset")
        met_axis = hist.Bin("met", r"$p_{T}^{miss}$ (GeV)", 600, 0.25, 1000)
        jet_pt_axis = hist.Bin("jetpt", r"$p_{T}$", 600, 0.25, 1000)
        new_axis = hist.Bin("new_variable",
                            r"Leading jet $p_{T}$ + $p_{T}^{miss}$ (GeV) ",
                            600, 0.25, 1000)

        self._accumulator = processor.dict_accumulator({
            "met":
            hist.Hist("Counts", dataset_axis, met_axis),
            "jet_pt":
            hist.Hist("Counts", dataset_axis, jet_pt_axis),
            "jet_pt_met100":
            hist.Hist("Counts", dataset_axis, jet_pt_axis),
            "new_variable":
            hist.Hist("Counts", dataset_axis, new_axis),
        })
Exemplo n.º 12
0
 def __init__(self):
     # Bins and categories for the histogram are defined here. For format, see https://coffeateam.github.io/coffea/stubs/coffea.hist.hist_tools.Hist.html && https://coffeateam.github.io/coffea/stubs/coffea.hist.hist_tools.Bin.html
     self._columns = ['MET_pt']
     dataset_axis = hist.Cat("dataset", "")
     MET_axis = hist.Bin("MET", "MET [GeV]", 50, 0, 100)
     # The accumulator keeps our data chunks together for histogramming. It also gives us cutflow, which can be used to keep track of data.
     self._accumulator = processor.dict_accumulator({
         'MET': hist.Hist("Counts", dataset_axis, MET_axis),
         'cutflow': processor.defaultdict_accumulator(int)
     })
Exemplo n.º 13
0
 def __init__(self, year='2017'):
     self._year = year
     self._accumulator = hist.Hist(
         'Events',
         hist.Cat('btag', 'BTag WP pass/fail'),
         hist.Bin('flavor', 'Jet hadronFlavour', [0, 4, 5, 6]),
         hist.Bin('pt', 'Jet pT',
                  [20, 30, 50, 70, 100, 140, 200, 300, 600, 1000]),
         hist.Bin('abseta', 'Jet abseta', [0, 1.4, 2.0, 2.5]),
     )
Exemplo n.º 14
0
    def __init__(self, columns=[]):
        self._columns = columns
        dataset_axis = hist.Cat("dataset", "Primary dataset")
        mass_axis = hist.Bin("mass", r"$m_{\mu\mu}$ [GeV]", 30000, 0.25, 300)
        pt_axis = hist.Bin("pt", r"$p_{T}$ [GeV]", 30000, 0.25, 300)

        self.expected_usermeta = {
            "ZJets": ("someusermeta", "hello"),
            "Data": ("someusermeta2", "world"),
        }

        self._accumulator = processor.dict_accumulator({
            "mass":
            hist.Hist("Counts", dataset_axis, mass_axis),
            "pt":
            hist.Hist("Counts", dataset_axis, pt_axis),
            "cutflow":
            processor.defaultdict_accumulator(int),
        })
Exemplo n.º 15
0
    def make_selection_hists(self):
        histo_dict = {}
        #histo_dict['mtt'] = hist.Hist("Events", self.dataset_axis, self.sys_axis, self.jetmult_axis, self.leptype_axis, self.btag_axis, self.lepcat_axis, self.mtt_axis)

        #histo_dict['tlep_ctstar']     = hist.Hist("Events", self.dataset_axis, self.sys_axis, self.jetmult_axis, self.leptype_axis, self.btag_axis, self.lepcat_axis, self.ctstar_axis)
        #histo_dict['tlep_ctstar_abs'] = hist.Hist("Events", self.dataset_axis, self.sys_axis, self.jetmult_axis, self.leptype_axis, self.btag_axis, self.lepcat_axis, self.ctstar_abs_axis)

        histo_dict['mtt_vs_tlep_ctstar_abs'] = hist.Hist("Events", self.dataset_axis, self.sys_axis, self.jetmult_axis, self.leptype_axis, self.btag_axis, self.lepcat_axis, self.pdf_axis, self.mtt_axis, self.ctstar_abs_axis)

        return histo_dict
Exemplo n.º 16
0
    def __init__(self, region='SR', data_type='sig-2mu2e'):
        self.region = region
        self.data_type = data_type

        dataset_axis = hist.Cat('dataset', 'dataset')
        channel_axis = hist.Bin('channel', 'channel', 3, 0, 3)
        bool_axis = hist.Bin('boolean', 'true/false', 2, 0, 2)
        vxy_axis = hist.Bin('vxy', 'vxy [cm]', 100, 0, 20)

        self._accumulator = processor.dict_accumulator({
            'vertexgood':
            hist.Hist('Frequency', dataset_axis, channel_axis, bool_axis),
            'vxy':
            hist.Hist('Counts', dataset_axis, channel_axis, vxy_axis),
        })
        self.pucorrs = get_pu_weights_function()
        ## NOT applied for now
        self.nlo_w = get_nlo_weight_function('w')
        self.nlo_z = get_nlo_weight_function('z')
Exemplo n.º 17
0
    def __init__(self, year='2017'):
        self._year = year
        self._triggers = {
            '2017': [
                'PFHT1050',
                'AK8PFJet400_TrimMass30',
                'AK8PFJet420_TrimMass30',
                'AK8PFHT800_TrimMass50',
                'PFJet500',
                'AK8PFJet500',
                'AK8PFJet550',
                'CaloJet500_NoJetID',
                'CaloJet550_NoJetID', 
                 ]
        }
        self._muontriggers = {
            '2017': [
                'Mu50', 
                #'TkMu50',
                 ]
        }
        self._accumulator = processor.dict_accumulator({
            'sumw': processor.defaultdict_accumulator(float),
            'templates': hist.Hist(
                'Events',
                hist.Cat('dataset', 'Dataset'),
                hist.Cat('region', 'Region'),
                #hist.Cat('systematic', 'Systematic'),
                hist.Bin('pt', r'Jet $p_{T}$ [GeV]', 25,500,1000),#[525,575,625,700,800,1500]),#np.arange(525,2000,50)),
                hist.Bin('msd', r'Jet $m_{sd}$', 23, 40, 300),
                #hist.Bin('gru', 'GRU value',20,0.,1.),
                #hist.Bin('gruddt', 'GRU$^{DDT}$ value',[-1,0,1]),
                #hist.Bin('rho', 'jet rho', 20,-5.5,-2.),#[-5.5,-5.,-4.5,-4.,-3.5,-3.,-2.5,-2.]),
                #hist.Bin('n2', 'N$_2$ value', 20, 0., 0.5),
                #hist.Bin('n2ddt', 'N$_2^{DDT}$ value', 21, -0.3, 0.3),
                #hist.Bin('Vmatch', 'Matched to V', [-1,0,1]),
                hist.Bin('in_v3_ddt', 'IN$^{DDT}$  value', 20, -1, 0.5),
                hist.Bin('mu_pt', 'Leading muon p_{T}', 20,50., 700.),
                hist.Bin('mu_pfRelIso04_all', 'Muon pfRelIso04 isolation', 20,0.,1.),
                #hist.Bin('nPFConstituents', 'Number of PF candidates',41,20,60),
                #hist.Bin('nJet', 'Number of fat jets', 10,0,9), 
            ),
            #'gruddt' : hist.Hist(
            #    hist.Cat('dataset', 'Dataset'),
            #    hist.Cat('region', 'Region'),
            #'cutflow': hist.Hist(
            #    'Events',
            #    hist.Cat('dataset', 'Dataset'),
            #    hist.Cat('region', 'Region'),
            #    hist.Bin('cut', 'Cut index', 11, 0, 11),
            #),
            'cutflow_signal' : processor.defaultdict_accumulator(partial(processor.defaultdict_accumulator, float)),
            'cutflow_ttbar_muoncontrol' : processor.defaultdict_accumulator(partial(processor.defaultdict_accumulator, float)),

        })
Exemplo n.º 18
0
def plot_mhiggs(tag, y1, label1, y2, label2, title=''):
    fig = plt.figure()
    hmh = hist.Hist("Events", hist.Cat("process", title),
                    hist.Bin("mhiggs", "Higgs mass [GeV]", 60, 0, 300))
    hmh.fill(process=label1, mhiggs=y1)
    hmh.fill(process=label2, mhiggs=y2)
    ax = hist.plot1d(hmh, overlay="process", stack=False)
    filename = tag + '.pdf'
    fig.savefig(filename)
    cprint('imgcat ' + filename, 'green')
    return
Exemplo n.º 19
0
    def genpartons_hists(self):
        histo_dict = {}
        histo_dict["pt"] = hist.Hist("Events", self.dataset_axis,
                                     self.object_axis, self.ttdecaymode_axis,
                                     self.pt_axis)
        histo_dict["eta"] = hist.Hist("Events", self.dataset_axis,
                                      self.object_axis, self.ttdecaymode_axis,
                                      self.eta_axis)
        histo_dict["phi"] = hist.Hist("Events", self.dataset_axis,
                                      self.object_axis, self.ttdecaymode_axis,
                                      self.phi_axis)
        histo_dict["mass"] = hist.Hist("Events", self.dataset_axis,
                                       self.object_axis, self.ttdecaymode_axis,
                                       self.mass_axis)
        histo_dict["energy"] = hist.Hist("Events", self.dataset_axis,
                                         self.object_axis,
                                         self.ttdecaymode_axis,
                                         self.energy_axis)

        return histo_dict
Exemplo n.º 20
0
def fill_lepton_kinematics():
    import uproot
    import uproot_methods
    import awkward

    # histogram creation and manipulation
    from coffea import hist

    fin = uproot.open("HZZ.root")
    tree = fin["events"]

    arrays = {
        k.replace('Electron_', ''): v
        for k, v in tree.arrays("Electron_*", namedecode='ascii').items()
    }
    p4 = uproot_methods.TLorentzVectorArray.from_cartesian(
        arrays.pop('Px'),
        arrays.pop('Py'),
        arrays.pop('Pz'),
        arrays.pop('E'),
    )
    electrons = awkward.JaggedArray.zip(p4=p4, **arrays)

    arrays = {
        k.replace('Muon_', ''): v
        for k, v in tree.arrays("Muon_*", namedecode='ascii').items()
    }
    p4 = uproot_methods.TLorentzVectorArray.from_cartesian(
        arrays.pop('Px'),
        arrays.pop('Py'),
        arrays.pop('Pz'),
        arrays.pop('E'),
    )
    muons = awkward.JaggedArray.zip(p4=p4, **arrays)

    # Two types of axes exist presently: bins and categories
    lepton_kinematics = hist.Hist(
        "Events",
        hist.Cat("flavor", "Lepton flavor"),
        hist.Bin("pt", "$p_{T}$", 19, 10, 100),
        hist.Bin("eta", r"$\eta$", [-2.5, -1.4, 0, 1.4, 2.5]),
    )

    # Pass keyword arguments to fill, all arrays must be flat numpy arrays
    # User is responsible for ensuring all arrays have same jagged structure!
    lepton_kinematics.fill(flavor="electron",
                           pt=electrons['p4'].pt.flatten(),
                           eta=electrons['p4'].eta.flatten())
    lepton_kinematics.fill(flavor="muon",
                           pt=muons['p4'].pt.flatten(),
                           eta=muons['p4'].eta.flatten())

    return lepton_kinematics
Exemplo n.º 21
0
    def __init__(self, region='SR', data_type='bkg'):
        self.region = region
        self.data_type = data_type

        dataset_axis = hist.Cat('dataset', 'dataset')
        pt_axis = hist.Bin('pt', '$p_T$ [GeV]', 100, 0, 200)
        invm_axis = hist.Bin('invm', 'mass [GeV]', 100, 0, 200)
        mass_axis = hist.Bin('mass', 'mass [GeV]', 100, 0, 200)
        channel_axis = hist.Bin('channel', 'channel', 3, 0, 3)

        self._accumulator = processor.dict_accumulator({
            'pt0':
            hist.Hist('Counts', dataset_axis, pt_axis, channel_axis),
            'pt1':
            hist.Hist('Counts', dataset_axis, pt_axis, channel_axis),
            'ptegm':
            hist.Hist('Counts', dataset_axis, pt_axis,
                      channel_axis),  # leading EGM-type for 2mu2e channel
            'ptmu':
            hist.Hist('Counts', dataset_axis, pt_axis,
                      channel_axis),  # leading mu-type for 2mu2e channel
            'invm':
            hist.Hist('Counts', dataset_axis, invm_axis, channel_axis),
            'massmu':
            hist.Hist('Counts', dataset_axis, mass_axis,
                      channel_axis),  # mass of mu-type leptonjet
        })

        self.pucorrs = get_pu_weights_function()
        ## NOT applied for now
        self.nlo_w = get_nlo_weight_function('w')
        self.nlo_z = get_nlo_weight_function('z')
Exemplo n.º 22
0
    def __init__(self, data_type='bkg', bothNeutral=True):
        dataset_axis = hist.Cat('dataset', 'dataset')
        sumpt_axis = hist.Bin('sumpt', '$\sum p_T$ [GeV]', 50, 0, 50)
        iso_axis = hist.Bin('iso', 'Isolation', np.arange(0, 1, 0.04))
        channel_axis = hist.Bin('channel', 'channel', 3, 0, 3)
        self._accumulator = processor.dict_accumulator({
            'sumpt':
            hist.Hist('Counts', dataset_axis, sumpt_axis, channel_axis),
            'pfiso':
            hist.Hist('Counts', dataset_axis, iso_axis, channel_axis),
            'isodbeta':
            hist.Hist('Counts', dataset_axis, iso_axis, channel_axis),
            'minpfiso':
            hist.Hist('Counts', dataset_axis, iso_axis, channel_axis),
            'maxpfiso':
            hist.Hist('Counts', dataset_axis, iso_axis, channel_axis),
            'lj0pfiso':
            hist.Hist('Counts', dataset_axis, iso_axis, channel_axis),
        })

        self.pucorrs = get_pu_weights_function()
        ## NOT applied for now
        self.nlo_w = get_nlo_weight_function('w')
        self.nlo_z = get_nlo_weight_function('z')

        self.data_type = data_type
        self.bothNeutral = bothNeutral
Exemplo n.º 23
0
def test_boost_conversion():
    import boost_histogram as bh

    dummy = hist.Hist(
        "Dummy",
        hist.Cat("sample", "sample"),
        hist.Bin("dummy", "Number of events", 1, 0, 1),
    )
    dummy.fill(sample="test", dummy=1, weight=0.5)
    dummy.fill(sample="test", dummy=0.1)
    dummy.fill(sample="test2", dummy=-0.1)
    dummy.fill(sample="test3", dummy=0.5, weight=0.1)
    dummy.fill(sample="test3", dummy=0.5, weight=0.9)

    h = dummy.to_boost()
    assert len(h.axes) == 2
    assert h[bh.loc("test"), bh.loc(1)].value == 0.5
    assert h[bh.loc("test"), bh.loc(100)].value == 0.5
    assert h[bh.loc("test"), bh.loc(1)].variance == 0.25
    assert h[0, 0].value == 1.0
    assert h[0, 0].variance == 1.0
    assert h[1, 0].value == 0.0
    assert h[bh.loc("test2"), 0].value == 0.0
    assert h[1, bh.underflow].value == 1.0
    assert h[bh.loc("test3"), bh.loc(0.5)].value == 1.0
    assert h[bh.loc("test3"), bh.loc(0.5)].variance == 0.1 * 0.1 + 0.9 * 0.9

    dummy = hist.Hist(
        "Dummy",
        hist.Cat("sample", "sample"),
        hist.Bin("dummy", "Number of events", 1, 0, 1),
    )
    dummy.fill(sample="test", dummy=0.1)
    dummy.fill(sample="test", dummy=0.2)
    dummy.fill(sample="test2", dummy=0.2)
    # No sumw2 -> simple bh storage
    h = dummy.to_boost()
    assert len(h.axes) == 2
    assert h[0, 0] == 2.0
    assert h[1, 0] == 1.0
Exemplo n.º 24
0
    def __init__(self, samples, wc_names_lst=[], do_errors=False, dtype=np.float32):
        self._samples = samples
        self._dtype = dtype

        # Create the histograms
        # In general, histograms depend on 'sample', 'channel' (final state) and 'cut' (level of selection)
        self._accumulator = processor.dict_accumulator({
        'SumOfEFTweights'  : HistEFT("SumOfWeights", wc_names_lst, hist.Cat("sample", "sample"), hist.Bin("SumOfEFTweights", "sow", 1, 0, 2), dtype=self._dtype),
        'dummy'   : hist.Hist("Dummy" , hist.Cat("sample", "sample"), hist.Bin("dummy", "Number of events", 1, 0, 1), dtype=self._dtype),
        'counts'  : hist.Hist("Events", hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("counts", "Counts", 1, 0, 2), dtype=self._dtype),
        'invmass' : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut","cut"), hist.Bin("invmass", "$m_{\ell\ell}$ (GeV) ", 20, 0, 200), dtype=self._dtype),
        'njets'   : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("njets",  "Jet multiplicity ", 10, 0, 10), dtype=self._dtype),
        'nbtags'  : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("nbtags", "btag multiplicity ", 5, 0, 5), dtype=self._dtype),
        'met'     : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("met",    "MET (GeV)", 40, 0, 400), dtype=self._dtype),
        'm3l'     : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("m3l",    "$m_{3\ell}$ (GeV) ", 20, 0, 200), dtype=self._dtype),
        'wleppt'  : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("wleppt", "$p_{T}^{lepW}$ (GeV) ", 20, 0, 200), dtype=self._dtype),
        'e0pt'    : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("e0pt",   "Leading elec $p_{T}$ (GeV)", 30, 0, 300), dtype=self._dtype),
        'e1pt'    : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("e1pt",   "Second elec $p_{T}$ (GeV)", 30, 0, 300), dtype=self._dtype),
        'e2pt'    : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("e2pt",   "Third elec $p_{T}$ (GeV)", 30, 0, 300), dtype=self._dtype),
        'm0pt'    : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("m0pt",   "Leading muon $p_{T}$ (GeV)", 30, 0, 300), dtype=self._dtype),
        'm1pt'    : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("m1pt",   "Second muon $p_{T}$ (GeV)", 30, 0, 300), dtype=self._dtype),
        'm2pt'    : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("m2pt",   "Third muon $p_{T}$ (GeV)", 30, 0, 300), dtype=self._dtype),
        'j0pt'    : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("j0pt",   "Leading jet  $p_{T}$ (GeV)", 20, 0, 400), dtype=self._dtype),
        'j1pt'    : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("j1pt",   "Second jet  $p_{T}$ (GeV)", 20, 0, 400), dtype=self._dtype),
        'j2pt'    : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("j2pt",   "Third jet  $p_{T}$ (GeV)", 20, 0, 400), dtype=self._dtype),
        'j3pt'    : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("j3pt",   "Foruth jet  $p_{T}$ (GeV)", 20, 0, 400), dtype=self._dtype),
        'e0eta'   : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("e0eta",  "Leading elec $\eta$", 20, -2.5, 2.5), dtype=self._dtype),
        'e1eta'   : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("e1eta",  "Second elec $\eta$", 20, -2.5, 2.5), dtype=self._dtype),
        'e2eta'   : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("e2eta",  "Third elec $\eta$", 20, -2.5, 2.5), dtype=self._dtype),
        'm0eta'   : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("m0eta",  "Leading muon $\eta$", 20, -2.5, 2.5), dtype=self._dtype),
        'm1eta'   : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("m1eta",  "Second muon $\eta$", 20, -2.5, 2.5), dtype=self._dtype),
        'm2eta'   : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("m2eta",  "Third muon $\eta$", 20, -2.5, 2.5), dtype=self._dtype),
        'j0eta'   : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("j0eta",  "Leading jet  $\eta$", 20, -2.5, 2.5), dtype=self._dtype),
        'j1eta'   : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("j1eta",  "Second jet  $\eta$", 20, -2.5, 2.5), dtype=self._dtype),
        'j2eta'   : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("j2eta",  "Third jet  $\eta$", 20, -2.5, 2.5), dtype=self._dtype),
        'j3eta'   : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("j3eta",  "Fourth jet  $\eta$", 20, -2.5, 2.5), dtype=self._dtype),
        'ht'      : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("cut", "cut"), hist.Bin("ht",     "H$_{T}$ (GeV)", 40, 0, 800), dtype=self._dtype),
        })

        self._do_errors = do_errors # Whether to calculate and store the w**2 coefficients
Exemplo n.º 25
0
    def make_jet_hists(self):
        histo_dict = {}
        histo_dict['Jets_pt']    = hist.Hist("Events", self.dataset_axis, self.sys_axis, self.jetmult_axis, self.leptype_axis, self.btag_axis, self.lepcat_axis, self.pt_axis)
        histo_dict['Jets_eta']   = hist.Hist("Events", self.dataset_axis, self.sys_axis, self.jetmult_axis, self.leptype_axis, self.btag_axis, self.lepcat_axis, self.eta_axis)
        histo_dict['Jets_phi']   = hist.Hist("Events", self.dataset_axis, self.sys_axis, self.jetmult_axis, self.leptype_axis, self.btag_axis, self.lepcat_axis, self.phi_axis)
        histo_dict['Jets_njets'] = hist.Hist("Events", self.dataset_axis, self.sys_axis, self.jetmult_axis, self.leptype_axis, self.btag_axis, self.lepcat_axis, self.njets_axis)
        histo_dict['Jets_LeadJet_pt']    = hist.Hist("Events", self.dataset_axis, self.sys_axis, self.jetmult_axis, self.leptype_axis, self.btag_axis, self.lepcat_axis, self.pt_axis)
        histo_dict['Jets_LeadJet_eta']   = hist.Hist("Events", self.dataset_axis, self.sys_axis, self.jetmult_axis, self.leptype_axis, self.btag_axis, self.lepcat_axis, self.eta_axis)
        histo_dict['Jets_phi_vs_eta'] = hist.Hist("Events", self.dataset_axis, self.sys_axis, self.jetmult_axis, self.leptype_axis, self.btag_axis, self.lepcat_axis, self.phi_2d_axis, self.eta_2d_axis)

        return histo_dict
Exemplo n.º 26
0
    def __init__(self):

        # we can use a large number of bins and rebin later
        dataset_axis = hist.Cat("dataset", "Primary dataset")
        pt_axis = hist.Bin("pt", r"$p_{T}$ (GeV)", 600, 0, 1000)
        mass_axis = hist.Bin("mass", r"$p_{T}$ (GeV)", 250, 0, 500)
        eta_axis = hist.Bin("eta", r"$\eta$", 60, -5.5, 5.5)
        multiplicity_axis = hist.Bin("multiplicity", r"N", 20, -0.5, 19.5)

        self._accumulator = processor.dict_accumulator({
            "MET_pt":
            hist.Hist("Counts", dataset_axis, pt_axis),
        })
Exemplo n.º 27
0
    def __init__(self, isMC, era=2017, sample="DY", do_syst=False, syst_var='', weight_syst=False, haddFileName=None, flag=False):
        self._flag = flag
        self.do_syst = do_syst
        self.era = era
        self.isMC = isMC
        self.sample = sample
        self._accumulator = dict_accumulator({
            "genEventSumw": hist.Hist(
                "Runs",
		hist.Bin("genEventSumw", "genEventSumw",1,0,1),
            ),
        })
        self.outfile = haddFileName
Exemplo n.º 28
0
    def __init__(self):
        dataset_axis = hist.Cat('dataset', 'dataset')
        dphi_axis = hist.Bin('dphi', '$\Delta\phi$', 50, 0, np.pi)
        self._accumulator = processor.dict_accumulator({
            'dphi': hist.Hist('Counts', dataset_axis, dphi_axis),
        })

        self.pucorrs = get_pu_weights_function()
        ## NOT applied for now
        self.nlo_w = get_nlo_weight_function('w')
        self.nlo_z = get_nlo_weight_function('z')

        self.data_type = 'bkg'
Exemplo n.º 29
0
    def __init__(self, data_type='sig-2mu2e'):
        self.data_type = data_type

        dataset_axis = hist.Cat('dataset', 'dataset')
        count_axis = hist.Bin('cnt', 'Number of Jets', 10, 0, 10)
        self._accumulator = processor.dict_accumulator({
            'njets':
            hist.Hist('Counts', dataset_axis, count_axis),
        })
        self.pucorrs = get_pu_weights_function()
        ## NOT applied for now
        self.nlo_w = get_nlo_weight_function('w')
        self.nlo_z = get_nlo_weight_function('z')
Exemplo n.º 30
0
    def __init__(self, samples):
        self._samples = samples

        # Create the histograms
        # In general, histograms depend on 'sample', 'channel' (final state) and 'cut' (level of selection)
        self._accumulator = processor.dict_accumulator({
            'jetpt':
            hist.Hist("Events", hist.Cat("WP", "WP"), hist.Cat("Flav", "Flav"),
                      hist.Bin("pt", "Jet p_{T} (GeV) ", 40, 0, 800)),
            'jeteta':
            hist.Hist("Events", hist.Cat("WP", "WP"), hist.Cat("Flav", "Flav"),
                      hist.Bin("eta", "Jet eta", 25, -2.5, 2.5)),
            'jetpteta':
            hist.Hist("Events", hist.Cat("WP", "WP"), hist.Cat("Flav", "Flav"),
                      hist.Bin("pt", "Jet p_{T} (GeV) ", [20, 30, 60, 120]),
                      hist.Bin("abseta", "Jet eta", [0, 1, 1.8, 2.4])),
            'jetptetaflav':
            hist.Hist("Events", hist.Cat("WP", "WP"),
                      hist.Bin("pt", "Jet p_{T} (GeV) ", [20, 30, 60, 120]),
                      hist.Bin("abseta", "Jet eta", [0, 1, 1.8, 2.4]),
                      hist.Bin("flav", "Flavor", [0, 4, 5])),
        })