Additional protection in case we have more clusters than the size of the array
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Jul 2009 11:29:13 +0000 (11:29 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Jul 2009 11:29:13 +0000 (11:29 +0000)
PMD/AliPMDcluster.cxx

index bb3dcb3..b8af581 100644 (file)
@@ -22,6 +22,7 @@
 #include "Riostream.h"
 #include "Rtypes.h"
 #include "AliPMDcluster.h"
+#include "AliLog.h"
 #include <stdio.h>
 
 ClassImp(AliPMDcluster)
@@ -58,6 +59,11 @@ AliPMDcluster::AliPMDcluster(Int_t idet, Int_t ismn, Float_t *clusdata,
     {
       fClusData[i] = clusdata[i];
     }
+  if(fClusData[3]>19){
+    AliError(Form("Too many clusters %d >= 19",fClusData[3]));
+    fClusData[3] = 19;
+  }
+            
   for (Int_t i = 0; i < 19; i++)
     {
       fClusCellDataX[i] = celldataX[i];
@@ -87,6 +93,10 @@ AliPMDcluster::AliPMDcluster(const AliPMDcluster &pmdcluster):
     {
       this->fClusData[i] = pmdcluster.fClusData[i];
     }
+  if(fClusData[3]>19){
+    AliError(Form("Too many clusters %d >= 19",fClusData[3]));
+    fClusData[3] = 19;
+  }
   for(Int_t i=0; i<19; i++)
     {
       this->fClusCellDataX[i] = pmdcluster.fClusCellDataX[i];
@@ -109,6 +119,10 @@ AliPMDcluster & AliPMDcluster::operator=(const AliPMDcluster &pmdcluster)
        {
          this->fClusData[i] = pmdcluster.fClusData[i];
        }
+      if(fClusData[3]>19){
+       AliError(Form("Too many clusters %d >= 19",fClusData[3]));
+       fClusData[3] = 19;
+      }
       for(Int_t i=0; i<19; i++)
        {
          this->fClusCellDataX[i] = pmdcluster.fClusCellDataX[i];