Hi,
There seems to be something funny about the way TTrees and TBranches
treat unsigned integers…see simple macro below.
I’ve seen this in root 3.10.02 and 3.02 on Mac OS X, and Linux
Am I filling the branch incorrectly? Any ideas?
Tom
{
unsigned int a=2312372224; // unsigned int 0 to 4,294,967,295
int b=2312372224; // int -2,147,483,648 to 2,147,483,647
cout << "unsigned int a= " << a << endl;
cout << "int b= " << b << endl;
// correct: looks like int gives “right wrong answer” for b (overflow)
// unsigned int a= 2312372224
// int b= -1982595072
TTree *t1=new TTree(“t1”,“sad tree”);
t1->Branch(“hi1”,&a,“a/i”); // … /i=unsigned int
t1->Branch(“hi2”,&b,“b/I”); // … /I=int
t1->Fill();
// see output of Show(0) and Scan() below
// Show() seems to treat the unsigned int as an out of range int
// Scan() gets the right value…I assume the extra precision
// is really there but just not displayed (?)
// t1->Show(0)
// ======> EVENT:0
// a = -1982595072
// b = -1982595072
// t1->Scan()
// ************************************
// * Row * a * b *
// ************************************
// * 0 * 2.312e+09 * -1.98e+09 *
// ************************************
}