Hi,

I have a 2D histogram. The x-axis range is -80 to 80 in steps of 1. The y-axis is the same as the x-axis. There are a total of 25600 bins. How can I obtain the values in each bin?

In case you need a running example showing how to use the method suggested by @vpadulan, here is one:

```
{
// Create the fake histogram
const int n=160;
auto h = new TH2D("h","h",n,-80,80,n,-80,80);
// Fill the fake histogram
for (int i=1; i<=n; i++) {
for (int j=1; j<=n; j++) {
h->SetBinContent(i,j,i+j);
}
}
// Read the bins of the fake histogram
for (int i=1; i<=n; i++) {
for (int j=1; j<=n; j++) {
printf("Bin (%d,%d) contains %g\n",i,j,h->GetBinContent(i,j));
}
}
}
```

Thank you for your reply.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.