Re: [ROOT] Problem with TVectorD

From: daniel cussol (cussol@ccimap.in2p3.fr)
Date: Thu Jun 24 2004 - 16:44:10 MEST


Francesco Perfetto a écrit :

>Hi All,
>
>I have the following problem:
>I use the TVectorD class in my program, 
>...
>/ definizione della Fermi Dirac e della tripla gaussiana
>Double_t norm_FD[] = {474.76,466.72,459.35,423.14};
>Double_t parFD[4][4];
>Double_t par3G[9][21];
>
>void riempi()
>{
>  Int_t kfd = 0;
>  for(Int_t i=1; i<=4; i++){
>    for(Int_t j=0; j<4; j++){
>      TVectorD *par = (TVectorD*)fpar->Get(Form("par%d",i));
>      parFD[j][kfd] = par(j);   <<<<<<<---------THIS IS LINE 81
>    }
>    kfd++;
>  }
>
>  Int_t kg3 = 0;
>  for(Int_t i=5;i<=25; i++){
>    for(Int_t j=0;j<9; j++){
>      TVectorD *par = (TVectorD*)fpar->Get(Form("par%d",i));
>      par3G[j][kg3] = par(j);   <<<<------THIS IS LINE 90
>    }
>    kg3++;
>  }
>}
>
>...
>
>when I compile my program I have the following errors:
>
>likelihood.cc: In function `void riempi()':
>likelihood.cc:81: `par' cannot be used as a function
>likelihood.cc:90: `par' cannot be used as a function
>gmake: *** [Linux/likelihood.o] Error 1
>
>Can anyone help me?
>
>I use root 4.00/04 on linux redhat 9.0 
>
>P.S. The same function riempi() work very well from the root prompt:
> 
>root [0] .L inserimento_numeri.C
>root [1] riempi()
> 
>
>Thanks
>Francesco.
>
>
>
>  
>
Hello Francesco,
 The parenthesis cannot be used directly on a pointer to a TVector. 
Instead of

parFD[j][kfd] = par(j);
par3G[j][kg3] = par(j);

type

parFD[j][kfd] = (*par)(j);
par3G[j][kg3] = (*par)(j);


I hope this helps.

-- 
Daniel CUSSOL

LPC Caen IN2P3/ENSICAEN/Universite de Caen
Boulevard du Marechal Juin
14050 CAEN CEDEX

e-mail : cussol@in2p3.fr
Tel    : +33-(0)2-31-45-29-73
FAX    : +33-(0)2-31-45-25-49



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