Opened 6 years ago
Closed 6 years ago
#1367 closed Bug (fixed)
TRefArray problem in Jet Constituent in python 2.7.10
Reported by: | Tae Kim | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | Delphes code | Version: | Delphes 3 |
Keywords: | Cc: |
Description
Hello
I am currently trying to modify example/Example3.C into python to read Jet constituents (similar to Example1.py case)
However, for some reason, when it comes to converting TRefArray to TObject by using .At(number), the code cannot use the pointer correctly. (ROOT version 6.13/08)
Following is a part of the code in python and full file is attached
# Loop over all events for entry in range(0, numberOfEntries): # Load selected branches with data from jet event treeReader.ReadEntry(entry) for jetentry in range (0, branchJet.GetEntriesFast()): jet = branchJet.At(jetentry) for constit in range (0, jet.Constituents.GetEntriesFast()): obj = jet.Constituents.At(constit) print(jet.Constituents) print(obj) # print(constit) # event_jet = event_jet.append({'Event' : entry, # 'jet number': jetentry, # 'jet constituent pT': obj.PT, # 'jet constituent Eta': obj.Eta, # 'jet constituent Phi': obj.Phi}, ignore_index=True)
I've tested whether TRefArray is filled or not by using
print(jet.Constituents.GetEntriesFast())
and boolean
jet.Constituents.IsEmpty()
This is the result that I get when I run
<ROOT.TRefArray object ("TRefArray") at 0x7f859e6ae348> <ROOT.TObject object at 0x0>
Attachments (1)
Change History (4)
by , 6 years ago
Attachment: | Jet_constituent.py added |
---|
comment:1 by , 6 years ago
Summary: | TRefArray problem in Jet Constituent → TRefArray problem in Jet Constituent in python 2.7.10 |
---|
comment:2 by , 6 years ago
comment:3 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
This is very similar to #1366.
The
UseBranch()
method should be called for all the branches required for the analysis algorithm.So, if your analysis algorithm requires the jet constituents, then the
UseBranch()
method should be called for all the branches containing the jet constituents: