Hi Carter, Thanks for reporting this problem with this function in TSpectrum. I have now implemented your fix in the CVS version. Rene Brun On Sun, 26 Sep 2004, Hall, Carter R. wrote: > > > Hello ROOTers, > > I've made some progress tracking down my looping problem > with TSpectrum. > > To recap: I have a script which uses TSpectrum to find > peaks in ten histograms. The histograms are identical, > so the results of the peak search should be identical. > TSpectrum finds the peaks in the first couple of iterations, > but then gives spurious results. I sent a tarfile with the > script and the histograms, but Rene was unable to reproduce > the problem. I am running ROOT 4.00/08 on Solaris 9, and > I checked it on RedHat linux 7.2, where I found the same > problem. > > The problem seems to be related to the array "working_space" > in TSpectrum::Search1HighRes. The array is declared on > line 2367 of TSpectrum.cxx, but not initialized. I was > able to make the problem go away by initializing the > elements to zero: > > Int_t wslen = 6*(size+i); > double *working_space = new double [wslen]; > > // Initialize the working space > for ( Int_t kinit = 0; kinit < wslen; kinit++ ) { > working_space[kinit] = 0.0; > } > > I don't know if this is a permanent cure or not. > > I've included a tarfile with a script which does the > peak search with the standard TSpectrum and with a modified > "MyTSpectrum" which has the new array initialization. > To execute it: gmake; root test_it.C > > I've included a copy of the output of the script below. > > Carter Hall > > > Processing test_it.C... > loading the MyTSpectrum library > loading the test macro > Info in <TUnixSystem::ACLiC>: creating shared library /afs/slac.stan > ford.edu/u/ey/chall/temp/./TSpectrumtest_C.so > > running the test macro using the standard TSpectrum > > ***Note: the peak search works correctly the first two iterations*** > > In histogram number 0, found 2 peaks > xpeak = 406.517 > xpeak = 3016.52 > c to continue, or q to quit > c > In histogram number 1, found 2 peaks > xpeak = 406.517 > xpeak = 3016.52 > c to continue, or q to quit > c > > ***Note: the remaining eight iterations give incorrect results*** > > In histogram number 2, found 0 peaks > c to continue, or q to quit > c > In histogram number 3, found 0 peaks > c to continue, or q to quit > c > In histogram number 4, found 1 peaks > xpeak = 4556.52 > c to continue, or q to quit > c > In histogram number 5, found 2 peaks > xpeak = 606.517 > xpeak = 4546.52 > c to continue, or q to quit > c > In histogram number 6, found 2 peaks > xpeak = -1983.48 > xpeak = 2026.52 > c to continue, or q to quit > c > In histogram number 7, found 3 peaks > xpeak = -2243.48 > xpeak = -2113.48 > xpeak = 606.517 > c to continue, or q to quit > c > In histogram number 8, found 1 peaks > xpeak = 2026.52 > c to continue, or q to quit > c > In histogram number 9, found 1 peaks > xpeak = 2026.52 > c to continue, or q to quit > c > > > running the test macro using the MyTSpectrum > > ***Note: all ten iterations give correct results with MyTSpectrum*** > > In histogram number 0, found 2 peaks > xpeak = 406.517 > xpeak = 3016.52 > c to continue, or q to quit > c > In histogram number 1, found 2 peaks > xpeak = 406.517 > xpeak = 3016.52 > c to continue, or q to quit > c > In histogram number 2, found 2 peaks > xpeak = 406.517 > xpeak = 3016.52 > c to continue, or q to quit > c > In histogram number 3, found 2 peaks > xpeak = 406.517 > xpeak = 3016.52 > c to continue, or q to quit > c > In histogram number 4, found 2 peaks > xpeak = 406.517 > xpeak = 3016.52 > c to continue, or q to quit > c > In histogram number 5, found 2 peaks > xpeak = 406.517 > xpeak = 3016.52 > c to continue, or q to quit > c > In histogram number 6, found 2 peaks > xpeak = 406.517 > xpeak = 3016.52 > c to continue, or q to quit > c > In histogram number 7, found 2 peaks > xpeak = 406.517 > xpeak = 3016.52 > c to continue, or q to quit > c > In histogram number 8, found 2 peaks > xpeak = 406.517 > xpeak = 3016.52 > c to continue, or q to quit > c > In histogram number 9, found 2 peaks > xpeak = 406.517 > xpeak = 3016.52 > c to continue, or q to quit > c > > > > > > > > -----Original Message----- > From: owner-roottalk@pcroot.cern.ch [mailto:owner-roottalk@pcroot.cern.ch] On Behalf Of Rene Brun > Sent: Friday, September 24, 2004 11:05 PM > To: Hall, Carter R. > Cc: roottalk@pcroot.cern.ch > Subject: Re: [ROOT] looping with TSpectrum > > Hi Carter, > > I cannot reproduce your problem when running your 3 scripts. > I always obtain the correct results. > Is it intended that all your 10 histograms in the file are identical? > > Rene Brun > > On > Fri, 24 Sep > 2004, Hall, Carter R. wrote: > > > > > > > Hello ROOTers - > > > > I have a peak search problem for which I'd like to use TSpectrum, but > > I'm having some difficulty getting it to work. The trouble seems to be > > related to the fact that I'm performing the search on multiple > > histograms. > > > > I've tried several different ways to do this: > > > > - creating the TSpectrum object before the loop, and using the same > > object on multiple histograms > > > > - creating the TSpectrum object inside the loop, and deleting it at > > the end of each iteration > > > > - creating an array of TSpectrum objects, one for each histogram. > > > > In all three cases, the peak search usually works fine on the first > > few iterations, but the results become spurious afterwards. The > > attached tarfile has three macros to illustrate this, and a rootfile > > with ten histograms. The ten histograms are all identical, so the peak > > search results should be the same. > > > > I'm using ROOT 4.00/08 on a Sun Enterprise 420. > > > > Thanks in advance, > > > > Carter Hall > > > > > > > > > > > > > >
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET