TText in Projection canvas vanish

ROOT Version: 6.23/01
Platform: 64 bit Fedora 32
Compiler: gcc version 10.1.1 20200507 (Red Hat 10.1.1-1); Python 2.7.18

@Wile_E_Coyote @etejedor @couet

Please refer to the modified version of the example in the topic below:

I have noticed that the peak-labels in the projection canvas vanish when I resize or double-click the corresponding canvas. This is not the behavior I expect, those labels should stay there. Please suggest.

Thank you.



This looks more like a graphics issue than a PyROOT one, could you have a look @couet ?

It looks like th Text is removed at the end of the script . Is there a way in python to make the text persistent ? like when we create a pointer in C++ macro ? Have you tried to make this example in C++ ? (to see if you get the same effect)

Thank you very much for your reply.

I must admit that I am neither expert in C++ nor in Python. It just so happened that I was going through different tutorials and came across , and immediately realized that it would be great tool to quickly analyze 2D gamma-gamma coincidence Histograms.

Any further guidance to convert the code to C++ would be of great help.

May be this example can help.

And all you may try:

Thank you very much. It would be of really great help!

One quick observation (with any hist_2D histogram):

root[] hist_2D->Draw("colz");
root[] c1->SetLogz();
root[] hist_2D->SetShowProjectionX(4);

gives me a new canvas of which Y-Axis is in log scale. This is undesirable. I want Y-axis of the projection to be in linear scale. How can I do that?

The lin/log state of the projection matches the link/log state of the initial histogram. This cannot be changed.
Turn off logz scale on the original plot.

I tried to modified the DynamicSlice.C macro as suggested by you. It is working, sort of! But not exactly. There are two problems - (1) Both the projections are same and (2) The lines persists. I am sure, there must be something simple which I am doing wrong. Can you please help?

Please find attached the modified macro - DynamicSlice_GG.C (5.8 KB) and corresponding root file is here: test54.root

let me see

Never mind, I have now modified it, and it is working as expected.

Can you post the modified macro ?

Here it is: DynamicSlice_GG_v1.C (5.2 KB) .

If you have any ideas for further improvements to this macro, then please let me know.

I would do:

    else   c3 = new TCanvas("c3","yProjection",10,550,700,500);

Not that it matters but if I click in the “Dynamic Slicer” canvas then root freezes.

@Wile_E_Coyote Yes, it freezes for some time only, for the reasons unknown to me! ROOT expert may comment.


Incorporated your suggestion (which, I guess, was just to avoid the overlapping of the two canvases) as:

else   c3 = new TCanvas("c3","Y-Projection Canvas",10,550,700,500);

yes indeed

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