void test() { TFile *f = new TFile("hist.root"); TH1D *h = f->Get("gSpecOut"); printPeakPositions(h); return; } void printPeakPositions(TH1 *h) { //make TSpectrum with max 40 peaks //NOTE: the second parameter is unused but it's supposed to represent the //peak resolution (for separating adjacent peaks, or something) TSpectrum *ts = new TSpectrum(40,1); //search for the peaks Int_t n = ts->Search(h,2,"",.004); cout << n << " peaks found. " << endl; cout << endl; //print the x positions Double_t *peakx = ts->GetPositionX(); for(int i=0;i