Logo ROOT   6.21/01
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 
10 class TFoamVect : public TObject {
11  // constructor
12 private:
13  Int_t fDim; ///< Dimension
14  Double_t *fCoords; ///< [fDim] Coordinates
15 public:
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 
virtual ~TFoamVect()
Destructor.
Definition: TFoamVect.cxx:75
Int_t fDim
Dimension.
Definition: TFoamVect.h:13
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:108
TFoamVect operator-(const TFoamVect &)
subtraction operator -; difference of 2 vectors; c=a-b, a=a-b, NEVER USE IT, VERY SLOW!!! ...
Definition: TFoamVect.cxx:168
const char Option_t
Definition: RtypesCore.h:62
Int_t GetDim() const
Definition: TFoamVect.h:32
int Int_t
Definition: RtypesCore.h:41
TFoamVect & operator=(const TFoamVect &)
substitution operator
Definition: TFoamVect.cxx:85
TFoamVect & operator-=(const TFoamVect &)
unary subtraction operator -=
Definition: TFoamVect.cxx:142
#define ClassDef(name, id)
Definition: Rtypes.h:326
TFoamVect & operator+=(const TFoamVect &)
unary addition operator +=; adding vector c*=x,
Definition: TFoamVect.cxx:129
TFoamVect & operator*=(const Double_t &)
unary multiplication operator *=
Definition: TFoamVect.cxx:119
TFoamVect()
Default constructor for streamer.
Definition: TFoamVect.cxx:27
Auxiliary class TFoamVect of n-dimensional vector, with dynamic allocation used for the cartesian geo...
Definition: TFoamVect.h:10
Double_t * fCoords
[fDim] Coordinates
Definition: TFoamVect.h:14
double Double_t
Definition: RtypesCore.h:55
void Print(Option_t *option) const
Printout of all vector components on "std::cout".
Definition: TFoamVect.cxx:202
Mother of all ROOT objects.
Definition: TObject.h:37
Double_t GetCoord(Int_t i) const
Definition: TFoamVect.h:33
TFoamVect operator+(const TFoamVect &)
addition operator +; sum of 2 vectors: c=a+b, a=a+b, NEVER USE IT, VERY SLOW!!!
Definition: TFoamVect.cxx:156