Problem using "same" option with THStack in root 3

Hello,

I have some code that works just fine with these two lines:

stack->Draw();
Hists[0]->Draw(“sames*P”);

where stack is a THStack already filled and Hists is a vector of TH1D’s.
Both the points from Hists[0] and the THStack appear as I intend (see further on for how I intended them)

If I flip the order of the above two lines:

Hists[0]->Draw("*P");
stack->Draw(“same”);

The THStack appears in a modified fashion. When I filled THStack I did:

Hists[i]->SetFillColor(i);
stack->Add(Hists[i]);

(note i isnt set to 0 ever… so I dont add Hists[0] to THStack)

so I expect to see each histogram in the stack with filled colors. The second method above fails to display the colors. Instead I just get black points plotted. So I have lost the options I set for the histograms in the stack.

How can I preserve the options on the histograms in THStack while plotting Hists[0] on the canvas prior to the THStack?

I am using Red Hat 7.2 with gcc 2.95.3

Thanks,

Mark

Hi Mark,

It looks like your histograms have been created with error bars (Sumw2).
In this case, the default drawing option is to show the error bars.
Instead of

Hists[0]->Draw("*P"); 
stack->Draw("same"); 

do
Hists[0]->Draw("*P");
stack->Draw(“same hist”);

Rene