#include "TCanvas.h" #include "TF1.h" #include "TMath.h" #include "TFile.h" #include "TSpectrum.h" #include "TH1F.h" void FindPeaks(int npeaks) { double sigma = 3; double threshold = 0.01; TFile *fileHisto = TFile::Open(Form("GeSpectra_R74.root")); //---------------recover histos-------------- TString histoname; TH1F *h = (TH1F*) fileHisto ->Get("EGe_6"); TCanvas *c = new TCanvas("c","c"); c->cd(); h->Rebin(2); h->GetXaxis()->SetRangeUser(100,4100); h->Draw(); TSpectrum *s = new TSpectrum(npeaks); Int_t nfound = s->Search(h, sigma, "new",threshold); cout<<"Found "<GetNPeaks()<<" "<GetPositionX(); long long sizes = nfound; //long long inds[nfound]; long long inds[10]; // need to have static size for(int k=0; k