Re: functions

From: Axel Naumann <Axel.Naumann_at_cern.ch>
Date: Mon, 05 Dec 2005 17:08:14 +0100


Hi Chiara,

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

The last line is not what you want (looking at the syntax, you access element no 3 of an array of TF1, i.e. a TF1, not a TF1*). This might work (depending on what GetFitFunctions() returns):

> root [2] TF1** f = ciccio->GetFitFunctions();
> root [3] f[2]->GetName()

As this is awkward and error-prone, you should always pass TLists* around, which contain the elements you currently store in a plain C array of TF1*. I.e. not TF1* f[3], but TList* listFunc; listFunc->Add(new TF1...).

Cheers, Axel. Received on Mon Dec 05 2005 - 17:08:20 MET

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