Tspectrum2 search high resolution problem


ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Hey Guys, I have a trouble when I tried to use the TSpectrum function: SearchHigRes, it always tell me
Error: Can’t call TSpectrum2::SearchHighRes(source,dest,n,m,0.1,0.4,kTRUE,1,kFALSE,1) in current scope newtry3.cc:206:

Possible candidates are…

(in TSpectrum2)

My code, data file are attached here. By the way, I use the SearchHighRes simply because the search could not give me the preferred result. It always ended up finding something in the background.image65_2.txt (1.3 MB)
newtry3.cc (6.6 KB)

I have cleaned up a bit your macro (it had a few mistakes).

newtry3.cc (2.8 KB)

It gives me a error. But not the one you see:

$ root newtry3.cc 
   ------------------------------------------------------------
  | Welcome to ROOT 6.15/01                  https://root.cern |
  |                               (c) 1995-2018, The ROOT Team |
  | Built for macosx64 on Oct 18 2018, 09:41:34                |
  | From heads/master@v6-13-04-1801-g51bad13f4f                |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
   ------------------------------------------------------------

root [0] 
Processing newtry3.cc...
Error in <TSpectrum2::SearchHighRes>: Invalid sigma, must be greater than or equal to 1
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1

Number of positions = 0
Gener=30, Found=0, Good=0, Ghost=0

So it seems sigma is invalid… Can you check ?

1 Like

Dear Couet,
Thanks very much for the reply. In fact, I do not have a good understanding of what parameters are reasonable since I have just started using this function. I tried to change the sigma, but the problem is still here:
Error: Can’t call TSpectrum2::SearchHighRes(source,dest,n,m,3,3,kTRUE,1,kFALSE,1) in current scope newtry3.cc:65:

Possible candidates are…

(in TSpectrum2)

/Applications/root/lib/libSpectrum.so -1:-1 0 public: Int_t TSpectrum2::SearchHighRes(float** source,float** dest,Int_t ssizex,Int_t ssizey,Double_t sigma,Double_t threshold,Bool_t backgroundRemove,Int_t deconIterations,Bool_t markov,Int_t averWindow);

*** Interpreter error recovered ***

Do you think it might be a version problem? I had my ROOT in 2016 summer. Is it too old to do something? In addition to this, the search could work, but it found some weird peaks. I believe under the cut I set in the code, it could find nothing even the background is almost clear, and clear peaks could be seen from draw “SURF7”.

Hi,

the problem is that in ROOT5, the first two parameters of TSpectrum2::SearchHighRes were of type float**, and in ROOT6 they are Double_t**.

Search for “ROOT_VERSION” in the example source codes:



Thanks for Yus and Coyote’s reply. I have successfully done the searching. However, the last small problem is that I could not see any marker on the drawn histogram (or canvas) and thus it is hard for me to modify the sigma. Is there any suggestion? (For the example of searching 2D peaks provided by root, I could clearly see the marker)

Could you provide a more complete example showing the problem ?

hey Couet, I followed your code and change the double ** to float. I expect to see some markers on the peaks the ROOT found. Specifically, I started with the TSpectrum by learning this example here: https://root.cern.ch/root/html/tutorials/spectrum/peaks2.C.html, which has the marker on the found peak. However, I could not see the marker from the high resolution search option.

Yes peaks2.C is working.
It works for me too. Can you provide your non working code ? or a modified version of peaks2.C which is not working ?

I modified your attached code (change double** to float ** and set the sigma as 3), and this was what I obtained. It could tell me where were the peaks( and it was reasonable I believe), but it didn’t show any markers like the peaks2.C did( downtriangular).

Can you post the modified macro ?
There in nowhere double ** in peaks2.C…
See https://root.cern/doc/master/peaks2_8C.html

hey Couet I upload it here, but it might not work for you if you use ROOT6
newtry3.cc (3.1 KB)

I tried your macro with ROOT 5.

It doesn’t not find any peaks.

$ root newtry3.cc 
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   5.34/39     12 March 2018   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

ROOT 5.34/39 (heads/v5-34-00-patches@v5-34-38-1-g507abd2, Aug 31 2018, 15:17:00 on macosx64)

CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] 
Processing newtry3.cc...

Number of positions = 0
 Found=0, Good=0, Ghost=0
root [1] 

hi Couet, it is a really weird problem. From my screen shoot you could clearly see the out put found peaks. I wonder the background cut or the sigma may affect result a lot.

well, I do not know what to say. The macro you sent me does not find peaks with ROOT 5.34 running on my mac. By the way are you obliged to use 5.34 ?

@couet It seems you did not download the “image65_2.txt” file (present in the first post here).

oops … true … !!! sorry for that. There was no message saying that a file was not found that’s what I thought I had every thing… thanks to have seen it. Looking at it.

Hi,
I slightly modified your macro:

  • remove reminiscent unused code of tutorial
  • add sigma+ threshold in arglist to ease testing
  • initialize all elements of source and destination field
  • add more graphical output
  • choose between cutting also the craters or plain only
  • see also comments in code
    run it with:
.L newtry3.cc
newtry3(2,0.01)

now you may change sigma and threshold to get
more or less peaks

newtry3.cc (3.0 KB)

Cheers
Otto

sorry I forgot: this was done with root 6.14.04
and you should use:

.L newtry3.cc+

Otto

Here the 5.34 version
newtry3.cc (3.2 KB)
Note that SeachHighRes does not draw the marker. They should be added to the histogram