How can I get the right jets for a particular object selection?

Python Code

import ROOT
import ATLASWatchMan.Bindings

#open the .root file
f = ROOT.TFile( "OutputD3PD.root" )

#open the TTree
tree = f.Get( "MyAnalysisTree" )
#open the Info TTree
t_info = f.Get( "MyAnalysisInfoTree" )

#store the object selection position info
objSelDict = {}
t_info.GetEntry( 0 )
objSelVec = t_info.objSelectionMap

for n, objSel in enumerate( objSelVec ):
    objSelDict[objSel] = n
print "objSelDict:", objSelDict

# let's say that in my analysis I'm only interested 
# in particles having passed the custom object selection that
# in the steering file I called "MyObjSelection_20GeV"
# so it's more convenient
objSelPosition = objSelDict['MyObjSelection_20GeV']

#loading the number of events stored in the TTree
nEntries = tree.GetEntries()

#loop over all events
for ev in range( nEntries ):
    #load the event
    tree.GetEntry( ev )
    #print the run number and event number:
    print "run n.:  %s - ev n.:  %s" % (tree.runNumber[0], tree.eventNumber[0]) #there are stored as vector but they have only one entry
    #get jets
    #I loop over all jets
    for j, jet in enumerate( tree.jet4mom ):
        # and I check if that jet passed the object selection I want
        if tree.jetObjSel[j][objSelPosition] == 1:
            print "I got the right jet passing my object selection"
            print "jet.Pt():", jet.Pt()
            print "jet.Eta():", jet.Eta()


C++ Code

Cooming Soon...


-- RiccardoMariaBianchi - 23-Oct-2009

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r2 - 2009-10-27 - RiccardoMariaBianchi
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback