Problem in fitting (in function!)

The first one is not helping.

The second one is OK. But, it fails when I use multi-palette in same pad. I’ve used TExec as you have shown in https://root.cern.ch/doc/master/multipalette_8C.html.

I don’t know why.

May be post again the macro you have so I can have a look at it.

Yeah, here it is…

I have modified your example only.

multi.C (755 Bytes)

This one is ok:

void multi() {
   gStyle->SetCanvasPreferGL(kTRUE);
   auto c  = new TCanvas("c","c",0,0,1000,800);

   auto frame = new TH2F ("frame","Example of two surface on the same plot",20,1,3,20,1,3);
   frame->SetMaximum(1.2);

   auto f1 = new TF2("f1","0.1+(1-(x-2)*(x-2))*(1-(y-2)*(y-2))",1,3,1,3);
   auto f2 = new TF2("f2","0.1+(2-(x-3)*(x-3))*(2-(y-3)*(y-3))",2,4,2,4);

   f1->SetLineWidth(1);
   f1->SetLineColor(kBlue);
   f2->SetLineWidth(1);
   f2->SetLineColor(kBlack);

   frame->Draw("lego0");
   TExec *ex1 = new TExec("ex1","gStyle->SetPalette(kBird, 0, 0.5);");
   ex1->Draw();
   f1->Draw("surf2 same ");

   TExec *ex2 = new TExec("ex2","gStyle->SetPalette(75, 0, 0.5);");
   ex2->Draw();
   f2->Draw("surf2 same");
}

With your modifications, I am getting this.

with an error- “Error: Symbol kBird is not defined in current scope (tmpfile):1:”

I tried with kRed too. But, no good.

Why I don’t know.

This macro multi.C (766 Bytes) gives me this picture:

That’s exactly what I want, but, I am getting the previous figure I posted. I am using ROOT 5.34/36 version in Ubuntu.

I have included:
#include “TStyle.h”
#include “TColor.h”
#include “TF2.h”
#include “TExec.h”
#include “TCanvas.h”

Do I need to include some more?

You would need ROOT 6 …

ROOT 6 is available on Ubuntu … I assume you can easily get it.

Is there no other option?

Can I install root 6 beside root 5?

No, some functionalities are in ROOT 6 only

Yes. you can change from a version to an other by “sourcing” $ROOTSYS/bin/thisroot.sh

Which Ubuntu version?
How did you install the current ROOT 5?

BTW. You can easily get the macro working on ROOT 5. You just need to get rid of “auto” and replace “kBird” with some number, e.g. “55”.

Ubuntu 16.04 LTS

I installed it following what was given in root website, few years back

Installed into where? I hope NOT into some “standard” system directories.

BTW. The ROOT team provides ready-to-use binary distributions for some systems, including various Ubuntu versions, which you just need to download and unpack (see “Using binaries” therein).

After installing to my computer, I changed in the bash file to have root directory independent. That’s what I remember.

So there should be no problem in having multiple ROOT versions. See e.g.:

May be try this version on ROOT 5 (as @Wile_E_Coyote suggested)
multi5.C (769 Bytes)

Yeah, somehow, if it works in root5 that would be better, as right now I don’t want to change my root version. If something bad happens I would be in a big trouble. Once it happened to me earlier, there was a version mismatch between root 6 and ubuntu.

I’ve forgotten that palette “75” does not exist in ROOT 5, so you need to replace it with e.g. “52”.

Yeah, working ultimately. Thanks to @Wile_E_Coyote and @couet

1 Like

You do NOT need to replace ROOT 5 with ROOT 6.
You can have MULTIPLE (different) ROOT versions installed SIMULTANEOUSLY in different directories (and easily switch between them).