]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSEmcBadChannelsMap.cxx
bugfix
[u/mrichter/AliRoot.git] / PHOS / AliPHOSEmcBadChannelsMap.cxx
index bf3a60860ad9ac7f95f1ce45cda1af69caa3a9b4..3fb983a076c4f3f2ee96e32c6c9d13b32e1c83f8 100644 (file)
@@ -22,6 +22,7 @@
 ///////////////////////////////////////////////////////////////////////////////
  
 #include "AliPHOSEmcBadChannelsMap.h"
+#include "AliPHOSGeometry.h"
  
 ClassImp(AliPHOSEmcBadChannelsMap)
  
@@ -77,3 +78,52 @@ AliPHOSEmcBadChannelsMap& AliPHOSEmcBadChannelsMap::operator= (const AliPHOSEmcB
 
   return *this;
 }
+
+//_________________________________________________________________
+
+void AliPHOSEmcBadChannelsMap::SetBadChannel(Int_t module, Int_t col, Int_t row)
+{
+  // Declare a channel (module,col,row) as a bad, if it was not set before
+
+  if (!fBadChannelEmc[module-1][col-1][row-1]) {
+    fBadChannelEmc[module-1][col-1][row-1] = kTRUE;
+    ++fBads; 
+  }
+}
+//_________________________________________________________________
+
+void AliPHOSEmcBadChannelsMap::BadChannelIds(Int_t *badIds)
+{
+  //Fill array badIds by the Ids of bad channels.
+  //Array badIds of length GetNumOfBadChannels() should be prepared in advance. 
+
+  if(!badIds) return;
+  if(!fBads>0) return;
+
+  AliPHOSGeometry* geom = AliPHOSGeometry::GetInstance();
+
+  if(!geom)
+    geom = AliPHOSGeometry::GetInstance("IHEP");
+
+  Int_t absId;
+  Int_t relId[4];
+
+  Int_t iBad = 0;
+  relId[1] =  0; // EMC crystal
+
+  for(Int_t mod=1; mod<6; mod++) { 
+    for(Int_t col=1; col<57; col++) { 
+      for(Int_t row=1; row<65; row++) {
+       if(IsBadChannel(mod,col,row)) {
+         relId[0] = mod;
+         relId[3] = col;
+         relId[2] = row;
+         geom->RelToAbsNumbering(relId,absId);
+         badIds[iBad]=absId;
+         iBad++;
+       }
+      }
+    }
+  }
+
+}