Reading multiple root files

Dear experts,

I’m trying to read several root files to array in my root script:

TFile *f01[9]; for(int i=0; i<9; i++) { sprintf(nl,"/Users/Anton/rootf/RD_2016_nothr_%d.root", i+1); f01[i] = new TFile(nl); }

after getting these files everything in script works perfectly and it runs till the very end, but then it finishes, there is an unexpected quit from root :
root.exe quit unexpectedly.

there is no additional information or errors in the output, so I can’t find the source of the problem.
Is any additional code required in the end of the script to process these files ?

thank you,
Anton

Hi Anton,

impossible to say with the current information: can you share a reproducer and the root version you are using?

Cheers,
D

Hi,

the version is 6.06/06, running on OS X 10.11,
the whole code is the following:



#include <stdio.h>
#include <stdlib.h>

#include "string.h"
#include <string.h>
#include <iostream>
#include "TH1.h"
#include "TF1.h"
#include "TLegend.h"
#include "TCanvas.h"

#include <TROOT.h>
#include <TStyle.h>

#include "TH1.h"
#include "TFile.h"
#include "TTree.h"
#include "TVirtualPad.h"
#include "TApplication.h"
#include "TLegend.h"
#include "TF1.h"
#include "TF2.h"

double p=TMath::Pi();
#define LEN 200
#define LEN1 6
#define LEN2 5
#define Pi p;

//#define Nbins 8



void radiation2()
{
  //  setTDRStyle();
    // gROOT->ProcessLine(".L ~/rootlogon_tdr.C");
    double totl=0;
    TCanvas *c1 = new TCanvas("c1","comparison",100,10,1100,800);
    TPaveText *pt = new TPaveText(.05,.1,.95,.8);
    c1->SetWindowSize(700, 800);
  //  c1->Divide(0,2);
    TPad* c1_1=(TPad*)(c1->GetPrimitive("hMVA"));
    //c1->Divide(3,1);
    
char nl[26];
    char nl2[26];
    //cout<<ns<<"  ,  "<<nl<<endl;
   // gr_l[i] = new TH1D(nl,nl,     500, 0., 500.);
   

    
    
    TFile *f01[9];
    for(int i=0; i<9; i++)
    {
        sprintf(nl,"/Users/Anton/rootf/RD_2016_nothr_%d.root", i+1);
        f01[i] = new TFile(nl);
    }

    
  
    cout<<"finish"<<endl;
  
}

thank you,
Anton


char nl[256];
char nl2[256];

thank you!
that was stupid mistake

kind regards,
Anton