Re: calling cern lib complex functions

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Apr 22 1999 - 17:48:05 MEST


Hongquan Niu wrote:
> 
> Hi, Rooters,
> 
> I have three questions:
> 
> 1. I basicly can follow the example to call CERNLIB routines,
>    but now I am dealing with complex type in fortran, for example
>    complex*16   wwerf(Z), and I am wondering how should I declare
>    wwerf in CERNfunctions.h.
> 

wwerf is not a very long Fortran function. Making the interface
with your code depends mainly on how you deal with complex*16 in your
C++ code. I assume you already have a class Complex somewhere.
I think that interfacing with fortran will be a mess. It might be
faster to reimplement the wwerf code in C++!


> 2. I have a class which has member functions in the format like
>    Double_t myclass::funcs(Double_t *x,Double_t *par), I want to
>    have a methord  to draw this function, but since it is not
>    pure function, how can I acheive this?
> 

The TF1 class expects an argument of the type
    Double_t funcs(Double_t *x, Double_t *par)
You should call your class member function from this C static function.


> 3. Can I include a picture, for example in gif format, in an
>    existing canvas?
> 

This facility has been implemented and never announced. The reason is
that a good implementation requires to be able to :
 - grow/shring the pad containing the image (like XV is doing). 
   The current implementation does not allow that.
 - get the image on Postscript.

If you want to try, you can do the following:
{
   TCanvas *c1 = new TCanvas("c1","gif image",10,10,600,500);
   c1->SetFillStyle(3101);
   //the trick is to create a TNamed object with 
   // a name gifxxxx where xxxx is 3101,3102... up to 3199
   // a title containing the name of the gif file
   //and to add this named object to the list of "special" Root objects
   TNamed *gif = new TNamed("gif3101","mypict.gif");
   gROOT->GetListOfSpecials()->Add(gif);
   //now draw a histogram on top of the background gif image
   hpx->Draw();
}


Rene Brun



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