Skip to content

Conversation

@ShamrockLee
Copy link
Contributor

@ShamrockLee ShamrockLee commented Dec 21, 2022

This Pull request:

Changes or fixes:

This PR fixes the TH1::GetCumulative() method by assigning the cumulative error to the newly generated histogram instead of the original one.

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

This PR fixes #11947

@ShamrockLee ShamrockLee requested a review from lmoneta as a code owner December 21, 2022 10:34
@phsft-bot
Copy link

Can one of the admins verify this patch?

Copy link
Member

@lmoneta lmoneta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this fix. I agree this was a bug, great you have found it.
Just a small comment for avoid using virtual functions (TArray::SetAt) for better efficiency

if (fSumw2.fN) {
esum += GetBinErrorSqUnchecked(bin);
fSumw2.fArray[bin] = esum;
hintegrated->GetSumw2()->SetAt(esum, bin);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is maybe shorter and more efficient to write:

hintegrated->fSumw2.fArray[bin] = esum;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! But why are these protective attributes of a non-self TH1 instance accessible here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is maybe shorter and more efficient to write:

hintegrated->fSumw2.fArray[bin] = esum;

Updated and tested.

Assign the cumulative error to the newly generated histogram
instead of the original one.
@lmoneta
Copy link
Member

lmoneta commented Dec 23, 2022

@phsft-bot build!

@phsft-bot
Copy link

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu18.04/nortcxxmod, ROOT-ubuntu2004/python3, mac12/noimt, mac11/cxx14, windows10/cxx14
How to customize builds

@phsft-bot
Copy link

Build failed on ROOT-performance-centos8-multicore/cxx17.
Running on olbdw-01.cern.ch:/data/sftnight/workspace/root-pullrequests-build
See console output.

Errors:

  • [2022-12-23T17:30:15.568Z] 1221/2420 Test [cxxmodules] Unify *32 dictionaries into one #936: tutorial-roostats-OneSidedFrequentistUpperLimitWithBands ..........................................***Failed Error regular expression found in output. Regex=[: error:] 1.03 sec
  • [2022-12-23T17:30:15.568Z] 1222/2420 Test [cxxmodules] Mark libc/STL as system #931: tutorial-roostats-FourBinInstructional ............................................................***Failed Error regular expression found in output. Regex=[: error:] 1.40 sec
  • [2022-12-23T17:30:15.568Z] 1223/2420 Test [IMT] Add TThreadedObject::GetAtSlotRaw #934: tutorial-roostats-IntervalExamples ................................................................***Failed Error regular expression found in output. Regex=[: error:] 1.23 sec
  • [2022-12-23T17:30:16.084Z] 1228/2420 Test Added TMCThreadLocalStatic type (according to Geant4 tls.hh) #939: tutorial-roostats-StandardFeldmanCousinsDemo ......................................................***Failed Error regular expression found in output. Regex=[: error:] 0.93 sec
  • [2022-12-23T17:30:16.887Z] 1236/2420 Test [cmake] Stop searching headers in the default paths #948: tutorial-roostats-TwoSidedFrequentistUpperLimitWithBands ..........................................***Failed Error regular expression found in output. Regex=[: error:] 0.97 sec
  • [2022-12-23T17:30:17.933Z] 1246/2420 Test Added new TVirtualMC functions TrackPosition|Momentum(Float_t& ...): #954: tutorial-roostats-rs401c_FeldmanCousins ...........................................................***Failed Error regular expression found in output. Regex=[: error:] 1.16 sec
  • [2022-12-23T17:30:17.933Z] 1247/2420 Test Fix Imt configure in the classic build #950: tutorial-roostats-rs101_limitexample ..............................................................***Failed Error regular expression found in output. Regex=[: error:] 1.84 sec

Warnings:

  • [2022-12-23T17:25:16.457Z] /data/sftnight/workspace/root-pullrequests-build/build/include/ROOT/RDataSource.hxx:213:11: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-23T17:25:17.479Z] /data/sftnight/workspace/root-pullrequests-build/build/include/ROOT/RCsvDS.hxx:112:1: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-23T17:25:17.479Z] /data/sftnight/workspace/root-pullrequests-build/build/include/ROOT/RSqliteDS.hxx:117:1: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-23T17:25:17.479Z] /data/sftnight/workspace/root-pullrequests-build/build/include/ROOT/RNTupleDS.hxx:96:1: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-23T17:25:17.479Z] /data/sftnight/workspace/root-pullrequests-build/build/include/ROOT/RNTupleDS.hxx:98:1: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-23T17:25:28.550Z] /data/sftnight/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:215:7: warning: ‘REMOVE_THIS_NOW’ attribute directive ignored [-Wattributes]
  • [2022-12-23T17:25:30.868Z] /data/sftnight/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RCsvDS.hxx:114:114: warning: ‘REMOVE_THIS_NOW’ attribute directive ignored [-Wattributes]
  • [2022-12-23T17:25:31.158Z] /data/sftnight/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RSqliteDS.hxx:118:81: warning: ‘REMOVE_THIS_NOW’ attribute directive ignored [-Wattributes]
  • [2022-12-23T17:25:31.158Z] /data/sftnight/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RNTupleDS.hxx:97:86: warning: ‘REMOVE_THIS_NOW’ attribute directive ignored [-Wattributes]
  • [2022-12-23T17:25:31.158Z] /data/sftnight/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RNTupleDS.hxx:99:47: warning: ‘REMOVE_THIS_NOW’ attribute directive ignored [-Wattributes]

