Below's a small improvement proposal to the TH1::GetBinCenter() method in order that it could also return the bin center in log.
- Code: Select all
Double_t TH1::GetBinCenter (Int_t ibin, Bool_t log=kFALSE)
{
Double_t lowEdge = this->GetXaxis()->GetBinLowEdge(ibin) ;
Double_t upEdge = this->GetXaxis()->GetBinUpEdge (ibin) ;
if ( !log ) { return ( 0.5*(lowEdge+upEdge) ) ; }
else { return ( TMath::Sqrt(lowEdge*upEdge) ) ; }
}
Cheers,
Z