Canvas is not catching up the Histogram

Hi
I am using 3 different canvas to print 3 2D histograms. I am doing the same for declaring and drawing for all of three. Two are fine, but one canvas is completely blank (just white sheet).
Is there any problem that I am making but I am unaware of?
Here is that part of code.

TCanvas *Back = new TCanvas (“Background”,“Background_distri”,15,15,700,500);
Back->cd();
gStyle->SetPalette(kBird);
Backgrnd->Draw(“SURF”);
TCanvas *Signal = new TCanvas (“Signal”,“Signal_distr”,15,15,700,500);
Signal->cd();
gStyle->SetPalette(kBird);
RawDeltaPhi1->Draw(“SURF”);
TCanvas *Final = new TCanvas (“Final”,“Correlation”);
TH2D h3 = (TH2D)RawDeltaPhi1->Clone(“h3”);
h3->Divide(Backgrnd);
gStyle->SetPalette(kBird);
h3->Draw(“surf”);

The second Signal canvas is blank.
Thank You

Hi,
Can you post the full script please? The snippet you posted looks fine.

There is a warning.
Warning in TCanvas::ResizePad: Inf/NaN propagated to the pad. Check drawn objects.

Well there you go then, you are trying to draw a histogram with malformed entries.
You probably have an error in your program’s logic that causes it to fill a histogram with “inf” or “NaN” values.

More precisely :slightly_frowning_face:

I have no way to know, sorry :sweat_smile: you have to debug your program, for example by taking a copy of your program, deleting everything that does not have anything to do with the problematic histogram, checking that the reduced program still reproduces the issue and then printing at screen all the values you are filling the histogram with.

So you can manually inspect what is going on and what is going wrong. This might be a good start.

1 Like

I will do :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.