How to get maximum X range value

Hi Rooters,
I was wondering if there is a way to set maximum X range of the histo from the data automatically?
The Histogram class:
TH1D *h1 = new TH1D(“h1”,“”,100,0,100); takes value of xmin and xmax and these values are user defined. Is there a way that it takes maximum X value automatically looking into the data ? Also what if I want to know what is the maximum X value which is fill in h1 ?

TH1 → Histograms with automatic bins