Re: Weird numbers when compiling macro

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Tue, 21 Sep 2010 16:41:35 -0500


  Hi Florian,

Most likely you have uninitialized memory in your code (the result is hence random, including possibly the correct result).

Running:

     valgrind --track-origins=yes root.exe -b -l -q messung3.C+

Is likely to show you exactly what memory is not initialized.

Cheers,
Philippe.

On 9/21/10 2:33 PM, Florian Sittel wrote:
> Hello fellow ROOT-users and developers,
>
> I am new to ROOT and I hope this is the right place to ask this question:
>
> I wrote some little macros to process some data. In short, I produce several graphs from different csv-files and fit a sinusoidal
> function to them. Nothing special here.
> The macros run OK when running through CINT.
> The output is as follows (numbers are amplitudes of sinusoidal fit, the last numbers are just 2*amplitudes):
>
> # root messung3.C
> root [0]
> Processing messung3.C...
> mes3_2_HM1508.csv 0.678808 +/-0.000605315 1.35762
> mes3_4_HM1508.csv 1.46738 +/-0.000653343 2.93476
> mes3_6_HM1508.csv 1.65165 +/-0.00108274 3.3033
> mes3_7_HM1508.csv 1.68977 +/-0.00129468 3.37955
> mes3_8_HM1508.csv 1.74871 +/-0.00111871 3.49742
> root [1] .q
> root -l messung3.C 12,15s user 0,08s system 85% cpu 14,282 total
>
>
> These numbers seem to be correct.
>
>
>
>
> Anyway, if I compile the macro and run it, I get random numbers:
>
>
> first run:
>
> # root messung3.C++
> root [0]
> Processing messung3.C++...
> Info in <TUnixSystem::ACLiC>: creating shared library /somePath/./messung3_C.so
> mes3_2_HM1508.csv 2684.47 +/-2508.35 5368.95
> mes3_4_HM1508.csv 1142.86 +/-14.5639 2285.71
> mes3_6_HM1508.csv 2493.13 +/-1758.83 4986.25
> mes3_7_HM1508.csv 2465.53 +/-55480.5 4931.06
> mes3_8_HM1508.csv 1.74871 +/-0.00111871 3.49742
> root [1] .q
>
>
> second run:
>
> # root messung3.C++
> root [0]
> Processing messung3.C++...
> Info in <TUnixSystem::ACLiC>: creating shared library /somePath/./messung3_C.so
> mes3_2_HM1508.csv 0 +/-7.69996e+31 0
> mes3_4_HM1508.csv 0 +/-7.69996e+31 0
> mes3_6_HM1508.csv 0 +/-7.69996e+31 0
> mes3_7_HM1508.csv 0 +/-7.69996e+31 0
> mes3_8_HM1508.csv 1.74871 +/-0.00111871 3.49742
>
>
> third run:
>
> # root messung3.C++
> root [0]
> Processing messung3.C++...
> Info in <TUnixSystem::ACLiC>: creating shared library /somePath/./messung3_C.so
> mes3_2_HM1508.csv 0.678808 +/-0.000605315 1.35762
> mes3_4_HM1508.csv 1.46738 +/-0.000653343 2.93476
> mes3_6_HM1508.csv 1.65165 +/-0.00108274 3.3033
> mes3_7_HM1508.csv 1.68977 +/-0.00129468 3.37955
> mes3_8_HM1508.csv 7.62246e+11 +/-2.00788e+13 1.52449e+12
>
>
>
> Interestingly, sometimes some numbers are correct, while during the same run, others get messed up.
>
> I thought, maybe ROOT doesn't reset memory properly, so I added a gROOT->Reset() before every single graph-generation and fit.
> No change here.
> Even when I quit ROOT and re-run it the data gets messed up.
>
>
> The code is a bit complex to post here, but I hope there is somebody, who has experienced a similar problem before. Perhaps it is
> just some trivial setting.
>
>
> Thanks in advance,
> Florian
>
Received on Tue Sep 21 2010 - 23:41:41 CEST

This archive was generated by hypermail 2.2.0 : Wed Sep 22 2010 - 05:50:01 CEST