int main(unsigned int sdevno, SEvent::ConstStationIterator sIt){ double *x = new double[size]; double s[2]; const TraceD& trace = sIt->GetVEMTrace(); // Root TGraph wants a double*, so copy our trace there s[0] = sIt->GetRecData().GetSignalStartSlot()*25; s[1] = (sIt->GetRecData().GetSignalEndSlot() - sIt->GetRecData().GetSignalStartSlot())*25; for (int i = 0; i < size; ++i){ x[i] = (i*25)-s[0]; } double y[size]; std::copy(trace.Begin(), trace.End(), y); ostringstream canvas_title; canvas_title <<"Event id "<GetId(); TCanvas* NewCanvas=new TCanvas(canvas_title.str().c_str(),canvas_title.str().c_str()); // graph of the VEM trace TGraph* graph = new TGraph(size, x, y); graph->Draw("ap"); graph->SetName("graph"); graph->SetTitle(Form("%d", sdevno)); graph->GetXaxis()->SetTitle("t [ns]"); graph->GetYaxis()->SetTitle("Signal [VEM]"); graph->GetXaxis()->SetLimits(0,6000); TH1F *h = new TH1F("h","FADC trace",size,0,6000); h->SetContent(y); //set SPR in an array; double SPR[size]; for (int j = 0; j < size; ++j) 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, size, 30); }