Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
write_to_file.C
Go to the documentation of this file.
2
3 // Instance of our histogram
4 TH1F h("my_histogram","My Title;X;# of entries",100,-5,5);
5
6 // Let's fill it randomly
7 h.FillRandom("gaus");
8
9 // Let's open a TFile
10 TFile out_file("my_rootfile.root","RECREATE");
11
12 // Write the histogram in the file
13 h.Write();
14
15 // Close the file
16 out_file.Close();
17}
#define h(i)
Definition RSha256.hxx:106
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
Definition TFile.h:130
void Close(Option_t *option="") override
Close a file.
Definition TFile.cxx:982
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:878
void write_to_file()