#include using namespace std; void peakfinder(){ TString filename = "testdata.txt"; TTree tr = TTree("tr","title"); tr.ReadFile(filename,"a:b:c:d"); TH1F *hist=new TH1F("hist","",1000,0,20000); tr.Draw("c>>hist"); TSpectrum *s=new TSpectrum(4,1); int n_peaks=s->Search(hist,0.03,"",0.1); cout << "The number of peaks found are: " << n_peaks << endl; double* peak_position_array=s->GetPositionX(); for(int i =0;i