Logo ROOT   6.08/07
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 ////////////////////////////////////////////////////////////////////////////////
8 // //
9 // Auxiliary class TFoamVect of n-dimensional vector, with dynamic allocation //
10 // used for the cartesian geometry of the TFoam cells //
11 // //
12 ////////////////////////////////////////////////////////////////////////////////
13 
14 #ifndef ROOT_TObject
15 #include "TObject.h"
16 #endif
17 
18 
19 ///////////////////////////////////////////////////////////////////////////////
20 class TFoamVect : public TObject {
21  // constructor
22 private:
23  Int_t fDim; // Dimension
24  Double_t *fCoords; // [fDim] Coordinates
25 public:
26  TFoamVect(); // Constructor
27  TFoamVect(Int_t); // USER Constructor
28  TFoamVect(const TFoamVect &); // Copy constructor
29  virtual ~TFoamVect(); // Destructor
30 //////////////////////////////////////////////////////////////////////////////
31 // Overloading operators //
32 //////////////////////////////////////////////////////////////////////////////
33  TFoamVect& operator =(const TFoamVect&); // = operator; Substitution
34  Double_t &operator[](Int_t); // [] provides POINTER to coordinate
35  TFoamVect& operator =(Double_t []); // LOAD IN entire double vector
36  TFoamVect& operator =(Double_t); // LOAD IN double number
37 ////////////////////////// OTHER METHODS //////////////////////////////////
38  TFoamVect& operator+=(const TFoamVect&); // +=; add vector u+=v (FAST)
39  TFoamVect& operator-=(const TFoamVect&); // +=; add vector u+=v (FAST)
40  TFoamVect& operator*=(const Double_t&); // *=; mult. by scalar v*=x (FAST)
41  TFoamVect operator+( const TFoamVect&); // +; u=v+s, NEVER USE IT, SLOW!!!
42  TFoamVect operator-( const TFoamVect&); // -; u=v-s, NEVER USE IT, SLOW!!!
43  void Print(Option_t *option) const; // Prints vector
44  Int_t GetDim() const { return fDim; } // Returns dimension
45  Double_t GetCoord(Int_t i) const {return fCoords[i];}; // Returns coordinate
46 
47  ClassDef(TFoamVect,1) //n-dimensional vector with dynamical allocation
48 };
49 
50 #endif
51 
virtual ~TFoamVect()
Destructor.
Definition: TFoamVect.cxx:69
Int_t fDim
Definition: TFoamVect.h:23
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:107
TFoamVect operator-(const TFoamVect &)
subtraction operator -; difference of 2 vectors; c=a-b, a=a-b, NEVER USE IT, VERY SLOW!!! ...
Definition: TFoamVect.cxx:167
const char Option_t
Definition: RtypesCore.h:62
Int_t GetDim() const
Definition: TFoamVect.h:44
int Int_t
Definition: RtypesCore.h:41
TFoamVect & operator=(const TFoamVect &)
substitution operator
Definition: TFoamVect.cxx:84
TFoamVect & operator-=(const TFoamVect &)
unary subtraction operator -=
Definition: TFoamVect.cxx:141
#define ClassDef(name, id)
Definition: Rtypes.h:254
TFoamVect & operator+=(const TFoamVect &)
unary addition operator +=; adding vector c*=x,
Definition: TFoamVect.cxx:128
TFoamVect & operator*=(const Double_t &)
unary multiplication operator *=
Definition: TFoamVect.cxx:118
TFoamVect()
Default constructor for streamer.
Definition: TFoamVect.cxx:21
Double_t * fCoords
Definition: TFoamVect.h:24
double Double_t
Definition: RtypesCore.h:55
void Print(Option_t *option) const
Printout of all vector components on "std::cout".
Definition: TFoamVect.cxx:204
Mother of all ROOT objects.
Definition: TObject.h:37
Double_t GetCoord(Int_t i) const
Definition: TFoamVect.h:45
TFoamVect operator+(const TFoamVect &)
addition operator +; sum of 2 vectors: c=a+b, a=a+b, NEVER USE IT, VERY SLOW!!!
Definition: TFoamVect.cxx:155