Re: How to change to STRATEGY = 2?

From: Lorenzo Moneta <Lorenzo.Moneta_at_cern.ch>
Date: Tue, 17 Jun 2008 09:40:49 +0200


Hi,

  you can change the strategy using the global fitter. After having performed your first fit, you can do:

TVirtualFitter * gfitter = TVirtualFitter::GetFitter(); double arg[1];
arg[0] = 2;
gfitter->ExecuteCommand("SET STRATEGY",arg,1);

and then you can call again h1->Fit

  Best Regards

  Lorenzo

On Jun 15, 2008, at 9:08 AM, G. Alejandro Garcia-Guerra wrote:

> Hi.
>
> I have a doubt on how to change from strategy 1 to strategy 2.
>
> I have the following in the code:
>
>
> #include "TH1.h"
> #include "TF1.h"
> #include "TLegend.h"
> #include "TCanvas.h"
> #include "TMinuit.h"
>
> // Sum of background and peak function
> Double_t fitFunction(Double_t *x, Double_t *par)
> {
> return background(x,par) + gaussiana(x,&par[4]);
> }
>
> TFile *f = new TFile("for.mass.root","update");
> void fit_mass(TH1F *h1, bool salvar)
> {
> TCanvas *c1 = new TCanvas("c1","Mass Fitting",10,10,700,500);
> c1->SetFillColor(33);
> c1->SetFrameFillColor(41);
> c1->SetGrid();
> gStyle->SetOptStat("e");
>
> TF1 *fitFcn = new TF1("fitFcn",fitFunction,4.9355,5.6105,7);
> fitFcn->SetNpx(500);
> fitFcn->SetLineWidth(4);
> fitFcn->SetLineColor(kMagenta);
>
> fitFcn->SetParameters(5.96975e+05,1.005,1.38,-1.28738,1.04316e
> +02,5.273,0.04);
>
> h1->SetMinimum(0.0);
> h1->Fit("fitFcn","R+","ep");
> h1->Fit("fitFcn","I");
> h1->Fit("fitFcn","E+");
> h1->Fit("fitFcn","LL+");
> h1->Fit("fitFcn","I+");
> h1->Fit("fitFcn","E+");
> .
> .
> .
>
> And my output is like this:
>
> FCN=69.7808 FROM MIGRAD STATUS=CONVERGED 181 CALLS
> 182 TOTAL
> EDM=2.41219e-05 STRATEGY= 1 ERROR MATRIX
> UNCERTAINTY 6.9 per cent
> EXT PARAMETER STEP FIRST
> NO. NAME VALUE ERROR SIZE DERIVATIVE
> 1 p0 6.66984e+04 1.83006e+04 4.23819e+01
> -3.82647e-05
> 2 p1 5.57381e-01 5.58623e-02 1.33276e-04 1.35478e
> +01
> 3 p2 1.26573e-04 1.28440e-04 5.17355e-07 -2.83897e
> +03
> 4 p3 -2.81907e+00 1.74841e-01 6.48014e-04 1.99462e
> +00
> 5 p4 2.87799e+01 5.72452e+00 6.10723e-03
> -8.73317e-04
> 6 p5 5.27836e+00 5.52207e-03 9.35097e-08
> -2.84406e-02
> 7 p6 4.55613e-02 7.62789e-03 6.73559e-06
> 2.53169e-02
>
>
>
> Is there a way to change the strategy in a code like this?
>
> Thank you in advance.
>
> Sincerely,
> Alejandro
> D0 Experiment. Fermilab
> e-mail: gagarcia_at_fnal.gov
>
Received on Tue Jun 17 2008 - 09:41:25 CEST

This archive was generated by hypermail 2.2.0 : Tue Jun 17 2008 - 17:50:02 CEST