My question seems simple, but I can’t quite find a satisfactory answer. If I have a TH2D h that has been filled, potentially with fractional weights (and certainly with Sumw2() called before filling), how can I draw the Sumw2 errors for each bin in the “colz” style? I would like to do something like the following:
// TH2D *h has already been declared and filled by here. TCanvas *c = new TCanvas("c","c",1000,1000); c->Divide(1,2); c->cd(1); h->Draw("colz"); // gives a display of the contents of h c->cd(2); h->DrawSumw2Error("colz"); // THIS IS WHAT I WANT TO DO, IS THIS POSSIBLE?
I am aware that h can be drawn with the various E options but this gives a 3D view and is not what I want. I want a 2D colour-coded map of the Sumw2 errors, so that each bin value in the drawn histogram of errors is the square root of the Sumw2 value for that bin in h.
I can create a whole new histogram hErr with the same size as h and loop over the bins, using SetBinContent() to assign values of sqrt( h->GetBinError(the_bin) ) to the same bin in hErr, and then draw hErr with the colz option. But I feel like this functionality might already be provided in the TH2 class and I just can’t find it. Any suggestions?