I have been using ROOT Trees for years to store and read tables from analysis of supernova data. However, I recently noticed a problem storing Galaxy ID, which can be very large. I tried both double and ‘long long int’. In both cases I can Scan the values back with interactive root, as long as I specify something like “precision=20” as an option. Within the C code, however, the query option always truncates very large numbers to just 4 digits of precision. For ID=131336659, for example, it reads back a string value 1.313e+11. I searched online for tricks, but couldn’t find anything. Below is the relevant code snippet. “scanString” is a colon-separated list of variables to read. The optString seems to be ignored, even if I fill it with garbage characters.
TREE_INFO_READ.SQL_Result =
TREE_INFO_READ.tree->Query(scanString, “”, optString,
NROW_READ, IROW_START);
Nfield = TREE_INFO_READ.SQL_Result->GetFieldCount();
Nrow = TREE_INFO_READ.SQL_Result->GetRowCount();
while( (TREE_INFO_READ.SQL_Row =
(TSQLRow *)TREE_INFO_READ.SQL_Result->Next()) ) {
for (i=0; i < Nfield; i++) { // ivar_read loop
sprintf(tmpString,"%s ", TREE_INFO_READ.SQL_Row->GetField(i));