示例#1
0
        #print('len(tree.nJet)', event.nJet)
        #for i in range(event.nJet):

        #print('Jet No.', i)
        #print('Jet_lepFilter', event.Jet_lepFilter[i])
        #print('Jet_puId', event.Jet_puId[i])
        #print('Jet_PtReg', event.Jet_PtReg[i])
        #print('Jet_eta', abs(event.Jet_eta[i]))
        #print(hasattr(event,'Jet_PtReg'))
        #print('------------------------')

        #print('sortb', sortb)
        #print('(getattr(event,Jet_btagDeepFlavB)', (getattr(event,'Jet_btagDeepFlavB')))

        #if len(sortb)>1:
        if (sampleTree.evaluate(signalRegionSelection_roc)):
            # for all events passing the signal selection
            if (event.Jet_btagDeepFlavB[event.hJidx_DeepJet[0]] > 0.0494 and
                    event.Jet_btagDeepFlavB[event.hJidx_DeepJet[1]] > 0.0494):

                # evaluate quantity (tagger, weight etc.)
                #roc_data_DeepCSV.append([sampleTree.evaluate(taggerExpression_DeepCSV), sampleTree.evaluate(weightExpression_DeepCSV) * scaleXStoLumi, isSignal])
                roc_data_DeepJet.append([
                    sampleTree.evaluate(taggerExpression_DeepJet),
                    sampleTree.evaluate(weightExpression_DeepJet) *
                    scaleXStoLumi, isSignal,
                    sampleTree.evaluate(weightExpression_DeepJet_nosf) *
                    scaleXStoLumi
                ])
                #roc_data_DeepJet_nosf.append([sampleTree.evaluate(taggerExpression_DeepJet), sampleTree.evaluate(weightExpression_DeepJet_nosf) * scaleXStoLumi, isSignal])
示例#2
0
from __future__ import print_function
import ROOT
ROOT.gROOT.SetBatch(True)
from myutils.XbbConfig import XbbConfigReader, XbbConfigTools
from myutils.sampleTree import SampleTree as SampleTree
from myutils.BranchList import BranchList

config = XbbConfigTools(XbbConfigReader.read("Zvv2017"))
sampleTree = SampleTree(
    {
        'name': 'MET',
        'folder': config.get('Directories', 'dcSamples')
    },
    config=config)
variables = ["H_pt", "MET_Pt", "H_pt/MET_Pt"]

# enable only explicitly used branches
sampleTree.enableBranches(BranchList(variables).getListOfBranches())

# create TTReeFormula's
for variable in variables:
    sampleTree.addFormula(variable)

# loop over events
for event in sampleTree:
    print(
        sampleTree.tree.GetReadEntry(),
        ", ".join([x + "=%1.4f" % sampleTree.evaluate(x) for x in variables]))
    if sampleTree.tree.GetReadEntry() > 98:
        break