Back Midas Rome Roody Rootana
  Midas DAQ System  Not logged in ELOG logo
Entry  06 Oct 2019, Nik Berger, Bug Report, History data size mismatch 
    Reply  06 Oct 2019, Stefan Ritt, Bug Report, History data size mismatch 
    Reply  10 Oct 2019, Konstantin Olchanski, Bug Report, History data size mismatch 
    Reply  10 Oct 2019, Nik Berger, Bug Report, History data size mismatch 
       Reply  10 Oct 2019, Stefan Ritt, Bug Report, History data size mismatch 
Message ID: 1721     Entry time: 10 Oct 2019     In reply to: 1719
Author: Konstantin Olchanski 
Topic: Bug Report 
Subject: History data size mismatch 
>
> In our history, a long list of doubles (64 Bit) fas followed by three floats (32 bit)
>

Padding trouble, mixing "double" and "float" trouble. Ouch.

Best wisdom I received on this: never use "float", always use "double".

I was burned by "float" with following code, which produced the same result from
analyzing 100 files as from analyzing 1000 files. (why did we take data for 10 weeks
instead of 1 week?). Hint: "float" overflows way too quickly, after overflow sum+=1 does not change
the value of "sum". The actual code used ROOT TH1F. Lesson: always use TH1D.

float sum = 0; // should always be "double" !!!
foreach data_file {
    foreach data from current data file {
        sum += data;
    }   
}
print sum;

K.O.
ELOG V3.1.4-2e1708b5