#include "AliITSOnlineCalibrationSPDhandler.h"
#include "AliITSOnlineCalibrationSPD.h"
+#include "AliITSTriggerConditions.h"
#include "AliITSIntMap.h"
#include <TObjArray.h>
#include <TArrayI.h>
/* $Id$ */
+using std::ifstream;
+using std::ofstream;
+
//____________________________________________________________________________________________
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();
}
//____________________________________________________________________________________________
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++) {
// ClearMaps();
for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
delete fDeadPixelMap[gloChip];
+ delete fSparseDeadPixelMap[gloChip];
delete fNoisyPixelMap[gloChip];
}
}
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++) {
UnSetDeadALL();
for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
fNrDead[gloChip]=0;
+ fNrSparseDead[gloChip]=0;
fDeadPixelMap[gloChip]->Clear();
+ fSparseDeadPixelMap[gloChip]->Clear();
}
}
//____________________________________________________________________________________________
if (fDeadPixelMap[gloChip]->Remove(key)) {
fNrDead[gloChip]--;
}
+ if (fSparseDeadPixelMap[gloChip]->Remove(key)) {
+ fNrSparseDead[gloChip]--;
+ }
}
}
}
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++) {
}
}
else {
- storageSTR = Form("local://%s",storage);
+ storageSTR = Form("%s",storage);
man->SetDefaultStorage(storageSTR.Data());
}
AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
}
}
else {
- storageSTR = Form("local://%s",storage);
+ storageSTR = Form("%s",storage);
man->SetDefaultStorage(storageSTR.Data());
}
AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
}
}
else {
- storageSTR = Form("local://%s",storage);
+ storageSTR = Form("%s",storage);
man->SetDefaultStorage(storageSTR.Data());
}
AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
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, 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
}
}
else {
- storageSTR = Form("local://%s",storage);
+ storageSTR = Form("%s",storage);
man->SetDefaultStorage(storageSTR.Data());
}
AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
}
}
else {
- storageSTR = Form("local://%s",storage);
+ storageSTR = Form("%s",storage);
man->SetDefaultStorage(storageSTR.Data());
}
AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
return kTRUE;
}
//____________________________________________________________________________________________
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromCalibObj(TObjArray* calObj) {
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromCalibObj(const TObjArray* calObj) {
// reads dead pixels from calib object
for (UInt_t module=0; module<240; module++) {
AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*)calObj->At(module);
return kTRUE;
}
//____________________________________________________________________________________________
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromCalibObj(TObjArray* calObj) {
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromCalibObj(const TObjArray* calObj) {
// reads noisy pixels from calib object
for (UInt_t module=0; module<240; module++) {
AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*)calObj->At(module);
}
}
else {
- storageSTR = Form("local://%s",storage);
+ storageSTR = Form("%s",storage);
man->SetDefaultStorage(storageSTR.Data());
}
AliCDBMetaData* metaData = new AliCDBMetaData();
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
}
}
else {
- storageSTR = Form("local://%s",storage);
+ storageSTR = Form("%s",storage);
man->SetDefaultStorage(storageSTR.Data());
}
AliCDBMetaData* metaData = new AliCDBMetaData();
}
}
else {
- storageSTR = Form("local://%s",storage);
+ storageSTR = Form("%s",storage);
man->SetDefaultStorage(storageSTR.Data());
}
AliCDBMetaData* metaData = new AliCDBMetaData();
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;
return returnArray;
}
//____________________________________________________________________________________________
+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=GetNrSparseDead(module);
+ returnArray.Set(size*2);
+ UInt_t gloIndex=0;
+ for (UInt_t ch=0; ch<5; ch++) {
+ 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;
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,6,GetNrSilentEq(eq),6,GetNrDeadEq(eq),6,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::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");
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);
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);
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);
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);
// 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);
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;
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) {
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;
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);
return GetNrSilent() - tmpdead;
}
//____________________________________________________________________________________________
-UInt_t AliITSOnlineCalibrationSPDhandler::AddDeadFrom(AliITSOnlineCalibrationSPDhandler* other) {
+UInt_t AliITSOnlineCalibrationSPDhandler::AddDeadFrom(const AliITSOnlineCalibrationSPDhandler* other) {
// returns number of new dead pixels in this' list
UInt_t returnval=0;
for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
return returnval;
}
//____________________________________________________________________________________________
-UInt_t AliITSOnlineCalibrationSPDhandler::AddNoisyFrom(AliITSOnlineCalibrationSPDhandler* other) {
+UInt_t AliITSOnlineCalibrationSPDhandler::AddNoisyFrom(const AliITSOnlineCalibrationSPDhandler* other) {
// returns number of new noisy pixels in this' list
UInt_t returnval=0;
for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
return returnval;
}
//____________________________________________________________________________________________
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadDiff(const AliITSOnlineCalibrationSPDhandler* other) const {
// returns nr of dead in this' lists and not in other's lists
UInt_t returnval=0;
for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
return returnval;
}
//____________________________________________________________________________________________
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyDiff(const AliITSOnlineCalibrationSPDhandler* other) const {
// returns nr of noisy in this' lists and not in other's lists
UInt_t returnval=0;
for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
return returnval;
}
//____________________________________________________________________________________________
-AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDiff(AliITSOnlineCalibrationSPDhandler* other) const {
+AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDiff(const AliITSOnlineCalibrationSPDhandler* other) const {
// returns handler with active/dead/noisy in this' lists, removing those that are in other's lists
AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
return newHandler;
}
//____________________________________________________________________________________________
-AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetSilentDiff(AliITSOnlineCalibrationSPDhandler* other) const {
+AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetSilentDiff(const AliITSOnlineCalibrationSPDhandler* other) const {
// returns handler with active/dead in this' lists, removing those that are in other's lists
AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
return newHandler;
}
//____________________________________________________________________________________________
-AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
+AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDeadDiff(const AliITSOnlineCalibrationSPDhandler* other) const {
// returns handler with dead in this' lists, except for those in other's lists
AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
return newHandler;
}
//____________________________________________________________________________________________
-AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
+AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetNoisyDiff(const AliITSOnlineCalibrationSPDhandler* other) const {
// returns handler with noisy in this' lists, except for those in other's lists
AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
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) {
// 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++) {
}
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);
+
+}