Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-7258

MinIf and MaxIf TTreeFormula functions ignore last element

    XMLWordPrintable

Details

    Description

      I think there is a mistake with the MinIf$ and MaxIf$ implementations that causes the last element to be ignored:

      https://root.cern.ch/root/html/src/TTreeFormula.cxx.html#3812

      If the last element is the only one that satisfies the condition, the value of "i" will still be "len" because of the "++i". I haven't tested, but I think you could fix this by changing the linked line above to:

      if (!cond && i==len) {

      A similar fix is needed at https://root.cern.ch/root/html/src/TTreeFormula.cxx.html#3844

      I didn't go through the rest of the class to see if any other similar problems exist... I hope not!

      Attachments

        Activity

          People

            pcanal Philippe Canal
            will Will Buttinger
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: