]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSOnlineCalibrationSPDhandler.cxx
Coverity fixes
[u/mrichter/AliRoot.git] / ITS / AliITSOnlineCalibrationSPDhandler.cxx
index fdedb537d3d213f2f2f797edc0e54f093f7f5d74..123b46619ac6c7f4e0d226ee5372f0395d70dd70 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "AliITSOnlineCalibrationSPDhandler.h"
 #include "AliITSOnlineCalibrationSPD.h"
+#include "AliITSTriggerConditions.h"
 #include "AliITSIntMap.h"
 #include <TObjArray.h>
 #include <TArrayI.h>
 #endif
 
 /* $Id$ */
+
 //____________________________________________________________________________________________
 AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler():
-  fFileLocation(".")
+  fFileLocation("."),
+  fTriggerConditions(0)
 {
   // constructor
   for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
     fNrDead[gloChip]=0;
+    fNrSparseDead[gloChip]=0;
     fNrNoisy[gloChip]=0;
     fDeadPixelMap[gloChip] = new AliITSIntMap();
+    fSparseDeadPixelMap[gloChip] = new AliITSIntMap();
     fNoisyPixelMap[gloChip] = new AliITSIntMap();    
   }
   ActivateALL();
+  UnSetDeadALL();
 }
 //____________________________________________________________________________________________
 AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler(const AliITSOnlineCalibrationSPDhandler& handle): 
