Hi Boris,
I suggest replacing your code like:
TMarker *m;
Double_t limits[100];
int num = 5;
....................
for(int j = 0; j < num*2; j++) {
m = (TMarker*)gPad->WaitPrimitive("TMarker","Marker");
*limits*[j] = m -> GetX();
m -> Delete();
}
by
TLine *l;
Double_t limits[100];
int num = 5;
....................
for(int j = 0; j < num; j++) {
l = (TLine*)gPad->WaitPrimitive("TLine","Line");
limits[2*j] = l -> GetX1();
limits[2*j+1] = l -> GetX2();
delete l;
}
Rene Brun
On Tue, 12 Apr
2005, Boris Skorodumov
wrote:
> dear rooters,
>
> if i want to fit histogram *h1* with several *"gaus"* functions, i can
> carry out the next procedure:
>
> ...............
>
> TMarker *m;
> Double_t limits[100];
> int num = 5;
>
> ....................
>
> for(int j = 0; j < num*2; j++) {
> m = (TMarker*)gPad->WaitPrimitive("TMarker","Marker");
> *limits*[j] = m -> GetX();
> m -> Delete();
> }
> ...................
>
> g1 = new TF1("g1","gaus",limits[0],limits[1]);
> g2 = new TF1("g2","gaus",limits[2],limits[3]);
> g3 = new TF1("g3","gaus",limits[4],limits[5]);
> g4 = new TF1("g4","gaus",limits[6],limits[7]);
> g5 = new TF1("g5","gaus",limits[8],limits[9]);
>
> h1 -> Fit("g1","RQ+");
> h1 -> Fit("g2","RQ+");
> h1 -> Fit("g3","RQ+");
> h1 -> Fit("g4","RQ+");
> h1 -> Fit("g5","RQ+");
>
> h1 -> Draw();
> ....................
>
> i remember, somewhere in tutorials i saw how to make the same think in
> one loop, but unfortunatly i cannot find it.
>
> thank you,
> boris.
>
>
Received on Thu Apr 14 2005 - 10:54:00 MEST
This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:06 MET