Can't call TSpectrumTransform::Transform(source,dest)

hi,

I try to run the example code in http://root.cern.ch/root/htmldoc/TSpectrumTransform.html, and I get such error

[quote]Error: Can’t call TSpectrumTransform::Transform(source,dest) in current scope Transform.C:49:
Possible candidates are…
(in TSpectrumTransform)
~/root/lib/libSpectrum.so -1:-1 0 public: void TSpectrumTransform::Transform(const float* source,float* destVector);
*** Interpreter error recovered ***
[/quote]

Then, I change

Double_t * source = new Double_t[nbins]; Double_t * dest = new Double_t[nbins];
to

Float_t * source = new Float_t[nbins]; Float_t* dest = new Float_t[nbins];

it works well.

So, is it an error in the example?

yjc

According to the doc this function uses double:

root.cern.ch/root/htmldoc/TSpect … :Transform

[quote=“couet”]According to the doc this function uses double:

root.cern.ch/root/htmldoc/TSpect … :Transform[/quote]

However, according to the source code, http://root.cern.ch/root/html522/src/TSpectrumTransform.cxx.html

void TSpectrumTransform::Transform(const float *source, float *destVector) { /////////////////////////////////////////////////////////////////////////////// // ONE-DIMENSIONAL TRANSFORM FUNCTION // This function transforms the source spectrum. The calling program // should fill in input parameters. // Transformed data are written into dest spectrum. // // Function parameters: // source-pointer to the vector of source spectrum, its length should // be size except for inverse FOURIER, FOUR-WALSH, FOUR-HAAR // transform. These need 2*size length to supply real and // imaginary coefficients.
we should use float instead of double (as well as the header file http://root.cern.ch/root/html522/src/TSpectrumTransform.h.html).

Unless the code of TSpectrumTransform.cxx and TSpectrumTransform.h I found are the older version, that doc is wrong.

I see… It is a float in 534 but a double in the root-trunk.

root.cern.ch/gitweb?p=root.git;a … 2845171ef2

[quote=“couet”]I see… It is a float in 534 but a double in the root-trunk.

root.cern.ch/gitweb?p=root.git;a … 2845171ef2[/quote]

I will take a break.

Good day.