Hi Navzat et al,
On Sun, 2006-01-29 at 11:15 +0100, Rene Brun wrote: > You have at least 3 C++ coding errors in your code. > In the attachement see lines marked with //<-----
Let me take this opportunity to point out a few things about the ROOT plug-in manager and TMinuit in particular.
In ROOT, there's a number `TVirtual' interfaces, like `TSQlServer', `TVirtualFitter', `TVirtualMC', `TVirtualAuth', `TGenerator', `TFile' and so on.
Most of these (if not all) are transparent interfaces to plug-ins. The concrete implementations implements these interfaces. However, it is advisable _not_ to instantise the concrete implementations in code directly. Instead one should use the static member functions that instantises the interface. For example:
TFile* file = TFile::Open("foo.root"); TFile* file = TFile::Open("root://127.0.0.1/foo.root"); TFile* file = TFile::Open("castor://cern.ch/castor/foo.root");
and so on. The point is, that `TFile::Open' looks for a plug-in that will handle a particular protocol ("", "root:", "castor:"), and instantise the proper concrete implementation. The end-user can customise the exact concrete implementation in `.rootrc'.
The same goes for TMinuit and TVirtualFitter. There's a line in the `.rootrc' which tells ROOT which concrete fitter the _end_user_ prefers:
# Default Fitter (current choices are Minuit and Fumili). Root.Fitter: Minuit
So in code, one should _not_ instantise TMinuit directly. So instead of doing
gMinuit = new TMinuit(2);
one should do
TVirtualFitter* fitter = TVirtualFitter::Fitter(0, 2);
In that way, the end user is free to choose exactly which fitter class to use. This of course means that one has to adapt the code to the `TVirtualFitter' interface rather than the `TMinuit' interface. However, that is easily done:
TMinuit call -> TVirtualFitter call
gMinuit->mnexcm("SET ERR", arglist ,1,ierflg);
-> ierflg = fitter->ExecuteCommand("SET ERR", arglist, 1);
gMinuit->mnexcm("MIGRAD", arglist ,2,ierflg);
-> ierflg = fitter->ExecuteCommand("MIGRAD", arglist, 2);
gMinuit->mnparm(0, "a1", vstart[0], step[0], 0,0,ierflg);
-> ierflg = fitter->SetParameter(0,"a1",vstart[0],step[0],0,0);
gMinuit->mnstat(amin,edm,errdef,nvpar,nparx,icstat);
-> icstat = fitter->GetStats(amin, edm, errdef, nvpar, nparx);
gMinuit->mnprin(3,amin);
-> fitter->PrintResults(3,amin);
Of course, it would be best if `TMinuit', `TFitter', and similar concrete implementations did not export any public constructors, copy constructors, or assignment operators.
Yours,
-- ___ | Christian Holm Christensen |_| | ------------------------------------------------------------- | | Address: Sankt Hansgade 23, 1. th. Phone: (+45) 35 35 96 91 _| DK-2200 Copenhagen N Cell: (+45) 24 61 85 91 _| Denmark Office: (+45) 353 25 404 ____| Email: cholm_at_nbi.dk Web: www.nbi.dk/~cholm | |Received on Tue Jan 31 2006 - 14:43:20 MET
This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:57 MET