Re: TVector Index

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Sat Aug 07 1999 - 18:21:55 MEST


Hi Norbert,

  how did you define your TVector: TVector v(3) or TVector v(1,3).
In the first case the index is from 0-2 in the latter from 1-3.

Just try:

TVector v1(3)
v1.Print()
TVector v2(1,3)
v2.Print()


Cheers, Fons.



Norbert Danneberg wrote:
> 
> Hi ,
> 
> meight there be a problem in the TVector indexing ??
> 
> in the documentation of TVector is written :
> 
> Unless otherwise specified, matrix and vector indices always start
> with 0, spanning up to the specified limit-1.
> 
> In my Code TVector::Print() yields the following output
> 
> Vector 3 is as follows
> 
>      |        1  |
> ------------------
>    1 |   -0.09016
>    2 |     0.1186
>    3 |     0.9888
> 
> but TVector(2) which is supposed to be the third component  (assuming an
> index 0,1,2)
> gives
> 
> Gamma1Dir z: 0.118618
> 
> Below I paseted a sample of my code which produced the output:
> 
>    Float_t CosTheta3=Gamma1Direction(2)/Gamma1Direction.Norm1();
>    cout << "Gamma1Vector :" << endl;
>    Gamma1Direction.Print();
>    cout << "Gamma1Dir z: " << Gamma1Direction(2) << endl;
> 
> Norbert
> 
> --
> 
> 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

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



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