00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TArrayF
00013 #define ROOT_TArrayF
00014
00015
00017
00018
00019
00020
00021
00023
00024 #ifndef ROOT_TArray
00025 #include "TArray.h"
00026 #endif
00027
00028
00029 class TArrayF : public TArray {
00030
00031 public:
00032 Float_t *fArray;
00033
00034 TArrayF();
00035 TArrayF(Int_t n);
00036 TArrayF(Int_t n, const Float_t *array);
00037 TArrayF(const TArrayF &array);
00038 TArrayF &operator=(const TArrayF &rhs);
00039 virtual ~TArrayF();
00040
00041 void Adopt(Int_t n, Float_t *array);
00042 void AddAt(Float_t c, Int_t i);
00043 Float_t At(Int_t i) const ;
00044 void Copy(TArrayF &array) const {array.Set(fN); for (Int_t i=0;i<fN;i++) array.fArray[i] = fArray[i];}
00045 const Float_t *GetArray() const { return fArray; }
00046 Float_t *GetArray() { return fArray; }
00047 Stat_t GetSum() const {Stat_t sum=0; for (Int_t i=0;i<fN;i++) sum+=fArray[i]; return sum;}
00048 void Reset() {memset(fArray, 0, fN*sizeof(Float_t));}
00049 void Reset(Float_t val) {for (Int_t i=0;i<fN;i++) fArray[i] = val;}
00050 void Set(Int_t n);
00051 void Set(Int_t n, const Float_t *array);
00052 Float_t &operator[](Int_t i);
00053 Float_t operator[](Int_t i) const;
00054
00055 ClassDef(TArrayF,1)
00056 };
00057
00058 #if defined R__TEMPLATE_OVERLOAD_BUG
00059 template <>
00060 #endif
00061 inline TBuffer &operator>>(TBuffer &buf, TArrayF *&obj)
00062 {
00063
00064
00065 obj = (TArrayF *) TArray::ReadArray(buf, TArrayF::Class());
00066 return buf;
00067 }
00068
00069 #if defined R__TEMPLATE_OVERLOAD_BUG
00070 template <>
00071 #endif
00072 inline TBuffer &operator<<(TBuffer &buf, const TArrayF *obj)
00073 {
00074
00075 return buf << (TArray*)obj;
00076 }
00077
00078 inline Float_t TArrayF::At(Int_t i) const
00079 {
00080 if (!BoundsOk("TArrayF::At", i)) return 0;
00081 return fArray[i];
00082 }
00083
00084 inline Float_t &TArrayF::operator[](Int_t i)
00085 {
00086 if (!BoundsOk("TArrayF::operator[]", i))
00087 i = 0;
00088 return fArray[i];
00089 }
00090
00091 inline Float_t TArrayF::operator[](Int_t i) const
00092 {
00093 if (!BoundsOk("TArrayF::operator[]", i)) return 0;
00094 return fArray[i];
00095 }
00096
00097 #endif