# Using LorentzVector/PtEtaPhiM

**URL:** <https://root-forum.cern.ch/t/using-lorentzvector-ptetaphim/50729>\
**Category:** Newbie\
**Created:** [July 8, 2022, 6:45pm UTC](https://root-forum.cern.ch/t/using-lorentzvector-ptetaphim/50729 "2022-07-08T18:45:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![abunka](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/d6d6ee/32.png) [@abunka](https://root-forum.cern.ch/u/abunka)\
**Post date:** [July 8, 2022, 6:45pm UTC](https://root-forum.cern.ch/t/using-lorentzvector-ptetaphim/50729/1 "2022-07-08T18:45:16Z")

</div>

Hello ROOT friends  
I am trying to work with LorentzVector and am struggling to set it up properly.  
From the documentation, I declare the vector as:

```auto
LorentzVector<PtEtaPhiM4D<double>> vectorName;

```

With

```auto
include <Math/Vector4D.h>

```

At the top.  
This says the Lorentz vector is undefined “error: ‘LorentzVector’ was not declared in this scope”.  
So I added:

```auto
include <LorentzVector.h>

```

Which it then says does not exist “LorentzVector.h: No such file or directory”.

So what is the trick for this?  
Thanks!

EDIT: I’ll also add I would like to get the delta phi between this and another vector. I know for TLorentz vector there was a function for this

```auto
TLorentzVector.DeltaPhi(TLorentzVector2);

```

but I don’t see such a function for Lorentz Vector, so what should I do?

---

<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:** [July 8, 2022, 7:16pm UTC](https://root-forum.cern.ch/t/using-lorentzvector-ptetaphim/50729/2 "2022-07-08T19:16:27Z")

</div>

Try with

```auto
#include <Math/LorentzVector.h>
#include <Math/PtEtaPhiM4D.h>

ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double>> vectorName;

```

---

<div class="post-metadata">

**Author:** ![abunka](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/d6d6ee/32.png) [@abunka](https://root-forum.cern.ch/u/abunka)\
**Post date:** [July 8, 2022, 7:41pm UTC](https://root-forum.cern.ch/t/using-lorentzvector-ptetaphim/50729/3 "2022-07-08T19:41:58Z")

</div>

Thanks, this worked for initiating the vector.  
Any idea for the deltaPhi? or should I just do that manually?

---

<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:** [July 8, 2022, 7:46pm UTC](https://root-forum.cern.ch/t/using-lorentzvector-ptetaphim/50729/4 "2022-07-08T19:46:33Z")

</div>

Maybe using [ROOT::Math::VectorUtil::DeltaPhi](https://root.cern.ch/doc/v606/namespaceROOT_1_1Math_1_1VectorUtil.html#a36f74a2dc97e8c37450913d922caee6a)
