Re: some confusion about TString

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Mar 10 1999 - 12:03:56 MET


Petar Maksimovic wrote:
> 
> Hi all,
> 
> I'm a little confused about some uses of the TString class.  What I
> ultimately want to do is to tokenize a command line.  (I'm trying to
> write a layer on top of TMinuit::mnexcm() and avoid creating the
> annoying array of needed to supply arguments.)
> 
> The web page for TString claims that there is a member function
> istream& ReadToken(istream& str) that seems perfect for the job.  Does
> anybody have an example on how to use it (the whole root web site
> contains only two references to it -- in the class definition).
> 
> Also, one would naively expect the following few commands to work:
> 
> root [0] #include <iostream.h>
> root [1] TString test = "one two three";
> root [2] cout << test << endl;
> 
>  *** Break *** segmentation violation
> 
> I'd appreciate a hint on what I'm missing here.
> 
> I'm using root 2.21/02.   Thanks a bunch!
> 
>                 Petar

Hi Petar,
In Root 2.21/03, Fons fixed a problem in Tstring::ReadToken.
At least, I checked that your above commands work correctly with
our current version 2.21/07.

Note that TMinuit has a member function TMinuit::mncomd to execute
a const char *command. There were several problems with this function.
They were fixed in 2.21/05

Christian lacunza has suggested a set of new functions in the TMinuit
class.
These functions simplify the use of the TMinuit class:
I have added TMinuit::Command(const char *command) also.

     Int_t  Command(const char *command);
     Int_t  DefineParameter( Int_t parNo, const char *name, Double_t
initVal,                Double_t initErr, Double_t lowerLimit, Double_t
upperLimit );
     Int_t  FixParameter( Int_t parNo );
     Int_t  GetParameter( Int_t parNo, Double_t& current_value,
Double_t&                    current_error );
     Int_t  Migrad();
     Int_t  Release( Int_t parNo );
     Int_t  SetErrorDef( Double_t up );
     Int_t  SetPrintLevel( Int_t printLevel=0 );

Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:30 MET