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)
Change History (6)
by , 7 years ago
comment:1 by , 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 , 7 years ago
I tried adding that line in, but I still ended up with the same errors as before
comment:3 by , 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 , 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!
python script