Logo ROOT  
Reference Guide
TFoamVect.h
Go to the documentation of this file.
1// @(#)root/foam:$Id$
2// Author: S. Jadach <mailto:Stanislaw.jadach@ifj.edu.pl>, P.Sawicki <mailto:Pawel.Sawicki@ifj.edu.pl>
3
4#ifndef ROOT_TFoamVect
5#define ROOT_TFoamVect
6
7#include "TObject.h"
8
9
10class TFoamVect : public TObject {
11 // constructor
12private:
13 Int_t fDim; ///< Dimension
14 Double_t *fCoords; ///< [fDim] Coordinates
15public:
16 TFoamVect(); // Constructor
17 TFoamVect(Int_t); // USER Constructor
18 TFoamVect(const TFoamVect &); // Copy constructor
19 virtual ~TFoamVect(); // Destructor
20
21 TFoamVect& operator =(const TFoamVect&); // = operator; Substitution
22 Double_t &operator[](Int_t); // [] provides POINTER to coordinate
23 TFoamVect& operator =(Double_t []); // LOAD IN entire double vector
24 TFoamVect& operator =(Double_t); // LOAD IN double number
25
26 TFoamVect& operator+=(const TFoamVect&); // +=; add vector u+=v (FAST)
27 TFoamVect& operator-=(const TFoamVect&); // +=; add vector u+=v (FAST)
28 TFoamVect& operator*=(const Double_t&); // *=; mult. by scalar v*=x (FAST)
29 TFoamVect operator+( const TFoamVect&); // +; u=v+s, NEVER USE IT, SLOW!!!
30 TFoamVect operator-( const TFoamVect&); // -; u=v-s, NEVER USE IT, SLOW!!!
31 void Print(Option_t *option) const; // Prints vector
32 Int_t GetDim() const { return fDim; } // Returns dimension
33 Double_t GetCoord(Int_t i) const {return fCoords[i];}; // Returns coordinate
34
35 ClassDef(TFoamVect,1) //n-dimensional vector with dynamical allocation
36};
37
38#endif
39
int Int_t
Definition: RtypesCore.h:45
double Double_t
Definition: RtypesCore.h:59
const char Option_t
Definition: RtypesCore.h:66
#define ClassDef(name, id)
Definition: Rtypes.h:325
Auxiliary class TFoamVect of n-dimensional vector, with dynamic allocation used for the cartesian geo...
Definition: TFoamVect.h:10
TFoamVect & operator=(const TFoamVect &)
substitution operator
Definition: TFoamVect.cxx:86
TFoamVect operator+(const TFoamVect &)
addition operator +; sum of 2 vectors: c=a+b, a=a+b, NEVER USE IT, VERY SLOW!!!
Definition: TFoamVect.cxx:157
TFoamVect operator-(const TFoamVect &)
subtraction operator -; difference of 2 vectors; c=a-b, a=a-b, NEVER USE IT, VERY SLOW!...
Definition: TFoamVect.cxx:169
TFoamVect & operator*=(const Double_t &)
unary multiplication operator *=
Definition: TFoamVect.cxx:120
Int_t GetDim() const
Definition: TFoamVect.h:32
TFoamVect & operator+=(const TFoamVect &)
unary addition operator +=; adding vector c*=x,
Definition: TFoamVect.cxx:130
TFoamVect & operator-=(const TFoamVect &)
unary subtraction operator -=
Definition: TFoamVect.cxx:143
Double_t * fCoords
[fDim] Coordinates
Definition: TFoamVect.h:14
Int_t fDim
Dimension.
Definition: TFoamVect.h:13
TFoamVect()
Default constructor for streamer.
Definition: TFoamVect.cxx:28
Double_t & operator[](Int_t)
[] is for access to elements as in ordinary matrix like a[j]=bj Range protection is built in,...
Definition: TFoamVect.cxx:109
virtual ~TFoamVect()
Destructor.
Definition: TFoamVect.cxx:76
void Print(Option_t *option) const
Printout of all vector components on "std::cout".
Definition: TFoamVect.cxx:203
Double_t GetCoord(Int_t i) const
Definition: TFoamVect.h:33
Mother of all ROOT objects.
Definition: TObject.h:37