And 130 more

Failing tests:

And 7 more

@phsft-bot
Copy link

Build failed on ROOT-ubuntu18.04/nortcxxmod.
Running on sft-ubuntu-1804-2.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Warnings:

  • [2022-12-23T17:18:32.203Z] /mnt/build/workspace/root-pullrequests-build/build/include/ROOT/RDataSource.hxx:213:11: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-23T17:18:32.203Z] /mnt/build/workspace/root-pullrequests-build/build/include/ROOT/RCsvDS.hxx:112:1: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-23T17:18:32.204Z] /mnt/build/workspace/root-pullrequests-build/build/include/ROOT/RSqliteDS.hxx:117:1: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-23T17:18:32.204Z] /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:215:7: warning: ‘REMOVE_THIS_NOW’ attribute directive ignored [-Wattributes]
  • [2022-12-23T17:18:32.204Z] /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RCsvDS.hxx:114:114: warning: ‘REMOVE_THIS_NOW’ attribute directive ignored [-Wattributes]
  • [2022-12-23T17:18:32.204Z] /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:215:7: warning: ‘REMOVE_THIS_NOW’ attribute directive ignored [-Wattributes]
  • [2022-12-23T17:18:32.204Z] /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:215:7: warning: ‘REMOVE_THIS_NOW’ attribute directive ignored [-Wattributes]
  • [2022-12-23T17:18:32.204Z] /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:215:7: warning: ‘REMOVE_THIS_NOW’ attribute directive ignored [-Wattributes]
  • [2022-12-23T17:18:32.204Z] /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:215:7: warning: ‘REMOVE_THIS_NOW’ attribute directive ignored [-Wattributes]
  • [2022-12-23T17:18:32.463Z] /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:215:7: warning: ‘REMOVE_THIS_NOW’ attribute directive ignored [-Wattributes]

And 60 more

Failing tests:

@phsft-bot
Copy link

