Logo ROOT   6.14/05
Reference Guide
basic2.C File Reference

Detailed Description

View in nbviewer Open in SWAN Create can ntuple reading data from an ascii file.

This macro is a variant of basic.C

pict1_basic2.C.png
void basic2() {
TString dir = gROOT->GetTutorialDir();
dir.Append("/tree/");
dir.ReplaceAll("/./","/");
TFile *f = new TFile("basic2.root","RECREATE");
TH1F *h1 = new TH1F("h1","x distribution",100,-4,4);
TTree *T = new TTree("ntuple","data from ascii file");
Long64_t nlines = T->ReadFile(Form("%sbasic.dat",dir.Data()),"x:y:z");
printf(" found %lld points\n",nlines);
T->Draw("x","z>2");
T->Write();
}
Author
Rene Brun

Definition in file basic2.C.