| Line | |
|---|
| 1 |
|
|---|
| 2 | Hi,
|
|---|
| 3 |
|
|---|
| 4 | in order to get the data out of these root files I did:
|
|---|
| 5 |
|
|---|
| 6 | open root file on the command line
|
|---|
| 7 | :~> root filename.root
|
|---|
| 8 |
|
|---|
| 9 | in root I checked the contents of the file using
|
|---|
| 10 | .ls
|
|---|
| 11 |
|
|---|
| 12 | I see that there is a TH1F inside and I can also see its name --> histname
|
|---|
| 13 | then I get a pointer to that histo
|
|---|
| 14 |
|
|---|
| 15 | TH1F *h = _file0.Get("histname");
|
|---|
| 16 |
|
|---|
| 17 | then I open an output text file:
|
|---|
| 18 |
|
|---|
| 19 | ofstream myfile;
|
|---|
| 20 | myfile.open("output_file_name.txt");
|
|---|
| 21 |
|
|---|
| 22 | now just loop over the histogram bins...
|
|---|
| 23 | for (int i = 1; 1<301; i++) {
|
|---|
| 24 | myfile << i << "\t" << h->GetBinContent(i) << endl;
|
|---|
| 25 | }
|
|---|
| 26 | myfile.close();
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 | that's it ...
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.