]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDUShortMap.cxx
Bug fixed (Christian)
[u/mrichter/AliRoot.git] / FMD / AliFMDUShortMap.cxx
index a4be648921db2487718b214b1317d48622ccfbba..16cb51c2beed38915484a5b4743eee974e2a4fdb 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-
 /* $Id$ */
-
+/** @file    AliFMDUShortMap.cxx
+    @author  Christian Holm Christensen <cholm@nbi.dk>
+    @date    Mon Mar 27 12:48:18 2006
+    @brief   Per strip of unisgned shorts (16 bit) data 
+*/
 //____________________________________________________________________
 //                                                                          
 // A map of per strip UShort_t information (for example ADC values,
@@ -35,12 +38,13 @@ ClassImp(AliFMDUShortMap)
 AliFMDUShortMap::AliFMDUShortMap(const AliFMDUShortMap& other)
   : AliFMDMap(other.fMaxDetectors, other.fMaxRings, other.fMaxSectors, 
              other.fMaxStrips), 
+    fTotal(0),
     fData(0)
 {
   // CTOR
-  fData = new UShort_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips];
-  for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
-       i++) fData[i] = other.fData[i];
+  fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
+  fData  = new UShort_t[fTotal];
+  for (size_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
 }
 
   
@@ -51,6 +55,7 @@ AliFMDUShortMap::AliFMDUShortMap(size_t maxDet,
                                 size_t maxSec, 
                                 size_t maxStr)
   : AliFMDMap(maxDet, maxRing, maxSec, maxStr), 
+    fTotal(0),
     fData(0)
 {
   // Construct a map
@@ -60,7 +65,8 @@ AliFMDUShortMap::AliFMDUShortMap(size_t maxDet,
   //     maxRinf      Maximum # of rings
   //     maxSec       Maximum # of sectors
   //     maxStr       Maximum # of strips
-  fData = new UShort_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips];
+  fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
+  fData  = new UShort_t[fTotal];
 }
 
 //____________________________________________________________________
@@ -73,9 +79,9 @@ AliFMDUShortMap::operator=(const AliFMDUShortMap& other)
   fMaxSectors   = other.fMaxSectors;
   fMaxStrips    = other.fMaxStrips;
   if (fData) delete [] fData;
-  fData = new UShort_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips];
-  for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
-       i++) fData[i] = other.fData[i];
+  fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
+  fData  = new UShort_t[fTotal];
+  for (size_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
   return *this;
 }
 
@@ -84,8 +90,7 @@ void
 AliFMDUShortMap::Reset(const UShort_t& val) 
 {
   // Reset to val
-  for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
-       i++) fData[i] = val;
+  for (size_t i = 0; i < fTotal; i++) fData[i] = val;
 }
 
 //____________________________________________________________________