All histogram classes are derived from TH1. This class includes
several member functions to access the histogram info, such as
GetBinContent, GetBinError,etc
In an interactive macro, you can do for example:
Root > Int_t nbins = h->GetNbinsX();
Root > {for(Int_t i=0;i<nbins;i++) printf("bin[%d]=%g\n",i,h->GetBinContent(i));}
where h is a pointer to an histogram.
To write the contents to an ascii file, you can:
- Include these two statements (or more) in a macro (say test.C)
and do: Root > .x test.C > test.log
The file test.log will contain the output of the macro
- type any root command, for example second command above
and piping the result to a file. Note that in this case, the command
must be terminated by ;
Root > { for(..) printf(..);} > test.log
To dump the bin contents of an histogram to a file, you can also do:
Root > h->Print("all"); > test.log
To see the histogram data structure (or any object):
Root > h->Dump(); > test.log
Rene Brun