functions

From: chiara zampolli <Chiara.Zampolli_at_bo.infn.it>
Date: Mon, 05 Dec 2005 16:44:03 +0000


Dear rooters,

    I have a class (AliTOFcalib) with an array of functions as data member:

TF1* ffunc[3];

These functions are then set in the cxx file of the class in a method similar to this (this is a simplified version):

void AliTOFcalib::SetFitFunctions(){

  TF1 *mypol1 = new TF1("mypol1", "[0]+[1]*x");
  TF1 *mypol2 = new TF1("mypol2", "[0]+[1]*x+[2]*x*x");
  TF1 *mypol3 = new TF1("mypol3", "[0]+[1]*x+[2]*x*x+[3]*x*x*x");
  ffunc[0]=mypol1;
  ffunc[1]=mypol2;
  ffunc[2]=mypol3;
  ffunc[0]->SetName("ciccio0");

  ffunc[1]->SetName("ciccio1");
  ffunc[2]->SetName("ciccio2");
  return;
}

When, then, even from the ROOT prompt, I try to retrieve the functions, then ROOT crashes:


FreeType Engine v2.1.9 used to render TrueType fonts. Compiled on 16 November 2005 for linux with thread support.

CINT/ROOT C/C++ Interpreter version 5.16.2, July 14 2005 Type ? for help. Commands must be C++ statements. Enclose multiple statements between { }.

root [0] AliTOFcalib *ciccio = new AliTOFcalib();
root [1] ciccio->SetFitFunctions()
root [2] TF1* f = ciccio->GetFitFunctions();
root [3] f[2]->GetName()

Do you know where I am doing wrong? Is it because I am using a pointer for my array of functions?

Thank you in advance.
Cheers,

     chiara Received on Mon Dec 05 2005 - 16:45:35 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:14 MET