# Extracting variables from TLorentzVector

**URL:** <https://root-forum.cern.ch/t/extracting-variables-from-tlorentzvector/40805>\
**Category:** Newbie\
**Created:** [August 3, 2020, 3:45pm UTC](https://root-forum.cern.ch/t/extracting-variables-from-tlorentzvector/40805 "2020-08-03T15:45:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Liam\_hayden](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/ecccb3/32.png) [@Liam\_hayden](https://root-forum.cern.ch/u/Liam_hayden)\
**Post date:** [August 3, 2020, 3:45pm UTC](https://root-forum.cern.ch/t/extracting-variables-from-tlorentzvector/40805/1 "2020-08-03T15:45:07Z")

</div>

Can someone tell me how to extract the variables px, py, pz, E from Tlorentzvector and assign it into newly declared variables which are of the double datatype

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [August 3, 2020, 3:53pm UTC](https://root-forum.cern.ch/t/extracting-variables-from-tlorentzvector/40805/2 "2020-08-03T15:53:28Z")

</div>

I think you are looking for the Px() , Py() and Pz() methods defined [here](https://root.cern/doc/master/classTLorentzVector.html#a5797d78e628134f7b76b2f2b53a7d297).

---

<div class="post-metadata">

**Author:** ![Liam\_hayden](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/ecccb3/32.png) [@Liam\_hayden](https://root-forum.cern.ch/u/Liam_hayden)\
**Post date:** [August 3, 2020, 3:59pm UTC](https://root-forum.cern.ch/t/extracting-variables-from-tlorentzvector/40805/3 "2020-08-03T15:59:33Z")

</div>

Yes I did refer this. Let me be more specific. Can I extract these for a Jet? The px, py, pz,E of a jet would be just the sum of its constituents particles right?

---

<div class="post-metadata">

**Author:** ![Liam\_hayden](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/ecccb3/32.png) [@Liam\_hayden](https://root-forum.cern.ch/u/Liam_hayden)\
**Post date:** [August 3, 2020, 4:22pm UTC](https://root-forum.cern.ch/t/extracting-variables-from-tlorentzvector/40805/4 "2020-08-03T16:22:28Z")

</div>

Alright . It does work for jet. Thanks anyway
