Creating empty LorentzVector

Dear experts,

I’m trying to create empty LorentzVector with consequent filling it with some values:

  LorentzVector empty ;

however I get error

error: no viable constructor or deduction guide for deduction of template arguments of 'LorentzVector'

Could you please suggest, where I can find any examples of declaring and filling LorentzVector objects?

Thank you,

kind regards,

ROOT Version: 6.24/07
Platform: linuxx8664gcc (lxplus7)
Compiler: With g++ (GCC) 10.3.0

Hi @Stepennov,

You can’t construct a Lorenz vector just with the LorentzVector type, because this is a templated type. You need to pass the coordinate system as a template parameter:

ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>> myVec;

I suggested here the PxPyPzE coordinate system, because this is also what you use to set the vector in your snippet.

There are also some aliases for these types defined in the ROOT::Math namespace:

Using these aliases, you can instantiate the vector like this, for example:

ROOT::Math::PxPyPzEVector emptyVec;

Hi Jonas,

Thanks a lot! This helped.

kind regards,

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