]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSOnlineCalibrationSPDhandler.cxx
Last warnings... fed up to wait
[u/mrichter/AliRoot.git] / ITS / AliITSOnlineCalibrationSPDhandler.cxx
index 9e4642d162e0ee146d5fc05dc0371c43d8b2ce77..020de9f641f1f6d9ca1d338827674a3fc46c64d5 100644 (file)
@@ -2,7 +2,11 @@
 // Author: Henrik Tydesjo                                           //
 // For easier handling of dead and noisy pixels they are kept in    //
 // container maps (AliITSIntMap).                                   //
-// The TArrayI objects that are put in the AliITSCalibrationSPD     //
+// Handling of inactive equipments,HSs,chips have been added.       //
+// A pixel that is either dead or inactive is called SILENT here.   //
+// The lists of single dead and noisy pixels are separated from the //
+// information about which eq/hs/chip are inactive.                 //
+// The TArrayS objects that are put in the AliITSCalibrationSPD     //
 // objects can be obtained from the methods GetDeadArray and        //
 // GetNoisyArray.                                                   //
 //////////////////////////////////////////////////////////////////////   
@@ -12,6 +16,7 @@
 #include "AliITSIntMap.h"
 #include <TObjArray.h>
 #include <TArrayI.h>
+#include <TArrayS.h>
 #include <TFile.h>
 #include <TError.h>
 #include <fstream>
@@ -22,6 +27,8 @@
 #include "AliCDBEntry.h"
 #endif
 
+/* $Id$ */
+
 //____________________________________________________________________________________________
 AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler():
   fFileLocation(".")
@@ -31,9 +38,12 @@ AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler():
     fNrDead[gloChip]=0;
     fNrNoisy[gloChip]=0;
     fDeadPixelMap[gloChip] = new AliITSIntMap();
-    fNoisyPixelMap[gloChip] = new AliITSIntMap();
+    fNoisyPixelMap[gloChip] = new AliITSIntMap();    
   }
+  ActivateALL();
+  UnSetDeadALL();
 }
+//____________________________________________________________________________________________
 AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler(const AliITSOnlineCalibrationSPDhandler& handle): 
   fFileLocation(".")
 {
@@ -44,8 +54,18 @@ AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler(const AliIT
     fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
     fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
   }
+  for (UInt_t eq=0; eq<20; eq++) {
+    fActiveEq[eq] = handle.fActiveEq[eq];
+    for (UInt_t hs=0; hs<6; hs++) {
+      fActiveHS[eq][hs] = handle.fActiveHS[eq][hs];
+      for (UInt_t chip=0; chip<10; chip++) {
+       fActiveChip[eq][hs][chip] = handle.fActiveChip[eq][hs][chip];
+      }
+    }
+  }
   fFileLocation = handle.fFileLocation;
 }
+//____________________________________________________________________________________________
 AliITSOnlineCalibrationSPDhandler::~AliITSOnlineCalibrationSPDhandler() {
   //  ClearMaps();
   for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
@@ -53,6 +73,7 @@ AliITSOnlineCalibrationSPDhandler::~AliITSOnlineCalibrationSPDhandler() {
     delete fNoisyPixelMap[gloChip];
   }
 }
+//____________________________________________________________________________________________
 AliITSOnlineCalibrationSPDhandler& AliITSOnlineCalibrationSPDhandler::operator=(const AliITSOnlineCalibrationSPDhandler& handle) {
   // assignment operator
   if (this!=&handle) {
@@ -63,6 +84,15 @@ AliITSOnlineCalibrationSPDhandler& AliITSOnlineCalibrationSPDhandler::operator=(
       fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
       fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
     }
+    for (UInt_t eq=0; eq<20; eq++) {
+      fActiveEq[eq] = handle.fActiveEq[eq];
+      for (UInt_t hs=0; hs<6; hs++) {
+       fActiveHS[eq][hs] = handle.fActiveHS[eq][hs];
+       for (UInt_t chip=0; chip<10; chip++) {
+         fActiveChip[eq][hs][chip] = handle.fActiveChip[eq][hs][chip];
+       }
+      }
+    }
     fFileLocation = handle.fFileLocation;
   }
   return *this;
@@ -72,14 +102,18 @@ void AliITSOnlineCalibrationSPDhandler::ClearMaps() {
   // clear the lists of dead and noisy
   ResetDead();
   ResetNoisy();
+  ActivateALL();
 }
+//____________________________________________________________________________________________
 void AliITSOnlineCalibrationSPDhandler::ResetDead() {
-  // reset the dead pixel map
+  // reset the dead pixel map and inactive eq,hs,chip
+  UnSetDeadALL();
   for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
     fNrDead[gloChip]=0;
     fDeadPixelMap[gloChip]->Clear();
   }
 }
+//____________________________________________________________________________________________
 void AliITSOnlineCalibrationSPDhandler::ResetNoisy() {
   // clear the list of noisy pixels
   for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
@@ -87,8 +121,10 @@ void AliITSOnlineCalibrationSPDhandler::ResetNoisy() {
     fNoisyPixelMap[gloChip]->Clear();
   }
 }
+//____________________________________________________________________________________________
 void AliITSOnlineCalibrationSPDhandler::ResetDeadForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
   // clear the dead pixels for this chip
+  SetDeadChip(eq,hs,chip,kFALSE);
   UInt_t gloChip = GetGloChip(eq,hs,chip);
   for (UInt_t col=0; col<32; col++) {
     for (UInt_t row=0; row<256; row++) {
@@ -99,6 +135,7 @@ void AliITSOnlineCalibrationSPDhandler::ResetDeadForChip(UInt_t eq, UInt_t hs, U
     }
   }
 }
+//____________________________________________________________________________________________
 void AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
   // clear the noisy pixels for this chip
   UInt_t gloChip = GetGloChip(eq,hs,chip);
@@ -115,6 +152,7 @@ void AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip(UInt_t eq, UInt_t hs,
     }
   }
 }
+//____________________________________________________________________________________________
 void AliITSOnlineCalibrationSPDhandler::ResetDeadForEq(UInt_t eq) {
   // clear the dead pixels for this eq
   if (eq>=20) {
@@ -127,6 +165,7 @@ void AliITSOnlineCalibrationSPDhandler::ResetDeadForEq(UInt_t eq) {
     }
   }
 }
+//____________________________________________________________________________________________
 void AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq(UInt_t eq) {
   // clear the noisy pixels for this eq
   if (eq>=20) {
@@ -139,45 +178,56 @@ void AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq(UInt_t eq) {
     }
   }
 }
+
+
 //____________________________________________________________________________________________
 Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromFiles() {
-  // read dead and noisy files from file location. returns true if at least one file found
+  // read files from file location (active,dead,noisy info). returns true if at least one file found
   Bool_t b1 = ReadNoisyFromFiles();
-  Bool_t b2 = ReadDeadFromFiles();
-  return (b1 && b2);
+  Bool_t b2 = ReadSilentFromFiles();
+  return (b1 || b2);
 }
