Problem when compiling ROOT::Math::PtEtaPhiMVector

I try to compile my code containing PtEtaPhiM4D class.
It’s a necessary part to cooperate with others.
I include all related head files but it doesn’t work.

Finally, I found the correct head file is <Math/Vector4D.h> not <Math/GenVector/PtEtaPhiM4D.h>
I guess it’s wrong on the document, ROOT::Math::PtEtaPhiM4D.
Can you help to fix it or add more information?


what ROOT version are you using?

I just tried with v6.22 and the following works fine:

// ptetaphi.cpp
#include <Math/GenVector/PtEtaPhiM4D.h>                                              
int main() {                                                                         
   ROOT::Math::PtEtaPhiM4D m(0.,0.,0.,0.);                                           
   return 0;                                                                         
$ g++ -g -Wall -Wextra -Wpedantic -o "ptetaphi" "ptetaphi.cpp" $(root-config --cflags -


I run it on lxplus7 with v6.20 and v6.22.
Actually PtEtaPhiMVector is used in my code, not PtEtaPhiM4D.
anyway, I am not sure which head file is required when compiling PtEtaPhiMVector.

// test.C
// #include <Math/GenVector/LorentzVector.h>  // not work
// #include <Math/GenVector/PtEtaPhiM4D.h>   // not work
#include <Math/Vector4D.h>  // work
void test() {
    ROOT::Math::PtEtaPhiMVector m(0.,0.,0.,0.);
source /cvmfs/
## not OK
root -l -q test.C++
## OK
root -l -q test.C  

Ah you are using PhEtaPhiMVector!

Then can you point me again to the part of the doxygen documentation that should be updated/fixed please?


The reference document is here.
the #include line should be updated.

#include <Math/GenVector/LorentzVector.h>


Sorry if I’m being slow, but as far as I understand what you linked to is the page that contains the correct link to use.

I’m confused as to which is the page that contains a wrong link, because the one you linked originally, ROOT::Math::PtEtaPhiM4D, turned out to be ok.

Thank you for the feedback, just trying to understand what to fix :sweat_smile:

Ok, PtEtaPhiMVector indicates Vector4Dfwd.h as a header file, although that only contains forward declarations. This problem was reported before but @moneta pointed out that at the top of the distinction between Vector4Dfwd.h and Vector4D.h is clearly discussed.


I don’t know how to point it because it doesn’t have anchor link.
I took the head file name here.
ROOT::Math::LorentzVector doc


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