int main(){ double *x = new double[1000]; double *y = new double[1000]; int iter = 0; ifstream Data; Data.open("h.txt"); while (Data >> x[iter] >>y[iter]) iter++; ostringstream canvas_title; canvas_title <<"Deconvolution procedure"; TCanvas* NewCanvas=new TCanvas(canvas_title.str().c_str(),canvas_title.str().c_str()); // graph of the VEM trace TGraph* graph = new TGraph(iter, x, y); graph->Draw("apl"); graph->SetName("graph"); graph->SetTitle(""); graph->GetXaxis()->SetTitle("t [ns]"); graph->GetYaxis()->SetTitle("Signal [VEM]"); graph->GetXaxis()->SetLimits(0,iter); TH1F *h = new TH1F("h","FADC trace",iter,0,1000); h->SetContent(y); //set SPR in an array; const int size = iter; double SPR[size];//define the response function of the system for (int j = 0; j < iter; ++j) //this is the response function SPR[j]=1.8*(exp(-1*j*25.0/67.0) - exp(-1*j*25.0/13.0)); //Use TSpectrum to find the peak candidates TSpectrum *spec = new TSpectrum(1000); Int_t nfound = spec->Search(h,2,""); //deconvolute SPR from trace spec->Deconvolution1(y,SPR, iter, 30); }