-
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFiles() {
-  // read dead files from file location. returns true if at least one file found
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFiles() {
+  // read dead,active files from file location. returns true if at least one file found
   Bool_t returnval=kFALSE;
   for (UInt_t eq=0; eq<20; eq++) {
-    if (ReadDeadFromFile(eq)) {
+    if (ReadSilentFromFile(eq)) {
       returnval=kTRUE;
     }
   }
   return returnval;
 }
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFiles() {
-  // read noisy files from file location. returns true if at least one file found
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFiles() {
+  // read dead,active files from file location. returns true if at least one file found
   Bool_t returnval=kFALSE;
   for (UInt_t eq=0; eq<20; eq++) {
-    if (ReadNoisyFromFile(eq)) {
+    if (ReadDeadFromFile(eq)) {
       returnval=kTRUE;
     }
   }
   return returnval;
 }
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFile(UInt_t eq) {
+  // read dead file for eq from file location. 
+  TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
+  return ReadSilentFromFileName(fileName.Data());
+}
+//____________________________________________________________________________________________
 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFile(UInt_t eq) {
-  // read dead file for module from file location. 
+  // read dead file for eq from file location. 
   TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
   return ReadDeadFromFileName(fileName.Data());
 }
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFile(UInt_t eq) {
-  // read noisy file for module from file location. 
-  TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
-  return ReadNoisyFromFileName(fileName.Data());
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFileName(const char *fileName) {
+  // read dead from file fileName (including inactive)
+  return ReadDeadFromFileName(fileName, kTRUE);
 }
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFileName(const char *fileName) {
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFileName(const char *fileName, Bool_t inactive) {
   // read dead from file fileName
   AliITSOnlineCalibrationSPD* calib;
   FILE* fp0 = fopen(fileName, "r");
@@ -199,11 +249,53 @@ Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFileName(const char *fileN
          UInt_t row = GetRowFromKey(key);
          SetDeadPixel(eq,hs,chip,col,row);
        }
+       UInt_t eq1 = calib->GetEqNr();
+       if (calib->IsDeadEq()) SetDeadEq(eq1);
+       else                   SetDeadEq(eq1,kFALSE);
+       for (UInt_t hs=0; hs<6; hs++) {
+         if (calib->IsDeadHS(hs)) SetDeadHS(eq1,hs);
+         else                     SetDeadHS(eq1,hs,kFALSE);
+         for (UInt_t chip=0; chip<10; chip++) {
+           if (calib->IsDeadChip(hs,chip)) SetDeadChip(eq1,hs,chip);
+           else                            SetDeadChip(eq1,hs,chip,kFALSE);
+         }
+       }
+       if (inactive) {
+         UInt_t eq = calib->GetEqNr();
+         if (calib->IsActiveEq()) ActivateEq(eq);
+         else                     ActivateEq(eq,kFALSE);
+         for (UInt_t hs=0; hs<6; hs++) {
+           if (calib->IsActiveHS(hs)) ActivateHS(eq,hs);
+           else                       ActivateHS(eq,hs,kFALSE);
+           for (UInt_t chip=0; chip<10; chip++) {
+             if (calib->IsActiveChip(hs,chip)) ActivateChip(eq,hs,chip);
+             else                              ActivateChip(eq,hs,chip,kFALSE);
+           }
+         }
+       }
       }
     }
   }
   return kTRUE;
 }
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFiles() {
+  // read noisy files from file location. returns true if at least one file found
+  Bool_t returnval=kFALSE;
+  for (UInt_t eq=0; eq<20; eq++) {
+    if (ReadNoisyFromFile(eq)) {
+      returnval=kTRUE;
+    }
+  }
+  return returnval;
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFile(UInt_t eq) {
+  // read noisy file for eq from file location. 
+  TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
+  return ReadNoisyFromFileName(fileName.Data());
+}
+//____________________________________________________________________________________________
 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFileName(const char *fileName) {
   // read noisy from file fileName
   AliITSOnlineCalibrationSPD* calib;
@@ -231,6 +323,7 @@ Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFileName(const char *file
   }
   return kTRUE;
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromText(const char *fileName, UInt_t module) {
   // read dead from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
   // insert only those pixels that belong to module (or all if module=240). 
@@ -259,6 +352,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromText(const char *fileName,
   }
   return newNrDead;
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText(const char *fileName, UInt_t module) {
   // read noisy from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
   // insert only those pixels that belong to module (or all if module=240). 
@@ -289,28 +383,51 @@ UInt_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText(const char *fileName
 }
 //____________________________________________________________________________________________
 void AliITSOnlineCalibrationSPDhandler::WriteToFilesAlways() {
-  // write the lists of dead and noisy to files
+  // write the lists of active,dead,noisy to files
   for (UInt_t eq=0; eq<20; eq++) {
-    WriteDeadToFile(eq);
+    WriteSilentToFile(eq);
     WriteNoisyToFile(eq);
   }
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::WriteToFiles() {
   // write the lists of dead and noisy to files (only if there are >0 dead or noisy pixels) , returns nr of files produced
-  return (WriteNoisyToFiles() + WriteDeadToFiles());
+  return (WriteNoisyToFiles() + WriteSilentToFiles());
+}
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::WriteSilentToFilesAlways() {
+  // write the lists of silent to files
+  for (UInt_t eq=0; eq<20; eq++) {
+      WriteSilentToFile(eq);
+  }
 }
+//____________________________________________________________________________________________
 void AliITSOnlineCalibrationSPDhandler::WriteDeadToFilesAlways() {
   // write the lists of dead to files
   for (UInt_t eq=0; eq<20; eq++) {
       WriteDeadToFile(eq);
   }
 }
+//____________________________________________________________________________________________
 void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFilesAlways() {
   // write the lists of noisy to files
   for (UInt_t eq=0; eq<20; eq++) {
     WriteNoisyToFile(eq);
   }
 }
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::WriteSilentToFiles() {
+  // write the list of silent to file (only if there are >0 silent pixels) , returns nr of files produced
+  UInt_t nrFiles=0;
+  for (UInt_t eq=0; eq<20; eq++) {
+    if (GetNrSilentEq(eq) > 0) {
+      WriteSilentToFile(eq);
+      nrFiles++;
+    }
+  }
+  return nrFiles;
+}
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::WriteDeadToFiles() {
   // write the list of dead to file (only if there are >0 dead pixels) , returns nr of files produced
   UInt_t nrFiles=0;
@@ -322,6 +439,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::WriteDeadToFiles() {
   }
   return nrFiles;
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToFiles() {
   // write the list of noisy to file (only if there are >0 noisy pixels) , returns nr of files produced
   UInt_t nrFiles=0;
@@ -333,20 +451,48 @@ UInt_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToFiles() {
   }
   return nrFiles;
 }
-void AliITSOnlineCalibrationSPDhandler::WriteDeadToFile(UInt_t eq) {
-  // write the lists of dead and noisy for module to file
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::WriteSilentToFile(UInt_t eq) {
+  WriteDeadToFile(eq,kTRUE);
+}
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::WriteDeadToFile(UInt_t eq, Bool_t inactive) {
+  // write the lists of dead (and inactive if input boolean is true) for eq to file
   AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
   calib->SetEqNr(eq);
   calib->SetBadList(GetDeadArrayOnline(eq));
   calib->SetNrBad(GetNrDeadEq(eq));
+  if (IsDeadEq(eq)) calib->SetDeadEq();
+  else              calib->SetDeadEq(kFALSE);
+  for (UInt_t hs=0; hs<6; hs++) {
+    if (IsDeadHS(eq,hs)) calib->SetDeadHS(hs);
+    else                 calib->SetDeadHS(hs,kFALSE);
+    for (UInt_t chip=0; chip<10; chip++) {
+      if (IsDeadChip(eq,hs,chip)) calib->SetDeadChip(hs,chip);
+      else                        calib->SetDeadChip(hs,chip,kFALSE);
+    }
+  }
+  if (inactive) {
+    if (IsActiveEq(eq)) calib->ActivateEq();
+    else                calib->ActivateEq(kFALSE);
+    for (UInt_t hs=0; hs<6; hs++) {
+      if (IsActiveHS(eq,hs)) calib->ActivateHS(hs);
+      else                   calib->ActivateHS(hs,kFALSE);
+      for (UInt_t chip=0; chip<10; chip++) {
+       if (IsActiveChip(eq,hs,chip)) calib->ActivateChip(hs,chip);
+       else                          calib->ActivateChip(hs,chip,kFALSE);
+      }
+    }
+  }
   TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
   TFile file(fileName.Data(), "RECREATE");
   file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
   file.Close();
   delete calib;
 }
+//____________________________________________________________________________________________
 void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFile(UInt_t eq) {
-  // write the lists of noisy and noisy for module to file
+  // write the lists of noisy for eq to file
   AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
   calib->SetEqNr(eq);
   calib->SetBadList(GetNoisyArrayOnline(eq));
@@ -359,11 +505,18 @@ void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFile(UInt_t eq) {
 }
 //____________________________________________________________________________________________
 #ifndef SPD_DA_OFF
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB(UInt_t module, Int_t runNr, Bool_t treeSerial) {
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB(UInt_t module, Int_t runNr, Char_t *storage, Bool_t treeSerial) {
   // reads dead pixels from DB for given module and runNr
   AliCDBManager* man = AliCDBManager::Instance();
-  if(!man->IsDefaultStorageSet()) {
-    man->SetDefaultStorage("local://$ALICE_ROOT");
+  TString storageSTR = Form("%s",storage);
+  if (storageSTR.CompareTo("default")==0) {
+    if(!man->IsDefaultStorageSet()) {
+      man->SetDefaultStorage("local://$ALICE_ROOT");
+    }
+  }
+  else {
+    storageSTR = Form("local://%s",storage);
+    man->SetDefaultStorage(storageSTR.Data());
   }
   AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
   TObjArray* spdEntry;
@@ -377,7 +530,8 @@ Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB(UInt_t module, In
   }
   AliITSCalibrationSPD* calibSPD;
   calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
-  UInt_t nrDead = calibSPD->GetNrBad();
+
+  UInt_t nrDead = calibSPD->GetNrBadSingle();
   if (nrDead>0) {
     if (!treeSerial) RecursiveInsertDead(calibSPD,module,0,nrDead-1);
     else {
@@ -388,15 +542,34 @@ Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB(UInt_t module, In
       }
     }
   }
+  for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
+    UInt_t eq,hs,chip,col,row;
+    AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
+    if (calibSPD->IsChipBad(chipIndex)) {
+      SetDeadChip(eq,hs,chip);
+    }
+    else {
+      SetDeadChip(eq,hs,chip,kFALSE);
+    }
+  }
+
   spdEntry->SetOwner(kTRUE);
   spdEntry->Clear();
   return kTRUE;
 }
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB(UInt_t module, Int_t runNr, Bool_t treeSerial) {
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB(UInt_t module, Int_t runNr, Char_t *storage, Bool_t treeSerial) {
   // reads noisy pixels from DB for given module and runNr
   AliCDBManager* man = AliCDBManager::Instance();
-  if(!man->IsDefaultStorageSet()) {
-    man->SetDefaultStorage("local://$ALICE_ROOT");
+  TString storageSTR = Form("%s",storage);
+  if (storageSTR.CompareTo("default")==0) {
+    if(!man->IsDefaultStorageSet()) {
+      man->SetDefaultStorage("local://$ALICE_ROOT");
+    }
+  }
+  else {
+    storageSTR = Form("local://%s",storage);
+    man->SetDefaultStorage(storageSTR.Data());
   }
   AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
   TObjArray* spdEntry;
@@ -410,7 +583,7 @@ Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB(UInt_t module, I
   }
   AliITSCalibrationSPD* calibSPD;
   calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
-  UInt_t nrNoisy = calibSPD->GetNrBad();
+  UInt_t nrNoisy = calibSPD->GetNrBadSingle();
   if (nrNoisy>0) {
     if (!treeSerial) RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
     else {
@@ -425,17 +598,26 @@ Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB(UInt_t module, I
   spdEntry->Clear();
   return kTRUE;
 }
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromDB(Int_t runNr, Bool_t treeSerial) {
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromDB(Int_t runNr, Char_t *storage, Bool_t treeSerial) {
   // reads dead and noisy pixels from DB for given runNr
   // note that you may want to clear the lists (if they are not empty) before reading
-  return (ReadNoisyFromDB(runNr,treeSerial) && ReadDeadFromDB(runNr,treeSerial));
+  return (ReadNoisyFromDB(runNr,storage,treeSerial) && ReadDeadFromDB(runNr,storage,treeSerial));
 }
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB(Int_t runNr, Bool_t treeSerial) {
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB(Int_t runNr, Char_t *storage, Bool_t treeSerial) {
   // reads dead pixels from DB for given runNr
   // note that you may want to clear the list (if it is not empty) before reading
   AliCDBManager* man = AliCDBManager::Instance();
-  if(!man->IsDefaultStorageSet()) {
-    man->SetDefaultStorage("local://$ALICE_ROOT");
+  TString storageSTR = Form("%s",storage);
+  if (storageSTR.CompareTo("default")==0) {
+    if(!man->IsDefaultStorageSet()) {
+      man->SetDefaultStorage("local://$ALICE_ROOT");
+    }
+  }
+  else {
+    storageSTR = Form("local://%s",storage);
+    man->SetDefaultStorage(storageSTR.Data());
   }
   AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
   TObjArray* spdEntry;
@@ -449,11 +631,13 @@ Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB(Int_t runNr, Bool_t tre
   }
   AliITSCalibrationSPD* calibSPD;
   for (UInt_t module=0; module<240; module++) {
-    //    printf("Reading module %d\n",module);
     calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
-    UInt_t nrDead = calibSPD->GetNrBad();
-    if (nrDead>0) {    
-      if (!treeSerial) RecursiveInsertDead(calibSPD,module,0,nrDead-1);
+    UInt_t nrDead = calibSPD->GetNrBadSingle();
+    if (nrDead>0) {
+      if (!treeSerial) {
+       RecursiveInsertDead(calibSPD,module,0,nrDead-1);
+      }
+
       else {
        for (UInt_t index=0; index<nrDead; index++) {
          UInt_t colM = calibSPD->GetBadColAt(index);
@@ -462,17 +646,35 @@ Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB(Int_t runNr, Bool_t tre
        }
       }
     }
+    for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
+      UInt_t eq,hs,chip,col,row;
+      AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
+      if (calibSPD->IsChipBad(chipIndex)) {
+       SetDeadChip(eq,hs,chip);
+      }
+      else {
+       SetDeadChip(eq,hs,chip,kFALSE);
+      }
+    }
   }
   spdEntry->SetOwner(kTRUE);
   spdEntry->Clear();
   return kTRUE;
 }
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB(Int_t runNr, Bool_t treeSerial) {
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB(Int_t runNr, Char_t *storage, Bool_t treeSerial) {
   // reads noisy pixels from DB for given runNr
   // note that you may want to clear the list (if it is not empty) before reading
   AliCDBManager* man = AliCDBManager::Instance();
-  if(!man->IsDefaultStorageSet()) {
-    man->SetDefaultStorage("local://$ALICE_ROOT");
+  TString storageSTR = Form("%s",storage);
+  if (storageSTR.CompareTo("default")==0) {
+    if(!man->IsDefaultStorageSet()) {
+      man->SetDefaultStorage("local://$ALICE_ROOT");
+    }
+  }
+  else {
+    storageSTR = Form("local://%s",storage);
+    man->SetDefaultStorage(storageSTR.Data());
   }
   AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
   TObjArray* spdEntry;
@@ -486,12 +688,10 @@ Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB(Int_t runNr, Bool_t tr
   }
   AliITSCalibrationSPD* calibSPD;
   for (UInt_t module=0; module<240; module++) {
-    //    printf("Reading module %d\n",module);
     calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
-    UInt_t nrNoisy = calibSPD->GetNrBad();
+    UInt_t nrNoisy = calibSPD->GetNrBadSingle();
     if (nrNoisy>0) {    
       if (!treeSerial) {
-       printf("*** mod %d nrnoisy=%d\n",module,nrNoisy);
        RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
       }
       else {
@@ -507,39 +707,115 @@ Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB(Int_t runNr, Bool_t tr
   spdEntry->Clear();
   return kTRUE;
 }
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDBasNoisy(Int_t runNr, Char_t *storage, Bool_t treeSerial) {
+  // reads dead pixels (put as noisy) from DB for given runNr
+  // note that you may want to clear the list (if it is not empty) before reading
+  AliCDBManager* man = AliCDBManager::Instance();
+  TString storageSTR = Form("%s",storage);
+  if (storageSTR.CompareTo("default")==0) {
+    if(!man->IsDefaultStorageSet()) {
+      man->SetDefaultStorage("local://$ALICE_ROOT");
+    }
+  }
+  else {
+    storageSTR = Form("local://%s",storage);
+    man->SetDefaultStorage(storageSTR.Data());
+  }
+  AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
+  TObjArray* spdEntry;
+  if(cdbEntry) {
+    spdEntry = (TObjArray*)cdbEntry->GetObject();
+    if(!spdEntry) return kFALSE;
+  }
+  else {
+    Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromDBasNoisy","Calibration for run %d not found in database.",runNr);
+    return kFALSE;
+  }
+  AliITSCalibrationSPD* calibSPD;
+  for (UInt_t module=0; module<240; module++) {
+    calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
+    UInt_t nrDead = calibSPD->GetNrBadSingle();
+    if (nrDead>0) {
+      if (!treeSerial) {
+       RecursiveInsertDead(calibSPD,module,0,nrDead-1);
+      }
+
+      else {
+       for (UInt_t index=0; index<nrDead; index++) {
+         UInt_t colM = calibSPD->GetBadColAt(index);
+         UInt_t rowM = calibSPD->GetBadRowAt(index);
+         SetDeadPixelM(module,colM,rowM);
+       }
+      }
+    }
+    for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
+      UInt_t eq,hs,chip,col,row;
+      AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
+      if (calibSPD->IsChipBad(chipIndex)) {
+       SetDeadChip(eq,hs,chip);
+      }
+      else {
+       SetDeadChip(eq,hs,chip,kFALSE);
+      }
+    }
+  }
+  spdEntry->SetOwner(kTRUE);
+  spdEntry->Clear();
+  return kTRUE;
+}
+//____________________________________________________________________________________________
 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromCalibObj(TObjArray* calObj) {
   // reads dead pixels from calib object
   for (UInt_t module=0; module<240; module++) {
-    for (Int_t i=0; i<((AliITSCalibrationSPD*)calObj->At(module))->GetNrBad(); i++) {
-      SetDeadPixelM(module,
-                   ((AliITSCalibrationSPD*)calObj->At(module))->GetBadColAt(i),
-                   ((AliITSCalibrationSPD*)calObj->At(module))->GetBadRowAt(i));
+    AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*)calObj->At(module);
+    for (Int_t i=0; i<calibSPD->GetNrBadSingle(); i++) {
+      SetDeadPixelM(module,calibSPD->GetBadColAt(i),calibSPD->GetBadRowAt(i));
+    }
+    for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
+      UInt_t eq,hs,chip,col,row;
+      AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
+      if (calibSPD->IsChipBad(chipIndex)) {
+       SetDeadChip(eq,hs,chip);
+      }
+      else {
+       SetDeadChip(eq,hs,chip,kFALSE);
+      }
     }
   }
   return kTRUE;
 }
+//____________________________________________________________________________________________
 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromCalibObj(TObjArray* calObj) {
   // reads noisy pixels from calib object
   for (UInt_t module=0; module<240; module++) {
-    for (Int_t i=0; i<((AliITSCalibrationSPD*)calObj->At(module))->GetNrBad(); i++) {
-      SetNoisyPixelM(module,
-                    ((AliITSCalibrationSPD*)calObj->At(module))->GetBadColAt(i),
-                    ((AliITSCalibrationSPD*)calObj->At(module))->GetBadRowAt(i));
+    AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*)calObj->At(module);
+    for (Int_t i=0; i<calibSPD->GetNrBadSingle(); i++) {
+      SetNoisyPixelM(module,calibSPD->GetBadColAt(i),calibSPD->GetBadRowAt(i));
     }
   }
   return kTRUE;
 }
-Bool_t AliITSOnlineCalibrationSPDhandler::WriteToDB(Int_t runNrStart, Int_t runNrEnd) {
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::WriteToDB(Int_t runNrStart, Int_t runNrEnd, Char_t *storage) {
   // writes dead and noisy pixels to DB for given runNrs
   // overwrites any previous entries
-  return (WriteNoisyToDB(runNrStart,runNrEnd) && WriteDeadToDB(runNrStart,runNrEnd));
+  return (WriteNoisyToDB(runNrStart,runNrEnd,storage) && WriteDeadToDB(runNrStart,runNrEnd,storage));
 }
-Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDB(Int_t runNrStart, Int_t runNrEnd) {
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDB(Int_t runNrStart, Int_t runNrEnd, Char_t *storage) {
   // writes dead pixels to DB for given runNrs
   // overwrites any previous entries
   AliCDBManager* man = AliCDBManager::Instance();
-  if(!man->IsDefaultStorageSet()) {
-    man->SetDefaultStorage("local://$ALICE_ROOT");
+  TString storageSTR = Form("%s",storage);
+  if (storageSTR.CompareTo("default")==0) {
+    if(!man->IsDefaultStorageSet()) {
+      man->SetDefaultStorage("local://$ALICE_ROOT");
+    }
+  }
+  else {
+    storageSTR = Form("local://%s",storage);
+    man->SetDefaultStorage(storageSTR.Data());
   }
   AliCDBMetaData* metaData = new AliCDBMetaData();
   metaData->SetResponsible("Henrik Tydesjo");
@@ -548,22 +824,70 @@ Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDB(Int_t runNrStart, Int_t
   TObjArray* spdEntry = new TObjArray(240);
   spdEntry->SetOwner(kTRUE);
   for(UInt_t module=0; module<240; module++){
-    AliITSCalibrationSPD* calObj = new AliITSCalibrationSPD();
-
-    // *** this is temporarily hard coded here ********************
-    // (later these parameters will be separated from the cal.obj.)
-    calObj->SetThresholds(3000, 250);
-    calObj->SetBiasVoltage(18.182);
-    calObj->SetNoiseParam(0,0);
-    calObj->SetCouplingParam(0.,0.055);
-    // *** remove later...
-    // ************************************************************
-
-    spdEntry->Add(calObj);
+    AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
+    spdEntry->Add(calibSPD);
   }
   for(UInt_t module=0; module<240; module++){
-    ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNrBad( GetNrDead(module) );
-    ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetBadList( GetDeadArray(module) );
+    AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
+    calibSPD->SetNrBadSingle( GetNrDeadSingle(module) );
+    calibSPD->SetBadList( GetDeadArray(module) );
+    for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
+      UInt_t eq,hs,chip,col,row;
+      AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
+      if (IsSilentChip(eq,hs,chip)) {
+       calibSPD->SetChipBad(chipIndex);
+      }
+      else {
+       calibSPD->UnSetChipBad(chipIndex);
+      }
+    }
+  }
+  AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
+  man->Put(cdbEntry);
+  delete spdEntry;
+  delete cdbEntry;
+  delete metaData;
+  return kTRUE;
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDBasNoisy(Int_t runNrStart, Int_t runNrEnd, Char_t *storage) {
+  // writes dead pixels to DB for given runNrs
+  // overwrites any previous entries
+  AliCDBManager* man = AliCDBManager::Instance();
+  TString storageSTR = Form("%s",storage);
+  if (storageSTR.CompareTo("default")==0) {
+    if(!man->IsDefaultStorageSet()) {
+      man->SetDefaultStorage("local://$ALICE_ROOT");
+    }
+  }
+  else {
+    storageSTR = Form("local://%s",storage);
+    man->SetDefaultStorage(storageSTR.Data());
+  }
+  AliCDBMetaData* metaData = new AliCDBMetaData();
+  metaData->SetResponsible("Henrik Tydesjo");
+  metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
+  AliCDBId idCalSPD("ITS/Calib/SPDNoisy",runNrStart,runNrEnd);
+  TObjArray* spdEntry = new TObjArray(240);
+  spdEntry->SetOwner(kTRUE);
+  for(UInt_t module=0; module<240; module++){
+    AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
+    spdEntry->Add(calibSPD);
+  }
+  for(UInt_t module=0; module<240; module++){
+    AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
+    calibSPD->SetNrBadSingle( GetNrDeadSingle(module) );
+    calibSPD->SetBadList( GetDeadArray(module) );
+    for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
+      UInt_t eq,hs,chip,col,row;
+      AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
+      if (IsSilentChip(eq,hs,chip)) {
+       calibSPD->SetChipBad(chipIndex);
+      }
+      else {
+       calibSPD->UnSetChipBad(chipIndex);
+      }
+    }
   }
   AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
   man->Put(cdbEntry);
@@ -572,12 +896,20 @@ Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDB(Int_t runNrStart, Int_t
   delete metaData;
   return kTRUE;
 }
-Bool_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToDB(Int_t runNrStart, Int_t runNrEnd) {
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToDB(Int_t runNrStart, Int_t runNrEnd, Char_t *storage) {
   // writes noisy pixels to DB for given runNrs
   // overwrites any previous entries
   AliCDBManager* man = AliCDBManager::Instance();
-  if(!man->IsDefaultStorageSet()) {
-    man->SetDefaultStorage("local://$ALICE_ROOT");
+  TString storageSTR = Form("%s",storage);
+  if (storageSTR.CompareTo("default")==0) {
+    if(!man->IsDefaultStorageSet()) {
+      man->SetDefaultStorage("local://$ALICE_ROOT");
+    }
+  }
+  else {
+    storageSTR = Form("local://%s",storage);
+    man->SetDefaultStorage(storageSTR.Data());
   }
   AliCDBMetaData* metaData = new AliCDBMetaData();
   metaData->SetResponsible("Henrik Tydesjo");
@@ -586,22 +918,13 @@ Bool_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToDB(Int_t runNrStart, Int_t
   TObjArray* spdEntry = new TObjArray(240);
   spdEntry->SetOwner(kTRUE);
   for(UInt_t module=0; module<240; module++){
-    AliITSCalibrationSPD* calObj = new AliITSCalibrationSPD();
-
-    // *** this is temporarily hard coded here ********************
-    // (later these parameters will be separated from the cal.obj.)
-    calObj->SetThresholds(3000, 250);
-    calObj->SetBiasVoltage(18.182);
-    calObj->SetNoiseParam(0,0);
-    calObj->SetCouplingParam(0.,0.055);
-    // *** remove later...
-    // ************************************************************
-
-    spdEntry->Add(calObj);
+    AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
+    spdEntry->Add(calibSPD);
   }
   for(UInt_t module=0; module<240; module++){
-    ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNrBad( GetNrNoisy(module) );
-    ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetBadList( GetNoisyArray(module) );
+    AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
+    calibSPD->SetNrBadSingle( GetNrNoisySingle(module) );
+    calibSPD->SetBadList( GetNoisyArray(module) );
   }
   AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
   man->Put(cdbEntry);
@@ -619,9 +942,9 @@ void AliITSOnlineCalibrationSPDhandler::RecursiveInsertDead(AliITSCalibrationSPD
   RecursiveInsertDead(calibSPD,module,lowInd,thisInd-1);
   RecursiveInsertDead(calibSPD,module,thisInd+1,highInd);
 }
+//____________________________________________________________________________________________
 void AliITSOnlineCalibrationSPDhandler::RecursiveInsertNoisy(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
   // inserts noisy pixels recursively, used when reading from db
-  printf("Rec mod %d : %d,%d\n",module,lowInd,highInd);
   if (lowInd>highInd) return;
   Int_t thisInd = lowInd+(highInd-lowInd)/2;
   SetNoisyPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
@@ -639,7 +962,7 @@ void AliITSOnlineCalibrationSPDhandler::GenerateDCSConfigFile(const Char_t* file
   dcsfile << "RunNumber=" << "0" << "\n"; // dummy value
   dcsfile << "Type=" << "4" << "\n";
   dcsfile << "Router=" << "0" << "\n"; // dummy value
-  dcsfile << "ActualDetCoonfiguration=" << "0,-1,-1\n"; // dummy values
+  dcsfile << "ActualDetConfiguration=" << "0,-1,-1\n"; // dummy values
   dcsfile << "[NOISY]\n";
   for (UInt_t module=0; module<240; module++) {
     UInt_t headkey=20*10*6;
@@ -657,49 +980,110 @@ void AliITSOnlineCalibrationSPDhandler::GenerateDCSConfigFile(const Char_t* file
   dcsfile.close();
 }
 //____________________________________________________________________________________________
-TArrayI AliITSOnlineCalibrationSPDhandler::GetDeadArray(UInt_t module, Bool_t treeSerial) {
-  // get a TArrayI of the dead pixels (format for the AliITSCalibrationSPD object)
-  TArrayI returnArray;
+TArrayS AliITSOnlineCalibrationSPDhandler::GetSilentArray(UInt_t module, Bool_t treeSerial) {
+  // get a TArrayS of the silent=dead+inactive pixels (format for the AliITSCalibrationSPD object)
+  // NB! with new implementation of AliITSCalibrationSPD this is not needed anymore
+  TArrayS returnArray;
 
   UInt_t eq = GetEqIdFromOffline(module);
   UInt_t hs = GetHSFromOffline(module);
   UInt_t size=0;
-  for (UInt_t chip=0; chip<5; chip++) {
-    UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
-    size += fNrDead[gloChip];
+  if ( !( IsActiveEq(eq) && IsActiveHS(eq,hs) ) ) {
+    size = 8192*5;
+  }
+  else {
+    for (UInt_t ch=0; ch<5; ch++) {
+      UInt_t chip = GetChipFromOffline(module,ch*32);
+      if (!(IsActiveChip(eq,hs,chip))) {
+       size += 8192;
+      }
+      else {
+       UInt_t gloChip = GetGloChip(eq,hs,chip);
+       size += fNrDead[gloChip];
+      }
+    }
+  }
+  returnArray.Set(size*2);
+
+  UInt_t gloIndex=0;
+  if ( !( IsActiveEq(eq) && IsActiveHS(eq,hs) ) ) {
+    for (UInt_t colM=0; colM<160; colM++) {
+      for (UInt_t rowM=0; rowM<256; rowM++) {
+       returnArray.AddAt(colM,gloIndex*2);
+       returnArray.AddAt(rowM,gloIndex*2+1);
+       gloIndex++;
+      }
+    }
+  }
+  else {
+    for (UInt_t ch=0; ch<5; ch++) {
+      UInt_t chip = GetChipFromOffline(module,ch*32);
+      if (!(IsActiveChip(eq,hs,chip))) {
+       for (UInt_t colM=ch*32; colM<ch*32+32; colM++) {
+         for (UInt_t rowM=0; rowM<256; rowM++) {
+           returnArray.AddAt(colM,gloIndex*2);
+           returnArray.AddAt(rowM,gloIndex*2+1);
+           gloIndex++;
+         }
+       }
+      }
+      else {
+       UInt_t gloChip = GetGloChip(eq,hs,chip);
+       if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
+       else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
+       for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
+         Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
+         Int_t colM = GetColMFromKey(key);
+         Int_t rowM = GetRowMFromKey(key);
+         returnArray.AddAt(colM,gloIndex*2);
+         returnArray.AddAt(rowM,gloIndex*2+1);
+         gloIndex++;
+       }
+      }
+    }
   }
+  return returnArray;
+}
+//____________________________________________________________________________________________
+TArrayS AliITSOnlineCalibrationSPDhandler::GetDeadArray(UInt_t module, Bool_t treeSerial) {
+  // get a TArrayS of the single dead pixels (format for the AliITSCalibrationSPD object)
+  TArrayS returnArray;
+
+  UInt_t eq = GetEqIdFromOffline(module);
+  UInt_t hs = GetHSFromOffline(module);
+  UInt_t size=GetNrDeadSingle(module);
   returnArray.Set(size*2);
   UInt_t gloIndex=0;
-  for (UInt_t chip=0; chip<5; chip++) {
-    UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
+  for (UInt_t ch=0; ch<5; ch++) {
+    UInt_t chip = GetChipFromOffline(module,ch*32);
+    UInt_t gloChip = GetGloChip(eq,hs,chip);
     if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
     else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
-    for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
-      Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
-      Int_t colM = GetColMFromKey(key);
-      Int_t rowM = GetRowMFromKey(key);
-      returnArray.AddAt(colM,gloIndex*2);
-      returnArray.AddAt(rowM,gloIndex*2+1);
-      gloIndex++;
+    if (!IsSilentChip(eq,hs,chip)) {
+      for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
+       Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
+       Int_t colM = GetColMFromKey(key);
+       Int_t rowM = GetRowMFromKey(key);
+       returnArray.AddAt(colM,gloIndex*2);
+       returnArray.AddAt(rowM,gloIndex*2+1);
+       gloIndex++;
+      }
     }
   }
   return returnArray;
 }
-TArrayI AliITSOnlineCalibrationSPDhandler::GetNoisyArray(UInt_t module, Bool_t treeSerial) {
-  // get a TArrayI of the noisy pixels (format for the AliITSCalibrationSPD object)
-  TArrayI returnArray;
+//____________________________________________________________________________________________
+TArrayS AliITSOnlineCalibrationSPDhandler::GetNoisyArray(UInt_t module, Bool_t treeSerial) {
+  // get a TArrayS of the single noisy pixels (format for the AliITSCalibrationSPD object)
+  TArrayS returnArray;
 
   UInt_t eq = GetEqIdFromOffline(module);
   UInt_t hs = GetHSFromOffline(module);
-  UInt_t size=0;
-  for (UInt_t chip=0; chip<5; chip++) {
-    UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
-    size += fNrNoisy[gloChip];
-  }
+  UInt_t size=GetNrNoisySingle(module);
   returnArray.Set(size*2);
   UInt_t gloIndex=0;
-  for (UInt_t chip=0; chip<5; chip++) {
-    UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
+  for (UInt_t ch=0; ch<5; ch++) {
+    UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
     if (treeSerial) fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
     else fNoisyPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
     for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
@@ -713,8 +1097,9 @@ TArrayI AliITSOnlineCalibrationSPDhandler::GetNoisyArray(UInt_t module, Bool_t t
   }
   return returnArray;
 }
+//____________________________________________________________________________________________
 TArrayI AliITSOnlineCalibrationSPDhandler::GetDeadArrayOnline(UInt_t eq) {
-  // get a TArrayI of the dead pixels (format for the AliITSOnlineCalibrationSPD object)
+  // get a TArrayI of the single dead pixels (format for the AliITSOnlineCalibrationSPD object)
   TArrayI returnArray;
   // fix size of array
   UInt_t size=0;
@@ -740,8 +1125,9 @@ TArrayI AliITSOnlineCalibrationSPDhandler::GetDeadArrayOnline(UInt_t eq) {
   }
   return returnArray;
 }
+//____________________________________________________________________________________________
 TArrayI AliITSOnlineCalibrationSPDhandler::GetNoisyArrayOnline(UInt_t eq) {
-  // get a TArrayI of the noisy pixels (format for the AliITSOnlineCalibrationSPD object)
+  // get a TArrayI of the single noisy pixels (format for the AliITSOnlineCalibrationSPD object)
   TArrayI returnArray;
   // fix size of array
   UInt_t size=0;
@@ -774,11 +1160,75 @@ void AliITSOnlineCalibrationSPDhandler::PrintEqSummary() {
   printf("Eq summary:\n");
   printf("-----------\n");
   for (UInt_t eq=0; eq<20; eq++) {
-    printf("Eq %*d: %*d dead , %*d noisy\n",2,eq,5,GetNrDeadEq(eq),5,GetNrNoisyEq(eq));
+    printf("Eq %*d: %*d silent(dead+inactive) , %*d dead , %*d noisy\n",2,eq,6,GetNrSilentEq(eq),6,GetNrDeadEq(eq),6,GetNrNoisyEq(eq));
+  }
+}
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::PrintSilent() const {
+  // print the inactive and dead pixels to screen
+  printf("-----------------------------------------------------------\n");
+  printf("Inactive or dead Equipments: (eq  |  module1 .. module12)\n");
+  printf("-----------------------------------------------------------\n");
+  for (UInt_t eq=0; eq<20; eq++) {
+    if (IsSilentEq(eq)) {
+      printf("%*d  |  ",2,eq);
+      for (UInt_t hs=0; hs<6; hs++) {
+       for (UInt_t chip=0; chip<10; chip+=5) {
+         UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
+         if (hs>0 || chip==5) printf(",");
+         printf("%*d",3,module);
+       }
+      }
+      printf("\n");
+    }
+  }
+
+  printf("-----------------------------------------------------------\n");
+  printf("Inactive or dead Half-staves: (eq,hs  |  module1,module2)\n");
+  printf("-----------------------------------------------------------\n");
+  for (UInt_t eq=0; eq<20; eq++) {
+    if (!IsSilentEq(eq)) {
+      for (UInt_t hs=0; hs<6; hs++) {
+       if (IsSilentHS(eq,hs)) {
+         printf("%*d,%*d  |  ",2,eq,1,hs);
+         for (UInt_t chip=0; chip<10; chip+=5) {
+           UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
+           if (chip==5) printf(",");
+           printf("%*d",3,module);
+         }
+         printf("\n");
+       }
+      }
+    }
   }
+
+  printf("-----------------------------------------------------------\n");
+  printf("Inactive or dead Chips: (eq,hs,chip  |  module,colM1-colM2)\n");
+  printf("-----------------------------------------------------------\n");
+  for (UInt_t eq=0; eq<20; eq++) {
+    if (!IsSilentEq(eq)) {
+      for (UInt_t hs=0; hs<6; hs++) {
+       if (!IsSilentHS(eq,hs)) {
+         for (UInt_t chip=0; chip<10; chip++) {
+           if (IsSilentChip(eq,hs,chip)) {
+             printf("%*d,%*d,%*d  |  ",2,eq,1,hs,1,chip);
+             UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
+             UInt_t colM1 = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,0);
+             UInt_t colM2 = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,31);
+             printf("%*d,%*d-%*d\n",3,module,3,colM1,3,colM2);
+           }
+         }
+       }
+      }
+    }
+  }
+
+  PrintDead();
+
 }
+//____________________________________________________________________________________________
 void AliITSOnlineCalibrationSPDhandler::PrintDead() const {
-  // print the dead pixels to screen
+  // print the single dead pixels to screen (disregards inactive eq,hs,chip)
   printf("------------------------------------------------------\n");
   printf("Dead Pixels: (eq,hs,chip,col,row  |  module,colM,rowM)\n");
   printf("------------------------------------------------------\n");
@@ -799,6 +1249,7 @@ void AliITSOnlineCalibrationSPDhandler::PrintDead() const {
     }
   }
 }
+//____________________________________________________________________________________________
 void AliITSOnlineCalibrationSPDhandler::PrintNoisy() const {
   // print the dead pixels to screen
   printf("-------------------------------------------------------\n");
@@ -842,6 +1293,7 @@ Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixel(UInt_t eq, UInt_t hs, UIn
   }
   return kFALSE;
 }
+//____________________________________________________________________________________________
 Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
   // set a noisy pixel, returns false if pixel is already noisy
   UInt_t gloChip = GetGloChip(eq,hs,chip);
@@ -864,6 +1316,7 @@ Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixel(UInt_t eq, UInt_t hs, UI
   }
   return kFALSE;
 }
+//____________________________________________________________________________________________
 Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
   // set a dead pixel, returns false if pixel is already dead
   UInt_t eq = GetEqIdFromOffline(module);
@@ -873,6 +1326,7 @@ Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixelM(UInt_t module, UInt_t co
   UInt_t row = GetRowFromOffline(module,rowM);
   return SetDeadPixel(eq,hs,chip,col,row);
 }
+//____________________________________________________________________________________________
 Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
   // set a noisy pixel, returns false if pixel is already noisy
   UInt_t eq = GetEqIdFromOffline(module);
@@ -882,6 +1336,7 @@ Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixelM(UInt_t module, UInt_t c
   UInt_t row = GetRowFromOffline(module,rowM);
   return SetNoisyPixel(eq,hs,chip,col,row);
 }
+//____________________________________________________________________________________________
 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
   // unset a dead pixel, returns false if pixel is not dead
   UInt_t gloChip = GetGloChip(eq,hs,chip);
@@ -896,6 +1351,7 @@ Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel(UInt_t eq, UInt_t hs, U
   }
   return kFALSE;
 }
+//____________________________________________________________________________________________
 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
   // unset a noisy pixel, returns false if pixel is not noisy
   UInt_t gloChip = GetGloChip(eq,hs,chip);
@@ -910,6 +1366,7 @@ Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel(UInt_t eq, UInt_t hs,
   }
   return kFALSE;
 }
+//____________________________________________________________________________________________
 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
   // unset a dead pixel, returns false if pixel is not dead
   UInt_t eq = GetEqIdFromOffline(module);
@@ -919,6 +1376,7 @@ Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixelM(UInt_t module, UInt_t
   UInt_t row = GetRowFromOffline(module,rowM);
   return UnSetDeadPixel(eq,hs,chip,col,row);
 }
+//____________________________________________________________________________________________
 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
   // unset a noisy pixel, returns false if pixel is not noisy
   UInt_t eq = GetEqIdFromOffline(module);
@@ -928,87 +1386,65 @@ Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixelM(UInt_t module, UInt_t
   UInt_t row = GetRowFromOffline(module,rowM);
   return UnSetNoisyPixel(eq,hs,chip,col,row);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::SetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip) {
-  // set a full chip dead, returns nr of new dead pixels
-  UInt_t nrNew = 0;
-  for (UInt_t col=0; col<32; col++) {
-    for (UInt_t row=0; row<256; row++) {
-      if (SetDeadPixel(eq,hs,chip,col,row)) {
-       nrNew++;
-      }
-    }
-  }
-  return nrNew;
-}
-UInt_t AliITSOnlineCalibrationSPDhandler::SetNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip) {
-  // set a full chip noisy, returns nr of new noisy pixels
-  UInt_t nrNew = 0;
-  for (UInt_t col=0; col<32; col++) {
-    for (UInt_t row=0; row<256; row++) {
-      if (SetNoisyPixel(eq,hs,chip,col,row)) {
-       nrNew++;
-      }
-    }
-  }
-  return nrNew;
-}
-Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip) {
-  // unset a full dead chip, returns false if it was not all dead before
-  UInt_t nrUnset = 0;
-  for (UInt_t col=0; col<32; col++) {
-    for (UInt_t row=0; row<256; row++) {
-      if (UnSetDeadPixel(eq,hs,chip,col,row)) {
-       nrUnset++;
-      }
-    }
-  }
-  if (nrUnset+GetNrNoisyC(eq,hs,chip)<8192) return kFALSE;
-  else return kTRUE;
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBad(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
+  // is the pixel bad (silent or noisy)
+  return (IsPixelSilent(eq,hs,chip,col,row) || IsPixelNoisy(eq,hs,chip,col,row));
 }
-Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip) {
-  // unset a full noisy chip, returns false if it was not all noisy before
-  UInt_t nrUnset = 0;
-  for (UInt_t col=0; col<32; col++) {
-    for (UInt_t row=0; row<256; row++) {
-      if (UnSetNoisyPixel(eq,hs,chip,col,row)) {
-       nrUnset++;
-      }
-    }
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilent(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
+  // is the pixel silent (dead or inactive)?
+  UInt_t gloChip = GetGloChip(eq,hs,chip);
+  if (gloChip>=1200 || col>=32 || row>=256) {
+    Error("AliITSOnlineCalibrationSPDhandler::IsPixelSilent", "eq,hs,chip,col,row nrs (%d,%d,%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
+    return kFALSE;
   }
-  if (nrUnset<8192) return kFALSE;
-  else return kTRUE;
+  if (IsSilentChip(eq,hs,chip)) return kTRUE;
+  else return IsPixelDead(eq,hs,chip,col,row);
 }
 //____________________________________________________________________________________________
 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDead(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
   // is the pixel dead?
   UInt_t gloChip = GetGloChip(eq,hs,chip);
-  if (gloChip>=1200) {
-    Error("AliITSOnlineCalibrationSPDhandler::IsPixelDead", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
+  if (gloChip>=1200 || col>=32 || row>=256) {
+    Error("AliITSOnlineCalibrationSPDhandler::IsPixelDead", "eq,hs,chip,col,row nrs (%d,%d,%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
     return kFALSE;
   }
   UInt_t key = GetKey(eq,hs,chip,col,row);
-  if ( fDeadPixelMap[gloChip]->Find(key) != NULL ) {
-    return kTRUE;
-  }
+  if (IsDeadEq(eq) || IsDeadHS(eq,hs) || IsDeadChip(eq,hs,chip)) return kTRUE;
   else {
-    return kFALSE;
+    if ( fDeadPixelMap[gloChip]->Find(key) != NULL ) return kTRUE;
+    else return kFALSE;
   }
 }
+//____________________________________________________________________________________________
 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisy(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
   // is the pixel noisy?
   UInt_t gloChip = GetGloChip(eq,hs,chip);
-  if (gloChip>=1200) {
-    Error("AliITSOnlineCalibrationSPDhandler::IsPixelNoisy", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
+  if (gloChip>=1200 || col>=32 || row>=256) {
+    Error("AliITSOnlineCalibrationSPDhandler::IsPixelNoisy", "eq,hs,chip,col,row nrs (%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
     return kFALSE;
   }
   UInt_t key = GetKey(eq,hs,chip,col,row);
-  if ( fNoisyPixelMap[gloChip]->Find(key) != NULL ) {
-    return kTRUE;
-  }
-  else {
-    return kFALSE;
-  }
+  if ( fNoisyPixelMap[gloChip]->Find(key) != NULL ) return kTRUE;
+  else return kFALSE;
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBadM(UInt_t module, UInt_t colM, UInt_t rowM) const {
+  // is the pixel bad (silent or noisy)?
+  return (IsPixelSilentM(module,colM,rowM) || IsPixelNoisyM(module,colM,rowM));
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilentM(UInt_t module, UInt_t colM, UInt_t rowM) const {
+  // is the pixel silent (dead or inactive)?
+  UInt_t eq = GetEqIdFromOffline(module);
+  UInt_t hs = GetHSFromOffline(module);
+  UInt_t chip = GetChipFromOffline(module,colM);
+  UInt_t col = GetColFromOffline(module,colM);
+  UInt_t row = GetRowFromOffline(module,rowM);
+  return IsPixelSilent(eq,hs,chip,col,row);
 }
+//____________________________________________________________________________________________
 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadM(UInt_t module, UInt_t colM, UInt_t rowM) const {
   // is the pixel dead?
   UInt_t eq = GetEqIdFromOffline(module);
@@ -1018,6 +1454,7 @@ Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadM(UInt_t module, UInt_t col
   UInt_t row = GetRowFromOffline(module,rowM);
   return IsPixelDead(eq,hs,chip,col,row);
 }
+//____________________________________________________________________________________________
 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyM(UInt_t module, UInt_t colM, UInt_t rowM) const  {
   // is the pixel noisy?
   UInt_t eq = GetEqIdFromOffline(module);
@@ -1027,6 +1464,27 @@ Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyM(UInt_t module, UInt_t co
   UInt_t row = GetRowFromOffline(module,rowM);
   return IsPixelNoisy(eq,hs,chip,col,row);
 }
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBadKey(Int_t key) const {
+  // is this pixel silent (dead or inactive)?
+  UInt_t eq = GetEqIdFromKey(key);
+  UInt_t hs = GetHSFromKey(key);
+  UInt_t chip = GetChipFromKey(key);
+  UInt_t col = GetColFromKey(key);
+  UInt_t row = GetRowFromKey(key);
+  return IsPixelBad(eq,hs,chip,col,row);
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilentKey(Int_t key) const {
+  // is this pixel silent (dead or inactive)?
+  UInt_t eq = GetEqIdFromKey(key);
+  UInt_t hs = GetHSFromKey(key);
+  UInt_t chip = GetChipFromKey(key);
+  UInt_t col = GetColFromKey(key);
+  UInt_t row = GetRowFromKey(key);
+  return IsPixelSilent(eq,hs,chip,col,row);
+}
+//____________________________________________________________________________________________
 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadKey(Int_t key) const {
   // is this pixel dead?
   UInt_t eq = GetEqIdFromKey(key);
@@ -1036,6 +1494,7 @@ Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadKey(Int_t key) const {
   UInt_t row = GetRowFromKey(key);
   return IsPixelDead(eq,hs,chip,col,row);
 }
+//____________________________________________________________________________________________
 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyKey(Int_t key) const {
   // is this pixel noisy?
   UInt_t eq = GetEqIdFromKey(key);
@@ -1046,6 +1505,50 @@ Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyKey(Int_t key) const {
   return IsPixelNoisy(eq,hs,chip,col,row);
 }
 //____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBad() const {
+  // returns the total nr of bad pixels (silent or noisy)
+  UInt_t nrBad=0;
+  nrBad+=GetNrSilent();
+  UInt_t nrNoisy = GetNrNoisy();
+  for (UInt_t i=0; i<nrNoisy; i++) {
+    UInt_t eq   = GetNoisyEqIdAt(i);
+    UInt_t hs   = GetNoisyHSAt(i);
+    UInt_t chip = GetNoisyChipAt(i);
+    UInt_t col  = GetNoisyColAt(i);
+    UInt_t row  = GetNoisyRowAt(i);
+    if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
+  }
+  return nrBad;
+}
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilent() const {
+  // returns the total nr of silent pixels (dead or inactive)
+  UInt_t nrDead = 0;
+  for (UInt_t eq=0; eq<20; eq++) {
+    if (IsSilentEq(eq)) {
+      nrDead+=81920*6;
+      continue;
+    }
+    for (UInt_t hs=0; hs<6; hs++) {
+      if (IsSilentHS(eq,hs)) {
+       nrDead+=81920;
+       continue;
+      }
+      for (UInt_t chip=0; chip<10; chip++) {
+       if (IsSilentChip(eq,hs,chip)) {
+         nrDead+=8192;
+         continue;
+       }
+       else {
+         UInt_t gloChip = GetGloChip(eq,hs,chip);
+         nrDead+=fNrDead[gloChip];
+       }
+      }
+    }
+  }
+  return nrDead;
+}
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead() const {
   // returns the total nr of dead pixels
   UInt_t nrDead = 0;
@@ -1054,6 +1557,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead() const {
   }
   return nrDead;
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy() const {
   // returns the total nr of noisy pixels
   UInt_t nrNoisy = 0;
@@ -1062,70 +1566,80 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy() const {
   }
   return nrNoisy;
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t index) const {
   // get eq for the dead pixel at position index in list of dead
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexTotDead(index,gloChip,chipIndex);
   return GetDeadEqIdAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t index) const {
   // get eq for the noisy pixel at position index in list of noisy
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
   return GetNoisyEqIdAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t index) const {
   // get hs for the dead pixel at position index in list of dead
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexTotDead(index,gloChip,chipIndex);
   return GetDeadHSAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t index) const {
   // get hs for the noisy pixel at position index in list of noisy
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
   return GetNoisyHSAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t index) const {
   // get chip for the dead pixel at position index in list of dead
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexTotDead(index,gloChip,chipIndex);
   return GetDeadChipAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t index) const {
   // get chip for the noisy pixel at position index in list of noisy
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
   return GetNoisyChipAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t index) const {
   // get hs for the dead pixel at position index in list of dead
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexTotDead(index,gloChip,chipIndex);
   return GetDeadColAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t index) const {
   // get hs for the noisy pixel at position index in list of noisy
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
   return GetNoisyColAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t index) const {
   // get hs for the dead pixel at position index in list of dead
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexTotDead(index,gloChip,chipIndex);
   return GetDeadRowAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t index) const {
   // get hs for the noisy pixel at position index in list of noisy
   UInt_t gloChip;
   UInt_t chipIndex;
@@ -1133,6 +1647,70 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t index) {
   return GetNoisyRowAtC2(gloChip,chipIndex);
 }
 //____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBad(UInt_t module) const {
+  // returns the number of bad pixels for a certain module (silent or noisy)
+  UInt_t nrBad = 0;
+  nrBad+=GetNrSilent(module);
+  UInt_t nrNoisy = GetNrNoisy(module);
+  for (UInt_t i=0; i<nrNoisy; i++) {
+    UInt_t eq   = GetNoisyEqIdAt(module,i);
+    UInt_t hs   = GetNoisyHSAt(module,i);
+    UInt_t chip = GetNoisyChipAt(module,i);
+    UInt_t col  = GetNoisyColAt(module,i);
+    UInt_t row  = GetNoisyRowAt(module,i);
+    if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
+  }
+  return nrBad;
+}
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilent(UInt_t module) const {
+  // returns the number of silent pixels for a certain module (dead or inactive)
+  if (module>=240) {
+    Error("AliITSOnlineCalibrationSPDhandler::GetNrSilent", "module nr (%d) out of bounds.",module);
+    return 0;
+  }
+  UInt_t nrSilent = 0;
+  UInt_t eq = GetEqIdFromOffline(module);
+  if (IsSilentEq(eq)) return 160*256;
+  UInt_t hs = GetHSFromOffline(module);
+  if (IsSilentHS(eq,hs)) return 160*256;
+  for (UInt_t ch=0; ch<5; ch++) {
+    UInt_t chip = GetChipFromOffline(module,ch*32);
+    if (IsSilentChip(eq,hs,chip)) {
+      nrSilent+=8192;
+    }
+    else {
+      UInt_t gloChip = GetGloChip(eq,hs,chip);
+      nrSilent+=fNrDead[gloChip];
+    }
+  }
+  return nrSilent;
+}
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadSingle(UInt_t module) const {
+  // returns the number of single dead pixels (excluding the ones on silent chips) for a certain module
+  if (module>=240) {
+    Error("AliITSOnlineCalibrationSPDhandler::GetNrDeadSingle", "module nr (%d) out of bounds.",module);
+    return 0;
+  }
+  UInt_t nrDead = 0;
+  UInt_t eq = GetEqIdFromOffline(module);
+  UInt_t hs = GetHSFromOffline(module);
+  for (UInt_t ch=0; ch<5; ch++) {
+    UInt_t chip = GetChipFromOffline(module,ch*32);
+    if (!IsSilentChip(eq,hs,chip)) {
+      UInt_t gloChip = GetGloChip(eq,hs,chip);
+      nrDead+=fNrDead[gloChip];
+    }
+  }
+  return nrDead;
+}
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisySingle(UInt_t module) const {
+  // returns the number of noisy pixels for a certain module
+  return GetNrNoisy(module);
+}
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead(UInt_t module) const {
   // returns the number of dead pixels for a certain module
   if (module>=240) {
@@ -1142,13 +1720,13 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead(UInt_t module) const {
   UInt_t nrDead = 0;
   UInt_t eq = GetEqIdFromOffline(module);
   UInt_t hs = GetHSFromOffline(module);
-  for (UInt_t chip=0; chip<5; chip++) {
-    UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
+  for (UInt_t ch=0; ch<5; ch++) {
+    UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
     nrDead+=fNrDead[gloChip];
-
   }
   return nrDead;
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy(UInt_t module) const {
   // returns the number of noisy pixels for a certain module
   if (module>=240) {
@@ -1158,77 +1736,86 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy(UInt_t module) const {
   UInt_t nrNoisy = 0;
   UInt_t eq = GetEqIdFromOffline(module);
   UInt_t hs = GetHSFromOffline(module);
-  for (UInt_t chip=0; chip<5; chip++) {
-    UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
+  for (UInt_t ch=0; ch<5; ch++) {
+    UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
     nrNoisy+=fNrNoisy[gloChip];
-
   }
   return nrNoisy;
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t module, UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t module, UInt_t index) const {
   // get eq for the dead pixel at position index in list of dead
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexDead(module,index,gloChip,chipIndex);
   return GetDeadEqIdAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t module, UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t module, UInt_t index) const {
   // get eq for the noisy pixel at position index in list of noisy
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
   return GetNoisyEqIdAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t module, UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t module, UInt_t index) const {
   // get hs for the dead pixel at position index in list of dead
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexDead(module,index,gloChip,chipIndex);
   return GetDeadHSAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t module, UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t module, UInt_t index) const {
   // get hs for the noisy pixel at position index in list of noisy
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
   return GetNoisyHSAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t module, UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t module, UInt_t index) const {
   // get chip for the dead pixel at position index in list of dead
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexDead(module,index,gloChip,chipIndex);
   return GetDeadChipAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t module, UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t module, UInt_t index) const {
   // get chip for the noisy pixel at position index in list of noisy
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
   return GetNoisyChipAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t module, UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t module, UInt_t index) const {
   // get hs for the dead pixel at position index in list of dead
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexDead(module,index,gloChip,chipIndex);
   return GetDeadColAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t module, UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t module, UInt_t index) const {
   // get hs for the noisy pixel at position index in list of noisy
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
   return GetNoisyColAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t module, UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t module, UInt_t index) const {
   // get hs for the dead pixel at position index in list of dead
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexDead(module,index,gloChip,chipIndex);
   return GetDeadRowAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t module, UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t module, UInt_t index) const {
   // get hs for the noisy pixel at position index in list of noisy
   UInt_t gloChip;
   UInt_t chipIndex;
@@ -1236,6 +1823,43 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t module, UInt_t in
   return GetNoisyRowAtC2(gloChip,chipIndex);
 }
 //____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBadEq(UInt_t eq) const {
+  // returns nr of bad for eq (silent or noisy)
+  UInt_t nrBad = 0;
+  nrBad+=GetNrSilentEq(eq);
+  UInt_t nrNoisy = GetNrNoisy(eq);
+  for (UInt_t i=0; i<nrNoisy; i++) {
+    UInt_t hs   = GetNoisyHSAtEq(eq,i);
+    UInt_t chip = GetNoisyChipAtEq(eq,i);
+    UInt_t col  = GetNoisyColAtEq(eq,i);
+    UInt_t row  = GetNoisyRowAtEq(eq,i);
+    if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
+  }
+  return nrBad;
+}
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentEq(UInt_t eq) const {
+  // returns nr of silent for eq (dead or inactive)
+  UInt_t returnval=0;
+  if (IsSilentEq(eq)) return 81920*6;
+  for (UInt_t hs=0; hs<6; hs++) {
+    if (IsSilentHS(eq,hs)) {
+      returnval+=81920;
+      continue;
+    }
+    for (UInt_t chip=0; chip<10; chip++) {
+      if (IsSilentChip(eq,hs,chip)) {
+       returnval+=8192;
+       continue;
+      }
+      else { 
+       returnval+=GetNrDeadC(eq,hs,chip);
+      }
+    }
+  }
+  return returnval;
+}
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadEq(UInt_t eq) const {
   // returns nr of dead for eq
   UInt_t returnval=0;
@@ -1246,6 +1870,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadEq(UInt_t eq) const {
   }
   return returnval;
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyEq(UInt_t eq) const {
   // returns nr of noisy for eq
   UInt_t returnval=0;
@@ -1256,6 +1881,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyEq(UInt_t eq) const {
   }
   return returnval;
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtEq(UInt_t eq, UInt_t index) const {
   // get eq for the dead pixel at position index in list of dead
   if (eq<20 && index<GetNrDeadEq(eq)) {
@@ -1265,6 +1891,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtEq(UInt_t eq, UInt_t inde
     return 20;
   }
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtEq(UInt_t eq, UInt_t index) const {
   // get eq for the noisy pixel at position index in list of noisy
   if (eq<20 && index<GetNrNoisyEq(eq)) {
@@ -1274,56 +1901,64 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtEq(UInt_t eq, UInt_t ind
     return 20;
   }
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtEq(UInt_t eq, UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtEq(UInt_t eq, UInt_t index) const {
   // get hs for the dead pixel at position index in list of dead
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
   return GetDeadHSAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtEq(UInt_t eq, UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtEq(UInt_t eq, UInt_t index) const {
   // get hs for the noisy pixel at position index in list of noisy
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
   return GetNoisyHSAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtEq(UInt_t eq, UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtEq(UInt_t eq, UInt_t index) const {
   // get chip for the dead pixel at position index in list of dead
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
   return GetDeadChipAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtEq(UInt_t eq, UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtEq(UInt_t eq, UInt_t index) const {
   // get chip for the noisy pixel at position index in list of noisy
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
   return GetNoisyChipAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtEq(UInt_t eq, UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtEq(UInt_t eq, UInt_t index) const {
   // get hs for the dead pixel at position index in list of dead
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
   return GetDeadColAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtEq(UInt_t eq, UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtEq(UInt_t eq, UInt_t index) const {
   // get hs for the noisy pixel at position index in list of noisy
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
   return GetNoisyColAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtEq(UInt_t eq, UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtEq(UInt_t eq, UInt_t index) const {
   // get hs for the dead pixel at position index in list of dead
   UInt_t gloChip;
   UInt_t chipIndex;
   GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
   return GetDeadRowAtC2(gloChip,chipIndex);
 }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtEq(UInt_t eq, UInt_t index) {
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtEq(UInt_t eq, UInt_t index) const {
   // get hs for the noisy pixel at position index in list of noisy
   UInt_t gloChip;
   UInt_t chipIndex;
@@ -1331,50 +1966,82 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtEq(UInt_t eq, UInt_t inde
   return GetNoisyRowAtC2(gloChip,chipIndex);
 }
 //____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
+  // returns nr of bad for chip (silent or noisy)
+  UInt_t nrBad = 0;
+  nrBad+=GetNrSilentC(eq,hs,chip);
+  UInt_t nrNoisy = GetNrNoisyC(eq,hs,chip);
+  for (UInt_t i=0; i<nrNoisy; i++) {
+    UInt_t col  = GetNoisyColAtC(eq,hs,chip,i);
+    UInt_t row  = GetNoisyRowAtC(eq,hs,chip,i);
+    if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
+  }
+  return nrBad;
+}
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentC(UInt_t eq, UInt_t hs, UInt_t chip) const {
+  // returns nr of silent for chip (dead or inactive)
+  if (IsSilentChip(eq,hs,chip)) return 8192;
+  else return GetNrDeadC(eq,hs,chip);
+}
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
+  // returns nr of dead for chip
   UInt_t gloChip = GetGloChip(eq,hs,chip);
   return GetNrDeadC2(gloChip);
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC(UInt_t eq, UInt_t hs, UInt_t chip) const {
+  // returns nr of noisy for chip
   UInt_t gloChip = GetGloChip(eq,hs,chip);
   return GetNrNoisyC2(gloChip);
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
   UInt_t gloChip = GetGloChip(eq,hs,chip);
   return GetDeadEqIdAtC2(gloChip,index);
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
   UInt_t gloChip = GetGloChip(eq,hs,chip);
   return GetNoisyEqIdAtC2(gloChip,index);
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
   UInt_t gloChip = GetGloChip(eq,hs,chip);
   return GetDeadHSAtC2(gloChip,index);
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
   UInt_t gloChip = GetGloChip(eq,hs,chip);
   return GetNoisyHSAtC2(gloChip,index);
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
   UInt_t gloChip = GetGloChip(eq,hs,chip);
   return GetDeadChipAtC2(gloChip,index);
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
   UInt_t gloChip = GetGloChip(eq,hs,chip);
   return GetNoisyChipAtC2(gloChip,index);
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
   UInt_t gloChip = GetGloChip(eq,hs,chip);
   return GetDeadColAtC2(gloChip,index);
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
   UInt_t gloChip = GetGloChip(eq,hs,chip);
   return GetNoisyColAtC2(gloChip,index);
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
   UInt_t gloChip = GetGloChip(eq,hs,chip);
   return GetDeadRowAtC2(gloChip,index);
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
   UInt_t gloChip = GetGloChip(eq,hs,chip);
   return GetNoisyRowAtC2(gloChip,index);
@@ -1390,15 +2057,12 @@ const Char_t* AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC(UInt_t eq,
   }
   if (index<fNrDead[gloChip]) {
     Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
-    UInt_t eq = GetEqIdFromKey(key);
-    UInt_t hs = GetHSFromKey(key);
-    UInt_t chip = GetChipFromKey(key);
     UInt_t col = GetColFromKey(key);
-    UInt_t row = GetRowFromKey(key);    
+    UInt_t row = GetRowFromKey(key);
     UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
     UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
     UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
-    returnMess = Form("%*d,%*d,%*d,%*d,%*d  |  %*d,%*d,%*d\n",2,eq,1,hs,1,chip,2,col,3,row,3,module,3,colM,3,rowM);
+    returnMess = Form("%*d,%*d,%*d,%*d,%*d  |  %*d,%*d,%*d",2,eq,1,hs,1,chip,2,col,3,row,3,module,3,colM,3,rowM);
     return returnMess.Data();
   }
   else {
@@ -1406,6 +2070,7 @@ const Char_t* AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC(UInt_t eq,
     return returnMess.Data();
   }
 }
+//____________________________________________________________________________________________
 const Char_t* AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
   // get a string of noisy pixel info
   TString returnMess = "";
@@ -1416,15 +2081,12 @@ const Char_t* AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC(UInt_t eq,
   }
   if (index<fNrNoisy[gloChip]) {
     Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
-    UInt_t eq = GetEqIdFromKey(key);
-    UInt_t hs = GetHSFromKey(key);
-    UInt_t chip = GetChipFromKey(key);
     UInt_t col = GetColFromKey(key);
     UInt_t row = GetRowFromKey(key);    
     UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
     UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
     UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
-    returnMess = Form("%*d,%*d,%*d,%*d,%*d  |  %*d,%*d,%*d\n",2,eq,1,hs,1,chip,2,col,3,row,3,module,3,colM,3,rowM);
+    returnMess = Form("%*d,%*d,%*d,%*d,%*d  |  %*d,%*d,%*d",2,eq,1,hs,1,chip,2,col,3,row,3,module,3,colM,3,rowM);
     return returnMess.Data();
   }
   else {
@@ -1433,6 +2095,28 @@ const Char_t* AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC(UInt_t eq,
   }
 }
 //____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::AddSilentFrom(AliITSOnlineCalibrationSPDhandler* other) {
+  // returns number of new silent pixels in this' list (dead or inactive)
+  UInt_t tmpdead = GetNrSilent();
+
+  for (UInt_t eq=0; eq<20; eq++) {
+    if (!(other->IsActiveEq(eq))) ActivateEq(eq,kFALSE);
+    if (other->IsDeadEq(eq))      SetDeadEq(eq,kTRUE);
+    for (UInt_t hs=0; hs<6; hs++) {
+      if (!(other->IsActiveHS(eq,hs))) ActivateHS(eq,hs,kFALSE);
+      if (other->IsDeadHS(eq,hs))      SetDeadHS(eq,hs,kTRUE);
+      for (UInt_t chip=0; chip<10; chip++) {
+       if (!(other->IsActiveChip(eq,hs,chip))) ActivateChip(eq,hs,chip,kFALSE);
+       if (other->IsDeadChip(eq,hs,chip))      SetDeadChip(eq,hs,chip,kTRUE);
+      }
+    }
+  }
+
+  AddDeadFrom(other);
+
+  return GetNrSilent() - tmpdead;
+}
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::AddDeadFrom(AliITSOnlineCalibrationSPDhandler* other) {
   // returns number of new dead pixels in this' list
   UInt_t returnval=0;
@@ -1450,6 +2134,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::AddDeadFrom(AliITSOnlineCalibrationSPD
   }
   return returnval;
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::AddNoisyFrom(AliITSOnlineCalibrationSPDhandler* other) {
   // returns number of new noisy pixels in this' list
   UInt_t returnval=0;
@@ -1469,9 +2154,39 @@ UInt_t AliITSOnlineCalibrationSPDhandler::AddNoisyFrom(AliITSOnlineCalibrationSP
 }
 //____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDiff(AliITSOnlineCalibrationSPDhandler* other) const {
-  // returns nr of dead/noisy in this' lists and not in other's lists
-  return GetNrDeadDiff(other) + GetNrNoisyDiff(other);
+  // returns nr of dead/noisy in this' lists and not in other's lists (including inactive)
+  return GetNrSilentDiff(other) + GetNrNoisyDiff(other);
+}
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentDiff(AliITSOnlineCalibrationSPDhandler* other) const {
+  // returns nr of single silent pixels in this' lists and not in other's lists (dead or inactive)
+  UInt_t returnval=0;
+  for (UInt_t eq=0; eq<20; eq++) {
+    for (UInt_t hs=0; hs<6; hs++) {
+      for (UInt_t chip=0; chip<10; chip++) {
+       if (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs) || !IsActiveChip(eq,hs,chip) || IsDeadChip(eq,hs,chip)) {
+         if (other->IsActiveEq(eq) && !other->IsDeadEq(eq) && other->IsActiveHS(eq,hs) && !other->IsDeadHS(eq,hs) && other->IsActiveChip(eq,hs,chip) && !other->IsDeadChip(eq,hs,chip)) {
+           // if this is inactive and the other is active...
+           returnval+= 8192 - other->GetNrDeadC(eq,hs,chip);
+         }
+       }
+       else {
+         UInt_t gloChip = GetGloChip(eq,hs,chip);
+         for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
+           Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
+           UInt_t col = GetColFromKey(key);
+           UInt_t row = GetRowFromKey(key);
+           if (!(other->IsPixelSilent(eq,hs,chip,col,row))) {
+             returnval++;
+           }
+         }
+       }
+      }
+    }
+  }
+  return returnval;
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
   // returns nr of dead in this' lists and not in other's lists
   UInt_t returnval=0;
@@ -1490,6 +2205,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadDiff(AliITSOnlineCalibrationS
   }
   return returnval;
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
   // returns nr of noisy in this' lists and not in other's lists
   UInt_t returnval=0;
@@ -1508,9 +2224,42 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyDiff(AliITSOnlineCalibration
   }
   return returnval;
 }
+//____________________________________________________________________________________________
 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDiff(AliITSOnlineCalibrationSPDhandler* other) const {
-  // returns handler with dead/noisy in this' lists, except for those in other's lists
+  // returns handler with active/dead/noisy in this' lists, removing those that are in other's lists
   AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
+
+  for (UInt_t eq=0; eq<20; eq++) {
+    if (!(IsActiveEq(eq))) {
+      newHandler->ActivateEq(eq,kFALSE);
+      if (!other->IsActiveEq(eq)) newHandler->ActivateEq(eq);
+    }
+    if (IsDeadEq(eq)) {
+      newHandler->SetDeadEq(eq);
+      if (other->IsDeadEq(eq)) newHandler->SetDeadEq(eq,kFALSE);
+    }
+    for (UInt_t hs=0; hs<6; hs++) {
+      if (!(IsActiveHS(eq,hs))) {
+       newHandler->ActivateHS(eq,hs,kFALSE);
+       if (!other->IsActiveHS(eq,hs)) newHandler->ActivateHS(eq,hs);
+      }
+      if (IsDeadHS(eq,hs)) {
+       newHandler->SetDeadHS(eq,hs);
+       if (other->IsDeadHS(eq,hs)) newHandler->SetDeadHS(eq,hs,kFALSE);
+      }
+      for (UInt_t chip=0; chip<10; chip++) {
+       if (!(IsActiveChip(eq,hs,chip))) {
+         newHandler->ActivateChip(eq,hs,chip,kFALSE);
+         if (!other->IsActiveChip(eq,hs,chip)) newHandler->ActivateHS(eq,hs,chip);
+       }
+       if (IsDeadChip(eq,hs,chip)) {
+         newHandler->SetDeadChip(eq,hs,chip);
+         if (other->IsDeadChip(eq,hs,chip)) newHandler->SetDeadChip(eq,hs,chip,kFALSE);
+       }
+      }
+    }
+  }
+
   for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
     for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
       Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
@@ -1523,6 +2272,9 @@ AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDiff(Al
        newHandler->SetDeadPixel(eq,hs,chip,col,row);
       }
     }
+  }
+
+  for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
     for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
       Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
       UInt_t eq = GetEqIdFromKey(key);
@@ -1535,8 +2287,62 @@ AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDiff(Al
       }
     }
   }
+
+  return newHandler;
+}
+//____________________________________________________________________________________________
+AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetSilentDiff(AliITSOnlineCalibrationSPDhandler* other) const {
+  // returns handler with active/dead in this' lists, removing those that are in other's lists
+  AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
+
+  for (UInt_t eq=0; eq<20; eq++) {
+    if (!(IsActiveEq(eq))) {
+      newHandler->ActivateEq(eq,kFALSE);
+      if (!other->IsActiveEq(eq)) newHandler->ActivateEq(eq);
+    }
+    if (IsDeadEq(eq)) {
+      newHandler->SetDeadEq(eq);
+      if (other->IsDeadEq(eq)) newHandler->SetDeadEq(eq,kFALSE);
+    }
+    for (UInt_t hs=0; hs<6; hs++) {
+      if (!(IsActiveHS(eq,hs))) {
+       newHandler->ActivateHS(eq,hs,kFALSE);
+       if (!other->IsActiveHS(eq,hs)) newHandler->ActivateHS(eq,hs);
+      }
+      if (IsDeadHS(eq,hs)) {
+       newHandler->SetDeadHS(eq,hs);
+       if (other->IsDeadHS(eq,hs)) newHandler->SetDeadHS(eq,hs,kFALSE);
+      }
+      for (UInt_t chip=0; chip<10; chip++) {
+       if (!(IsActiveChip(eq,hs,chip))) {
+         newHandler->ActivateChip(eq,hs,chip,kFALSE);
+         if (!other->IsActiveChip(eq,hs,chip)) newHandler->ActivateHS(eq,hs,chip);
+       }
+       if (IsDeadChip(eq,hs,chip)) {
+         newHandler->SetDeadChip(eq,hs,chip);
+         if (other->IsDeadChip(eq,hs,chip)) newHandler->SetDeadChip(eq,hs,chip,kFALSE);
+       }
+      }
+    }
+  }
+
+  for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
+    for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
+      Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
+      UInt_t eq = GetEqIdFromKey(key);
+      UInt_t hs = GetHSFromKey(key);
+      UInt_t chip = GetChipFromKey(key);
+      UInt_t col = GetColFromKey(key);
+      UInt_t row = GetRowFromKey(key);
+      if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
+       newHandler->SetDeadPixel(eq,hs,chip,col,row);
+      }
+    }
+  }
+
   return newHandler;
 }
+//____________________________________________________________________________________________
 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
   // returns handler with dead in this' lists, except for those in other's lists
   AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
@@ -1555,6 +2361,7 @@ AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDeadDif
   }
   return newHandler;
 }
+//____________________________________________________________________________________________
 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
   // returns handler with noisy in this' lists, except for those in other's lists
   AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
@@ -1574,15 +2381,15 @@ AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetNoisyDi
   return newHandler;
 }
 //____________________________________________________________________________________________
-void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
+void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
   // find gloChip and chipIndex from module and index
   if (index<GetNrDead(module)) {
     UInt_t eq = GetEqIdFromOffline(module);
     UInt_t hs = GetHSFromOffline(module);
     
     UInt_t glVal=0;
-    for (UInt_t chip=0; chip<5; chip++) {
-      gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
+    for (UInt_t ch=0; ch<5; ch++) {
+      gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
       if (glVal+fNrDead[gloChip]>index) {
        chipIndex = index-glVal;
        break;
@@ -1597,15 +2404,16 @@ void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead(UInt_t module, UInt_
     Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead", "Index %d out of bounds.", index);
   }
 }
-void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
   // find gloChip and chipIndex from module and index
   if (index<GetNrNoisy(module)) {
     UInt_t eq = GetEqIdFromOffline(module);
     UInt_t hs = GetHSFromOffline(module);
     
     UInt_t glVal=0;
-    for (UInt_t chip=0; chip<5; chip++) {
-      gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
+    for (UInt_t ch=0; ch<5; ch++) {
+      gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
       if (glVal+fNrNoisy[gloChip]>index) {
        chipIndex = index-glVal;
        break;
@@ -1620,7 +2428,8 @@ void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy(UInt_t module, UInt
     Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy", "Index %d out of bounds.", index);
   }
 }
-void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
   // find gloChip and chipIndex from module and index
   if (index<GetNrDeadEq(eq)) {
 
@@ -1643,7 +2452,8 @@ void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead(UInt_t eq, UInt_t
     Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead", "Index %d out of bounds.", index);
   }
 }
-void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
   // find gloChip and chipIndex from module and index
   if (index<GetNrNoisyEq(eq)) {
 
@@ -1666,7 +2476,8 @@ void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy(UInt_t eq, UInt_t
     Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy", "Index %d out of bounds.", index);
   }
 }
-void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
   // find gloChip and chipIndex from global index
   if (index<GetNrDead()) {
     
@@ -1686,7 +2497,8 @@ void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead(UInt_t index, UIn
     Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead", "Index %d out of bounds.", index);
   }
 }
-void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
   // find gloChip and chipIndex from global index
   if (index<GetNrNoisy()) {
     
@@ -1715,6 +2527,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline(UInt_t module) cons
   }
   return AliITSRawStreamSPD::GetOnlineEqIdFromOffline(module);
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetHSFromOffline(UInt_t module) const {
   // module to hs mapping
   if (module>=240) {
@@ -1723,6 +2536,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetHSFromOffline(UInt_t module) const
   }
   return AliITSRawStreamSPD::GetOnlineHSFromOffline(module);
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetChipFromOffline(UInt_t module, UInt_t colM) const {
   // module,colM to chip mapping
   if (module>=240 || colM>=160) {
@@ -1731,6 +2545,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetChipFromOffline(UInt_t module, UInt
   }
   return AliITSRawStreamSPD::GetOnlineChipFromOffline(module,colM);
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetColFromOffline(UInt_t module, UInt_t colM) const {
   // colM to col mapping
   if (colM>=160) {
@@ -1739,7 +2554,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetColFromOffline(UInt_t module, UInt_
   }
   return AliITSRawStreamSPD::GetOnlineColFromOffline(module,colM);
 }
-
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetRowFromOffline(UInt_t module, UInt_t rowM) const {
   // rowM to row mapping
   if (rowM>=256) {
@@ -1757,6 +2572,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC2(UInt_t gloChip) const {
   }
   return fNrDead[gloChip];
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2(UInt_t gloChip) const {
   // returns nr of noisy pixels on this chip
   if (gloChip>=1200) {
@@ -1765,6 +2581,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2(UInt_t gloChip) const {
   }
   return fNrNoisy[gloChip];
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC2(UInt_t gloChip, UInt_t index) const {
   // get eq for the dead pixel at position index in list of dead
   if (gloChip>=1200) {
@@ -1780,6 +2597,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC2(UInt_t gloChip, UInt_t
     return 0;
   }
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC2(UInt_t gloChip, UInt_t index) const {
   // get eq for the noisy pixel at position index in list of noisy
   if (gloChip>=1200) {
@@ -1795,6 +2613,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC2(UInt_t gloChip, UInt_
     return 0;
   }
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC2(UInt_t gloChip, UInt_t index) const {
   // get hs for the dead pixel at position index in list of dead
   if (gloChip>=1200) {
@@ -1810,6 +2629,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC2(UInt_t gloChip, UInt_t i
     return 0;
   }
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC2(UInt_t gloChip, UInt_t index) const {
   // get hs for the noisy pixel at position index in list of noisy
   if (gloChip>=1200) {
@@ -1825,6 +2645,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC2(UInt_t gloChip, UInt_t
     return 0;
   }
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC2(UInt_t gloChip, UInt_t index) const {
   // get chip for the dead pixel at position index in list of dead
   if (gloChip>=1200) {
@@ -1840,6 +2661,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC2(UInt_t gloChip, UInt_t
     return 0;
   }
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC2(UInt_t gloChip, UInt_t index) const {
   // get chip for the noisy pixel at position index in list of noisy
   if (gloChip>=1200) {
@@ -1855,6 +2677,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC2(UInt_t gloChip, UInt_
     return 0;
   }
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2(UInt_t gloChip, UInt_t index) const {
   // get col for the dead pixel at position index in list of dead
   if (gloChip>=1200) {
@@ -1870,6 +2693,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2(UInt_t gloChip, UInt_t
     return 0;
   }
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC2(UInt_t gloChip, UInt_t index) const {
   // get col for the noisy pixel at position index in list of noisy
   if (gloChip>=1200) {
@@ -1885,6 +2709,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC2(UInt_t gloChip, UInt_t
     return 0;
   }
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC2(UInt_t gloChip, UInt_t index) const {
   // get row for the dead pixel at position index in list of dead
   if (gloChip>=1200) {
@@ -1900,6 +2725,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC2(UInt_t gloChip, UInt_t
     return 0;
   }
 }
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC2(UInt_t gloChip, UInt_t index) const {
   // get row for the noisy pixel at position index in list of noisy
   if (gloChip>=1200) {
@@ -1915,22 +2741,164 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC2(UInt_t gloChip, UInt_t
     return 0;
   }
 }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::ActivateALL() {
+  // activate all eq,hs,chips
+  for (UInt_t eq=0; eq<20; eq++) {
+    ActivateEq(eq);
+    for (UInt_t hs=0; hs<6; hs++) {
+      ActivateHS(eq,hs);
+      for (UInt_t chip=0; chip<10; chip++) {
+       ActivateChip(eq,hs,chip);
+      }
+    }
+  }
+}
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::ActivateEq(UInt_t eq, Bool_t setval) {
+  // activate eq
+  if (eq>=20) {
+    Error("AliITSOnlineCalibrationSPDhandler::ActivateEq", "eq (%d) out of bounds.",eq);
+    return;
+  }
+  fActiveEq[eq] = setval;
+}
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::ActivateHS(UInt_t eq, UInt_t hs, Bool_t setval) {
+  // activate hs
+  if (eq>=20 || hs>=6) {
+    Error("AliITSOnlineCalibrationSPDhandler::ActivateHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
+    return;
+  }
+  fActiveHS[eq][hs] = setval;
+}
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::ActivateChip(UInt_t eq, UInt_t hs, UInt_t chip, Bool_t setval) {
+  // activate chip
+  if (eq>=20 || hs>=6 || chip>=10) {
+    Error("AliITSOnlineCalibrationSPDhandler::ActivateChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
+    return;
+  }
+  fActiveChip[eq][hs][chip] = setval;
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveEq(UInt_t eq) const {
+  // Is eq active?
+  if (eq>=20) {
+    Error("AliITSOnlineCalibrationSPDhandler::IsActiveEq", "eq (%d) out of bounds.",eq);
+    return kFALSE;
+  }
+  return fActiveEq[eq];
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveHS(UInt_t eq, UInt_t hs) const {
+  // Is hs active?
+  if (eq>=20 || hs>=6) {
+    Error("AliITSOnlineCalibrationSPDhandler::IsActiveHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
+    return kFALSE;
+  }
+  return fActiveHS[eq][hs];
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
+  // Is chip active?
+  if (eq>=20 || hs>=6 || chip>=10) {
+    Error("AliITSOnlineCalibrationSPDhandler::IsActiveChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
+    return kFALSE;
+  }
+  return fActiveChip[eq][hs][chip];
+}
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::UnSetDeadALL() {
+  // Clear all dead eq,hs,chips
+  for (UInt_t eq=0; eq<20; eq++) {
+    SetDeadEq(eq,kFALSE);
+    for (UInt_t hs=0; hs<6; hs++) {
+      SetDeadHS(eq,hs,kFALSE);
+      for (UInt_t chip=0; chip<10; chip++) {
+       SetDeadChip(eq,hs,chip,kFALSE);
+      }
+    }
+  }
+}
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::SetDeadEq(UInt_t eq, Bool_t setval) {
+  // set eq dead
+  if (eq>=20) {
+    Error("AliITSOnlineCalibrationSPDhandler::SetDeadEq", "eq (%d) out of bounds.",eq);
+    return;
+  }
+  fDeadEq[eq] = setval;
+}
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::SetDeadHS(UInt_t eq, UInt_t hs, Bool_t setval) {
+  // set hs dead
+  if (eq>=20 || hs>=6) {
+    Error("AliITSOnlineCalibrationSPDhandler::SetDeadHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
+    return;
+  }
+  fDeadHS[eq][hs] = setval;
+}
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::SetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip, Bool_t setval) {
+  // set chip dead
+  if (eq>=20 || hs>=6 || chip>=10) {
+    Error("AliITSOnlineCalibrationSPDhandler::SetDeadChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
+    return;
+  }
+  fDeadChip[eq][hs][chip] = setval;
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadEq(UInt_t eq) const {
+  // is eq dead?
+  if (eq>=20) {
+    Error("AliITSOnlineCalibrationSPDhandler::IsDeadEq", "eq (%d) out of bounds.",eq);
+    return kFALSE;
+  }
+  return fDeadEq[eq];
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadHS(UInt_t eq, UInt_t hs) const {
+  // is hs dead?
+  if (eq>=20 || hs>=6) {
+    Error("AliITSOnlineCalibrationSPDhandler::IsDeadHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
+    return kFALSE;
+  }
+  return fDeadHS[eq][hs];
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
+  // is chip dead?
+  if (eq>=20 || hs>=6 || chip>=10) {
+    Error("AliITSOnlineCalibrationSPDhandler::IsDeadChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
+    return kFALSE;
+  }
+  return fDeadChip[eq][hs][chip];
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentEq(UInt_t eq) const {
+  // is eq silent?
+  if (eq>=20) {
+    Error("AliITSOnlineCalibrationSPDhandler::IsSilentEq", "eq (%d) out of bounds.",eq);
+    return kFALSE;
+  }
+  return (!IsActiveEq(eq) || IsDeadEq(eq));
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentHS(UInt_t eq, UInt_t hs) const {
+  // is hs silent?
+  if (eq>=20 || hs>=6) {
+    Error("AliITSOnlineCalibrationSPDhandler::IsSilentHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
+    return kFALSE;
+  }
+  return (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs));
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
+  // is chip silent?
+  if (eq>=20 || hs>=6 || chip>=10) {
+    Error("AliITSOnlineCalibrationSPDhandler::IsSilentChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
+    return kFALSE;
+  }
+  return (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs) || !IsActiveChip(eq,hs,chip) || IsDeadChip(eq,hs,chip));
+}