Cannot draw TH2F, empty in TBrowser, GetBinContent not empty

Hi all,

My problem is that I have a TH2F histo, in the TBrowser seems empty, but when I do GetBinContet, or Print("all), I get values. When I use a macro to read it, it does not complain but it draws nothing.
My macro is the following:[code]
TFile file0(“data_phi.root”); file0.cd(“ZmumuTPMuon/MuonProbe_HighEtaNumMS/MuonProbe_OC_LooseProbes_noProbeIP/Dummy/Probes”);
TH2F data_phi = (TH2F)MuonProbe_HighEtaNumMS_MuonProbe_OC_LooseProbes_noProbeIP_Dummy_Probes_EtaPt->Clone();

TCanvas *c3=new TCanvas();
data_phi->Draw();

[/code]

Thank you in advance!
Des

Can it be that all “non-zero values” are in “underflow” and “overflow” bins?

I changed the the Axis range, the canvas is empty, but now the stats are different. The mean X value, the mean Y value are not zero now! But still it is empty…

PS Thanks for your prompt answer!

Attach your “.root” file here.

Here it is
data_phi.root (928 KB)

That’s what I thought … all “non-zero values” are in “underflow” and “overflow” bins.
Try: data_phi->Print(“range”);

However, I change both the axis range and still I cannot see anything drawn, is there
something else I can do to draw the histo?

You need to talk to the one who “creates” and “fills” this histogram.

Oh I see… Thank you very much for helping me! :slight_smile:

Hello again,

I now have a histogram in which everything is within the range of the two axis, but when I do Draw(), I
get an empty canvas. Then I go to the DrawPanel and check the 3D option, and I get a 3D histogram on
the canvas with the correct values. However I need to use the 2D , not the 3D.

Is there a way to get the 2D histo?

Attach your new “.root” file (and write which histogram you are trying to draw).

Just solved by adding histo->SetEntries(1) when the histo is created, but thank you!