-  fFileLocation(".")
+  fFileLocation("."),
+  fTriggerConditions(handle.fTriggerConditions)
 {
   // copy constructor
   for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
     fNrDead[gloChip] = handle.fNrDead[gloChip];
+    fNrSparseDead[gloChip] = handle.fNrSparseDead[gloChip];
     fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
     fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
+    fSparseDeadPixelMap[gloChip] = handle.fSparseDeadPixelMap[gloChip]->Clone();
     fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
   }
   for (UInt_t eq=0; eq<20; eq++) {
     fActiveEq[eq] = handle.fActiveEq[eq];
+    fDeadEq[eq]=handle.fDeadEq[eq];
     for (UInt_t hs=0; hs<6; hs++) {
       fActiveHS[eq][hs] = handle.fActiveHS[eq][hs];
       for (UInt_t chip=0; chip<10; chip++) {
@@ -68,6 +78,7 @@ AliITSOnlineCalibrationSPDhandler::~AliITSOnlineCalibrationSPDhandler() {
   //  ClearMaps();
   for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
     delete fDeadPixelMap[gloChip];
+    delete fSparseDeadPixelMap[gloChip];
     delete fNoisyPixelMap[gloChip];
   }
 }
@@ -78,12 +89,15 @@ AliITSOnlineCalibrationSPDhandler& AliITSOnlineCalibrationSPDhandler::operator=(
     this->ClearMaps();
     for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
       fNrDead[gloChip] = handle.fNrDead[gloChip];
+      fNrSparseDead[gloChip] = handle.fNrSparseDead[gloChip];
       fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
       fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
+      fSparseDeadPixelMap[gloChip] = handle.fSparseDeadPixelMap[gloChip]->Clone();
       fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
     }
     for (UInt_t eq=0; eq<20; eq++) {
       fActiveEq[eq] = handle.fActiveEq[eq];
+      fDeadEq[eq] = handle.fDeadEq[eq];
       for (UInt_t hs=0; hs<6; hs++) {
        fActiveHS[eq][hs] = handle.fActiveHS[eq][hs];
        for (UInt_t chip=0; chip<10; chip++) {
@@ -105,9 +119,12 @@ void AliITSOnlineCalibrationSPDhandler::ClearMaps() {
 //____________________________________________________________________________________________
 void AliITSOnlineCalibrationSPDhandler::ResetDead() {
   // reset the dead pixel map and inactive eq,hs,chip
+  UnSetDeadALL();
   for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
     fNrDead[gloChip]=0;
+    fNrSparseDead[gloChip]=0;
     fDeadPixelMap[gloChip]->Clear();
+    fSparseDeadPixelMap[gloChip]->Clear();
   }
 }
 //____________________________________________________________________________________________
@@ -121,6 +138,7 @@ void AliITSOnlineCalibrationSPDhandler::ResetNoisy() {
 //____________________________________________________________________________________________
 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++) {
@@ -128,6 +146,9 @@ void AliITSOnlineCalibrationSPDhandler::ResetDeadForChip(UInt_t eq, UInt_t hs, U
       if (fDeadPixelMap[gloChip]->Remove(key)) {
        fNrDead[gloChip]--;
       }
+      if (fSparseDeadPixelMap[gloChip]->Remove(key)) {
+       fNrSparseDead[gloChip]--;
+      }
     }
   }
 }
@@ -245,6 +266,17 @@ 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);
@@ -367,6 +399,35 @@ UInt_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText(const char *fileName
   return newNrNoisy;
 }
 //____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::ReadPITConditionsFromText(const char *fileName) {
+  // read PIT conditions file from text as printed out at P2
+  //  !!! please note that the chip numbering goes from 9 to 0 in the text. In PVSS panels is the opposite.
+  if(fTriggerConditions) fTriggerConditions->ResetAll();
+  else fTriggerConditions = new AliITSTriggerConditions();
+  fTriggerConditions->ReadFromTextFile(fileName);
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadPITConditionsFromDB(Int_t runNr, const Char_t *storage){
+// read PIT conditions from the OCDB
+
+  AliCDBManager* man = AliCDBManager::Instance();
+  TString storageSTR = Form("%s",storage);
+  if (storageSTR.CompareTo("default")==0) {
+    if(!man->IsDefaultStorageSet()) {
+      man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+    }
+  }
+  else {
+    storageSTR = Form("%s",storage);
+    man->SetDefaultStorage(storageSTR.Data());
+  }
+  AliCDBEntry *cdbEntry = man->Get("TRIGGER/SPD/PITConditions", runNr);
+ if(cdbEntry) {
+  fTriggerConditions = (AliITSTriggerConditions*)cdbEntry->GetObject();
+  return kTRUE;
+  } else return kFALSE;
+}
+//____________________________________________________________________________________________
 void AliITSOnlineCalibrationSPDhandler::WriteToFilesAlways() {
   // write the lists of active,dead,noisy to files
   for (UInt_t eq=0; eq<20; eq++) {
@@ -447,6 +508,16 @@ void AliITSOnlineCalibrationSPDhandler::WriteDeadToFile(UInt_t eq, Bool_t inacti
   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);
@@ -480,11 +551,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, const 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/OCDB");
+    }
+  }
+  else {
+    storageSTR = Form("%s",storage);
+    man->SetDefaultStorage(storageSTR.Data());
   }
   AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
   TObjArray* spdEntry;
@@ -498,7 +576,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 {
@@ -509,16 +588,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, const 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/OCDB");
+    }
+  }
+  else {
+    storageSTR = Form("%s",storage);
+    man->SetDefaultStorage(storageSTR.Data());
   }
   AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
   TObjArray* spdEntry;
@@ -532,7 +629,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 {
@@ -548,18 +645,25 @@ Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB(UInt_t module, I
   return kTRUE;
 }
 //____________________________________________________________________________________________
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromDB(Int_t runNr, Bool_t treeSerial) {
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromDB(Int_t runNr, const 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, const 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/OCDB");
+    }
+  }
+  else {
+    storageSTR = Form("%s",storage);
+    man->SetDefaultStorage(storageSTR.Data());
   }
   AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
   TObjArray* spdEntry;
@@ -573,11 +677,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);
@@ -586,18 +692,92 @@ 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::ReadSparseDeadFromDB(Int_t runNr, const 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();
+  TString storageSTR = Form("%s",storage);
+  if (storageSTR.CompareTo("default")==0) {
+    if(!man->IsDefaultStorageSet()) {
+      man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+    }
+  }
+  else {
+    storageSTR = Form("%s",storage);
+    man->SetDefaultStorage(storageSTR.Data());
+  }
+  AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDSparseDead", runNr);
+  TObjArray* spdEntry;
+  if(cdbEntry) {
+    spdEntry = (TObjArray*)cdbEntry->GetObject();
+    if(!spdEntry) return kFALSE;
+  }
+  else {
+    Warning("AliITSOnlineCalibrationSPDhandler::ReadSparseDeadFromDB","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) {
+        RecursiveInsertSparseDead(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);
+          SetSparseDeadPixelM(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::ReadNoisyFromDB(Int_t runNr, Bool_t treeSerial) {
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB(Int_t runNr, const 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/OCDB");
+    }
+  }
+  else {
+    storageSTR = Form("%s",storage);
+    man->SetDefaultStorage(storageSTR.Data());
   }
   AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
   TObjArray* spdEntry;
@@ -611,12 +791,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 {
@@ -633,13 +811,79 @@ Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB(Int_t runNr, Bool_t tr
   return kTRUE;
 }
 //____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDBasNoisy(Int_t runNr, const 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/OCDB");
+    }
+  }
+  else {
+    storageSTR = Form("%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;
@@ -648,27 +892,33 @@ Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromCalibObj(TObjArray* calObj
 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, const 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, const 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/OCDB");
+    }
+  }
+  else {
+    storageSTR = Form("%s",storage);
+    man->SetDefaultStorage(storageSTR.Data());
   }
   AliCDBMetaData* metaData = new AliCDBMetaData();
   metaData->SetResponsible("Henrik Tydesjo");
@@ -677,22 +927,118 @@ 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* 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::WriteSparseDeadToDB(Int_t runNrStart, Int_t runNrEnd, const 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/OCDB");
+    }
+  }
+  else {
+    storageSTR = Form("%s",storage);
+    man->SetDefaultStorage(storageSTR.Data());
+  }
+  AliCDBMetaData* metaData = new AliCDBMetaData();
+  metaData->SetResponsible("Annalisa Mastroserio");
+  metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
+  AliCDBId idCalSPD("ITS/Calib/SPDSparseDead",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);
+    //printf(" AliITSOnlineCalibrationSPDhandler::WriteSparseDeadToDB :  nr Sparse dead in module %i - %i \n",module,GetNrSparseDead(module));
+    calibSPD->SetNrBadSingle( GetNrSparseDead(module) );
+    calibSPD->SetBadList( GetSparseDeadArray(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, const 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/OCDB");
+    }
+  }
+  else {
+    storageSTR = Form("%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*) spdEntry->At(module)) -> SetNrBad( GetNrSilent(module) );
-    ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetBadList( GetSilentArray(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);
@@ -702,12 +1048,19 @@ Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDB(Int_t runNrStart, Int_t
   return kTRUE;
 }
 //____________________________________________________________________________________________
-Bool_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToDB(Int_t runNrStart, Int_t runNrEnd) {
+Bool_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToDB(Int_t runNrStart, Int_t runNrEnd, const 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/OCDB");
+    }
+  }
+  else {
+    storageSTR = Form("%s",storage);
+    man->SetDefaultStorage(storageSTR.Data());
   }
   AliCDBMetaData* metaData = new AliCDBMetaData();
   metaData->SetResponsible("Henrik Tydesjo");
@@ -716,22 +1069,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);
@@ -750,6 +1094,15 @@ void AliITSOnlineCalibrationSPDhandler::RecursiveInsertDead(AliITSCalibrationSPD
   RecursiveInsertDead(calibSPD,module,thisInd+1,highInd);
 }
 //____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::RecursiveInsertSparseDead(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
+  // inserts sparse dead pixels recursively, used when reading from db
+  if (lowInd>highInd) return;
+  Int_t thisInd = lowInd+(highInd-lowInd)/2;
+  SetSparseDeadPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
+  RecursiveInsertSparseDead(calibSPD,module,lowInd,thisInd-1);
+  RecursiveInsertSparseDead(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
   if (lowInd>highInd) return;
@@ -789,6 +1142,7 @@ void AliITSOnlineCalibrationSPDhandler::GenerateDCSConfigFile(const Char_t* file
 //____________________________________________________________________________________________
 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);
@@ -852,45 +1206,68 @@ TArrayS AliITSOnlineCalibrationSPDhandler::GetSilentArray(UInt_t module, Bool_t
 }
 //____________________________________________________________________________________________
 TArrayS AliITSOnlineCalibrationSPDhandler::GetDeadArray(UInt_t module, Bool_t treeSerial) {
-  // get a TArrayS of the dead pixels (format for the AliITSCalibrationSPD object)
+  // 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=0;
-  for (UInt_t ch=0; ch<5; ch++) {
-    UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
-    size += fNrDead[gloChip];
-  }
+  UInt_t size=GetNrDeadSingle(module);
   returnArray.Set(size*2);
   UInt_t gloIndex=0;
   for (UInt_t ch=0; ch<5; ch++) {
-    UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
+    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;
 }
 //____________________________________________________________________________________________
-TArrayS AliITSOnlineCalibrationSPDhandler::GetNoisyArray(UInt_t module, Bool_t treeSerial) {
-  // get a TArrayS of the noisy pixels (format for the AliITSCalibrationSPD object)
+TArrayS AliITSOnlineCalibrationSPDhandler::GetSparseDeadArray(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=0;
+  UInt_t size=GetNrSparseDead(module);
+  returnArray.Set(size*2);
+  UInt_t gloIndex=0;
   for (UInt_t ch=0; ch<5; ch++) {
-    UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
-    size += fNrNoisy[gloChip];
+    UInt_t chip = GetChipFromOffline(module,ch*32);
+    UInt_t gloChip = GetGloChip(eq,hs,chip);
+    if (treeSerial) fSparseDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
+    else fSparseDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
+    if (!IsSilentChip(eq,hs,chip)) {
+      for (UInt_t index=0; index<fNrSparseDead[gloChip]; index++) {
+        Int_t key = fSparseDeadPixelMap[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::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=GetNrNoisySingle(module);
   returnArray.Set(size*2);
   UInt_t gloIndex=0;
   for (UInt_t ch=0; ch<5; ch++) {
@@ -910,7 +1287,7 @@ TArrayS AliITSOnlineCalibrationSPDhandler::GetNoisyArray(UInt_t module, Bool_t t
 }
 //____________________________________________________________________________________________
 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;
@@ -938,7 +1315,7 @@ TArrayI AliITSOnlineCalibrationSPDhandler::GetDeadArrayOnline(UInt_t eq) {
 }
 //____________________________________________________________________________________________
 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;
@@ -971,17 +1348,17 @@ void AliITSOnlineCalibrationSPDhandler::PrintEqSummary() {
   printf("Eq summary:\n");
   printf("-----------\n");
   for (UInt_t eq=0; eq<20; eq++) {
-    printf("Eq %*d: %*d silent(dead+inactive) , %*d dead , %*d noisy\n",2,eq,5,GetNrSilentEq(eq),5,GetNrDeadEq(eq),5,GetNrNoisyEq(eq));
+    printf("Eq %*d: %*d silent(dead+inactive) , %*d dead , %*d sparse-dead %*d noisy\n",2,eq,6,GetNrSilentEq(eq),6,GetNrDeadEq(eq),6,GetNrSparseDeadEq(eq),6,GetNrNoisyEq(eq));
   }
 }
 //____________________________________________________________________________________________
 void AliITSOnlineCalibrationSPDhandler::PrintSilent() const {
   // print the inactive and dead pixels to screen
-  printf("------------------------------------------------------\n");
-  printf("Inactive Equipments: (eq  |  module1 .. module12)\n");
-  printf("------------------------------------------------------\n");
+  printf("-----------------------------------------------------------\n");
+  printf("Inactive or dead Equipments: (eq  |  module1 .. module12)\n");
+  printf("-----------------------------------------------------------\n");
   for (UInt_t eq=0; eq<20; eq++) {
-    if (!IsActiveEq(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) {
@@ -994,13 +1371,13 @@ void AliITSOnlineCalibrationSPDhandler::PrintSilent() const {
     }
   }
 
-  printf("------------------------------------------------------\n");
-  printf("Inactive Half-staves: (eq,hs  |  module1,module2)\n");
-  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 (IsActiveEq(eq)) {
+    if (!IsSilentEq(eq)) {
       for (UInt_t hs=0; hs<6; hs++) {
-       if (!IsActiveHS(eq,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);
@@ -1013,15 +1390,15 @@ void AliITSOnlineCalibrationSPDhandler::PrintSilent() const {
     }
   }
 
-  printf("------------------------------------------------------\n");
-  printf("Inactive Chips: (eq,hs,chip  |  module,colM1-colM2)\n");
-  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 (IsActiveEq(eq)) {
+    if (!IsSilentEq(eq)) {
       for (UInt_t hs=0; hs<6; hs++) {
-       if (IsActiveHS(eq,hs)) {
+       if (!IsSilentHS(eq,hs)) {
          for (UInt_t chip=0; chip<10; chip++) {
-           if (!IsActiveChip(eq,hs,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);
@@ -1036,27 +1413,6 @@ void AliITSOnlineCalibrationSPDhandler::PrintSilent() const {
 
   PrintDead();
 
-//!!!  printf("------------------------------------------------------\n");
-//!!!  printf("Dead Pixels: (eq,hs,chip,col,row  |  module,colM,rowM)\n");
-//!!!  printf("------------------------------------------------------\n");
-//!!!  for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
-//!!!    for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
-//!!!      Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
-//!!!      UInt_t eq = GetEqIdFromKey(key);
-//!!!      UInt_t hs = GetHSFromKey(key);
-//!!!      UInt_t chip = GetChipFromKey(key);
-//!!!      if (!( IsActiveEq(eq) && IsActiveHS(eq,hs) && IsActiveChip(eq,hs,chip) )) continue;
-//!!!      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);
-//!!!
-//!!!      printf("%*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);
-//!!!    }
-//!!!  }
-
 }
 //____________________________________________________________________________________________
 void AliITSOnlineCalibrationSPDhandler::PrintDead() const {
@@ -1082,6 +1438,29 @@ void AliITSOnlineCalibrationSPDhandler::PrintDead() const {
   }
 }
 //____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::PrintSparseDead() const {
+  // print the single dead pixels to screen (disregards inactive eq,hs,chip)
+  printf("------------------------------------------------------\n");
+  printf("Sparse Dead Pixels: (eq,hs,chip,col,row  |  module,colM,rowM)\n");
+  printf("------------------------------------------------------\n");
+  for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
+    for (UInt_t index=0; index<fNrSparseDead[gloChip]; index++) {
+      Int_t key = fSparseDeadPixelMap[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);
+
+      printf("%*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);
+    }
+  }
+}
+//____________________________________________________________________________________________
 void AliITSOnlineCalibrationSPDhandler::PrintNoisy() const {
   // print the dead pixels to screen
   printf("-------------------------------------------------------\n");
@@ -1126,6 +1505,28 @@ Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixel(UInt_t eq, UInt_t hs, UIn
   return kFALSE;
 }
 //____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::SetSparseDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
+  // set a dead pixel, returns false if pixel is already dead
+  UInt_t gloChip = GetGloChip(eq,hs,chip);
+  if (gloChip>=1200) {
+    Error("AliITSOnlineCalibrationSPDhandler::SetSparseDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
+    return kFALSE;
+  }
+  if (col>=32 && row>=256) {
+    Error("AliITSOnlineCalibrationSPDhandler::SetSparseDeadPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
+    return kFALSE;
+  }
+  Int_t key = GetKey(eq,hs,chip,col,row);
+  // if noisy we dont want to add it...
+  if (fSparseDeadPixelMap[gloChip]->Find(key) != NULL) return kFALSE;
+  if (fSparseDeadPixelMap[gloChip]->Insert(key,gloChip)) {
+    fNrSparseDead[gloChip]++;
+    //printf(" AliITSOnlineCalibrationSPDhandler::SetSparseDeadPixel nSparse Dead : %i \n",fNrSparseDead[gloChip]);    
+    return kTRUE;
+  }
+  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);
@@ -1159,6 +1560,16 @@ Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixelM(UInt_t module, UInt_t co
   return SetDeadPixel(eq,hs,chip,col,row);
 }
 //____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::SetSparseDeadPixelM(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);
+  UInt_t hs = GetHSFromOffline(module);
+  UInt_t chip = GetChipFromOffline(module,colM);
+  UInt_t col = GetColFromOffline(module,colM);
+  UInt_t row = GetRowFromOffline(module,rowM);
+  return SetSparseDeadPixel(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);
@@ -1184,6 +1595,21 @@ Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel(UInt_t eq, UInt_t hs, U
   return kFALSE;
 }
 //____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::UnSetSparseDeadPixel(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);
+  if (gloChip>=1200) {
+    Error("AliITSOnlineCalibrationSPDhandler::UnSetSparseDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
+    return kFALSE;
+  }
+  Int_t key = GetKey(eq,hs,chip,col,row);
+  if (fSparseDeadPixelMap[gloChip]->Remove(key)) {
+    fNrSparseDead[gloChip]--;
+    return kTRUE;
+  }
+  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);
@@ -1209,6 +1635,16 @@ Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixelM(UInt_t module, UInt_t
   return UnSetDeadPixel(eq,hs,chip,col,row);
 }
 //____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::UnSetSparseDeadPixelM(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);
+  UInt_t hs = GetHSFromOffline(module);
+  UInt_t chip = GetChipFromOffline(module,colM);
+  UInt_t col = GetColFromOffline(module,colM);
+  UInt_t row = GetRowFromOffline(module,rowM);
+  return UnSetSparseDeadPixel(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);
@@ -1219,58 +1655,9 @@ Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixelM(UInt_t module, UInt_t
   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::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++;
-      }
-    }
-  }
-  if (nrUnset<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::IsPixelSilent(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
@@ -1280,27 +1667,30 @@ Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilent(UInt_t eq, UInt_t hs, UI
     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 (!(IsActiveEq(eq) && IsActiveHS(eq,hs) && IsActiveChip(eq,hs,chip))) 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?
+  // is the pixel dead?
   UInt_t gloChip = GetGloChip(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;
-  else return kFALSE;
+  if (IsDeadEq(eq) || IsDeadHS(eq,hs) || IsDeadChip(eq,hs,chip)) return kTRUE;
+  else {
+    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 || col>=32 || row>=256) {
-    Error("AliITSOnlineCalibrationSPDhandler::IsPixelNoisy", "eq,hs,chip,col,row nrs (%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
+    Error("AliITSOnlineCalibrationSPDhandler::IsPixelNoisy","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);
@@ -1308,6 +1698,11 @@ Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisy(UInt_t eq, UInt_t hs, UIn
   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);
@@ -1338,6 +1733,16 @@ Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyM(UInt_t module, UInt_t co
   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);
@@ -1368,21 +1773,37 @@ 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 (!IsActiveEq(eq)) {
+    if (IsSilentEq(eq)) {
       nrDead+=81920*6;
       continue;
     }
     for (UInt_t hs=0; hs<6; hs++) {
-      if (!IsActiveHS(eq,hs)) {
+      if (IsSilentHS(eq,hs)) {
        nrDead+=81920;
        continue;
       }
       for (UInt_t chip=0; chip<10; chip++) {
-       if (!IsActiveChip(eq,hs,chip)) {
+       if (IsSilentChip(eq,hs,chip)) {
          nrDead+=8192;
          continue;
        }
@@ -1405,6 +1826,15 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead() const {
   return nrDead;
 }
 //____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSparseDead() const {
+  // returns the total nr of dead pixels
+  UInt_t nrSparseDead = 0;
+  for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
+    nrSparseDead+=fNrSparseDead[gloChip];
+  }
+  return nrSparseDead;
+}
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy() const {
   // returns the total nr of noisy pixels
   UInt_t nrNoisy = 0;
@@ -1414,7 +1844,7 @@ 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;
@@ -1422,7 +1852,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t index) {
   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;
@@ -1430,7 +1860,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t index) {
   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;
@@ -1438,7 +1868,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t index) {
   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;
@@ -1446,7 +1876,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t index) {
   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;
@@ -1454,7 +1884,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t index) {
   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;
@@ -1462,7 +1892,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t index) {
   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;
@@ -1470,7 +1900,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t index) {
   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;
@@ -1478,7 +1908,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t index) {
   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;
@@ -1486,7 +1916,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t index) {
   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;
@@ -1494,6 +1924,22 @@ 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) {
@@ -1502,12 +1948,12 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilent(UInt_t module) const {
   }
   UInt_t nrSilent = 0;
   UInt_t eq = GetEqIdFromOffline(module);
-  if (!IsActiveEq(eq)) return 160*256;
+  if (IsSilentEq(eq)) return 160*256;
   UInt_t hs = GetHSFromOffline(module);
-  if (!IsActiveHS(eq,hs)) return 160*256;
+  if (IsSilentHS(eq,hs)) return 160*256;
   for (UInt_t ch=0; ch<5; ch++) {
     UInt_t chip = GetChipFromOffline(module,ch*32);
-    if (!IsActiveChip(eq,hs,chip)) {
+    if (IsSilentChip(eq,hs,chip)) {
       nrSilent+=8192;
     }
     else {
@@ -1518,6 +1964,30 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilent(UInt_t module) const {
   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) {
@@ -1534,6 +2004,22 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead(UInt_t module) const {
   return nrDead;
 }
 //____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSparseDead(UInt_t module) const {
+  // returns the number of sparse dead pixels for a certain module
+  if (module>=240) {
+    Error("AliITSOnlineCalibrationSPDhandler::GetNrSparseDead", "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 gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
+    nrDead+=fNrSparseDead[gloChip];
+  }
+  return nrDead;
+}
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy(UInt_t module) const {
   // returns the number of noisy pixels for a certain module
   if (module>=240) {
@@ -1550,7 +2036,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy(UInt_t module) const {
   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;
@@ -1558,7 +2044,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t module, UInt_t in
   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;
@@ -1566,7 +2052,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t module, UInt_t i
   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;
@@ -1574,7 +2060,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t module, UInt_t inde
   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;
@@ -1582,7 +2068,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t module, UInt_t ind
   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;
@@ -1590,7 +2076,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t module, UInt_t in
   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;
@@ -1598,7 +2084,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t module, UInt_t i
   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;
@@ -1606,7 +2092,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t module, UInt_t ind
   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;
@@ -1614,7 +2100,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t module, UInt_t in
   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;
@@ -1622,7 +2108,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t module, UInt_t ind
   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;
@@ -1630,17 +2116,32 @@ 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 (!IsActiveEq(eq)) return 81920*6;
+  if (IsSilentEq(eq)) return 81920*6;
   for (UInt_t hs=0; hs<6; hs++) {
-    if (!IsActiveHS(eq,hs)) {
+    if (IsSilentHS(eq,hs)) {
       returnval+=81920;
       continue;
     }
     for (UInt_t chip=0; chip<10; chip++) {
-      if (!IsActiveChip(eq,hs,chip)) {
+      if (IsSilentChip(eq,hs,chip)) {
        returnval+=8192;
        continue;
       }
@@ -1663,6 +2164,17 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadEq(UInt_t eq) const {
   return returnval;
 }
 //____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSparseDeadEq(UInt_t eq) const {
+  // returns nr of dead for eq
+  UInt_t returnval=0;
+  for (UInt_t hs=0; hs<6; hs++) {
+    for (UInt_t chip=0; chip<10; chip++) {
+      returnval+=GetNrSparseDeadC(eq,hs,chip);
+    }
+  }
+  return returnval;
+}
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyEq(UInt_t eq) const {
   // returns nr of noisy for eq
   UInt_t returnval=0;
@@ -1694,7 +2206,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtEq(UInt_t eq, UInt_t ind
   }
 }
 //____________________________________________________________________________________________
-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;
@@ -1702,7 +2214,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtEq(UInt_t eq, UInt_t index)
   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;
@@ -1710,7 +2222,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtEq(UInt_t eq, UInt_t index
   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;
@@ -1718,7 +2230,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtEq(UInt_t eq, UInt_t inde
   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;
@@ -1726,7 +2238,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtEq(UInt_t eq, UInt_t ind
   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;
@@ -1734,7 +2246,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtEq(UInt_t eq, UInt_t index
   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;
@@ -1742,7 +2254,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtEq(UInt_t eq, UInt_t inde
   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;
@@ -1750,7 +2262,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtEq(UInt_t eq, UInt_t index
   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;
@@ -1758,9 +2270,22 @@ 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 (!(IsActiveEq(eq) && IsActiveHS(eq,hs) && IsActiveChip(eq,hs,chip))) return 8192;
+  if (IsSilentChip(eq,hs,chip)) return 8192;
   else return GetNrDeadC(eq,hs,chip);
 }
 //____________________________________________________________________________________________
@@ -1770,6 +2295,12 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC(UInt_t eq, UInt_t hs, UInt_
   return GetNrDeadC2(gloChip);
 }
 //____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSparseDeadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
+  // returns nr of sparse dead for chip
+  UInt_t gloChip = GetGloChip(eq,hs,chip);
+  return GetNrSparseDeadC2(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);
@@ -1841,7 +2372,7 @@ const Char_t* AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC(UInt_t eq,
     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 {
@@ -1865,7 +2396,7 @@ const Char_t* AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC(UInt_t eq,
     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 {
@@ -1880,10 +2411,13 @@ UInt_t AliITSOnlineCalibrationSPDhandler::AddSilentFrom(AliITSOnlineCalibrationS
 
   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);
       }
     }
   }
@@ -1940,8 +2474,8 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentDiff(AliITSOnlineCalibratio
   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) && IsActiveHS(eq,hs) && IsActiveChip(eq,hs,chip))) {
-         if (other->IsActiveEq(eq) && other->IsActiveHS(eq,hs) && other->IsActiveChip(eq,hs,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);
          }
@@ -2010,16 +2544,28 @@ AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDiff(Al
       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);
+       }
       }
     }
   }
@@ -2064,16 +2610,28 @@ AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetSilentD
       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);
+       }
       }
     }
   }
@@ -2133,7 +2691,7 @@ 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);
@@ -2157,7 +2715,7 @@ void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead(UInt_t module, UInt_
   }
 }
 //____________________________________________________________________________________________
-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);
@@ -2181,7 +2739,7 @@ void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy(UInt_t module, UInt
   }
 }
 //____________________________________________________________________________________________
-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)) {
 
@@ -2205,7 +2763,7 @@ void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead(UInt_t eq, UInt_t
   }
 }
 //____________________________________________________________________________________________
-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)) {
 
@@ -2229,7 +2787,7 @@ void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy(UInt_t eq, UInt_t
   }
 }
 //____________________________________________________________________________________________
-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()) {
     
@@ -2250,7 +2808,7 @@ void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead(UInt_t index, UIn
   }
 }
 //____________________________________________________________________________________________
-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()) {
     
@@ -2325,6 +2883,15 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC2(UInt_t gloChip) const {
   return fNrDead[gloChip];
 }
 //____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSparseDeadC2(UInt_t gloChip) const {
+  // returns nr of dead pixels on this chip
+  if (gloChip>=1200) {
+    Error("AliITSOnlineCalibrationSPDhandler::GetNrSparseDeadC2", "global chip nr (%d) out of bounds.",gloChip);
+    return 0;
+  }
+  return fNrSparseDead[gloChip];
+}
+//____________________________________________________________________________________________
 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2(UInt_t gloChip) const {
   // returns nr of noisy pixels on this chip
   if (gloChip>=1200) {
@@ -2495,8 +3062,10 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC2(UInt_t gloChip, UInt_t
 }
 //____________________________________________________________________________________________
 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++) {
@@ -2507,6 +3076,7 @@ void AliITSOnlineCalibrationSPDhandler::ActivateALL() {
 }
 //____________________________________________________________________________________________
 void AliITSOnlineCalibrationSPDhandler::ActivateEq(UInt_t eq, Bool_t setval) {
+  // activate eq
   if (eq>=20) {
     Error("AliITSOnlineCalibrationSPDhandler::ActivateEq", "eq (%d) out of bounds.",eq);
     return;
@@ -2515,6 +3085,7 @@ void AliITSOnlineCalibrationSPDhandler::ActivateEq(UInt_t eq, Bool_t 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;
@@ -2523,6 +3094,7 @@ void AliITSOnlineCalibrationSPDhandler::ActivateHS(UInt_t eq, UInt_t hs, Bool_t
 }
 //____________________________________________________________________________________________
 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;
@@ -2531,6 +3103,7 @@ void AliITSOnlineCalibrationSPDhandler::ActivateChip(UInt_t eq, UInt_t hs, UInt_
 }
 //____________________________________________________________________________________________
 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;
@@ -2539,6 +3112,7 @@ Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveEq(UInt_t eq) const {
 }
 //____________________________________________________________________________________________
 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;
@@ -2547,10 +3121,263 @@ Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveHS(UInt_t eq, UInt_t hs) const
 }
 //____________________________________________________________________________________________
 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));
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::IsNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
+  // returns true if there is at least a noisy pixel in the chip
+
+  if (eq>=20 || hs>=6 || chip>=10) {
+    Error("AliITSOnlineCalibrationSPDhandler::IsNoisyChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
+    return kFALSE;
+  }
+  Bool_t isNoisy = kFALSE;
+
+  UInt_t nrNoisy = GetNrNoisy();
+  for (UInt_t i=0; i<nrNoisy; i++) {
+    if(eq  == GetNoisyEqIdAt(i)){
+      if(hs  == GetNoisyHSAt(i)){
+        if(chip == GetNoisyChipAt(i)) {
+            UInt_t col  = GetNoisyColAt(i);
+            UInt_t row  = GetNoisyRowAt(i);
+            if (IsPixelNoisy(eq,hs,chip,col,row)) isNoisy = kTRUE;
+        }
+      }
+    }
+  }
+  return isNoisy;
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::WritePITConditionsToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
+  // writes noisy 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/OCDB");
+    }
+  }
+  else {
+    storageSTR = Form("%s",storage);
+    man->SetDefaultStorage(storageSTR.Data());
+  }
+  AliCDBMetaData* metaData = new AliCDBMetaData();
+  metaData->SetResponsible("Annalisa Mastroserio");
+  metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
+  AliCDBId idCalSPD("TRIGGER/SPD/PITConditions",runNrStart,runNrEnd);
+  AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)fTriggerConditions,idCalSPD,metaData);
+  man->Put(cdbEntry);
+  delete cdbEntry;
+  delete metaData;
+  return kTRUE;
+}
+
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::SetInactiveChipInPITmask(UInt_t eq, UInt_t hs, UInt_t chip){
+  //
+  fTriggerConditions->SetInActiveChip(eq,hs,chip);
+  return kTRUE;
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::UnSetInactiveChipInPITmask(UInt_t eq, UInt_t hs, UInt_t chip){
+  //
+  fTriggerConditions->SetInActiveChip(eq,hs,chip);
+  return kTRUE;
+}
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::PrintDiffInDead(AliITSOnlineCalibrationSPDhandler *other) const {
+  //
+  // Printout of the differences between two ocdb files for SPD Dead channel map
+  //
+  UInt_t nrChipOk=0;
+  UInt_t nrDeadChipOk=0; 
+  UInt_t nrDeadHsOk=0;
+  UInt_t nrDeadHs =0;
+  UInt_t nrDeadChip=0;
+  UInt_t nrDeadHsInOther =0;
+  UInt_t nrDeadChipInOther=0;
+  UInt_t nrMismatch =0;
+  UInt_t nrMismatchInOther =0;
+  printf("\n\n ****** loop over chips ***** \n");
+  for(Int_t eq=0; eq<20; eq++){
+   if(TMath::Abs((Int_t)GetNrBadEq(eq) - (Int_t)other->GetNrBadEq(eq)) >0) printf("-----> dead pixels differ in eq %i!   %i - %i in the other \n",eq,GetNrBadEq(eq),other->GetNrBadEq(eq));
+   for(Int_t hs=0; hs<6; hs++){
+    Short_t nchips =0;
+    Short_t nchipsOther =0;
+    Short_t nok=0;
+    for(Int_t chip=0; chip<10; chip++){
+      UInt_t chipkey = AliITSRawStreamSPD::GetOfflineChipKeyFromOnline(eq,hs,chip);
+     // test if everything is coherent
+     if(IsDeadChip(eq,hs,chip) && other->IsDeadChip(eq,hs,chip)) {
+      nok++;
+      nrChipOk++;
+      nrDeadChipOk++;
+     }
+     if(!IsDeadChip(eq,hs,chip) && !other->IsDeadChip(eq,hs,chip)) nrChipOk++;
+     // now testing if mismatches
+     if(IsDeadChip(eq,hs,chip)) {
+      nrDeadChip++;
+      nchips++;
+      if(!other->IsDeadChip(eq,hs,chip)) {
+        nrMismatch++;
+        printf("  mismatch -> eq %i  hs %i  chip %i is DEAD  - ALIVE in the other (chipkey %i)\n",eq,hs,chip,chipkey);
+       }
+      }
+     if(other->IsDeadChip(eq,hs,chip)){
+      nrDeadChipInOther++;
+      nchipsOther++;
+      if(!IsDeadChip(eq,hs,chip)) {
+       nrMismatchInOther++;
+       printf("  mismatch -> eq %i  hs %i  chip %i is ALIVE -  DEAD in the other (chipkey %i)\n",eq,hs,chip,chipkey);
+      }
+     }
+    }
+    if(nok==10) nrDeadHsOk++;
+    if(nchips==10) nrDeadHs++;
+    if(nchipsOther==10) nrDeadHsInOther++;
+   }
+  }
+
+printf("\n\n\n*************SUMMARY****************\n");
+printf(" BOTH have : %i Dead HS and %i Dead chips  with %i coherent chips \n",nrDeadHsOk,nrDeadChipOk,nrChipOk);
+printf("\n_________MISMATCH RESULTS___________\n");
+printf(" THIS  : Nr Dead HS %i - Nr Dead Chip %i \n",nrDeadHs,nrDeadChip);
+printf(" OTHER : Nr Dead HS %i - Nr Dead Chip %i \n",nrDeadHsInOther,nrDeadChipInOther);
+printf(" N Mismatches in Dead  chips (=ALIVE in the other) %i \n",nrMismatch);
+printf(" N Mismatches in Alive chips (=DEAD  in the other) %i \n",nrMismatchInOther);
+}
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::PrintDiffInPITmask(AliITSOnlineCalibrationSPDhandler *other) const {
+  //
+  // Printout of the differences between two ocdb files for SPD Dead channel map
+  //
+
+Int_t nOk =0;
+Int_t nMismatch =0;
+Int_t nMismatchInOther =0;
+
+printf("\n\n ****** loop over chips in PIT mask***** \n");
+for(Int_t eq=0; eq<20; eq++){
+  for(Int_t hs=0; hs<6; hs++){
+   for(Int_t chip=0; chip<10; chip++){
+
+  UInt_t chipkey = AliITSRawStreamSPD::GetOfflineChipKeyFromOnline(eq,hs,chip);
+
+  if(fTriggerConditions->IsChipActive(eq,hs,chip) && (other->GetTriggerConditions())->IsChipActive(eq,hs,chip)) nOk++;
+  if(fTriggerConditions->IsChipActive(eq,hs,chip) && !(other->GetTriggerConditions())->IsChipActive(eq,hs,chip)) {
+   nMismatch++;
+   printf("Mismatch -> eq %i  hs %i chip %i is ACTIVE - INACTIVE in the other (chipkey %i) \n",eq,hs,chip,chipkey);
+  }
+  if(!fTriggerConditions->IsChipActive(eq,hs,chip) && (other->GetTriggerConditions())->IsChipActive(eq,hs,chip)) {
+   nMismatchInOther++;
+   printf("Mismatch -> eq %i  hs %i chip %i is INACTIVE - ACTIVE in the other (chipkey %i) \n",eq,hs,chip,chipkey);
+   }
+  if(!fTriggerConditions->IsChipActive(eq,hs,chip) && !(other->GetTriggerConditions())->IsChipActive(eq,hs,chip)) nOk++;
+  }
+ }
+}
+
+printf("n Chips OK %i : ACTIVE mismatch %i  - INACTIVE mismatch in %i \n",nOk,nMismatch,nMismatchInOther);
+
+}