Getting rid of TVector3::PseudoRapidity warnings

Is there any way to get rid of

Warning in <TVector3::PseudoRapidity>: transvers momentum = 0! return +/- 10e10

warnings? I have a code which saves to a TTree some TLorentzVector, which might be initialized to (x,y,z,y)=(0,0,0,0) or have a meaningful content, but this warning slows everything down. Is there any way to suppress them without suppressing all ROOT messages below “Warning”?

[quote]Is there any way to get rid of

Warning in <TVector3::PseudoRapidity>: transvers momentum = 0! return +/- 10e10

warnings? I have a code which saves to a TTree some TLorentzVector, which might be initialized to (x,y,z,y)=(0,0,0,0) or have a meaningful content, but this warning slows everything down. Is there any way to suppress them without suppressing all ROOT messages below “Warning”?
[/quote]

The answer is here:

Double_t TVector3::PseudoRapidity() const {
   //Double_t m = Mag();
   //return 0.5*log( (m+fZ)/(m-fZ) );
   // guard against Pt=0
   double cosTheta = CosTheta();
   if (cosTheta*cosTheta < 1) return -0.5* TMath::Log( (1.0-cosTheta)/(1.0+cosTheta) );
   Warning("PseudoRapidity","transvers momentum = 0! return +/- 10e10");
   if (fZ > 0) return 10e10;
   else        return -10e10;
}

Who’s calling PseudoRapidity and why? I/O while writing a tree? If not - check CosTheta in your code before calling PseudoRapidity.

Hi,
I agree the warning does not make sense for a null vector. I will remove then for that case. Also it makes more sense to return eta=0 when both pt and z are zero.
Would this be enough for you ? Otherwise you must suppress all ROOT warnings

Best Regards

Lorenzo

[quote=“moneta”]Hi,
I agree the warning does not make sense for a null vector. I will remove then for that case. Also it makes more sense to return eta=0 when both pt and z are zero.
Would this be enough for you ? Otherwise you must suppress all ROOT warnings
[/quote]

yes, that would be perfect - thanks!

The warning has been removed in the head of 5.34 patches and the master version

Lorenzo