]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliFMDFloatMap.h
Coverity fix (Haavard)
[u/mrichter/AliRoot.git] / STEER / AliFMDFloatMap.h
index a61792532e48aaf5ad22c2d5b4a122e9118a8181..c9a772f5d262f13c4e02102a52dc3b855760b420 100755 (executable)
@@ -6,21 +6,28 @@
  * See cxx source for full Copyright notice                               
  */
 #ifndef ALIFMDMAP_H
-# include <AliFMDMap.h>
+# include "AliFMDMap.h"
 #endif
 //____________________________________________________________________
 //
 // Array of floats indexed by strip identifier.
+// the floats are indexed by the coordinates 
+//     DETECTOR # (1-3)
+//     RING ID    ('I' or 'O', any case)
+//     SECTOR #   (0-39)
+//     STRIP #    (0-511)
 //
 class AliFMDFloatMap : public AliFMDMap
 {
 public:
-  AliFMDFloatMap(size_t  maxDet = kMaxDetectors, 
-                size_t  maxRing= kMaxRings, 
-                size_t  maxSec = kMaxSectors, 
-                size_t  maxStr = kMaxStrips);
+  AliFMDFloatMap();
+  AliFMDFloatMap(Int_t  maxDet, 
+                Int_t  maxRing= 0, 
+                Int_t  maxSec = 0, 
+                Int_t  maxStr = 0);
+  AliFMDFloatMap(const AliFMDMap& o);
   AliFMDFloatMap(const AliFMDFloatMap& o);
-  virtual ~AliFMDFloatMap() { delete [] fData; }
+  virtual ~AliFMDFloatMap() { delete [] fData;fData = 0; }
   AliFMDFloatMap& operator=(const AliFMDFloatMap& o);
   virtual void Reset(const Float_t& v=Float_t());
   virtual Float_t& operator()(UShort_t det,
@@ -31,12 +38,48 @@ public:
                                    Char_t   ring,
                                    UShort_t sec,
                                    UShort_t str) const;
+  Float_t* Data() const { return fData; }
+  void Print(Option_t* option="%8.4f") const;
 protected:
-  size_t   fTotal;  // Total number of entries
+  Int_t    MaxIndex() const { return fTotal; }
+  Float_t  AtAsFloat(Int_t i) const { return fData[i]; } 
+  Float_t& AtAsFloat(Int_t i)       { return fData[i]; } 
+  Bool_t   IsFloat() const { return kTRUE; }
+
+  Int_t   fTotal;  // Total number of entries
   Float_t* fData;   //[fTotal]
-  ClassDef(AliFMDFloatMap,1) // Map of floats
+  ClassDef(AliFMDFloatMap,3) // Map of floats
 };
 
+inline AliFMDFloatMap
+operator*(const AliFMDMap& lhs, const AliFMDMap& rhs)
+{
+  AliFMDFloatMap r(lhs);
+  r *= rhs;
+  return r;
+}
+inline AliFMDFloatMap
+operator/(const AliFMDMap& lhs, const AliFMDMap& rhs)
+{
+  AliFMDFloatMap r(lhs);
+  r /= rhs;
+  return r;
+}
+inline AliFMDFloatMap
+operator+(const AliFMDMap& lhs, const AliFMDMap& rhs)
+{
+  AliFMDFloatMap r(lhs);
+  r += rhs;
+  return r;
+}
+inline AliFMDFloatMap
+operator-(const AliFMDMap& lhs, const AliFMDMap& rhs)
+{
+  AliFMDFloatMap r(lhs);
+  r -= rhs;
+  return r;
+}
+
 #endif
 //____________________________________________________________________
 //