X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITSOnlineCalibrationSPDhandler.cxx;h=14a921984a67ea6de9cd6785fe72430e877b930b;hb=d583ec694806e6936bbf4a9c941a8ad1eaebae28;hp=020de9f641f1f6d9ca1d338827674a3fc46c64d5;hpb=f9e8ab3f271bf55b2cd5af36ed6a0bc321dade91;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSOnlineCalibrationSPDhandler.cxx b/ITS/AliITSOnlineCalibrationSPDhandler.cxx index 020de9f641f..14a921984a6 100644 --- a/ITS/AliITSOnlineCalibrationSPDhandler.cxx +++ b/ITS/AliITSOnlineCalibrationSPDhandler.cxx @@ -13,6 +13,7 @@ #include "AliITSOnlineCalibrationSPDhandler.h" #include "AliITSOnlineCalibrationSPD.h" +#include "AliITSTriggerConditions.h" #include "AliITSIntMap.h" #include #include @@ -29,15 +30,21 @@ /* $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(); @@ -45,17 +52,21 @@ AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler(): } //____________________________________________________________________________________________ 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++) { @@ -70,6 +81,7 @@ AliITSOnlineCalibrationSPDhandler::~AliITSOnlineCalibrationSPDhandler() { // ClearMaps(); for (UInt_t gloChip=0; gloChip<1200; gloChip++) { delete fDeadPixelMap[gloChip]; + delete fSparseDeadPixelMap[gloChip]; delete fNoisyPixelMap[gloChip]; } } @@ -80,12 +92,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++) { @@ -110,7 +125,9 @@ void AliITSOnlineCalibrationSPDhandler::ResetDead() { UnSetDeadALL(); for (UInt_t gloChip=0; gloChip<1200; gloChip++) { fNrDead[gloChip]=0; + fNrSparseDead[gloChip]=0; fDeadPixelMap[gloChip]->Clear(); + fSparseDeadPixelMap[gloChip]->Clear(); } } //____________________________________________________________________________________________ @@ -132,6 +149,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]--; + } } } } @@ -382,6 +402,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++) { @@ -505,17 +554,17 @@ void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFile(UInt_t eq) { } //____________________________________________________________________________________________ #ifndef SPD_DA_OFF -Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB(UInt_t module, Int_t runNr, Char_t *storage, 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(); TString storageSTR = Form("%s",storage); if (storageSTR.CompareTo("default")==0) { if(!man->IsDefaultStorageSet()) { - man->SetDefaultStorage("local://$ALICE_ROOT"); + man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); } } else { - storageSTR = Form("local://%s",storage); + storageSTR = Form("%s",storage); man->SetDefaultStorage(storageSTR.Data()); } AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr); @@ -558,17 +607,17 @@ Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB(UInt_t module, In return kTRUE; } //____________________________________________________________________________________________ -Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB(UInt_t module, Int_t runNr, Char_t *storage, 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(); TString storageSTR = Form("%s",storage); if (storageSTR.CompareTo("default")==0) { if(!man->IsDefaultStorageSet()) { - man->SetDefaultStorage("local://$ALICE_ROOT"); + man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); } } else { - storageSTR = Form("local://%s",storage); + storageSTR = Form("%s",storage); man->SetDefaultStorage(storageSTR.Data()); } AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr); @@ -599,24 +648,24 @@ Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB(UInt_t module, I return kTRUE; } //____________________________________________________________________________________________ -Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromDB(Int_t runNr, Char_t *storage, 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,storage,treeSerial) && ReadDeadFromDB(runNr,storage,treeSerial)); } //____________________________________________________________________________________________ -Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB(Int_t runNr, Char_t *storage, 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(); TString storageSTR = Form("%s",storage); if (storageSTR.CompareTo("default")==0) { if(!man->IsDefaultStorageSet()) { - man->SetDefaultStorage("local://$ALICE_ROOT"); + man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); } } else { - storageSTR = Form("local://%s",storage); + storageSTR = Form("%s",storage); man->SetDefaultStorage(storageSTR.Data()); } AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr); @@ -662,18 +711,75 @@ Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB(Int_t runNr, Char_t *st return kTRUE; } //____________________________________________________________________________________________ -Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB(Int_t runNr, Char_t *storage, Bool_t treeSerial) { +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; indexGetBadColAt(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 AliCDBManager* man = AliCDBManager::Instance(); TString storageSTR = Form("%s",storage); if (storageSTR.CompareTo("default")==0) { if(!man->IsDefaultStorageSet()) { - man->SetDefaultStorage("local://$ALICE_ROOT"); + man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); } } else { - storageSTR = Form("local://%s",storage); + storageSTR = Form("%s",storage); man->SetDefaultStorage(storageSTR.Data()); } AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr); @@ -708,18 +814,18 @@ Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB(Int_t runNr, Char_t *s return kTRUE; } //____________________________________________________________________________________________ -Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDBasNoisy(Int_t runNr, Char_t *storage, Bool_t treeSerial) { +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"); + man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); } } else { - storageSTR = Form("local://%s",storage); + storageSTR = Form("%s",storage); man->SetDefaultStorage(storageSTR.Data()); } AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr); @@ -765,7 +871,7 @@ Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDBasNoisy(Int_t runNr, Cha 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); @@ -786,7 +892,7 @@ Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromCalibObj(TObjArray* calObj 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); @@ -797,24 +903,24 @@ Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromCalibObj(TObjArray* calOb return kTRUE; } //____________________________________________________________________________________________ -Bool_t AliITSOnlineCalibrationSPDhandler::WriteToDB(Int_t runNrStart, Int_t runNrEnd, Char_t *storage) { +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,storage) && WriteDeadToDB(runNrStart,runNrEnd,storage)); } //____________________________________________________________________________________________ -Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDB(Int_t runNrStart, Int_t runNrEnd, Char_t *storage) { +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(); TString storageSTR = Form("%s",storage); if (storageSTR.CompareTo("default")==0) { if(!man->IsDefaultStorageSet()) { - man->SetDefaultStorage("local://$ALICE_ROOT"); + man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); } } else { - storageSTR = Form("local://%s",storage); + storageSTR = Form("%s",storage); man->SetDefaultStorage(storageSTR.Data()); } AliCDBMetaData* metaData = new AliCDBMetaData(); @@ -850,18 +956,66 @@ Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDB(Int_t runNrStart, Int_t return kTRUE; } //____________________________________________________________________________________________ -Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDBasNoisy(Int_t runNrStart, Int_t runNrEnd, Char_t *storage) { +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"); + man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); } } else { - storageSTR = Form("local://%s",storage); + 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(); @@ -897,18 +1051,18 @@ Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDBasNoisy(Int_t runNrStart, return kTRUE; } //____________________________________________________________________________________________ -Bool_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToDB(Int_t runNrStart, Int_t runNrEnd, Char_t *storage) { +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(); TString storageSTR = Form("%s",storage); if (storageSTR.CompareTo("default")==0) { if(!man->IsDefaultStorageSet()) { - man->SetDefaultStorage("local://$ALICE_ROOT"); + man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); } } else { - storageSTR = Form("local://%s",storage); + storageSTR = Form("%s",storage); man->SetDefaultStorage(storageSTR.Data()); } AliCDBMetaData* metaData = new AliCDBMetaData(); @@ -943,6 +1097,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; @@ -1073,6 +1236,34 @@ TArrayS AliITSOnlineCalibrationSPDhandler::GetDeadArray(UInt_t module, Bool_t tr 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; indexGetKeyIndex(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; @@ -1160,7 +1351,7 @@ 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,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)); } } //____________________________________________________________________________________________ @@ -1250,6 +1441,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; indexGetKeyIndex(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"); @@ -1294,6 +1508,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); @@ -1327,6 +1563,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); @@ -1352,6 +1598,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); @@ -1377,6 +1638,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); @@ -1422,7 +1693,7 @@ Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisy(UInt_t eq, UInt_t hs, UIn // 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); @@ -1558,6 +1829,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; @@ -1727,6 +2007,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) { @@ -1871,6 +2167,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; @@ -1991,6 +2298,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); @@ -2117,7 +2430,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::AddSilentFrom(AliITSOnlineCalibrationS 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++) { @@ -2135,7 +2448,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::AddDeadFrom(AliITSOnlineCalibrationSPD 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++) { @@ -2187,7 +2500,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentDiff(AliITSOnlineCalibratio 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++) { @@ -2206,7 +2519,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadDiff(AliITSOnlineCalibrationS 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++) { @@ -2225,7 +2538,7 @@ UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyDiff(AliITSOnlineCalibration 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(); @@ -2291,7 +2604,7 @@ AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDiff(Al 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(); @@ -2343,7 +2656,7 @@ AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetSilentD 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++) { @@ -2362,7 +2675,7 @@ AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDeadDif 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++) { @@ -2573,6 +2886,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) { @@ -2746,6 +3068,7 @@ 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++) { @@ -2902,3 +3225,162 @@ Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentChip(UInt_t eq, UInt_t hs, UIn } 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; iIsDefaultStorageSet()) { + 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); + +} +