# Getting branch data using RDataFrame

**URL:** <https://root-forum.cern.ch/t/getting-branch-data-using-rdataframe/57252>\
**Category:** Newbie\
**Created:** [November 25, 2023, 5:20pm UTC](https://root-forum.cern.ch/t/getting-branch-data-using-rdataframe/57252 "2023-11-25T17:20:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![amishgog](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/amishgog/32/34940_2.png) [@amishgog](https://root-forum.cern.ch/u/amishgog)\
**Post date:** [November 25, 2023, 5:20pm UTC](https://root-forum.cern.ch/t/getting-branch-data-using-rdataframe/57252/1 "2023-11-25T17:20:29Z")

</div>

Hi,

I have 2 questions:

1. What is the best way to access values of variables like particle mass, momentas and other parameters from a root file. Is RDataFrame easier to use for this?

2. In many papers I have seen that there are mass distributions of particles like J/psi phi or K-K+. What do these distributions mean. Is it just the sum of invariant mass of J/psi and phi?

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [November 28, 2023, 8:42am UTC](https://root-forum.cern.ch/t/getting-branch-data-using-rdataframe/57252/2 "2023-11-28T08:42:40Z")

</div>

I think @eguiraud or @vpadulan can give some hints

---

<div class="post-metadata">

**Author:** ![vpadulan](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/vpadulan/32/25315_2.png) [@vpadulan](https://root-forum.cern.ch/u/vpadulan)\
**Post date:** [December 12, 2023, 9:30am UTC](https://root-forum.cern.ch/t/getting-branch-data-using-rdataframe/57252/3 "2023-12-12T09:30:49Z")

</div>

Dear @amishgog,

I am very sorry for the prolonged silence. Let me answer your questions now:

1. I would definitely suggest RDataFrame for anything related to data processing of ROOT datasets. See the guide at [ROOT: ROOT::RDataFrame Class Reference](https://root.cern/doc/master/classROOT_1_1RDataFrame.html#crash-course)
2. Usually yes

Cheers,  
Vincenzo

---

<div class="post-metadata">

**Author:** ![amishgog](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/amishgog/32/34940_2.png) [@amishgog](https://root-forum.cern.ch/u/amishgog)\
**Post date:** [December 12, 2023, 2:38pm UTC](https://root-forum.cern.ch/t/getting-branch-data-using-rdataframe/57252/4 "2023-12-12T14:38:45Z")

</div>

Hi Vincenzo,

Thanks for your reply and no worries at all I was able to sort out the problems myself. I should have put up a solution to the topic as well.

Cheers,  
AG
