|
[Rivet] Rivet 1.5.0 now?Ben Waugh waugh at hep.ucl.ac.ukWed Mar 9 12:57:16 GMT 2011
On 09/03/11 11:13, Frank Siegert wrote: > Hi Ben, > >> Not that you asked me, but... > > Heh, I did ask everybody on the list! > >> Strictly speaking it is only the denominator that needs to be checked >> anyway, but I agree it makes more sense only to avoid dividing by zero, >> not to avoid negative values. > > True, but in case the numerator is zero then I can ignore the division > anyway and return the default 0, so it's at least not wrong. Indeed it makes no difference to the results, and any efficiency difference is likely to be negligible, so it is just a matter of what makes the code clearer. >> If you do change this, you will probably have to change some other >> methods to keep the behaviour consistent. For example, sumBinHeights >> also checks for a positive sum of weights. > > Well, in this particular case I was not worried about negative sumw, but > about negative sumyw, i.e. the underlying distribution being negative. > If the sum of weights becomes negative one has to worry about more > things, I agree, but I don't think there's actually a use case for that, > is there? Certainly not something I'd like to change so close to the > release. True. I think I looked too quickly and thought there was a check on sumyw. I don't have any use case in mind for negative weights. It looks like equivalentBinEntries is missing a check for division by zero, but this will only be encountered if the sum of weights in all bins is zero. So in practice only for an empty histogram, although in principle someone could put in balancing positive and negative weights. So for a quick pre-release change I think your proposal makes sense. Cheers, Ben > > Cheers, > Frank -- Dr Ben Waugh Tel. +44 (0)20 7679 7223 Dept of Physics and Astronomy Internal: 37223 University College London London WC1E 6BT
More information about the Rivet mailing list |