Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
read_ntuple_from_file.C
Go to the documentation of this file.
1// Read the previously produced N-Tuple and print on screen
2// its content
3
5
6 // Open a file, save the ntuple and close the file
7 TFile in_file("conductivity_experiment.root");
8 TNtuple* my_tuple;in_file.GetObject("cond_data",my_tuple);
9 float pot,cur,temp,pres; float* row_content;
10
11 cout << "Potential\tCurrent\tTemperature\tPressure\n";
12 for (int irow=0;irow<my_tuple->GetEntries();++irow){
13 my_tuple->GetEntry(irow);
14 row_content = my_tuple->GetArgs();
15 pot = row_content[0];
16 cur = row_content[1];
17 temp = row_content[2];
18 pres = row_content[3];
19 cout << pot << "\t" << cur << "\t" << temp
20 << "\t" << pres << endl;
21 }
22
23 }
void GetObject(const char *namecycle, T *&ptr)
Get an object with proper type checking.
Definition TDirectory.h:213
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
Definition TFile.h:130
A simple TTree restricted to a list of float variables only.
Definition TNtuple.h:28
Float_t * GetArgs() const
Definition TNtuple.h:56
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
Definition TTree.cxx:5719
virtual Long64_t GetEntries() const
Definition TTree.h:510
void read_ntuple_from_file()