void RF(){ double *x = new double[1000]; double *y = new double[1000]; float *yf = new float[1000]; int iter = 0; ifstream Data; Data.open("h.txt"); while (Data >> x[iter] >>y[iter]) iter++; TCanvas* NewCanvas=new TCanvas("c1","c1"); // 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,iter); h->GetXaxis()->SetRange(200,400); h->SetContent(y); h->SetMaximum(12); //set SPR in an array; const int size = iter; float SPR[1000];//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 int i; for (i=0;iDeconvolution(yf,SPR, iter, 50,10,20.); TH1F *h2 = new TH1F("h2","h deconvoluted",iter,0,iter); h2->GetXaxis()->SetRange(200,400); h2->SetFillColor(kBlue); for (i=0;iSetBinContent(i+1,yf[i]); h2->Draw("same"); }