forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic2.C
More file actions
24 lines (22 loc) · 648 Bytes
/
basic2.C
File metadata and controls
24 lines (22 loc) · 648 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/// \file
/// \ingroup tutorial_tree
/// \notebook -js
/// Create can ntuple reading data from an ascii file.
/// This macro is a variant of basic.C
///
/// \macro_image
/// \macro_code
///
/// \author Rene Brun
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();
}