00001 // @(#)root/foam:$Id: TFoamVect.h 20882 2007-11-19 11:31:26Z rdm $ 00002 // Author: S. Jadach <mailto:Stanislaw.jadach@ifj.edu.pl>, P.Sawicki <mailto:Pawel.Sawicki@ifj.edu.pl> 00003 00004 #ifndef ROOT_TFoamVect 00005 #define ROOT_TFoamVect 00006 00007 //////////////////////////////////////////////////////////////////////////////// 00008 // // 00009 // Auxiliary class TFoamVect of n-dimensional vector, with dynamic allocation // 00010 // used for the cartesian geometry of the TFoam cells // 00011 // // 00012 //////////////////////////////////////////////////////////////////////////////// 00013 00014 #ifndef ROOT_TObject 00015 #include "TObject.h" 00016 #endif 00017 00018 00019 /////////////////////////////////////////////////////////////////////////////// 00020 class TFoamVect : public TObject { 00021 // constructor 00022 private: 00023 Int_t fDim; // Dimension 00024 Double_t *fCoords; // [fDim] Coordinates 00025 TFoamVect *fNext; // pointer for tree construction 00026 TFoamVect *fPrev; // pointer for tree construction 00027 public: 00028 TFoamVect(); // Constructor 00029 TFoamVect(Int_t); // USER Constructor 00030 TFoamVect(const TFoamVect &); // Copy constructor 00031 virtual ~TFoamVect(); // Destructor 00032 ////////////////////////////////////////////////////////////////////////////// 00033 // Overloading operators // 00034 ////////////////////////////////////////////////////////////////////////////// 00035 TFoamVect& operator =(const TFoamVect&); // = operator; Substitution 00036 Double_t &operator[](Int_t); // [] provides POINTER to coordinate 00037 TFoamVect& operator =(Double_t []); // LOAD IN entire double vector 00038 TFoamVect& operator =(Double_t); // LOAD IN double number 00039 ////////////////////////// OTHER METHODS ////////////////////////////////// 00040 TFoamVect& operator+=(const TFoamVect&); // +=; add vector u+=v (FAST) 00041 TFoamVect& operator-=(const TFoamVect&); // +=; add vector u+=v (FAST) 00042 TFoamVect& operator*=(const Double_t&); // *=; mult. by scalar v*=x (FAST) 00043 TFoamVect operator+( const TFoamVect&); // +; u=v+s, NEVER USE IT, SLOW!!! 00044 TFoamVect operator-( const TFoamVect&); // -; u=v-s, NEVER USE IT, SLOW!!! 00045 void Print(Option_t *option) const; // Prints vector 00046 void PrintList(); // Prints vector and the following linked list 00047 Int_t GetDim() const { return fDim; } // Returns dimension 00048 Double_t GetCoord(Int_t i) const {return fCoords[i];}; // Returns coordinate 00049 00050 ClassDef(TFoamVect,1) //n-dimensional vector with dynamical allocation 00051 }; 00052 00053 #endif 00054