I need to know about getting values of any histogram and print it out to .txt file.
Hi,
a piece of code like this should work.
FILE *file =fopen("test.txt","w");
int i=1;
double x,y;
for(i=1;i<=hist->GetNbinsX();i++)
{
x=hist->GetBinCenter(i);
y=hist->GetBinContent(i);
fprintf(file,"%lf\t%lf\n",x,y);
}
Cheers,
Stefano
1 Like
It works thanx very much…