Puzzaling contz plot


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.

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

Proceed as shown below


[code]void test()
TChain *chain = new TChain(“test”);

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();
chain->Draw("beta_P:p_P >> betaP", "", "same cont"); //<===========


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.


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


Thanks. It is working perfectly.