Thresold set up in Yaxis count in histogram

You can save the histograms this way:

for (int i=0;i<n;i++)  {
   if (peakno[i]->GetMaximum() > treshold) {
      peakno[i]->Write();
      intno[i]->Write();
   }
}

And you can do a similar test to on search the peaks on the histogram having theirs maximum greater than treshold:

for (int i=0;i<n;i++) {
   if (peakno[i]->GetMaximum() > treshold) {
      TSpectrum *s = new TSpectrum(npeaks);
      int nfound = s->Search(peakno[i],0.0,"",0.1);
      intno[i]->Fill(nfound);
      std::cout << "idEvent = " << i << "no of peaks= " << nfound << std::endl;
      inttotal->Add(intno[i]);
   }
}