]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDBoolMap.cxx
Woops. TObject::MakeZombie is irrevertable. Made
[u/mrichter/AliRoot.git] / FMD / AliFMDBoolMap.cxx
index 17f5ba1c57ef33583cf798e69b42e7792d4eebeb..16f20c67b4101abc6dc6ee7ced557ac6b07d837e 100644 (file)
  * is provided "as is" without express or implied warranty.   *
  **************************************************************/
 /* $Id$ */
+/** @file    AliFMDBoolMap.cxx
+    @author  Christian Holm Christensen <cholm@nbi.dk>
+    @date    Sun Mar 26 18:28:42 2006
+    @brief   Per strip Boolean map
+*/
 //__________________________________________________________
 // 
-// Map of per strip Bool_t information
-// 
+// Map of Bool_t for each FMD strip
+// Used in calibration and the like classes.
+// Used amoung other things for dead-channel map
+// Can also be used for other stuff too
 // Created Mon Nov  8 12:51:51 2004 by Christian Holm Christensen
 // 
 #include "AliFMDBoolMap.h"     //ALIFMDBOOLMAP_H
 //__________________________________________________________
-ClassImp(AliFMDBoolMap);
+ClassImp(AliFMDBoolMap)
+#if 0
+  ; // This is here to keep Emacs for indenting the next line
+#endif
 //__________________________________________________________
 AliFMDBoolMap::AliFMDBoolMap(const AliFMDBoolMap& other)
   : AliFMDMap(other.fMaxDetectors,
               other.fMaxRings,
               other.fMaxSectors,
               other.fMaxStrips),
+    fTotal(fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips),
     fData(0)
 {
   // Copy constructor
-  fData = new Bool_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips];
-  for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; i++)
-    fData[i] = other.fData[i];
+  if (fTotal == 0) fTotal = 51200;
+  fData  = new Bool_t[fTotal];
+  for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
+}
+
+//__________________________________________________________
+AliFMDBoolMap::AliFMDBoolMap()
+  : AliFMDMap(),
+    fTotal(0),
+    fData(0)
+{
+  // Constructor.
+  // Parameters:
+  //   None
 }
 
 //__________________________________________________________
-AliFMDBoolMap::AliFMDBoolMap(size_t maxDet,
-                         size_t maxRing,
-                         size_t maxSec,
-                         size_t maxStr)
+AliFMDBoolMap::AliFMDBoolMap(UShort_t maxDet,
+                            UShort_t maxRing,
+                            UShort_t maxSec,
+                            UShort_t maxStr)
   : AliFMDMap(maxDet, maxRing, maxSec, maxStr),
+    fTotal(fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips),
     fData(0)
 {
   // Constructor.
@@ -52,8 +75,9 @@ AliFMDBoolMap::AliFMDBoolMap(size_t maxDet,
   //   maxRing Maximum number of rings per detector
   //   maxSec  Maximum number of sectors per ring
   //   maxStr  Maximum number of strips per sector
-  fData = new Bool_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips];
-  Clear();
+  if (fTotal == 0) fTotal = 51200;
+  fData  = new Bool_t[fTotal];
+  Reset();
 }
 
 //__________________________________________________________
@@ -61,26 +85,25 @@ AliFMDBoolMap&
 AliFMDBoolMap::operator=(const AliFMDBoolMap& other)
 {
   // Assignment operator 
+  if (&other == this) return *this; 
   fMaxDetectors = other.fMaxDetectors;
   fMaxRings     = other.fMaxRings;
   fMaxSectors   = other.fMaxSectors;
   fMaxStrips    = other.fMaxStrips;
   if (fData) delete [] fData;
-  fData = new Bool_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;
+  if (fTotal == 0) fTotal = 51200;
+  fData  = new Bool_t[fTotal];
+  for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
   return *this;
 }
 
 //__________________________________________________________
 void
-AliFMDBoolMap::Clear(const Bool_t& val)
+AliFMDBoolMap::Reset(const Bool_t& val)
 {
   // Reset map to val
-  for (size_t i = 0; i < fMaxDetectors * fMaxRings 
-        * fMaxSectors * fMaxStrips; i++)
-    fData[i] = val;
+  for (Int_t i = 0; i < fTotal; i++) fData[i] = val;
 }
 
 //__________________________________________________________