[ROOT] combining custom functions

From: Stilianos Kesisoglou (kesisogl@fnal.gov)
Date: Tue Feb 24 2004 - 09:59:21 MET


Hi,

    Is it possible to use custom made functions on ROOT the same way that
we use the canned ones?

    For example:

    a)    I define first :

    Double_t Func1(Double_t *x,Double_t *pars)
    {
        <my function here>
    }

    Double_t Func2(Double_t *x,Double_t *pars)
    {
        <my function here>
    }


    b)    then load the functions:

    .L Func1.C
    .L Func2.C


    c)    and then I do:


    TF1 *f1 = new TF1("f1",Func1,xminFunc1,xmaxFunc1,NparsFunc1);
    TF1 *f2 = new TF1("f2",Func2,xminFunc2,xmaxFunc2,NparsFunc2);

    f1->Draw();    or     f2->Draw();    


    The above works well. But when I try to do:


    TF1 *f1 = new TF1("f1",Func1,xminFunc1,xmaxFunc1,NparsFunc1); 
    TF1 *f2 = new TF1("f2",Func2,xminFunc2,xmaxFunc2,NparsFunc2);

    TF1 *f3 = new TF1("f3",f1*f2,xminFunc3,xmaxFunc3,NparsFunc1+NparsFunc2);

    f3->Draw();

    It fails with a message that the function f3 could not be compiled.

    Is it possible to make the above code to work. I would like to be able
to load a set of functions and then decide on the fly what is the combination I want.
    I would really like to avoid definning a third function.

    Also is it possible to make the f3 directly i.e:

    TF1 *f3 = new TF1("f3",Func1*Func2,xminFunc3,xmaxFunc3,NparsFunc1+NparsFunc2);

or something like that avoiding the definition of f1 and f2?

    Thanks!


Stelios.



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET