# Minimum y-value stored in a TH2F

Hi,
I don’t know how to solve this problem.
I have a TH2F and I need the minimum y-value stoerd and the corresponding x coordinate.
Any help?
Thanks
Bye

See function
TH1::GetMinimumBin(Int_t &locmix, Int_t &locmiy, Int_t &locmiz)

Where locmix is the bin number along X corresponding to the minimum, etc

Rene

Tell me if I understand, please.
h is a TH2F object.
h->GetMinimumBin() returns the Bin’s number with the minimum stored and if I want to know the value of such a minimum I can pass the output of h->GetMinimumBin() to
h->GetXaxis()->GetBinCenter()
Is it right?
Thanks

Example below

```void ymin() { TCanvas *c1 = new TCanvas("c1"); c1->SetTickx(); TH2F *h = new TH2F("h","test",20,-1,1,20,-1,1); TRandom r; for (Int_t i=0;i<100000;i++) { h->Fill(r.Gaus(0,1),r.Gaus(0,0.6)); } h->Draw("text"); c1->Update(); Int_t binx,biny,binz; h->GetMinimumBin(binx,biny,binz); printf("Minimum of histogram is at binx=%d, biny=%d\n",binx,biny); printf("ie xmin = %g, ymin = %g\n",h->GetXaxis()->GetBinCenter(binx), h->GetYaxis()->GetBinCenter(binx)); } ```

Rene