TF1::Eval of a compiled function

From: Norbert Danneberg (Norbert.Danneberg@psi.ch)
Date: Wed Aug 25 1999 - 20:22:49 MEST


HI,

I try to evaluate a compiled function wich is loaded as part of a shared
library into root.
After initalization of the parameters TF1::Eval leads to  a segmentation
violation in the
interpeter. I think the address of the parameter array is not set
correctly in  TF1:InitArgs(),
but I have no idea why.

This is what I type in the Interpreter:

PTSig =
new TF1("PTSig",PTSignalFunc,0,40,6);
PTSig->SetParName(0,"TotalEnergy");
PTSig->SetParName(1,"E3");
PTSig->SetParName(2,"PT1");
PTSig->SetParName(3,"PT2");
PTSig->SetParName(4,"Sigma0");
PTSig->SetParName(5,"Psi");
PTSig->SetParameter(0,30);
PTSig->SetParameter(1,15);
PTSig->SetParameter(2,1/sqrt(2));
PTSig->SetParameter(3,1/sqrt(2));
PTSig->SetParameter(4,1);
PTSig->SetParameter(5,0);
PTSig->Print();

                PTSig :  Ndim= 1, Npar= 6, Noper= 0
 Par  0           TotalEnergy = 30
 Par  1                    E3 = 15
 Par  2                   PT1 = 0.707107
 Par  3                   PT2 = 0.707107
 Par  4                Sigma0 = 1
 Par  5                   Psi = 0
root [0] PTSig->Eval(0)
Calling1

 *** Break *** segmentation violation
Root >


This is the compiled function. It is defined in the coresponding header
file as
extern Double_t PTSignal(...);



Double_t PTSignalFunc(Double_t *t, Double_t *par){
  cout << "Calling" << par <<endl;
  for(Int_t i =0; i <6; i++){
    cout <<"Par: " << par[0] << endl ;
    cout<< par[i] << endl;
  }
 return  PTSignal(par[0], par[1], *t, par[2], par[3], par[4], par[5]);
}


--

Norbert Danneberg

ETH Zurich - Institute for Particle Physics
  Laboratory for Nuclear Physics          Phone.: +41-1-633-2034
  Hoenggerberg                            Fax.:   +41-1-633-1067
  CH-8093 Zurich


ETH Zurich - Institute for Particle Physics
  Paul Scherrer Institute                 Phone.: +41-56-310-3284
  CH-5232 Villigen PSI                    Fax.:   +41-56-310-4362

email: Norbert.Danneberg@psi.ch



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