TMinuit function arguments

From: Till Sawala <>
Date: Mon, 4 Dec 2006 13:10:17 +0100

Hi Rooters,

I would like to minimze a likelyhood-function of 1 parameter with Tminuit. At the moment, I use the following pair of functions (adapted from

void NLL(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)

  Double_t LL = 0.0;
  const Int_t nbins = 100000;

  for (int i=1; i<nbins; i++)
      LL += TMath::Log(Prob(t[i], sigma[i],par));     }

  f = -1. * LL;

Double_t Prob(Double_t t, Double_t sigma, Double_t *par)

  return .5/par[0] * TMath::Exp(.5*sigma*sigma/(par[0]*par[0]) - t/par[0]) * TMath::Erfc(1/TMath::Sqrt(2) * (sigma/par[0] - t/sigma) ); }


Where NLL is the function to minimize for par[0], and Prob is a function to calculate the probability for each combination of par[0], t[i] and sigma[i]. However, as the format of NLL is fixed, t and sigma now have to be global and fixed, i.e. NLL only works for one set of t and sigma. Is there a way to change the format of NLL in some way, so that I can pass additional references or pointers? Or maybe you have another suggestion?

Till Received on Mon Dec 04 2006 - 13:09:08 MET

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:02 MET