Home | News | Documentation | Download

Can't open file TLorentzVector.h

excuse me, i am trying to compile and run a C++ code using root and i get this error "can’t open TLorentzVector.h " However the TLorentzVector.h header exist in the include library file ! what should i do to fix this problem ?

Can you append your code or directly the macro that you are using?

1 Like

Maybe add
root-config --cflags
to you compile line so that the compiler knows where to find the ROOT header files?

1 Like

TRotation r; v.Transform(r); or v *= r; // Attention v=M*v

1 Like

i construct a four vector for di-leptons then i calculate the invariant mass of the system, but i get that error, the function as fellows:-

#include "TLorentzVector.h"
//=== Methode to calculate the mass ===
float ZprimeMuMu_FR_MiniAod::Mass(float Pt1,float Eta1,float Phi1,float En1,
				  float Pt2,float Eta2,float Phi2,float En2)
  float MuMuMass = 0.0;
  TLorentzVector Mu1;
  TLorentzVector Mu2;
  MuMuMass = (Mu1 + Mu2).M();
  return MuMuMass;

excuse me, can you clarify it
where i have to compile this statment ?

sorry, can you explain !

How to you “build/compile” your code? What is the step that is leading to an error? What is the exact wording of the error?

Error : Can’t open TLorentzVector.h

You need to show the “command line” which you execute (the one that leads to this error).

[20] #include <----->
[21] #include <TLorentzVector.h>
[22] #include < ----->

the compiler stops and give an error at line 22 as the following screenshot

Attach “ZprimeMuMu_FR_MiniAod.C” and “ZprimeMuMu_FR_MiniAod.h” for inspection.

BTW. There is no “compiler” involved. It is just the ROOT “interpreter”. Which ROOT version? Which operating system? What do you get from:

ls -al `root-config --incdir`/TLorentzVector.h

i use root 5.34
linux - ubuntu

Which Ubuntu version exactly?
How did you install ROOT?

i get > no such file or directory

What do you get from: root-config --incdir


It seems to me that you use the very old Ubuntu provided ROOT version. You’d better get rid of it completely (e.g. execute “sudo apt-get purge root-system* root-plugin* libroot*” and afterwards check that the “/usr/lib/i386-linux-gnu/root5.34” and the “/usr/lib/x86_64-linux-gnu/root5.34” subdirectories disappeared completely).

The ROOT team provides ready-to-use binary distributions for some systems, including various Ubuntu versions, which you just need to download and unpack (see “Using binaries” therein).

1 Like

when i excute the command to remove the root version wich i use i get :-
E: The package libndp0 needs to be reinstalled, but I can’t find an archive for it.

Try something like:

sudo apt-get install --reinstall libndp0