I’m getting segfaults, but I’m almost certain what the problem is. I just don’t know how do this in root.
I call a function (asciiread) four times. The asciiread function would then create the TH1F objects and fill them. However, because the function was called 4 times, it tried to “book” the histograms 4 times. I created a new function hbkini to book only once, but the asciiread function has no knowledge of these objects.
hbkini(){
…make arrays of histograms…
TH1F h[i] = new TH1F(…)
}
asciiread(){
…fill histograms
h[i]->Fill;
}
MyMain(){
hbkini
asciiread(i);
asciiread(j);
asciiread(k);
asciiread(l);
}
I’ll attach the file to make things clearer.
Thanks
James
mchistnew_debug.c (15.6 KB)