Hi all,
I have a macro which I compile with some functions, using root_v5.10.
Most of the methods look like:
Int_t func(TTree* ntuple, vector<TH1D*>& histos);
Where ntuple is an already filled tree.
Inside I create the histos:
for(Int_t j = 0; j < 16; j++) {
TString hname("h");
hname += j;
histos[j] = new TH1D(hname.Data(), hname.Data(), 500, 0, 2000);
}
Afterwards I set the branches and read the tree. The tree has 3 branches: adc, sum and asym. The “adc” branch has 32 leafs “ADC0” to “ADC31” all type Short_t. The “sum” is similar but with 16. The “asym” branch is similar, but is Float_t type. I set the branches with:
Short_t adc[32];
Short_t sumraw[16];
Float_t asymraw[16];
ntuple->SetBranchAddress("adc", adc);
ntuple->SetBranchAddress("sum", sumraw);
ntuple->SetBranchAddress("asym", asymraw);
To read the event I use:
const Int_t nevts = (Int_t)ntuple->GetEntries();
Int_t print_mod = nevts/10;
for(Int_t j = 0; j < nevts; j++) {
if(j % print_mod == 0)
cout << "Processing evt " << j << " of " << nevts << endl;
ntuple->GetEntry(j);
// Use event data...
}
This function is called from another one where TTree* ntuple is retrieved.
Do you see anything wrong with this code?
What happens is that memmory allocation increases indefinetly and after some passages by similar functions the PC crashes!
Could you please specify what am I doing wrong?
Thanks in advance for everything!
Best regards,
Rui
