How to get the location of the maximum value of TH3F

hello everyone,

I’m using TH3F to analyse the results of geant4, and i want to know hot get the location of the maximum value. fillname->getMaximumBin() is just a number which I don’t understand well.

thanks a lot for helping me.

Int_t binglobal=h3->GetMaximumBin(); 
Int_t binx, biny, binz;
h3->GetBinXYZ(binglobal,  binx,  biny, binz) ;
printf("%d %d %d \n",binx, biny, binz);

Search for occurrences of “global bin” in the TH1 class description.