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

Show correct number of digits in number based on its uncertainty



    • New Feature
    • Status: Open (View Workflow)
    • Medium
    • Resolution: Unresolved
    • None
    • None
    • Graphics
    • None
    • Suggestion
    • 1 - Wish


      At ICHEP Alex asked us to send comments/suggestions... so this is the first of those suggestions.

      When doing fits (or showing statistics with errors) ROOT calculates a number and it's uncertainty and this gets printed in the terminal and/or in the plot with the A +- B format. However often enough the precision used in printing the A and B numbers is not the same – something which is a student/colleague did we would complain about using the proper number of significant digits.

      I'm not sure how far it makes sense in creating a 'number plus uncertainty' type (as propagating uncertainties on the fly would be tricky), but I think we can have a printer wrapper that can show things in the current format, or in a format with matching decimal places. (Another possible feature for numbers with lots of decimal places would be to use the concise form shown in CODATA for physical constants).

      I attach a small code in C to show roughly what I'm suggesting – there are probably pathological cases where we would need to fall back to the old format (for example when the calculated uncertainty is 0, or extremely small), but I think something like that would make all plots look nicer from the get go. (sure we can change the precision of everything now, but it requires doing it manually)

      If you want me to provide a patch with this implemented it would be nice to know where this should go in the official structure of the code and what kind of modifiers we need for it to work in a 'switchable' way with the current formater.




            couet Olivier Couet
            jathayde Joao Pedro Athayde Marcondes De Andre
            0 Vote for this issue
            2 Start watching this issue