TSpectrum::Search2() ; a 2-D version


Root version 5.01
GCC 3.4.3
Enterprse Linux 4.

The example Peaks.C by Rene Brun is truely an eye-opener for me. I learnt so much about the technique of fitting and sampling from the example.

Presently, I have a task (medical imaging) which requires finding 2 dimensional peak positions. These positions will be used as inputs for Delauley triiangulation to create a Voronoid diagram, which is an effective image segmentation algorithm available in ROOT.

ROOT has adapted the 1-D version of the peak searching algorithm implemented by M.Morhac et al. (althought an error message in the TSpectrum::Search() seems to imply a 2-D version has been implemendted):

if (hin == 0) return 0;
Int_t dimension = hin->GetDimension();
if (dimension > 2) {
Error(“Search”, “Only implemented for 1-d and 2-d histograms”);
return 0;

(Can the current ROOT version(5.08) do a 2-D search?)

An search on the internet revealed that a 2-D version for TSpectrum::Search2() exists in the Stanford ROOT directory:
(slac.stanford.edu/comp/unix/ … ctrum.html)

class TSpectrum : public TNamed


virtual Int_t Search(TH1* hist, Double_t sigma, Option_t* option = “goff”)
virtual Int_t Search1(float* spectrum, int size, double sigma)
virtual Int_t Search2(float** source, int sizex, int sizey, double sigma)

I have also had a look at the CERN ROOT CVS directory for the latest TSpectrum class. It does not look like the 2-D version is coming soon.

I am wondering if I were to get that particular source code from the Standford website and do a partial re-compilation myself in order to use the 2-D search algorithm, what steps I need to take to achieve that (if it is possible at all without causing conflicts)

I hope some one can spare a precious monent of thirs to give me a brief set of instructions to carry this task, as it is really going into a new territory for me.

May be some one can give me an alternative solution to find 2-D peak positions wihtin the ROOT environent (I like ROOT so much now, and many thanks to its developers).

Much appreciated.


We had the TSpectrum2 class in the ROOT code. We decided to remove it
because of many problems.
Meanwhile, the author Miroslav Morhac has made substantial developments in a new version of the code. Miroslav is coming at CERN end of January to interface this new code with ROOT CVS head.
The new code includes improvements in TSpectrum and a brain new
TSpectrum2 class. We expect to see this development in the new ROOT version 5.09/02 early February or 5.09/04 early March.


Thanks Rene for the information.

I Look foward to the release date.


An upgrade of TSpectrum and the new class TSpectrum2 is now in CVS.
The new tutorial peaks2.C illustrates the performance of TSpectrum2.


Thank you Rene,

I will have a chance to test it next week.