ROOT Version: v6-23-01-335-gffa7013ea6 Platform: 64 bit Fedora32 (5.6.16-300.fc32.x86_64) Compiler: gcc version 10.1.1 20200507 (Red Hat 10.1.1-1) (GCC); Python 2.7.18
Hello,
I am trying to modify "DynamicSlice.py" to search for transitions in the slices and label those transitions. The modified file (DynamicSlice_GG.py (5.2 KB)) and necessary input file (test54.root) are attached. However, I don’t get the behaviour that I am looking for - I want all the peaks to be labelled when I move mouse over the 2D-histogram i.e. when X and Y slices are dynamically displayed. As you will notice, that several peaks are marked with TPolyMarker, but the labels vanish . Only one, probably for the peak with smallest height (of course, depending on the threshold used for peak searching) remains.
You can run the attached code as: "python -i DynamicSlice_GG.py"
@couet ROOT 6.20/06 with python2 … why does it not work when (in the macro from the first post here) one replaces “t2.Draw()” with “gROOT.SetSelectedPad(gPad); t2.DrawClone()”? It does draw all “cloned” texts but it also looks like all “clones” are immediately deleted, while they should be owned by the pad (and remain). I cannot try it in the newly released ROOT 6.22/00 due to its bugs in python2 support.
@Wile_E_Coyote
You are genius! Thank you very much. It is now working exactly as I was expecting. I have always enjoyed discussions with you several times earlier. I hope you remember!
Anyway, do you have any suggestion/s to improve the present macro?
As noticed in another thread, the trick with defining “t2” as a list does not help when one resizes or double-clicks the corresponding canvas (all drawn texts disappear).
Unfortunately, as written in my first post here, ROOT with python2 will automatically delete “cloned” texts (note: the simple “gROOT.SetSelectedPad(gPad); t2.DrawClone()” sequence seems to work in ROOT with python3).
So, I’ve found another brutal fix which works in both python versions.