# Creating a histogram of particle final energies using their pdg codes

**URL:** <https://root-forum.cern.ch/t/creating-a-histogram-of-particle-final-energies-using-their-pdg-codes/52121>\
**Category:** Newbie\
**Tags:** hist, root\
**Created:** [October 27, 2022, 5:49pm UTC](https://root-forum.cern.ch/t/creating-a-histogram-of-particle-final-energies-using-their-pdg-codes/52121 "2022-10-27T17:49:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![HMahdy](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/7feea3/32.png) [@HMahdy](https://root-forum.cern.ch/u/HMahdy)\
**Post date:** [October 27, 2022, 5:49pm UTC](https://root-forum.cern.ch/t/creating-a-histogram-of-particle-final-energies-using-their-pdg-codes/52121/1 "2022-10-27T17:49:38Z")

</div>

I’m still new to this and am trying to create two histograms for daughter particle final energies - protons and/or neutrons- using their pdg codes but I’m not sure how to call them in my code. I sure need some help. Thank you.

[InteractionsII.root](https://root-forum.cern.ch/uploads/short-url/zmnK886Taa09rgvDE1CaB1doyHV.root) (25.8 KB)  
[Histogram.C](https://root-forum.cern.ch/uploads/short-url/7SdkrucBU66jZG1S4UDyYMeq9kG.C) (203 Bytes)

* * *

\_ROOT Version:6.22  
\_Platform:Ubuntu  
\_Compiler:gcc

* * *

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [October 27, 2022, 6:15pm UTC](https://root-forum.cern.ch/t/creating-a-histogram-of-particle-final-energies-using-their-pdg-codes/52121/2 "2022-10-27T18:15:34Z")

</div>

You have a “GENIE Summary Event Tree” (named “`gst`”):

`TTree *t; fFileA->GetObject("gst", t); t->Print();`

You need to talk to your colleagues and / or your supervisor (and / or the one who created your ROOT file) about how to deal with your data.

---

<div class="post-metadata">

**Author:** ![HMahdy](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/7feea3/32.png) [@HMahdy](https://root-forum.cern.ch/u/HMahdy)\
**Post date:** [October 27, 2022, 8:17pm UTC](https://root-forum.cern.ch/t/creating-a-histogram-of-particle-final-energies-using-their-pdg-codes/52121/3 "2022-10-27T20:17:08Z")

</div>

Thanks Wile, I can see the The GENIE Event Tree. How can I call any of the tree branches into a histogram ?

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [October 27, 2022, 8:26pm UTC](https://root-forum.cern.ch/t/creating-a-histogram-of-particle-final-energies-using-their-pdg-codes/52121/4 "2022-10-27T20:26:43Z")

</div>

[ROOT → Get Started](https://root.cern/get_started/)
