Dear ROOT friends,
I have encountered a problem with the TArrayI::Set method.
In my code, I have
TArrayI *fBinPos[2];
defined somewhere. Then I have a method to fill this array, it looks like this (print statements for debugging):
void TXaImage::SetBinPosArray(const EXaCoord crd,
const Int_t nPos,
const Int_t binPos[])
{
cout << "before nPos = " << nPos << endl;
cout << "before binPos[0] = " << binPos[0] << endl;
cout << "before binPos[1] = " << binPos[1] << endl;
cout << "before binPos[2] = " << binPos[2] << endl;
fBinPos[crd]->Set(nPos,binPos);
cout << "after nPos = " << nPos << endl;
cout << "after binPos[0] = " << binPos[0] << endl;
cout << "after binPos[1] = " << binPos[1] << endl;
cout << "after binPos[2] = " << binPos[2] << endl;
fNBinPos[crd] = nPos;
}
Now there are situations where I get the following output from the above cout statments:
before nPos = 11
before binPos[0] = 144
before binPos[1] = 171
before binPos[2] = 199
after nPos = 11
after binPos[0] = 0
after binPos[1] = 171
after binPos[2] = 199
In other words, the Set method messes up the array I supply! Why and how can that happen?
Any ideas are welcome.
Cheers,
Thomas