Fork me on GitHub

Opened 8 years ago

Last modified 8 years ago

#1059 new Bug

TrimmedP4 and pyroot

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

Description

Hello,
In pyroot, I am getting a segmentation violation when trying to access trimmed jet info using the TrimmedP4 variable (the same happens with PrunedP4).

The bug is present in Delphes 3.3.x and 3.4, and can be easily reproduced from Example1.py, by modifying the following near line 50

# Print jet transverse momentum
print jet.PT
print jet.TrimmedP4[0].Pt() # here len(jet.TrimmedP4[0]) also results in segmentation violation

With this modification, the error appears with any root file, e.g. here following the README in Delphes

curl -s http://cp3.irmp.ucl.ac.be/downloads/z_ee.hep.gz | gunzip | ./DelphesSTDHEP cards/delphes_card_CMS.tcl delphes_output.root
python examples/Example1.py delphes_output.root

Note that TrimmedP4 is correctly listed in dir(jet), so it should know what to do with it.

Also note that the C++ implementation works as intended, e.g. jet->TrimmedP4[0].Pt() gives the correct numbers.

Attachments (1)

segfault.log (8.4 KB ) - added by amonte 8 years ago.

Download all attachments as: .zip

Change History (3)

by amonte, 8 years ago

Attachment: segfault.log added

comment:1 by Pavel Demin, 8 years ago

I've just tried to reproduce this problem with ROOT 6.06.02 and with enabled debug information. Here is what I get:

#5  <signal handler called>
#6  0x0000000000000000 in ?? ()
#7  0x00007f63465869fa in TClass::GetActualClass(void const*) const () at root-6.06.02-source/core/meta/src/TClass.cxx:2556
#8  0x00007f634695a557 in Cppyy::GetActualClass(long, void*) () at root-6.06.02-source/bindings/pyroot/src/Cppyy.cxx:184

Here is the code around line 2556 in TClass.cxx:

TClass *TClass::GetActualClass(const void *object) const
{
...
         else {
            isa = (TVirtualIsAProxy*)gROOT->ProcessLineFast(TString::Format("new ::TIsAProxy(typeid(%s));",GetName()));
         }
         if (isa) {
            R__LOCKGUARD(gInterpreterMutex);
            const_cast<TClass*>(this)->fIsA = isa;
         }
         if (fIsA) {
            return (*fIsA)(object); // ROOT::IsA((ThisClass*)object);
         }
...

Since the problem is somewhere in the ROOT classes, I think that it's a question for the ROOT or PyROOT developers. Could you try to report this issue via the ROOT's bug tracking system (https://root.cern.ch/how/report-bug-jira)?

comment:2 by amonte, 8 years ago

Thanks Pavel,
I reported the problem with ROOT's bug tracking system, but I haven't heard back from them yet.

I was able to work around this issue by modifying the source code in Delphes, by re-defining TrimmedP4 from an array of TLorentzVectors to a single TLorentzVector (therefore dropping the info about the four hardest sub-jets), in classes/DelphesClasses.cc, classes/DelphesClasses.h, modules/FastJetFinder.cc, modules/TreeWriter.cc. With that change, I am able to access the trimmed jets in pyROOT, e.g. jet.TrimmedP4.Pt() and so on. I did the same to access other jet grooming variables (PrunedP4 and SoftDroppedP4).

This is a relataively simple fix, I just wanted to point it out if anyone else runs into the same problem and lands on this page.

Thanks for the help!

Note: See TracTickets for help on using tickets.