Hi, while using root 5.34 in the cluster of the national lab where I work, I found a constant error when trying to fill some histograms declared in a .C file apart of the main macro.C, and defined in a loop (by the way, it used to work fine with earlier versions of root, 5.28 or so, as I recall). The loop looks like this.
#include "TFile.h"
#include "TH1.h"
#include "TH2.h"
#include "histo_booking.h"
#include "skim_assym.h"
TH2F *hmass_p[10];
char *mass_p = new char[10];
for(Int_t i = 0; i <=10; i++){
sprintf(mass_p,"mass_p_%d",i); //proton mass checking
hmass_p[i] = new TH1F(mass_p,mass_p,333,0.0,1.5);
}
I get a segmentation violation all the time, whereas if I just use a histogram like
hmass_p = new TH1F("mass_p","mass_p",333,0.0,1.5);
Doesn’t do it for me. Could it be the 5.34 version? I had different problems with other macros last year when running them with v 5.34 but they ran fine when I upgraded to v 6.10.