mvodb treating doubles as integers

Issue #20 resolved
Thomas Lindner created an issue

I am using mvodb in rootana to grab some variables from ODB in a midas file (encoded as JSON).

I am finding that mvodb seems to not be correctly treating integers and doubles. For instance, I try to get back the variables in Equipment/*/Statistics. All the ODB keys in Statistics are type DOUBLE, even though ‘Events sent’ is actually only ever an integer.

I would expect this code to work:

double rate;                   
double events;
odb->RD("/Equipment/PMTS/Statistics/Events per sec.",&rate);
odb->RD("/Equipment/PMTS/Statistics/Events sent",&events);
std::cout << "Check rate and number of events: " << rate << " " << events << std::endl;

but it returns the wrong value for ‘events sent’ (Events per sec. is correct).

This code does work however:

double rate;                   
int events;
odb->RD("/Equipment/PMTS/Statistics/Events per sec.",&rate);
odb->RI("/Equipment/PMTS/Statistics/Events sent",&events);
std::cout << "Check rate and number of events: " << rate << " " << events << std::endl;

It returns “Check rate and number of events: 0.0459263 -1.27734e+294”

Perhaps somewhere in mvodb we are using the type that the json decoder thinks the variable is, rather than checking ‘Events sent/key’ to figure out what the variable actually is.

Comments (1)

  1. Log in to comment