ROOT
6.30.04
Reference Guide
All
Namespaces
Files
Pages
basic2.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_tree
3
/// \notebook -js
4
/// Create can ntuple reading data from an ascii file.
5
/// This macro is a variant of basic.C
6
///
7
/// \macro_image
8
/// \macro_code
9
///
10
/// \author Rene Brun
11
12
void
basic2() {
13
TString dir = gROOT->GetTutorialDir();
14
dir.Append(
"/tree/"
);
15
dir.ReplaceAll(
"/./"
,
"/"
);
16
17
TFile *f =
new
TFile(
"basic2.root"
,
"RECREATE"
);
18
TH1F *h1 =
new
TH1F(
"h1"
,
"x distribution"
,100,-4,4);
19
TTree *T =
new
TTree(
"ntuple"
,
"data from ascii file"
);
20
Long64_t nlines = T->ReadFile(Form(
"%sbasic.dat"
,dir.Data()),
"x:y:z"
);
21
printf(
" found %lld points\n"
,nlines);
22
T->Draw(
"x"
,
"z>2"
);
23
T->Write();
24
}
tutorials
tree
basic2.C
Generated on Tue May 5 2020 14:03:51 for ROOT by
1.8.5