Error title TH2F

Please read tips for efficient and successful posting and posting code

ROOT Version: 6.18.00
Platform: UBUNTU 18.04.04

Good morning!

I’m doing the code bellow and one of the TH2F histogram give this: in the picture the titles would be, respectively, “Edep x distance in to center Ti” and “Edep x distance in to center Ti ok”.

I don’t know what is happens. Can you help me? The code is attached also!

ClassAna.C (21.2 KB)

line 419:

ana16 -> SetNameTitle("energy", "Edep x distance in to center Ti;  Energy[MeV]; Sqrt(x^2+y^2+z^2) [mm]; Counts");

Then, line 429:

ana16 -> SetNameTitle("energy", "Edep x distance in to center Ti ok;  Energy[MeV]; Sqrt(x^2+y^2+z^2) [mm]; Counts");

So the final title of the histogram will be the last one. @couet might confirm that using DrawClone() can solve the issue

Thanks @bellenot!

I observed this. I tried the DrawClone() but nothing happens.

But when I add other canvas, like in the code, I expected that the first canvas (can) will be in this way showed in this way too, but is showed like bellow:


Actually, you should use: TH1::DrawCopy

Thanks @Wile_E_Coyote!

I used the TH1::DrawCopy but don’t fixed! If I remove the title from the projection resolved for the first but in the second canvas generated, the projection was generated with the title of the last canvas.

I can’t what I supposed to do!

Best regards

You cannot use ProjectionX("PROJECTION IN X").
Because all your “ana*” histograms use the same name, you MUST always use ProjectionX("different_histogram_specific_name").
If you set different names for “ana*” histograms, then you can use ProjectionX() or ProjectionX("_px").

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.