I am trying to read a ROOT File, write the data in an array and then some calculation will done.I have around 221 million data number in this ROOT File. When I run my macro I have this error :
The error says that the (first, at least) problem is in the creation of the FinalData array, with size of 221,200,000 long doubles, which is too much memory. Is that huge array really necessary? Probably you could change your code so it is not needed at all; and if the array is unavoidable, maybe it can/should be double instead of long double (are the values in the tree really long double?).
Yes, This code should be able to analysis huge data. I should read data from ROOT File and then write it in an array for doing next calculations.Data size was the reason that lead me to use ROOT. Even if array be double ,the problem will not solve.
Your code does not run (cf @dastudillo post) the following lines make root exit (on Mac) without doing anything:
const int NRSamples = 221200000;
const int NrNSamplesPerEvent = 34998;
const int NREvents = NRSamples / NrNSamplesPerEvent;
long double FinalData[NREvents][NrNSamplesPerEvent];
The array FinalData is far too large to fit in memory.
void fateme(){
const int NRSamples = 221200000;
const int NrNSamplesPerEvent = 34998;
const int NREvents = NRSamples / NrNSamplesPerEvent;
double FinalData[NREvents][NrNSamplesPerEvent];
printf("exit macro\n");
}
I get:
% root
------------------------------------------------------------------
| Welcome to ROOT 6.23/01 https://root.cern |
| (c) 1995-2020, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for macosx64 on Sep 29 2020, 07:54:42 |
| From heads/master@v6-23-01-1364-g5837b8294c |
| With Apple clang version 12.0.0 (clang-1200.0.32.2) |
| Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
------------------------------------------------------------------
root [0] .x fateme.C
%
So the macro does nothing and exit (it does not print the exit message) because the array FinalData is too big. You should change the logic of your macro to avoid having a such big array.