How to "clear" TPolyMarkers, results of TSpectrum:

Hi rooters,

How can I “clear” results of TSpectrum::Search(), i.e. erase the TPolyMakers which indicate positions of the peaks found in a TH1 spectrum (from scripts/programs)?

Using GUI, I can delete a TPolyMaker by right-clicking near the marker and selecting “Delete”.
According to

[quote]A pointer to the polymarker object can be retrieved later via:

TList *functions = hin->GetListOfFunctions(); TPolyMarker *pm = (TPolyMarker*)functions->FindObject("TPolyMarker")

So I did

and then the application segfaults…

My environment is root v5.22.00 on Fedora 10 i386/x86_64 w/ g++ (GCC) 4.3.2 20081105 (Red Hat 4.3.2-7).

Thanks in advance,


why not simply make search with “goff” option ?

or make 2 spectrums, one searches with markers and the other without.

BTW, they better give same result :slight_smile:

ROOT has a lot of weird storage schemes which are designed to be used in 1 or 2 specific ways. One could go nuts trying to figure all of them out.

Just stay simple and use standard interface and you’d be fine :slight_smile:.


TList *functions = hin->GetListOfFunctions(); TPolyMarker *pm = (TPolyMarker*)functions->FindObject("TPolyMarker") functions->Remove(pm);

Dear Rene,

Thanks for your advice. It works.