Just read the posting rules.
Sorry, I’m using root 3.05/07.

But prior to posting this thread, I looked up the reference guide for this version. That also indicates that the maxpositions limits the number of peaks returned by Search(histogram,sigma).

So … why doesn’t it?
The example I’ve uploaded is a bit trivial, but it shows the problem …
Or am I just missing a point somewhere?

//______________________________________________________________________________
TSpectrum::TSpectrum(Int_t maxpositions, Float_t resolution) :TNamed("Spectrum", "Miroslav Morhac peak finder")
{
Int_t n = TMath::Max(maxpositions, 100);
fMaxPeaks = n;
Maybe TMath::Max should be TMath::Min, otherwise at least 100 peaks can be returned.

Janos

BTW:
I think the default contructor

//______________________________________________________________________________
TSpectrum::TSpectrum() :TNamed(“Spectrum”, “Miroslav Morhac peak finder”)
{
Int_t n = 100;
fMaxPeaks = n;
fPosition = new Float_t[n];
fPositionX = new Float_t[n];
fPositionY = new Float_t[n];
fResolution = 1;
fHistogram = 0;
fNPeaks = 0;
}
is against coding standard, as it allocates memory.

[quote=“no1else”]Yeah, neither do I. its certainly messing things up for my code.
Anyway …[/quote]

You know, there are some mystic limitations like for example in TFumili.cxx

TFumili::TFumili(Int_t maxpar)
{//----------- FUMILI constructor ---------
// maxpar is the maximum number of parameters used with TFumili object
//
fMaxParam = TMath::Max(maxpar,25);
if (fMaxParam>200) fMaxParam=25;

So, if you have two peaks only, you receive a 100 packet of peaks (even if your array is prepared for 2 only (!)), with no upper limit for the peaks.
If you have 3 parameters, you will receive a 25 packet of parameters.
And, all the calculations are done with this number of (mostly, ghost) parameters.
However, you must not order more than 200.

Thanks for reporting the two problems with the maximum number of peaks
in the TSpectrum constructor or the maximum number of parameters
in the TFumili constructor.
Now fixed in teheCVS head.