Fork me on GitHub

Opened 7 years ago

Last modified 7 years ago

#1159 new Bug

ROOT unable to load libDelphes.so

Reported by: Miles R Owned by:
Priority: minor Milestone:
Component: Delphes code Version: Delphes 3
Keywords: Cc:

Description

Hello, I'm trying to load the Delphes file in a python script so I can access the GenParticle class objects in a root file. Attached is the script I have and the errors I get. I'm using ROOT v6.10/04, MG5 v2.6.0, and Delphes-3.4.0 (I also tried it with 3.4.1 and had the same problem). I've tried calling all of the files needed one by one which fixes the fatal error part, but I still can't read GenParticle data or load the dictionaries. I'm out of ideas of what to try here, so anything I could try in order to fix this problem would be much appreciated. Thanks!

Attachments (2)

new.py (510 bytes ) - added by Miles R 7 years ago.
python script
error.txt (3.4 KB ) - added by Miles R 7 years ago.
errors

Download all attachments as: .zip

Change History (6)

by Miles R, 7 years ago

Attachment: new.py added

python script

by Miles R, 7 years ago

Attachment: error.txt added

errors

comment:1 by Pavel Demin, 7 years ago

Looking at the "'classes/SortableObject.h' file not found" error message, I'd suggest to try adding the following line to your code:

ROOT.gROOT.ProcessLine('.include .')

comment:2 by Miles R, 7 years ago

I tried adding that line in, but I still ended up with the same errors as before

comment:3 by Pavel Demin, 7 years ago

Please have a look at examples/Example1.py.

Based on this example, I've written the following code that can access the particles:

import ROOT

ROOT.gSystem.Load("libDelphes")

ROOT.gInterpreter.Declare('#include "classes/DelphesClasses.h"')
ROOT.gInterpreter.Declare('#include "external/ExRootAnalysis/ExRootTreeReader.h"')

# Create chain of root trees
chain = ROOT.TChain("Delphes")
chain.Add("delphes_output.root")

# Create object of class ExRootTreeReader
treeReader = ROOT.ExRootTreeReader(chain)
numberOfEntries = treeReader.GetEntries()

# Get pointers to branches used in this analysis
branchParticle = treeReader.UseBranch("Particle")

# Loop over all events
for entry in range(0, numberOfEntries):
  # Load selected branches with data from specified event
  treeReader.ReadEntry(entry)
  # print PID of all particles
  for particle in branchParticle:
    print(particle.PID)

comment:4 by Miles R, 7 years ago

I still get missing FileEntry errors and file not found errors, but it prints off the PIDs just fine and seems to work. Thank you for the help!

Note: See TracTickets for help on using tickets.