Puzzaling contz plot

Hi,

I have two questions:

  1. I tried to plot two contz plots on the same canvas. If I type line-by-line of the code (in file test.C) in command line then it works fine. But If I include those lines in a file, i.e. test.C and run ‘root -l test.C’ then the second plot will be cut off at 1 in x-axis, which should not be.

I have included a data file (test.root) and code file (test.C).

  1. In the above plot, it draw two color palettes one for each plot. How do I plot only one color palette for all plots on the same canvas?

I am using root 5.22.

Thanks.
test.C (256 Bytes)
test.root (563 KB)

Proceed as shown below

Rene

[code]void test()
{
TChain *chain = new TChain(“test”);
chain->Add(“test.root”);

TH2F *beta_Pip = new TH2F("betaPip","",1000, 0.0, 2.5, 1000, 0.0, 1.1);
TH2F *beta_P   = new TH2F("betaP",  "",1000, 0.0, 2.5, 1000, 0.0, 1.1);
chain->Draw("beta_Pip:p_Pip >> betaPip", "", "contz");
double maxz = betaPip->GetMaximum();
beta_P->SetMaximum(maxz);
chain->Draw("beta_P:p_P >> betaP", "", "same cont"); //<===========

}
[/code]

Thanks Rene.

Just one comment: It does not plot “contz” for second plot “beta_P”. To do this, I have to write “same contz” but this will draw two color palettes. However, these two color palettes overlap each other.

Thanks.

see the last line marked with //<==== in my previous post

Rene

Thanks. It is working perfectly.