_ROOT Version: 6.10/09
Dear all,
I am trying to implement the TSpectrum class in an histogram, but the peak that was found is clearly not what it was supposed to be. See attached image. What is going wrong?
{
TChain ch("Events");
ch.Add("Skim25_07.root");
TCanvas *c1 = new TCanvas("c1","momentum",1);
gStyle->SetOptStat(0);
TH1F *h1 = new TH1F("h1", "momen", 20, 0, 200);
Events->Draw("mt_tot>>h1", "mt_tot>0");
//h1->Fit("gaus");
Int_t j = 0;
TSpectrum *sp1 = new TSpectrum();
sp1->Search(h1,1,"",0.5) ;
Int_t npeaks = sp1->GetNPeaks() ;
cout << "Peaks found " << npeaks << endl ;
Double_t *peaks;
peaks = sp1->GetPositionX();
for (j=0 ; j<npeaks ; j++){
cout << "Peak at = " << peaks[j] << endl ;
}
h1->GetYaxis()->SetTitle("# entries");
h1->GetXaxis()->SetTitle("M_{T}^{total}");
}
Peaks found 1
Peak at = 95