TTree* read (const TString& filename, Int_t ncol) { TString vars; Int_t nlin=0; for (Int_t i = 0; i < ncol; i++) { vars += Form("x%d", i); if (i==0) vars += "/D"; if (i + 1 != ncol) vars += ":"; } TArrayD x(ncol); TTree* tree = new TTree("tree", "Tree"); tree->Branch("data", &x.fArray, vars.Data()); ifstream in(filename.Data()); if (!in || in.bad()) return 1; while (!in.eof()) { x.Reset(); for (Int_t i = 0; i < ncol; i++) in >> x[i]; nlin++; tree->Fill(); } in.close(); cout<Print(); return tree; }