Compare two TLorentzVectors for equality with operator==

Hi, Experts

I am working on matching particles’ four-momenta. I find there is a member function of TLorentzVector and TVector3 called ==. I checked the source code. It returns a boolean by applying == to two double type variables. I am thinking whether I should trust the result. I am not an expert on data type. Is it safe to do in this way with double? Or should I compare two vectors in some other ways?


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Well, operator== compares all vector coordinates up to the least significant bits (roughly speaking, 16 decimal digits for a double).

Most probably, that is not what you want to use in any “physics analysis” dealing with “experimental / simulated data” (in which vector components will always have some “errors”).

BTW. Nowadays, instead of the TLorentzVector legacy class, you’d better try the new GenVector package.