Build failed on ROOT-ubuntu2004/python3.
Running on root-ubuntu-2004-1.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Warnings:

  • [2022-12-23T17:18:04.800Z] /home/sftnight/build/workspace/root-pullrequests-build/build/include/ROOT/RDataSource.hxx:213:11: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-23T17:18:04.800Z] /home/sftnight/build/workspace/root-pullrequests-build/build/include/ROOT/RCsvDS.hxx:112:1: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-23T17:18:04.800Z] /home/sftnight/build/workspace/root-pullrequests-build/build/include/ROOT/RSqliteDS.hxx:117:1: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-23T17:18:04.800Z] /home/sftnight/build/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:215:7: warning: ‘REMOVE_THIS_NOW’ attribute directive ignored [-Wattributes]
  • [2022-12-23T17:18:04.800Z] /home/sftnight/build/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RCsvDS.hxx:114:114: warning: ‘REMOVE_THIS_NOW’ attribute directive ignored [-Wattributes]
  • [2022-12-23T17:18:04.800Z] /home/sftnight/build/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:215:7: warning: ‘REMOVE_THIS_NOW’ attribute directive ignored [-Wattributes]
  • [2022-12-23T17:18:04.801Z] /home/sftnight/build/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:215:7: warning: ‘REMOVE_THIS_NOW’ attribute directive ignored [-Wattributes]
  • [2022-12-23T17:18:05.085Z] /home/sftnight/build/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RCsvDS.hxx:114:114: warning: ‘REMOVE_THIS_NOW’ attribute directive ignored [-Wattributes]
  • [2022-12-23T17:18:05.085Z] /home/sftnight/build/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RSqliteDS.hxx:118:81: warning: ‘REMOVE_THIS_NOW’ attribute directive ignored [-Wattributes]
  • [2022-12-23T17:18:05.085Z] /home/sftnight/build/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:215:7: warning: ‘REMOVE_THIS_NOW’ attribute directive ignored [-Wattributes]

And 54 more

Failing tests:

@phsft-bot
Copy link

Build failed on mac11/cxx14.
Running on macphsft20.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Errors:

Warnings:

  • [2022-12-23T17:43:27.231Z] /Users/sftnight/build/workspace/root-pullrequests-build/build/include/ROOT/RDataSource.hxx:213:11: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-23T17:43:27.231Z] /Users/sftnight/build/workspace/root-pullrequests-build/build/include/ROOT/RCsvDS.hxx:112:1: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-23T17:43:27.231Z] /Users/sftnight/build/workspace/root-pullrequests-build/build/include/ROOT/RSqliteDS.hxx:117:1: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-23T17:43:35.685Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:213:11: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-23T17:43:35.685Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RCsvDS.hxx:112:1: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-23T17:43:36.213Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:213:11: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-23T17:43:36.469Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:213:11: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-23T17:43:38.073Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:213:11: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-23T17:43:38.687Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:213:11: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-23T17:43:40.321Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:213:11: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]

And 54 more

Failing tests:

And 7 more

@phsft-bot
Copy link

Build failed on mac12/noimt.
Running on macphsft18.dyndns.cern.ch:/Users/sftnight/build/jenkins/workspace/root-pullrequests-build
See console output.

Warnings:

  • [2022-12-24T05:05:04.147Z] /Users/sftnight/build/jenkins/workspace/root-pullrequests-build/build/include/ROOT/RDataSource.hxx:213:11: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-24T05:05:04.147Z] /Users/sftnight/build/jenkins/workspace/root-pullrequests-build/build/include/ROOT/RCsvDS.hxx:112:1: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-24T05:05:04.147Z] /Users/sftnight/build/jenkins/workspace/root-pullrequests-build/build/include/ROOT/RSqliteDS.hxx:117:1: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-24T05:05:04.147Z] /Users/sftnight/build/jenkins/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:213:11: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-24T05:05:04.147Z] /Users/sftnight/build/jenkins/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RSqliteDS.hxx:117:1: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-24T05:05:04.147Z] /Users/sftnight/build/jenkins/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:213:11: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-24T05:05:04.148Z] /Users/sftnight/build/jenkins/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:213:11: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-24T05:05:04.148Z] /Users/sftnight/build/jenkins/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:213:11: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-24T05:05:04.148Z] /Users/sftnight/build/jenkins/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RCsvDS.hxx:112:1: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]
  • [2022-12-24T05:05:04.148Z] /Users/sftnight/build/jenkins/workspace/root-pullrequests-build/root/tree/dataframe/inc/ROOT/RDataSource.hxx:213:11: warning: unknown attribute 'REMOVE_THIS_NOW' ignored [-Wunknown-attributes]

And 53 more

Failing tests:

@ShamrockLee
Copy link
Contributor Author

Is there something I need to fix?

Copy link
Member

@lmoneta lmoneta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
Thank you for this fix!

@lmoneta lmoneta merged commit c57458a into root-project:master Jan 5, 2023
@ShamrockLee ShamrockLee deleted the hist-cumulative-error branch June 2, 2023 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[hist] TH1::GetCumulative doesn't set the bin error for the generated histogram, but change that of the original hist instead

3 participants