# Usage of Beta and Gamma factor in TLorentzVector

**URL:** <https://root-forum.cern.ch/t/usage-of-beta-and-gamma-factor-in-tlorentzvector/33942>\
**Category:** ROOT\
**Created:** [May 7, 2019, 2:18pm UTC](https://root-forum.cern.ch/t/usage-of-beta-and-gamma-factor-in-tlorentzvector/33942 "2019-05-07T14:18:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![trenta\_coollime](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/trenta_coollime/32/19159_2.png) [@trenta\_coollime](https://root-forum.cern.ch/u/trenta_coollime)\
**Post date:** [May 7, 2019, 2:18pm UTC](https://root-forum.cern.ch/t/usage-of-beta-and-gamma-factor-in-tlorentzvector/33942/1 "2019-05-07T14:18:44Z")

</div>

* * *

_ROOT Version:_ 6.14  
_Platform:_ Ubuntu16.04  
_Compiler:_ gcc630

* * *

Hi, I am running a code which needs to obtain gamma factor from its TLorentzVector.

At the moment, I fill the TLorentzVector with

`TLorentzVector scalar(ip->pt(),ip->eta(),ip->phi(),ip->mass());`  
where ip is the generated particle in MonteCarlo simulation.

When I try to obtain the beta and gamma factor with  
`Double_t gamma = scalar.Gamma(); and Double_t beta = scalar.Beta();`

gamma is equal to nan and beta seems to give me gamma value since it is always larger than 1, and never less than 1.

Could someone explain what is going on?

Thank you!

---

<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:** [May 7, 2019, 2:23pm UTC](https://root-forum.cern.ch/t/usage-of-beta-and-gamma-factor-in-tlorentzvector/33942/2 "2019-05-07T14:23:46Z")

</div>

Try:

```auto
TLorentzVector scalar;
scalar.SetPtEtaPhiM(ip->pt(), ip->eta(), ip->phi(), ip->mass());

```

See also:

> [@Boost to rest frame with TLorentzVector made with SetPtPhiEtaM](https://root-forum.cern.ch/t/boost-to-rest-frame-with-tlorentzvector-made-with-setptphietam/33924/2):
>
> Hi, TLorentzVector is a legacy class: it’s better to have a look at ROOT::Math::LorentzVector [https://root.cern.ch/doc/master/LorentzVectorPage.html](https://root.cern.ch/doc/master/LorentzVectorPage.html) for an answer to your question. Cheers, D

---

<div class="post-metadata">

**Author:** ![trenta\_coollime](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/trenta_coollime/32/19159_2.png) [@trenta\_coollime](https://root-forum.cern.ch/u/trenta_coollime)\
**Post date:** [May 7, 2019, 2:59pm UTC](https://root-forum.cern.ch/t/usage-of-beta-and-gamma-factor-in-tlorentzvector/33942/3 "2019-05-07T14:59:30Z")

</div>

It works.

Thank you!

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [May 21, 2019, 2:59pm UTC](https://root-forum.cern.ch/t/usage-of-beta-and-gamma-factor-in-tlorentzvector/33942/4 "2019-05-21T14:59:32Z")

</div>

Closed on May 21, 2019, 2:59pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
