Fork me on GitHub

Opened 13 years ago

Closed 13 years ago

#45 closed How to (fixed)

ROOT Analysis code with friend TTree's

Reported by: muanza Owned by:
Priority: major Milestone:
Component: Delphes code Version: all recent versions (> 1.8)
Keywords: Cc: muanza@…

Description

Hello,

I'd like to use MC truth infos from the GEN TTree within an analysis code based upon a MakeClass defined on the Analysis TTree.

I have no experience with friend TTree's, so I'd like to know if someone has a running example.

Thanks
Regards, Steve

Attachments (1)

AddFriendExample.cpp (3.8 KB ) - added by Pavel Demin 13 years ago.

Download all attachments as: .zip

Change History (5)

by Pavel Demin, 13 years ago

Attachment: AddFriendExample.cpp added

comment:1 by Pavel Demin, 13 years ago

Hi Steve,

Do you really need to use MakeClass? If it's so, I'm afraid we don't have any example showing how to use MakeClass and AddFriend.

Otherwise, there is a basic example in the ExRootAnalysis repository that uses ExRootTreeReader and AddFriend:

https://server06.fynu.ucl.ac.be/projects/ExRootAnalysis/browser/trunk/test/AddFriendExample.C

You can find in the attachment a version of this script adapted to the Delphes ROOT tree format.

You can compile and run this example using the following commands:

g++ -O2 -m32 -I. -IUtilities -Llib -lUtilities `root-config --cflags --libs` AddFriendExample.cpp -o AddFriendExample
export LD_LIBRARY_PATH=./lib
./AddFriendExample

Alternatively, there is an example that comes with the Delphes code that show how to analyze reconstructed and generated objects without using AddFriend. It uses 3 ExRootTreeReader objects to read Analysis, GEN and Trigger trees in parallel. Here is a list of relevant files:

Examples/Analysis_Ex.cpp
Examples/interface/Analysis_Ex.h
Examples/src/Analysis_Ex.cc

Regards,

Pavel

comment:2 by favereau, 13 years ago

Hi,

Did pavel's solution help ?

Thanks for the report,

Jerome

comment:3 by muanza@…, 13 years ago

Hello Pavel,

Thanks for this working example. Now I manage to access simultaneoulsy to the different TTrees.

I think this ticket can be closed.

Regards, Steve

comment:4 by favereau, 13 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.