| 1 |
// @(#)root/graf:$Name: $:$Id: TMultiGraph.cxx,v 1.18 2005/04/14 06:52:09 brun Exp $ |
// @(#)root/graf:$Name: $:$Id: TMultiGraph.cxx,v 1.19 2005/04/15 14:49:23 brun Exp $ |
| 2 |
// Author: Rene Brun 12/10/2000 |
// Author: Rene Brun 12/10/2000 |
| 3 |
|
|
| 4 |
/************************************************************************* |
/************************************************************************* |
| 212 |
// (by default, any previous function is deleted) |
// (by default, any previous function is deleted) |
| 213 |
// = "C" In case of linear fitting, not calculate the chisquare |
// = "C" In case of linear fitting, not calculate the chisquare |
| 214 |
// (saves time) |
// (saves time) |
| 215 |
|
// = "F" If fitting a polN, switch to minuit fitter |
| 216 |
// |
// |
| 217 |
// When the fit is drawn (by default), the parameter goption may be used |
// When the fit is drawn (by default), the parameter goption may be used |
| 218 |
// to specify a list of graphics options. See TGraph::Paint for a complete |
// to specify a list of graphics options. See TGraph::Paint for a complete |
| 377 |
fitOption.Plus = 0; |
fitOption.Plus = 0; |
| 378 |
fitOption.User = 0; |
fitOption.User = 0; |
| 379 |
fitOption.Nochisq = 0; |
fitOption.Nochisq = 0; |
| 380 |
|
fitOption.Minuit = 0; |
| 381 |
TString opt = option; |
TString opt = option; |
| 382 |
opt.ToUpper(); |
opt.ToUpper(); |
| 383 |
|
|
| 392 |
if (opt.Contains("+")) fitOption.Plus = 1; |
if (opt.Contains("+")) fitOption.Plus = 1; |
| 393 |
if (opt.Contains("B")) fitOption.Bound = 1; |
if (opt.Contains("B")) fitOption.Bound = 1; |
| 394 |
if (opt.Contains("C")) fitOption.Nochisq = 1; |
if (opt.Contains("C")) fitOption.Nochisq = 1; |
| 395 |
|
if (opt.Contains("F"))fitOption.Minuit = 1; |
| 396 |
|
|
| 397 |
if (rxmax > rxmin) { |
if (rxmax > rxmin) { |
| 398 |
xmin = rxmin; |
xmin = rxmin; |
| 433 |
/////////////// |
/////////////// |
| 434 |
//set the fitter |
//set the fitter |
| 435 |
////////////// |
////////////// |
| 436 |
//TClass *cl=gROOT->GetClass("TLinearFitter"); |
|
|
// |
|
| 437 |
Int_t special=f1->GetNumber(); |
Int_t special=f1->GetNumber(); |
| 438 |
Bool_t linear = f1->IsLinear(); |
Bool_t linear = f1->IsLinear(); |
| 439 |
if (special==299+npar) |
if (special==299+npar) |
| 440 |
linear=kTRUE; |
linear=kTRUE; |
| 441 |
|
if (fitOption.Bound || fitOption.User || fitOption.Errors || fitOption.Minuit) |
| 442 |
|
linear = kFALSE; |
| 443 |
|
|
| 444 |
char l[]="TLinearFitter"; |
char l[]="TLinearFitter"; |
| 445 |
Int_t strdiff = 0; |
Int_t strdiff = 0; |
| 450 |
strdiff = strcmp(TVirtualFitter::GetFitter()->IsA()->GetName(), l); |
strdiff = strcmp(TVirtualFitter::GetFitter()->IsA()->GetName(), l); |
| 451 |
} |
} |
| 452 |
if (linear){ |
if (linear){ |
|
// |
|
| 453 |
TClass *cl = gROOT->GetClass("TLinearFitter"); |
TClass *cl = gROOT->GetClass("TLinearFitter"); |
| 454 |
if (IsSet && strdiff!=0) { |
if (IsSet && strdiff!=0) { |
| 455 |
delete TVirtualFitter::GetFitter(); |
delete TVirtualFitter::GetFitter(); |
| 456 |
IsSet=kFALSE; |
IsSet=kFALSE; |
| 457 |
} |
} |
| 458 |
if (!IsSet) { |
if (!IsSet) { |
|
//TLinearFitter *lf=(TLinearFitter *)cl->New(); |
|
| 459 |
TVirtualFitter::SetFitter((TVirtualFitter *)cl->New()); |
TVirtualFitter::SetFitter((TVirtualFitter *)cl->New()); |
| 460 |
} |
} |
| 461 |
} else { |
} else { |
| 481 |
f1->SetRange(xmin, xmax); |
f1->SetRange(xmin, xmax); |
| 482 |
} |
} |
| 483 |
|
|
| 484 |
if (linear && !fitOption.Bound && !fitOption.Like && !fitOption.Errors){ |
if (linear){ |
| 485 |
grFitter->ExecuteCommand("FitMultiGraph", 0, 0); |
grFitter->ExecuteCommand("FitMultiGraph", 0, 0); |
| 486 |
|
|
| 487 |
} else { |
} else { |
| 715 |
LeastSquareFit(npar, fitpar, xmin, xmax); |
LeastSquareFit(npar, fitpar, xmin, xmax); |
| 716 |
|
|
| 717 |
for (Int_t i=0;i<npar;i++) f1->SetParameter(i, fitpar[i]); |
for (Int_t i=0;i<npar;i++) f1->SetParameter(i, fitpar[i]); |
| 718 |
|
|
| 719 |
} |
} |
| 720 |
|
|
| 721 |
//______________________________________________________________________________ |
//______________________________________________________________________________ |