RE: [ROOT] how to use TROOT::ProcessLine()

From: Valeri Fine (fine@bnl.gov)
Date: Wed Aug 13 2003 - 23:23:47 MEST


Hello dear TCLI,

You are kindly advised to read the ROOT manual. Very likely you should
read the ROOT tutorials as well:
                http://www-root.fnal.gov/root/
ROOT is a system and to understand things it is not enough to read the
definition of the selected method.

"void ProcessLine(const char *line, Int_t *error)"

does process the one single line of the C++ code.  There are very few
occasions when one needs to use this method. Of course there is no need
to use this method from the ROOT prompt at all.

Anyway you can do 
           gROOT->ProcessLine("2*sin(2.1*4.0)");
to get
root [0] gROOT->ProcessLine("2*sin(2.1*4.0)");
(const double)1.70919781617656086e+00

However you can get the same result much simpler:

root [1] 2*sin(2.1*4.0)
(const double)1.70919781617656086e+00


The method doesn't process the FILE. 
It doesn't process the ROOT macro either as your supervised should have
explained.

On other hand it is error prone to use the ROOT macro the way one used
to apply the PAW kumacs.

You are advised to consider the using of ACliC ROOT facilities to build
the compiled share library. That way you will work with the regular C++
code and regular C++ compiler and you may have found the answers of your
questions with any C/C++ text book.

Either ways you still need to read the manual and complete the FermiLab
tutorials.

               Hope this helps,
                            My best regards, Valeri


> Dear root users,
>       I want to use TROOT::ProcessLine() to execute multiple scripts
> with some conditions from a single top script.  The user guide v3.05
> simply mentions the name of this method and says it can be used for
this
> purpose. It also mentions an example from
> $ROOTSYS/tutorials/cernstaff.C. I went through the cernstaff.C file,
but
> it only demonstrates how to create and fill a tree, set branches,etc,
> including nothing on how to use TROOT::ProcessLine().
>       I seached in "root.cern.ch", finding only this:
> 
> "ProcessLine(const char* line, Int_t* error = 0)"
> 
> and
> 
> "void ProcessLine(const char *line, Int_t *error)
> 
>  Process interpreter command via TApplication::ProcessLine().
>  On Win32 the line will be processed a-synchronously by sending
>  it to the CINT interpreter thread. For explicit synchrounous
processing
>  use ProcessLineSync(). On non-Win32 platforms there is not difference
>  between ProcessLine() and ProcessLineSync().
>  The possible error codes are defined by TInterpreter::EErrorCode.  In
>  particular, error will equal to TInterpreter::kProcessing until the
>  CINT interpreted thread has finished executing the line."
> 
> 
>      The second long explantion includes no examples on how to use
> ProcessLine().
> 
>       Then I tried to do the following on the root prompt:
> root[] .L myfile.C
> root[] gROOT.ProcessLine("myfile.C")
> 
> but root says "..Symbol myfile is not defined in current scope ...".
So
> I have no idea on how to use it. Can anyone kindly help me?
> 
> The version of ROOT I am using is 3.05/04.
> 
> Thanks in advance!
> 
> tcli



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET