Hi, I just accidentally discovered that you can use [] on TH1 objects:
root [0] TH1D h("h","h",10,0,10)
root [1] h[0]
(Double_t)0.00000000000000000e+00
root [2] h[100]
Error in <TArrayD::operator[]>: index 100 out of bounds (size: 12, this: 0x7fb1ea89daa8)
(Double_t)0.00000000000000000e+00
root [3] h.Fill(2)
(Int_t)3
root [4] h[3]
(Double_t)1.00000000000000000e+00
However I notice that in the documentation, neither TH1 nor any of its base classes provide such an operator. What’s going on? Am I just reading the documentation wrong, or should this be a private method? TH1D have a protected TArrayD data member which has operator[], and it stores the weights in each bin, but why am I able to access it?
I think even if users are not supposed to use this, it should be documented somewhere.
Jean-François