]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDEdepMap.cxx
New detector numbering scheme (common for DAQ/HLT/Offline). All the subdetectors...
[u/mrichter/AliRoot.git] / FMD / AliFMDEdepMap.cxx
index 8f817b13724c50074c7b7687ddc2a4e391df1b8f..aa8cd817bd8c376851a80bb9983331d99d4fbe96 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-
 /* $Id$ */
-
+/** @file    AliFMDEdepMap.cxx
+    @author  Christian Holm Christensen <cholm@nbi.dk>
+    @date    Mon Mar 27 12:39:50 2006
+    @brief   Per strip map of energy deposited and number of hits 
+    @ingroup FMD_sim
+*/
 //____________________________________________________________________
 //                                                                          
+// Contains a pair of energy deposited fEdep and number of hits  
+// fN, fEdep is the summed energy deposition, and fN is the
+// number of hits.  The map contains one such object or each strip.
+// It is used to cache the data in the digitization classes
+// AliFMDBaseDigitizer and so on. 
 //
 //
 #include "AliFMDEdepMap.h"             // ALIFMDEDEPMAP_H
 
 //____________________________________________________________________
-ClassImp(AliFMDEdepMap);
+ClassImp(AliFMDEdepMap)
+#if 0
+  ; // This is here to keep Emacs for indenting the next line
+#endif
 
 //____________________________________________________________________
 AliFMDEdepMap::AliFMDEdepMap(const AliFMDEdepMap& other)
@@ -30,10 +42,10 @@ AliFMDEdepMap::AliFMDEdepMap(const AliFMDEdepMap& other)
              other.fMaxStrips), 
     fData(0)
 {
-  fData = new AliFMDEdepHitPair[fMaxDetectors * fMaxRings * 
-                               fMaxSectors * fMaxStrips];
-  for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
-       i++) fData[i] = other.fData[i];
+  // Copy constructor 
+  fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
+  fData  = new AliFMDEdepHitPair[fTotal];
+  for (size_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
 }
 
   
@@ -53,32 +65,46 @@ AliFMDEdepMap::AliFMDEdepMap(size_t maxDet,
   //     maxRinf      Maximum # of rings
   //     maxSec       Maximum # of sectors
   //     maxStr       Maximum # of strips
-  fData = new AliFMDEdepHitPair[fMaxDetectors * fMaxRings * 
-                               fMaxSectors * fMaxStrips];
+  fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
+  fData  = new AliFMDEdepHitPair[fTotal];
 }
 
 //____________________________________________________________________
 AliFMDEdepMap&
 AliFMDEdepMap::operator=(const AliFMDEdepMap& other) 
 {
+  // Assignment operator
   fMaxDetectors = other.fMaxDetectors;
   fMaxRings     = other.fMaxRings;
   fMaxSectors   = other.fMaxSectors;
   fMaxStrips    = other.fMaxStrips;
   if (fData) delete [] fData;
-  fData = new AliFMDEdepHitPair[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 AliFMDEdepHitPair[fTotal];
+  for (size_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
   return *this;
 }
 
 //____________________________________________________________________
 void
-AliFMDEdepMap::Clear(const AliFMDEdepHitPair& val) 
+AliFMDEdepMap::Reset() 
+{
+  // Reset to zero
+  for (size_t i = 0; i < fTotal; i++) { 
+    fData[i].fEdep = 0; 
+    fData[i].fN = 0; 
+  };
+}
+
+//____________________________________________________________________
+void
+AliFMDEdepMap::Reset(const AliFMDEdepHitPair& val) 
 {
-  for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
-       i++) fData[i] = val;
+  // Reset to val
+  for (size_t i = 0; i < fTotal; i++) { 
+    fData[i].fEdep = val.fEdep; 
+    fData[i].fN = val.fN; 
+  };
 }
 
 //____________________________________________________________________