About profilex()

Hi,

I studyed data resolution.
But I can’t take profile region.

void Fittt::draw_fit(int ii){ TProfile *prof = new TProfile("histp_pfx", title, nbinx, xmin1, xmax1, ymin1, ymax1,""); prof = histp->ProfileX(); TF1 *e = new TF1("e",fitfunc,-1,1); prof->Fit(e,"","", fit1, fit2); };

But I can take profilex() region X.
And then, I looked profilex() region Y taking near zero by automactic.
I want not y to take near zero.
How to work? In this picture, I want just to take X(2100~4000) Y(400~700) .

regards,
Youngkwon

TH2::ProfileX creates automatically a TProfile, so you should not create
a TProfile before calling histp->ProfileX.
When calling TH2::ProfileX you can specify a range in Y, eg

histp->ProfileX("histp_pfx",frombiny,tobiny);
If you still have problems, please send the shortest possible running script
showing what you try to do (with teh data file for your TH2).

Rene

It’s my shortest source.
I have using root on Win Xp.

I still have problems. Could you see the source?
Thank you.
ee.c (2.77 KB)
chamberdata.root (98.2 KB)

Do I understand correctly that you simply want to restrict the drawing range of the profile histogram? If yes, you can modify your function Fittt::draw_fit as follows:

void Fittt::draw_fit(int ii){ TProfile *prof = histp->ProfileX("histp_pfx"); prof->GetXaxis()->SetRange(histp->GetXaxis()->FindBin(2100) ,histp->GetXaxis()->FindBin(4000)); prof->SetMinimum(500); prof->SetMaximum(700); TF1 *e = new TF1("e",fitfunc,-1,1); prof->Fit(e,"","", fit1, fit2); }
Rene

Thank you.

regards,
YoungKwon