Maybe a tiny "bug" in TProfile3D source code

Dear ROOT users,

I am not quite sure if this is a “bug”, or it’s intentionally being so. But when you look at line 642 of this ROOT (6.11/01) class (TProfile3D) source code (link posted below), you may get a little confused.

https://root.cern.ch/doc/master/TProfile3D_8cxx_source.html#l00635

Let me quote some code of it here,

if (fTmin != fTmax) {
      if (t < fTmin || z > fTmax || TMath::IsNaN(t) ) return -1;
}

It’s about a function TProfile3D::Fill to fill a bin associated with (x,y,z) with a value t weighted by w. And the specific code above explains what would happen if function TProfile3D::BuildOptions(Double_t tmin,Double_t tmax,Option_t *option) is called before filling, which limits the minimum and maximum values of t (when tmin != tmax).
So when t value is outside the limits it should be discarded by this code. But why would the second “if” asks for that t < fTmin or z > fTmax ? Shouldn’t it be asking for t < fTmin or t > fTmax ?

And I noticed it’s not like this in TProfile or TProfile2D, where it’s always y < fYmin or y > fYmax. And other filling functions in TProfile3D class are actually not like this either …

Thanks!

1 Like

Hi,

Yes, this is clearly a bug ! It should be t and not z. Thank you for reporting it !
It will be fixed as soon as possible

Best Regards

Lorenzo

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