How to modify/recompile the source code


I’m writing some codes including “TSpectrum”, and I notice that when I run TSpectrum::Search, a histogram will “pop up”. It is a little bit annoying if you run it in the loop and only want to record the positions. So I looked up the source code(TSpectrum.cxx) and found this:

      for(i=0;i<npeaks;i++) {
         bin = Int_t(fPositionX[i] +0.5);
         fPositionX[i] = hin->GetBinCenter(bin);
         fPositionY[i] = hin->GetBinContent(bin);
      if (strstr(option,"goff")) return npeaks;
      TPolyMarker *pm = new TPolyMarker(npeaks,fPositionX, fPositionY);
      return npeaks;

Apparently, hin->Draw()/pm->Draw() are the reason. If I comment them or change them to if(blabla) hin->Draw(), my problem will be solved.

So, I’d like to know how could I “only” recompile I do not guess it wrong) from the modified TSpectrum.cxx, or how could I change it in the most easily way.



Hi yjc,

And what about using the “nodraw” option, as described in the TSpectrum::Search documentation? :wink:

Cheers, Bertrand.

Not really the answer you asked for, but TSpectrum::Search takes an option parameter “goff” to turn off drawing (parsed on the line above the Draw call in the code you posted).

Thanks bellenot and honk,

I dont know why I ignored these two lines