Re: [ROOT] array of functions

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sun May 19 2002 - 14:31:23 MEST


Hi,

You do not give enough info (example).
Here is an example with a dynamic array of functions

Rene Brun

void af() {
   const Int_t nfunc = 10;
   TF1 **functions = new TF1*[nfunc];
   for (Int_t i=0;i<nfunc;i++) {
      char fname[20];
      sprintf(fname,"f%d",i);
      functions[i] = new TF1(fname,"gaus",-10,10);
      functions[i]->SetParameters(1,0,0.5+i/2.);
      if (i == 0) functions[i]->Draw();
      else        functions[i]->Draw("lsame");
   }  
}

On Thu, 16 May 2002 kmakonyi@nist.gov wrote:

> Hi rooters,
> 
> I'm a really beginner in the Root. But my first 
> impressions are very good.
> 
> My problem is not so crutial, but it would be nice to 
> solve it.
> So, I would have to create an array of functions.
> I tried the create in the constructor the
> 
> TF1** functions;
> 
> ,but in this point I get an error message from the 
> Windows: "the indtruction at [...]. The memory could 
> not be written". 
> 
> What would be the problem?
> 
> Thanks,
> 
> Karoly Makonyi
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:53 MET