basic2.C

Go to the documentation of this file.
00001 void basic2() {
00002 //   example of macro to create can ntuple reading data from an ascii file.
00003 //   This macro is a variant of basic.C
00004 //Author: Rene Brun   
00005 
00006    TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
00007    dir.ReplaceAll("basic2.C","");
00008    dir.ReplaceAll("/./","/");
00009    
00010    TFile *f = new TFile("basic2.root","RECREATE");
00011    TH1F *h1 = new TH1F("h1","x distribution",100,-4,4);
00012    TTree *T = new TTree("ntuple","data from ascii file");
00013    Long64_t nlines = T->ReadFile(Form("%sbasic.dat",dir.Data()),"x:y:z");
00014    printf(" found %lld points\n",nlines);
00015    T->Draw("x","z>2");
00016    T->Write();
00017 }

Generated on Tue Jul 5 15:45:10 2011 for ROOT_528-00b_version by  doxygen 1.5.1