Problem with 2D plot values

does @couet or someone else know how to fix it please?

I was away for a bit. Looking at your new code now.

I do not get the same error. It seems your code has some invalid pointer:

Error in <HandleInterpreterException>: Trying to dereference null pointer or trying to call routine taking non-null arguments.
Execution of your code was aborted.
In file included from input_line_9:1:
/Users/couet/Downloads/calo.C:6886:14: warning: null passed to a callee that requires a non-null argument [-Wnonnull]
                        p09sub = htemp9sub->GetFunction("gaus")->GetParameter(0);
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hi @couet, I donā€™t know. I get the error just when I add

		TH1 *hh2 = henecdsubstringcutrelTHFsumdiff->DrawCopy("colz"); // creates all axes
			gPad->Modified();
			gPad->Update(); // make sure it's really (re)drawn
			TPaletteAxis * palette2 = (TPaletteAxis *) hh2->GetListOfFunctions()->FindObject("palette");
   			palette2->SetX1NDC(0.86);
   			palette2->SetX2NDC(0.90);
   			palette2->SetY1NDC(0.20);
   			palette2->SetY2NDC(0.80);
			c45->Modified();
			c45->Update();

otherwise, it works (but I canā€™t move the palette). Moreover, I would like to increase the marker sizeā€¦so I wrote:

henecdsubstringcutrelTHFsumdiff->SetMarkerSize(20);

the marker size doesnā€™t increase.

The error I get is not due to the palette2 code. I commented it and I get the same error.

You are rightā€¦I commented it and I get errorā€¦but I downloaded again your file and I get error using it too o_O
When you uploaded it, it workedā€¦ I get the same error that in my printscreenā€¦
line 3258 TH1 *hh = henecdsubstringcutrelTHF->DrawCopy("colz"); // creates all axes
I canā€™t understand what is happeningā€¦

Sometimes your histograms are empty and the fit does not produce any function. But you call GetParameter on this non existing function. This is why it crashes. I have put a few protections here and there to make your macro work. I would anyway recommend that you revisit it completely. It really looks very ā€œdraftā€ (no indentation, a lot of useless code, etc ā€¦).
calo.C (1.0 MB)

Hi @couet, thank you for your help.

  1. The macro currently works, but when I add
 TH1 *hh2 = henecdsubstringcutrelTHFsumdiff->DrawCopy("colz"); // creates all axes
         TPaletteAxis * palette2 = (TPaletteAxis *) hh2->GetListOfFunctions()->FindObject("palette");
         palette2->SetX2NDC(0.93);
         gPad->Modified();
         gPad->Update(); // make sure it's really (re)drawn
         c25->Modified();
         c25->Update();
         henecdsubstringcutrelTHFsumdiff->SetName(heneabname);
         gPad->Modified();
         gPad->Update(); // make sure it's really (re)drawn

to move also the second palette, it crashes again;
2. can you say me the useless code?
3. I would like to set the mark size. I wrote

henecdsubstringcutrelTHFsumdiff->SetMarkerSize(20);

but it doesnā€™t look to changeā€¦

  1. Please, can you check also this post please? Set energy 0 in a sum

Can you post the macro as you modified it ?

Hi @couet this is the macro. I just didnā€™t comment the second palette code.
calo.C (1.0 MB)

I ran you macro. I do not get any crash

Hi @couet, I donā€™t know the reasonā€¦
@bellenot do you think it could be releated to windows ROOT?

I canā€™t try, I donā€™t have the si-500636660.root file: Error in <TFile::TFile>: file C:/si-calo-sep18/si-500636660.root does not exist

@bellenot:
This macro and this file are the ones.

calo.C (1011.6 KB)

https://cernbox.cern.ch/index.php/s/GA61mMqpz06ih2O

OK, I can reproduce the problem on Windows

thank you @couet to share the root file

Ps. @bellenot Moreover, on Windows, I also canā€™t increase the marker size by using

henecdsubstringcutrelTHFsumdiff->SetMarkerSize(20);

OK, so you canā€™t create TH2F with 10000*10000 bins with 32 bit floating points on a 32 bit machine: 10000*10000*32 = 3.2GB! (max: 2GB)

Hi @bellenot , thank you. I rebinned it and it worked (It doesnā€™t crash and I can move the palette).
Currently I just canā€™t increase the marker size.

calo.C (1.0 MB)

Well, Iā€™m not sure setting a marker size on a TH2F drawn with COLZ makes any sense. What you see is the bin sizeā€¦ Maybe @couet can comment on this one

You are right, it does not makes sense.