1 //////////////////////////////////////////////////////////////////////
2 // Author: Henrik Tydesjo //
3 // For easier handling of dead and noisy pixels they are kept in //
4 // container maps (AliITSIntMap). //
5 // Handling of inactive equipments,HSs,chips have been added. //
6 // A pixel that is either dead or inactive is called SILENT here. //
7 // The lists of single dead and noisy pixels are separated from the //
8 // information about which eq/hs/chip are inactive. //
9 // The TArrayS objects that are put in the AliITSCalibrationSPD //
10 // objects can be obtained from the methods GetDeadArray and //
12 //////////////////////////////////////////////////////////////////////
14 #include "AliITSOnlineCalibrationSPDhandler.h"
15 #include "AliITSOnlineCalibrationSPD.h"
16 #include "AliITSTriggerConditions.h"
17 #include "AliITSIntMap.h"
18 #include <TObjArray.h>
25 #ifndef SPD_DA_OFF // you may want to exclude cdb classes, if using this class outside aliroot
26 #include "AliITSCalibrationSPD.h"
27 #include "AliCDBManager.h"
28 #include "AliCDBEntry.h"
33 //____________________________________________________________________________________________
34 AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler():
39 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
41 fNrSparseDead[gloChip]=0;
43 fDeadPixelMap[gloChip] = new AliITSIntMap();
44 fSparseDeadPixelMap[gloChip] = new AliITSIntMap();
45 fNoisyPixelMap[gloChip] = new AliITSIntMap();
50 //____________________________________________________________________________________________
51 AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler(const AliITSOnlineCalibrationSPDhandler& handle):
53 fTriggerConditions(handle.fTriggerConditions)
56 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
57 fNrDead[gloChip] = handle.fNrDead[gloChip];
58 fNrSparseDead[gloChip] = handle.fNrSparseDead[gloChip];
59 fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
60 fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
61 fSparseDeadPixelMap[gloChip] = handle.fSparseDeadPixelMap[gloChip]->Clone();
62 fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
64 for (UInt_t eq=0; eq<20; eq++) {
65 fActiveEq[eq] = handle.fActiveEq[eq];
66 fDeadEq[eq]=handle.fDeadEq[eq];
67 for (UInt_t hs=0; hs<6; hs++) {
68 fActiveHS[eq][hs] = handle.fActiveHS[eq][hs];
69 for (UInt_t chip=0; chip<10; chip++) {
70 fActiveChip[eq][hs][chip] = handle.fActiveChip[eq][hs][chip];
74 fFileLocation = handle.fFileLocation;
76 //____________________________________________________________________________________________
77 AliITSOnlineCalibrationSPDhandler::~AliITSOnlineCalibrationSPDhandler() {
79 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
80 delete fDeadPixelMap[gloChip];
81 delete fDeadPixelMap[gloChip];
82 delete fNoisyPixelMap[gloChip];
85 //____________________________________________________________________________________________
86 AliITSOnlineCalibrationSPDhandler& AliITSOnlineCalibrationSPDhandler::operator=(const AliITSOnlineCalibrationSPDhandler& handle) {
87 // assignment operator
90 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
91 fNrDead[gloChip] = handle.fNrDead[gloChip];
92 fNrSparseDead[gloChip] = handle.fNrSparseDead[gloChip];
93 fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
94 fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
95 fSparseDeadPixelMap[gloChip] = handle.fSparseDeadPixelMap[gloChip]->Clone();
96 fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
98 for (UInt_t eq=0; eq<20; eq++) {
99 fActiveEq[eq] = handle.fActiveEq[eq];
100 fDeadEq[eq] = handle.fDeadEq[eq];
101 for (UInt_t hs=0; hs<6; hs++) {
102 fActiveHS[eq][hs] = handle.fActiveHS[eq][hs];
103 for (UInt_t chip=0; chip<10; chip++) {
104 fActiveChip[eq][hs][chip] = handle.fActiveChip[eq][hs][chip];
108 fFileLocation = handle.fFileLocation;
112 //____________________________________________________________________________________________
113 void AliITSOnlineCalibrationSPDhandler::ClearMaps() {
114 // clear the lists of dead and noisy
119 //____________________________________________________________________________________________
120 void AliITSOnlineCalibrationSPDhandler::ResetDead() {
121 // reset the dead pixel map and inactive eq,hs,chip
123 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
125 fNrSparseDead[gloChip]=0;
126 fDeadPixelMap[gloChip]->Clear();
127 fSparseDeadPixelMap[gloChip]->Clear();
130 //____________________________________________________________________________________________
131 void AliITSOnlineCalibrationSPDhandler::ResetNoisy() {
132 // clear the list of noisy pixels
133 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
135 fNoisyPixelMap[gloChip]->Clear();
138 //____________________________________________________________________________________________
139 void AliITSOnlineCalibrationSPDhandler::ResetDeadForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
140 // clear the dead pixels for this chip
141 SetDeadChip(eq,hs,chip,kFALSE);
142 UInt_t gloChip = GetGloChip(eq,hs,chip);
143 for (UInt_t col=0; col<32; col++) {
144 for (UInt_t row=0; row<256; row++) {
145 Int_t key = GetKey(eq,hs,chip,col,row);
146 if (fDeadPixelMap[gloChip]->Remove(key)) {
149 if (fSparseDeadPixelMap[gloChip]->Remove(key)) {
150 fNrSparseDead[gloChip]--;
155 //____________________________________________________________________________________________
156 void AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
157 // clear the noisy pixels for this chip
158 UInt_t gloChip = GetGloChip(eq,hs,chip);
160 Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip","global chip nr (%d) out of bounds\n",gloChip);
163 for (UInt_t col=0; col<32; col++) {
164 for (UInt_t row=0; row<256; row++) {
165 Int_t key = GetKey(eq,hs,chip,col,row);
166 if (fNoisyPixelMap[gloChip]->Remove(key)) {
172 //____________________________________________________________________________________________
173 void AliITSOnlineCalibrationSPDhandler::ResetDeadForEq(UInt_t eq) {
174 // clear the dead pixels for this eq
176 Error("AliITSOnlineCalibrationSPDhandler::ResetDeadForEq", "eq (%d) out of bounds.",eq);
179 for (UInt_t hs=0; hs<6; hs++) {
180 for (UInt_t chip=0; chip<10; chip++) {
181 ResetDeadForChip(eq, hs, chip);
185 //____________________________________________________________________________________________
186 void AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq(UInt_t eq) {
187 // clear the noisy pixels for this eq
189 Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq", "eq (%d) out of bounds.",eq);
192 for (UInt_t hs=0; hs<6; hs++) {
193 for (UInt_t chip=0; chip<10; chip++) {
194 ResetNoisyForChip(eq, hs, chip);
200 //____________________________________________________________________________________________
201 Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromFiles() {
202 // read files from file location (active,dead,noisy info). returns true if at least one file found
203 Bool_t b1 = ReadNoisyFromFiles();
204 Bool_t b2 = ReadSilentFromFiles();
207 //____________________________________________________________________________________________
208 Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFiles() {
209 // read dead,active files from file location. returns true if at least one file found
210 Bool_t returnval=kFALSE;
211 for (UInt_t eq=0; eq<20; eq++) {
212 if (ReadSilentFromFile(eq)) {
218 //____________________________________________________________________________________________
219 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFiles() {
220 // read dead,active files from file location. returns true if at least one file found
221 Bool_t returnval=kFALSE;
222 for (UInt_t eq=0; eq<20; eq++) {
223 if (ReadDeadFromFile(eq)) {
229 //____________________________________________________________________________________________
230 Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFile(UInt_t eq) {
231 // read dead file for eq from file location.
232 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
233 return ReadSilentFromFileName(fileName.Data());
235 //____________________________________________________________________________________________
236 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFile(UInt_t eq) {
237 // read dead file for eq from file location.
238 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
239 return ReadDeadFromFileName(fileName.Data());
241 //____________________________________________________________________________________________
242 Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFileName(const char *fileName) {
243 // read dead from file fileName (including inactive)
244 return ReadDeadFromFileName(fileName, kTRUE);
246 //____________________________________________________________________________________________
247 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFileName(const char *fileName, Bool_t inactive) {
248 // read dead from file fileName
249 AliITSOnlineCalibrationSPD* calib;
250 FILE* fp0 = fopen(fileName, "r");
251 if (fp0 == NULL) {return kFALSE;}
254 TFile file(fileName, "READ");
256 file.GetObject("AliITSOnlineCalibrationSPD", calib);
259 UInt_t nrDead=calib->GetNrBad();
260 for (UInt_t index=0; index<nrDead; index++) {
261 UInt_t key = calib->GetKeyAt(index);
262 UInt_t eq = GetEqIdFromKey(key);
263 UInt_t hs = GetHSFromKey(key);
264 UInt_t chip = GetChipFromKey(key);
265 UInt_t col = GetColFromKey(key);
266 UInt_t row = GetRowFromKey(key);
267 SetDeadPixel(eq,hs,chip,col,row);
269 UInt_t eq1 = calib->GetEqNr();
270 if (calib->IsDeadEq()) SetDeadEq(eq1);
271 else SetDeadEq(eq1,kFALSE);
272 for (UInt_t hs=0; hs<6; hs++) {
273 if (calib->IsDeadHS(hs)) SetDeadHS(eq1,hs);
274 else SetDeadHS(eq1,hs,kFALSE);
275 for (UInt_t chip=0; chip<10; chip++) {
276 if (calib->IsDeadChip(hs,chip)) SetDeadChip(eq1,hs,chip);
277 else SetDeadChip(eq1,hs,chip,kFALSE);
281 UInt_t eq = calib->GetEqNr();
282 if (calib->IsActiveEq()) ActivateEq(eq);
283 else ActivateEq(eq,kFALSE);
284 for (UInt_t hs=0; hs<6; hs++) {
285 if (calib->IsActiveHS(hs)) ActivateHS(eq,hs);
286 else ActivateHS(eq,hs,kFALSE);
287 for (UInt_t chip=0; chip<10; chip++) {
288 if (calib->IsActiveChip(hs,chip)) ActivateChip(eq,hs,chip);
289 else ActivateChip(eq,hs,chip,kFALSE);
298 //____________________________________________________________________________________________
299 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFiles() {
300 // read noisy files from file location. returns true if at least one file found
301 Bool_t returnval=kFALSE;
302 for (UInt_t eq=0; eq<20; eq++) {
303 if (ReadNoisyFromFile(eq)) {
309 //____________________________________________________________________________________________
310 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFile(UInt_t eq) {
311 // read noisy file for eq from file location.
312 TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
313 return ReadNoisyFromFileName(fileName.Data());
315 //____________________________________________________________________________________________
316 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFileName(const char *fileName) {
317 // read noisy from file fileName
318 AliITSOnlineCalibrationSPD* calib;
319 FILE* fp0 = fopen(fileName, "r");
320 if (fp0 == NULL) {return kFALSE;}
323 TFile file(fileName, "READ");
325 file.GetObject("AliITSOnlineCalibrationSPD", calib);
328 UInt_t nrNoisy=calib->GetNrBad();
329 for (UInt_t index=0; index<nrNoisy; index++) {
330 UInt_t key = calib->GetKeyAt(index);
331 UInt_t eq = GetEqIdFromKey(key);
332 UInt_t hs = GetHSFromKey(key);
333 UInt_t chip = GetChipFromKey(key);
334 UInt_t col = GetColFromKey(key);
335 UInt_t row = GetRowFromKey(key);
336 SetNoisyPixel(eq,hs,chip,col,row);
343 //____________________________________________________________________________________________
344 UInt_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromText(const char *fileName, UInt_t module) {
345 // read dead from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
346 // insert only those pixels that belong to module (or all if module=240).
349 textFile.open(fileName, ifstream::in);
350 if (textFile.fail()) {
351 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromText","No dead text file (%s) present.",fileName);
355 UInt_t eq,hs,chip,col,row;
356 textFile >> eq; if (textFile.eof()) break;
357 textFile >> hs; if (textFile.eof()) break;
358 textFile >> chip; if (textFile.eof()) break;
359 textFile >> col; if (textFile.eof()) break;
361 if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){
362 if (SetDeadPixel(eq,hs,chip,col,row)) {
366 if (textFile.eof()) break;
372 //____________________________________________________________________________________________
373 UInt_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText(const char *fileName, UInt_t module) {
374 // read noisy from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
375 // insert only those pixels that belong to module (or all if module=240).
378 textFile.open(fileName, ifstream::in);
379 if (textFile.fail()) {
380 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText","No noisy text file (%s) present.",fileName);
384 UInt_t eq,hs,chip,col,row;
385 textFile >> eq; if (textFile.eof()) break;
386 textFile >> hs; if (textFile.eof()) break;
387 textFile >> chip; if (textFile.eof()) break;
388 textFile >> col; if (textFile.eof()) break;
390 if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){
391 if (SetNoisyPixel(eq,hs,chip,col,row)) {
395 if (textFile.eof()) break;
401 //____________________________________________________________________________________________
402 void AliITSOnlineCalibrationSPDhandler::ReadPITConditionsFromText(const char *fileName) {
403 // read PIT conditions file from text as printed out at P2
404 // !!! please note that the chip numbering goes from 9 to 0 in the text. In PVSS panels is the opposite.
405 if(fTriggerConditions) fTriggerConditions->ResetAll();
406 else fTriggerConditions = new AliITSTriggerConditions();
407 fTriggerConditions->ReadFromTextFile(fileName);
409 //____________________________________________________________________________________________
410 Bool_t AliITSOnlineCalibrationSPDhandler::ReadPITConditionsFromDB(Int_t runNr, const Char_t *storage){
411 // read PIT conditions from the OCDB
413 AliCDBManager* man = AliCDBManager::Instance();
414 TString storageSTR = Form("%s",storage);
415 if (storageSTR.CompareTo("default")==0) {
416 if(!man->IsDefaultStorageSet()) {
417 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
421 storageSTR = Form("%s",storage);
422 man->SetDefaultStorage(storageSTR.Data());
424 AliCDBEntry *cdbEntry = man->Get("TRIGGER/SPD/PITConditions", runNr);
426 fTriggerConditions = (AliITSTriggerConditions*)cdbEntry->GetObject();
428 } else return kFALSE;
430 //____________________________________________________________________________________________
431 void AliITSOnlineCalibrationSPDhandler::WriteToFilesAlways() {
432 // write the lists of active,dead,noisy to files
433 for (UInt_t eq=0; eq<20; eq++) {
434 WriteSilentToFile(eq);
435 WriteNoisyToFile(eq);
438 //____________________________________________________________________________________________
439 UInt_t AliITSOnlineCalibrationSPDhandler::WriteToFiles() {
440 // write the lists of dead and noisy to files (only if there are >0 dead or noisy pixels) , returns nr of files produced
441 return (WriteNoisyToFiles() + WriteSilentToFiles());
443 //____________________________________________________________________________________________
444 void AliITSOnlineCalibrationSPDhandler::WriteSilentToFilesAlways() {
445 // write the lists of silent to files
446 for (UInt_t eq=0; eq<20; eq++) {
447 WriteSilentToFile(eq);
450 //____________________________________________________________________________________________
451 void AliITSOnlineCalibrationSPDhandler::WriteDeadToFilesAlways() {
452 // write the lists of dead to files
453 for (UInt_t eq=0; eq<20; eq++) {
457 //____________________________________________________________________________________________
458 void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFilesAlways() {
459 // write the lists of noisy to files
460 for (UInt_t eq=0; eq<20; eq++) {
461 WriteNoisyToFile(eq);
464 //____________________________________________________________________________________________
465 UInt_t AliITSOnlineCalibrationSPDhandler::WriteSilentToFiles() {
466 // write the list of silent to file (only if there are >0 silent pixels) , returns nr of files produced
468 for (UInt_t eq=0; eq<20; eq++) {
469 if (GetNrSilentEq(eq) > 0) {
470 WriteSilentToFile(eq);
476 //____________________________________________________________________________________________
477 UInt_t AliITSOnlineCalibrationSPDhandler::WriteDeadToFiles() {
478 // write the list of dead to file (only if there are >0 dead pixels) , returns nr of files produced
480 for (UInt_t eq=0; eq<20; eq++) {
481 if (GetNrDeadEq(eq) > 0) {
488 //____________________________________________________________________________________________
489 UInt_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToFiles() {
490 // write the list of noisy to file (only if there are >0 noisy pixels) , returns nr of files produced
492 for (UInt_t eq=0; eq<20; eq++) {
493 if (GetNrNoisyEq(eq) > 0) {
494 WriteNoisyToFile(eq);
500 //____________________________________________________________________________________________
501 void AliITSOnlineCalibrationSPDhandler::WriteSilentToFile(UInt_t eq) {
502 WriteDeadToFile(eq,kTRUE);
504 //____________________________________________________________________________________________
505 void AliITSOnlineCalibrationSPDhandler::WriteDeadToFile(UInt_t eq, Bool_t inactive) {
506 // write the lists of dead (and inactive if input boolean is true) for eq to file
507 AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
509 calib->SetBadList(GetDeadArrayOnline(eq));
510 calib->SetNrBad(GetNrDeadEq(eq));
511 if (IsDeadEq(eq)) calib->SetDeadEq();
512 else calib->SetDeadEq(kFALSE);
513 for (UInt_t hs=0; hs<6; hs++) {
514 if (IsDeadHS(eq,hs)) calib->SetDeadHS(hs);
515 else calib->SetDeadHS(hs,kFALSE);
516 for (UInt_t chip=0; chip<10; chip++) {
517 if (IsDeadChip(eq,hs,chip)) calib->SetDeadChip(hs,chip);
518 else calib->SetDeadChip(hs,chip,kFALSE);
522 if (IsActiveEq(eq)) calib->ActivateEq();
523 else calib->ActivateEq(kFALSE);
524 for (UInt_t hs=0; hs<6; hs++) {
525 if (IsActiveHS(eq,hs)) calib->ActivateHS(hs);
526 else calib->ActivateHS(hs,kFALSE);
527 for (UInt_t chip=0; chip<10; chip++) {
528 if (IsActiveChip(eq,hs,chip)) calib->ActivateChip(hs,chip);
529 else calib->ActivateChip(hs,chip,kFALSE);
533 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
534 TFile file(fileName.Data(), "RECREATE");
535 file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
539 //____________________________________________________________________________________________
540 void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFile(UInt_t eq) {
541 // write the lists of noisy for eq to file
542 AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
544 calib->SetBadList(GetNoisyArrayOnline(eq));
545 calib->SetNrBad(GetNrNoisyEq(eq));
546 TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
547 TFile file(fileName.Data(), "RECREATE");
548 file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
552 //____________________________________________________________________________________________
554 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB(UInt_t module, Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
555 // reads dead pixels from DB for given module and runNr
556 AliCDBManager* man = AliCDBManager::Instance();
557 TString storageSTR = Form("%s",storage);
558 if (storageSTR.CompareTo("default")==0) {
559 if(!man->IsDefaultStorageSet()) {
560 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
564 storageSTR = Form("%s",storage);
565 man->SetDefaultStorage(storageSTR.Data());
567 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
570 spdEntry = (TObjArray*)cdbEntry->GetObject();
571 if(!spdEntry) return kFALSE;
574 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB","Calibration for run %d not found in database.",runNr);
577 AliITSCalibrationSPD* calibSPD;
578 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
580 UInt_t nrDead = calibSPD->GetNrBadSingle();
582 if (!treeSerial) RecursiveInsertDead(calibSPD,module,0,nrDead-1);
584 for (UInt_t index=0; index<nrDead; index++) {
585 UInt_t colM = calibSPD->GetBadColAt(index);
586 UInt_t rowM = calibSPD->GetBadRowAt(index);
587 SetDeadPixelM(module,colM,rowM);
591 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
592 UInt_t eq,hs,chip,col,row;
593 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
594 if (calibSPD->IsChipBad(chipIndex)) {
595 SetDeadChip(eq,hs,chip);
598 SetDeadChip(eq,hs,chip,kFALSE);
602 spdEntry->SetOwner(kTRUE);
606 //____________________________________________________________________________________________
607 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB(UInt_t module, Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
608 // reads noisy pixels from DB for given module and runNr
609 AliCDBManager* man = AliCDBManager::Instance();
610 TString storageSTR = Form("%s",storage);
611 if (storageSTR.CompareTo("default")==0) {
612 if(!man->IsDefaultStorageSet()) {
613 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
617 storageSTR = Form("%s",storage);
618 man->SetDefaultStorage(storageSTR.Data());
620 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
623 spdEntry = (TObjArray*)cdbEntry->GetObject();
624 if(!spdEntry) return kFALSE;
627 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB","Calibration for run %d not found in database.",runNr);
630 AliITSCalibrationSPD* calibSPD;
631 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
632 UInt_t nrNoisy = calibSPD->GetNrBadSingle();
634 if (!treeSerial) RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
636 for (UInt_t index=0; index<nrNoisy; index++) {
637 UInt_t colM = calibSPD->GetBadColAt(index);
638 UInt_t rowM = calibSPD->GetBadRowAt(index);
639 SetNoisyPixelM(module,colM,rowM);
643 spdEntry->SetOwner(kTRUE);
647 //____________________________________________________________________________________________
648 Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromDB(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
649 // reads dead and noisy pixels from DB for given runNr
650 // note that you may want to clear the lists (if they are not empty) before reading
651 return (ReadNoisyFromDB(runNr,storage,treeSerial) && ReadDeadFromDB(runNr,storage,treeSerial));
653 //____________________________________________________________________________________________
654 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
655 // reads dead pixels from DB for given runNr
656 // note that you may want to clear the list (if it is not empty) before reading
657 AliCDBManager* man = AliCDBManager::Instance();
658 TString storageSTR = Form("%s",storage);
659 if (storageSTR.CompareTo("default")==0) {
660 if(!man->IsDefaultStorageSet()) {
661 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
665 storageSTR = Form("%s",storage);
666 man->SetDefaultStorage(storageSTR.Data());
668 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
671 spdEntry = (TObjArray*)cdbEntry->GetObject();
672 if(!spdEntry) return kFALSE;
675 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB","Calibration for run %d not found in database.",runNr);
678 AliITSCalibrationSPD* calibSPD;
679 for (UInt_t module=0; module<240; module++) {
680 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
681 UInt_t nrDead = calibSPD->GetNrBadSingle();
684 RecursiveInsertDead(calibSPD,module,0,nrDead-1);
688 for (UInt_t index=0; index<nrDead; index++) {
689 UInt_t colM = calibSPD->GetBadColAt(index);
690 UInt_t rowM = calibSPD->GetBadRowAt(index);
691 SetDeadPixelM(module,colM,rowM);
695 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
696 UInt_t eq,hs,chip,col,row;
697 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
698 if (calibSPD->IsChipBad(chipIndex)) {
699 SetDeadChip(eq,hs,chip);
702 SetDeadChip(eq,hs,chip,kFALSE);
706 spdEntry->SetOwner(kTRUE);
710 //____________________________________________________________________________________________
711 Bool_t AliITSOnlineCalibrationSPDhandler::ReadSparseDeadFromDB(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
712 // reads dead pixels from DB for given runNr
713 // note that you may want to clear the list (if it is not empty) before reading
714 AliCDBManager* man = AliCDBManager::Instance();
715 TString storageSTR = Form("%s",storage);
716 if (storageSTR.CompareTo("default")==0) {
717 if(!man->IsDefaultStorageSet()) {
718 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
722 storageSTR = Form("%s",storage);
723 man->SetDefaultStorage(storageSTR.Data());
725 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDSparseDead", runNr);
728 spdEntry = (TObjArray*)cdbEntry->GetObject();
729 if(!spdEntry) return kFALSE;
732 Warning("AliITSOnlineCalibrationSPDhandler::ReadSparseDeadFromDB","Calibration for run %d not found in database.",runNr);
735 AliITSCalibrationSPD* calibSPD;
736 for (UInt_t module=0; module<240; module++) {
737 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
738 UInt_t nrDead = calibSPD->GetNrBadSingle();
741 RecursiveInsertSparseDead(calibSPD,module,0,nrDead-1);
745 for (UInt_t index=0; index<nrDead; index++) {
746 UInt_t colM = calibSPD->GetBadColAt(index);
747 UInt_t rowM = calibSPD->GetBadRowAt(index);
748 SetSparseDeadPixelM(module,colM,rowM);
752 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
753 UInt_t eq,hs,chip,col,row;
754 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
755 if (calibSPD->IsChipBad(chipIndex)) {
756 SetDeadChip(eq,hs,chip);
759 SetDeadChip(eq,hs,chip,kFALSE);
763 spdEntry->SetOwner(kTRUE);
767 //____________________________________________________________________________________________
768 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
769 // reads noisy pixels from DB for given runNr
770 // note that you may want to clear the list (if it is not empty) before reading
771 AliCDBManager* man = AliCDBManager::Instance();
772 TString storageSTR = Form("%s",storage);
773 if (storageSTR.CompareTo("default")==0) {
774 if(!man->IsDefaultStorageSet()) {
775 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
779 storageSTR = Form("%s",storage);
780 man->SetDefaultStorage(storageSTR.Data());
782 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
785 spdEntry = (TObjArray*)cdbEntry->GetObject();
786 if(!spdEntry) return kFALSE;
789 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB","Calibration for run %d not found in database.",runNr);
792 AliITSCalibrationSPD* calibSPD;
793 for (UInt_t module=0; module<240; module++) {
794 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
795 UInt_t nrNoisy = calibSPD->GetNrBadSingle();
798 RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
801 for (UInt_t index=0; index<nrNoisy; index++) {
802 UInt_t colM = calibSPD->GetBadColAt(index);
803 UInt_t rowM = calibSPD->GetBadRowAt(index);
804 SetNoisyPixelM(module,colM,rowM);
809 spdEntry->SetOwner(kTRUE);
813 //____________________________________________________________________________________________
814 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDBasNoisy(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
815 // reads dead pixels (put as noisy) from DB for given runNr
816 // note that you may want to clear the list (if it is not empty) before reading
817 AliCDBManager* man = AliCDBManager::Instance();
818 TString storageSTR = Form("%s",storage);
819 if (storageSTR.CompareTo("default")==0) {
820 if(!man->IsDefaultStorageSet()) {
821 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
825 storageSTR = Form("%s",storage);
826 man->SetDefaultStorage(storageSTR.Data());
828 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
831 spdEntry = (TObjArray*)cdbEntry->GetObject();
832 if(!spdEntry) return kFALSE;
835 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromDBasNoisy","Calibration for run %d not found in database.",runNr);
838 AliITSCalibrationSPD* calibSPD;
839 for (UInt_t module=0; module<240; module++) {
840 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
841 UInt_t nrDead = calibSPD->GetNrBadSingle();
844 RecursiveInsertDead(calibSPD,module,0,nrDead-1);
848 for (UInt_t index=0; index<nrDead; index++) {
849 UInt_t colM = calibSPD->GetBadColAt(index);
850 UInt_t rowM = calibSPD->GetBadRowAt(index);
851 SetDeadPixelM(module,colM,rowM);
855 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
856 UInt_t eq,hs,chip,col,row;
857 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
858 if (calibSPD->IsChipBad(chipIndex)) {
859 SetDeadChip(eq,hs,chip);
862 SetDeadChip(eq,hs,chip,kFALSE);
866 spdEntry->SetOwner(kTRUE);
870 //____________________________________________________________________________________________
871 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromCalibObj(TObjArray* calObj) {
872 // reads dead pixels from calib object
873 for (UInt_t module=0; module<240; module++) {
874 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*)calObj->At(module);
875 for (Int_t i=0; i<calibSPD->GetNrBadSingle(); i++) {
876 SetDeadPixelM(module,calibSPD->GetBadColAt(i),calibSPD->GetBadRowAt(i));
878 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
879 UInt_t eq,hs,chip,col,row;
880 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
881 if (calibSPD->IsChipBad(chipIndex)) {
882 SetDeadChip(eq,hs,chip);
885 SetDeadChip(eq,hs,chip,kFALSE);
891 //____________________________________________________________________________________________
892 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromCalibObj(TObjArray* calObj) {
893 // reads noisy pixels from calib object
894 for (UInt_t module=0; module<240; module++) {
895 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*)calObj->At(module);
896 for (Int_t i=0; i<calibSPD->GetNrBadSingle(); i++) {
897 SetNoisyPixelM(module,calibSPD->GetBadColAt(i),calibSPD->GetBadRowAt(i));
902 //____________________________________________________________________________________________
903 Bool_t AliITSOnlineCalibrationSPDhandler::WriteToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
904 // writes dead and noisy pixels to DB for given runNrs
905 // overwrites any previous entries
906 return (WriteNoisyToDB(runNrStart,runNrEnd,storage) && WriteDeadToDB(runNrStart,runNrEnd,storage));
908 //____________________________________________________________________________________________
909 Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
910 // writes dead pixels to DB for given runNrs
911 // overwrites any previous entries
912 AliCDBManager* man = AliCDBManager::Instance();
913 TString storageSTR = Form("%s",storage);
914 if (storageSTR.CompareTo("default")==0) {
915 if(!man->IsDefaultStorageSet()) {
916 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
920 storageSTR = Form("%s",storage);
921 man->SetDefaultStorage(storageSTR.Data());
923 AliCDBMetaData* metaData = new AliCDBMetaData();
924 metaData->SetResponsible("Henrik Tydesjo");
925 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
926 AliCDBId idCalSPD("ITS/Calib/SPDDead",runNrStart,runNrEnd);
927 TObjArray* spdEntry = new TObjArray(240);
928 spdEntry->SetOwner(kTRUE);
929 for(UInt_t module=0; module<240; module++){
930 AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
931 spdEntry->Add(calibSPD);
933 for(UInt_t module=0; module<240; module++){
934 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
935 calibSPD->SetNrBadSingle( GetNrDeadSingle(module) );
936 calibSPD->SetBadList( GetDeadArray(module) );
937 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
938 UInt_t eq,hs,chip,col,row;
939 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
940 if (IsSilentChip(eq,hs,chip)) {
941 calibSPD->SetChipBad(chipIndex);
944 calibSPD->UnSetChipBad(chipIndex);
948 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
955 //____________________________________________________________________________________________
956 Bool_t AliITSOnlineCalibrationSPDhandler::WriteSparseDeadToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
957 // writes dead pixels to DB for given runNrs
958 // overwrites any previous entries
959 AliCDBManager* man = AliCDBManager::Instance();
960 TString storageSTR = Form("%s",storage);
961 if (storageSTR.CompareTo("default")==0) {
962 if(!man->IsDefaultStorageSet()) {
963 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
967 storageSTR = Form("%s",storage);
968 man->SetDefaultStorage(storageSTR.Data());
970 AliCDBMetaData* metaData = new AliCDBMetaData();
971 metaData->SetResponsible("Annalisa Mastroserio");
972 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
973 AliCDBId idCalSPD("ITS/Calib/SPDSparseDead",runNrStart,runNrEnd);
974 TObjArray* spdEntry = new TObjArray(240);
975 spdEntry->SetOwner(kTRUE);
976 for(UInt_t module=0; module<240; module++){
977 AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
978 spdEntry->Add(calibSPD);
980 for(UInt_t module=0; module<240; module++){
981 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
982 //printf(" AliITSOnlineCalibrationSPDhandler::WriteSparseDeadToDB : nr Sparse dead in module %i - %i \n",module,GetNrSparseDead(module));
983 calibSPD->SetNrBadSingle( GetNrSparseDead(module) );
984 calibSPD->SetBadList( GetSparseDeadArray(module) );
985 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
986 UInt_t eq,hs,chip,col,row;
987 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
988 if (IsSilentChip(eq,hs,chip)) {
989 calibSPD->SetChipBad(chipIndex);
992 calibSPD->UnSetChipBad(chipIndex);
996 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
1003 //____________________________________________________________________________________________
1004 Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDBasNoisy(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
1005 // writes dead pixels to DB for given runNrs
1006 // overwrites any previous entries
1007 AliCDBManager* man = AliCDBManager::Instance();
1008 TString storageSTR = Form("%s",storage);
1009 if (storageSTR.CompareTo("default")==0) {
1010 if(!man->IsDefaultStorageSet()) {
1011 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
1015 storageSTR = Form("%s",storage);
1016 man->SetDefaultStorage(storageSTR.Data());
1018 AliCDBMetaData* metaData = new AliCDBMetaData();
1019 metaData->SetResponsible("Henrik Tydesjo");
1020 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
1021 AliCDBId idCalSPD("ITS/Calib/SPDNoisy",runNrStart,runNrEnd);
1022 TObjArray* spdEntry = new TObjArray(240);
1023 spdEntry->SetOwner(kTRUE);
1024 for(UInt_t module=0; module<240; module++){
1025 AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
1026 spdEntry->Add(calibSPD);
1028 for(UInt_t module=0; module<240; module++){
1029 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
1030 calibSPD->SetNrBadSingle( GetNrDeadSingle(module) );
1031 calibSPD->SetBadList( GetDeadArray(module) );
1032 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
1033 UInt_t eq,hs,chip,col,row;
1034 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
1035 if (IsSilentChip(eq,hs,chip)) {
1036 calibSPD->SetChipBad(chipIndex);
1039 calibSPD->UnSetChipBad(chipIndex);
1043 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
1050 //____________________________________________________________________________________________
1051 Bool_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
1052 // writes noisy pixels to DB for given runNrs
1053 // overwrites any previous entries
1054 AliCDBManager* man = AliCDBManager::Instance();
1055 TString storageSTR = Form("%s",storage);
1056 if (storageSTR.CompareTo("default")==0) {
1057 if(!man->IsDefaultStorageSet()) {
1058 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
1062 storageSTR = Form("%s",storage);
1063 man->SetDefaultStorage(storageSTR.Data());
1065 AliCDBMetaData* metaData = new AliCDBMetaData();
1066 metaData->SetResponsible("Henrik Tydesjo");
1067 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
1068 AliCDBId idCalSPD("ITS/Calib/SPDNoisy",runNrStart,runNrEnd);
1069 TObjArray* spdEntry = new TObjArray(240);
1070 spdEntry->SetOwner(kTRUE);
1071 for(UInt_t module=0; module<240; module++){
1072 AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
1073 spdEntry->Add(calibSPD);
1075 for(UInt_t module=0; module<240; module++){
1076 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
1077 calibSPD->SetNrBadSingle( GetNrNoisySingle(module) );
1078 calibSPD->SetBadList( GetNoisyArray(module) );
1080 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
1087 //____________________________________________________________________________________________
1088 void AliITSOnlineCalibrationSPDhandler::RecursiveInsertDead(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
1089 // inserts dead pixels recursively, used when reading from db
1090 if (lowInd>highInd) return;
1091 Int_t thisInd = lowInd+(highInd-lowInd)/2;
1092 SetDeadPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
1093 RecursiveInsertDead(calibSPD,module,lowInd,thisInd-1);
1094 RecursiveInsertDead(calibSPD,module,thisInd+1,highInd);
1096 //____________________________________________________________________________________________
1097 void AliITSOnlineCalibrationSPDhandler::RecursiveInsertSparseDead(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
1098 // inserts sparse dead pixels recursively, used when reading from db
1099 if (lowInd>highInd) return;
1100 Int_t thisInd = lowInd+(highInd-lowInd)/2;
1101 SetSparseDeadPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
1102 RecursiveInsertSparseDead(calibSPD,module,lowInd,thisInd-1);
1103 RecursiveInsertSparseDead(calibSPD,module,thisInd+1,highInd);
1105 //____________________________________________________________________________________________
1106 void AliITSOnlineCalibrationSPDhandler::RecursiveInsertNoisy(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
1107 // inserts noisy pixels recursively, used when reading from db
1108 if (lowInd>highInd) return;
1109 Int_t thisInd = lowInd+(highInd-lowInd)/2;
1110 SetNoisyPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
1111 RecursiveInsertNoisy(calibSPD,module,lowInd,thisInd-1);
1112 RecursiveInsertNoisy(calibSPD,module,thisInd+1,highInd);
1116 //____________________________________________________________________________________________
1117 void AliITSOnlineCalibrationSPDhandler::GenerateDCSConfigFile(const Char_t* fileName) {
1118 // generates an ascii file in the format as the one produced by online da (but with dummy runNr=0)
1120 dcsfile.open(fileName);
1121 dcsfile << "[SPD SCAN]\n";
1122 dcsfile << "RunNumber=" << "0" << "\n"; // dummy value
1123 dcsfile << "Type=" << "4" << "\n";
1124 dcsfile << "Router=" << "0" << "\n"; // dummy value
1125 dcsfile << "ActualDetConfiguration=" << "0,-1,-1\n"; // dummy values
1126 dcsfile << "[NOISY]\n";
1127 for (UInt_t module=0; module<240; module++) {
1128 UInt_t headkey=20*10*6;
1129 for (UInt_t ind=0; ind<GetNrNoisy(module); ind++) {
1130 UInt_t newkey = GetNoisyEqIdAt(module,ind)*10*6 +
1131 GetNoisyHSAt(module,ind)*10 +
1132 GetNoisyChipAt(module,ind);
1133 if (newkey!=headkey) { // print eq,hs,chip header
1135 dcsfile << "-" << newkey/(6*10) << "," << (newkey%(6*10))/10 << "," << (newkey%(6*10))%10 << "\n";
1137 dcsfile << GetNoisyColAt(module,ind) << "," << GetNoisyRowAt(module,ind) << "\n";
1142 //____________________________________________________________________________________________
1143 TArrayS AliITSOnlineCalibrationSPDhandler::GetSilentArray(UInt_t module, Bool_t treeSerial) {
1144 // get a TArrayS of the silent=dead+inactive pixels (format for the AliITSCalibrationSPD object)
1145 // NB! with new implementation of AliITSCalibrationSPD this is not needed anymore
1146 TArrayS returnArray;
1148 UInt_t eq = GetEqIdFromOffline(module);
1149 UInt_t hs = GetHSFromOffline(module);
1151 if ( !( IsActiveEq(eq) && IsActiveHS(eq,hs) ) ) {
1155 for (UInt_t ch=0; ch<5; ch++) {
1156 UInt_t chip = GetChipFromOffline(module,ch*32);
1157 if (!(IsActiveChip(eq,hs,chip))) {
1161 UInt_t gloChip = GetGloChip(eq,hs,chip);
1162 size += fNrDead[gloChip];
1166 returnArray.Set(size*2);
1169 if ( !( IsActiveEq(eq) && IsActiveHS(eq,hs) ) ) {
1170 for (UInt_t colM=0; colM<160; colM++) {
1171 for (UInt_t rowM=0; rowM<256; rowM++) {
1172 returnArray.AddAt(colM,gloIndex*2);
1173 returnArray.AddAt(rowM,gloIndex*2+1);
1179 for (UInt_t ch=0; ch<5; ch++) {
1180 UInt_t chip = GetChipFromOffline(module,ch*32);
1181 if (!(IsActiveChip(eq,hs,chip))) {
1182 for (UInt_t colM=ch*32; colM<ch*32+32; colM++) {
1183 for (UInt_t rowM=0; rowM<256; rowM++) {
1184 returnArray.AddAt(colM,gloIndex*2);
1185 returnArray.AddAt(rowM,gloIndex*2+1);
1191 UInt_t gloChip = GetGloChip(eq,hs,chip);
1192 if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1193 else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
1194 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1195 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1196 Int_t colM = GetColMFromKey(key);
1197 Int_t rowM = GetRowMFromKey(key);
1198 returnArray.AddAt(colM,gloIndex*2);
1199 returnArray.AddAt(rowM,gloIndex*2+1);
1207 //____________________________________________________________________________________________
1208 TArrayS AliITSOnlineCalibrationSPDhandler::GetDeadArray(UInt_t module, Bool_t treeSerial) {
1209 // get a TArrayS of the single dead pixels (format for the AliITSCalibrationSPD object)
1210 TArrayS returnArray;
1212 UInt_t eq = GetEqIdFromOffline(module);
1213 UInt_t hs = GetHSFromOffline(module);
1214 UInt_t size=GetNrDeadSingle(module);
1215 returnArray.Set(size*2);
1217 for (UInt_t ch=0; ch<5; ch++) {
1218 UInt_t chip = GetChipFromOffline(module,ch*32);
1219 UInt_t gloChip = GetGloChip(eq,hs,chip);
1220 if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1221 else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
1222 if (!IsSilentChip(eq,hs,chip)) {
1223 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1224 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1225 Int_t colM = GetColMFromKey(key);
1226 Int_t rowM = GetRowMFromKey(key);
1227 returnArray.AddAt(colM,gloIndex*2);
1228 returnArray.AddAt(rowM,gloIndex*2+1);
1235 //____________________________________________________________________________________________
1236 TArrayS AliITSOnlineCalibrationSPDhandler::GetSparseDeadArray(UInt_t module, Bool_t treeSerial) {
1237 // get a TArrayS of the single dead pixels (format for the AliITSCalibrationSPD object)
1238 TArrayS returnArray;
1240 UInt_t eq = GetEqIdFromOffline(module);
1241 UInt_t hs = GetHSFromOffline(module);
1242 UInt_t size=GetNrSparseDead(module);
1243 returnArray.Set(size*2);
1245 for (UInt_t ch=0; ch<5; ch++) {
1246 UInt_t chip = GetChipFromOffline(module,ch*32);
1247 UInt_t gloChip = GetGloChip(eq,hs,chip);
1248 if (treeSerial) fSparseDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1249 else fSparseDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
1250 if (!IsSilentChip(eq,hs,chip)) {
1251 for (UInt_t index=0; index<fNrSparseDead[gloChip]; index++) {
1252 Int_t key = fSparseDeadPixelMap[gloChip]->GetKeyIndex(index);
1253 Int_t colM = GetColMFromKey(key);
1254 Int_t rowM = GetRowMFromKey(key);
1255 returnArray.AddAt(colM,gloIndex*2);
1256 returnArray.AddAt(rowM,gloIndex*2+1);
1263 //____________________________________________________________________________________________
1264 TArrayS AliITSOnlineCalibrationSPDhandler::GetNoisyArray(UInt_t module, Bool_t treeSerial) {
1265 // get a TArrayS of the single noisy pixels (format for the AliITSCalibrationSPD object)
1266 TArrayS returnArray;
1268 UInt_t eq = GetEqIdFromOffline(module);
1269 UInt_t hs = GetHSFromOffline(module);
1270 UInt_t size=GetNrNoisySingle(module);
1271 returnArray.Set(size*2);
1273 for (UInt_t ch=0; ch<5; ch++) {
1274 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
1275 if (treeSerial) fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1276 else fNoisyPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
1277 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
1278 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1279 Int_t colM = GetColMFromKey(key);
1280 Int_t rowM = GetRowMFromKey(key);
1281 returnArray.AddAt(colM,gloIndex*2);
1282 returnArray.AddAt(rowM,gloIndex*2+1);
1288 //____________________________________________________________________________________________
1289 TArrayI AliITSOnlineCalibrationSPDhandler::GetDeadArrayOnline(UInt_t eq) {
1290 // get a TArrayI of the single dead pixels (format for the AliITSOnlineCalibrationSPD object)
1291 TArrayI returnArray;
1292 // fix size of array
1294 for (UInt_t hs=0; hs<6; hs++) {
1295 for (UInt_t chip=0; chip<10; chip++) {
1296 UInt_t gloChip = GetGloChip(eq,hs,chip);
1297 size+=fNrDead[gloChip];
1300 returnArray.Set(size);
1301 // put keys in array
1303 for (UInt_t hs=0; hs<6; hs++) {
1304 for (UInt_t chip=0; chip<10; chip++) {
1305 UInt_t gloChip = GetGloChip(eq,hs,chip);
1306 fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1307 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1308 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1309 returnArray.AddAt(key,gloIndex);
1316 //____________________________________________________________________________________________
1317 TArrayI AliITSOnlineCalibrationSPDhandler::GetNoisyArrayOnline(UInt_t eq) {
1318 // get a TArrayI of the single noisy pixels (format for the AliITSOnlineCalibrationSPD object)
1319 TArrayI returnArray;
1320 // fix size of array
1322 for (UInt_t hs=0; hs<6; hs++) {
1323 for (UInt_t chip=0; chip<10; chip++) {
1324 UInt_t gloChip = GetGloChip(eq,hs,chip);
1325 size+=fNrNoisy[gloChip];
1328 returnArray.Set(size);
1329 // put keys in array
1331 for (UInt_t hs=0; hs<6; hs++) {
1332 for (UInt_t chip=0; chip<10; chip++) {
1333 UInt_t gloChip = GetGloChip(eq,hs,chip);
1334 fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1335 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
1336 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1337 returnArray.AddAt(key,gloIndex);
1344 //____________________________________________________________________________________________
1345 void AliITSOnlineCalibrationSPDhandler::PrintEqSummary() {
1346 // print summary (nr of dead and noisy) for each equipment
1347 printf("-----------\n");
1348 printf("Eq summary:\n");
1349 printf("-----------\n");
1350 for (UInt_t eq=0; eq<20; eq++) {
1351 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));
1354 //____________________________________________________________________________________________
1355 void AliITSOnlineCalibrationSPDhandler::PrintSilent() const {
1356 // print the inactive and dead pixels to screen
1357 printf("-----------------------------------------------------------\n");
1358 printf("Inactive or dead Equipments: (eq | module1 .. module12)\n");
1359 printf("-----------------------------------------------------------\n");
1360 for (UInt_t eq=0; eq<20; eq++) {
1361 if (IsSilentEq(eq)) {
1362 printf("%*d | ",2,eq);
1363 for (UInt_t hs=0; hs<6; hs++) {
1364 for (UInt_t chip=0; chip<10; chip+=5) {
1365 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1366 if (hs>0 || chip==5) printf(",");
1367 printf("%*d",3,module);
1374 printf("-----------------------------------------------------------\n");
1375 printf("Inactive or dead Half-staves: (eq,hs | module1,module2)\n");
1376 printf("-----------------------------------------------------------\n");
1377 for (UInt_t eq=0; eq<20; eq++) {
1378 if (!IsSilentEq(eq)) {
1379 for (UInt_t hs=0; hs<6; hs++) {
1380 if (IsSilentHS(eq,hs)) {
1381 printf("%*d,%*d | ",2,eq,1,hs);
1382 for (UInt_t chip=0; chip<10; chip+=5) {
1383 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1384 if (chip==5) printf(",");
1385 printf("%*d",3,module);
1393 printf("-----------------------------------------------------------\n");
1394 printf("Inactive or dead Chips: (eq,hs,chip | module,colM1-colM2)\n");
1395 printf("-----------------------------------------------------------\n");
1396 for (UInt_t eq=0; eq<20; eq++) {
1397 if (!IsSilentEq(eq)) {
1398 for (UInt_t hs=0; hs<6; hs++) {
1399 if (!IsSilentHS(eq,hs)) {
1400 for (UInt_t chip=0; chip<10; chip++) {
1401 if (IsSilentChip(eq,hs,chip)) {
1402 printf("%*d,%*d,%*d | ",2,eq,1,hs,1,chip);
1403 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1404 UInt_t colM1 = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,0);
1405 UInt_t colM2 = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,31);
1406 printf("%*d,%*d-%*d\n",3,module,3,colM1,3,colM2);
1417 //____________________________________________________________________________________________
1418 void AliITSOnlineCalibrationSPDhandler::PrintDead() const {
1419 // print the single dead pixels to screen (disregards inactive eq,hs,chip)
1420 printf("------------------------------------------------------\n");
1421 printf("Dead Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
1422 printf("------------------------------------------------------\n");
1423 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1424 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1425 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1426 UInt_t eq = GetEqIdFromKey(key);
1427 UInt_t hs = GetHSFromKey(key);
1428 UInt_t chip = GetChipFromKey(key);
1429 UInt_t col = GetColFromKey(key);
1430 UInt_t row = GetRowFromKey(key);
1432 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1433 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1434 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1436 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);
1440 //____________________________________________________________________________________________
1441 void AliITSOnlineCalibrationSPDhandler::PrintSparseDead() const {
1442 // print the single dead pixels to screen (disregards inactive eq,hs,chip)
1443 printf("------------------------------------------------------\n");
1444 printf("Sparse Dead Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
1445 printf("------------------------------------------------------\n");
1446 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1447 for (UInt_t index=0; index<fNrSparseDead[gloChip]; index++) {
1448 Int_t key = fSparseDeadPixelMap[gloChip]->GetKeyIndex(index);
1449 UInt_t eq = GetEqIdFromKey(key);
1450 UInt_t hs = GetHSFromKey(key);
1451 UInt_t chip = GetChipFromKey(key);
1452 UInt_t col = GetColFromKey(key);
1453 UInt_t row = GetRowFromKey(key);
1455 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1456 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1457 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1459 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);
1463 //____________________________________________________________________________________________
1464 void AliITSOnlineCalibrationSPDhandler::PrintNoisy() const {
1465 // print the dead pixels to screen
1466 printf("-------------------------------------------------------\n");
1467 printf("Noisy Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
1468 printf("-------------------------------------------------------\n");
1469 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1470 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
1471 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1472 UInt_t eq = GetEqIdFromKey(key);
1473 UInt_t hs = GetHSFromKey(key);
1474 UInt_t chip = GetChipFromKey(key);
1475 UInt_t col = GetColFromKey(key);
1476 UInt_t row = GetRowFromKey(key);
1478 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1479 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1480 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1482 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);
1486 //____________________________________________________________________________________________
1487 Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1488 // set a dead pixel, returns false if pixel is already dead
1489 UInt_t gloChip = GetGloChip(eq,hs,chip);
1490 if (gloChip>=1200) {
1491 Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1494 if (col>=32 && row>=256) {
1495 Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
1498 Int_t key = GetKey(eq,hs,chip,col,row);
1499 // if noisy we dont want to add it...
1500 if (fNoisyPixelMap[gloChip]->Find(key) != NULL) return kFALSE;
1501 if (fDeadPixelMap[gloChip]->Insert(key,gloChip)) {
1507 //____________________________________________________________________________________________
1508 Bool_t AliITSOnlineCalibrationSPDhandler::SetSparseDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1509 // set a dead pixel, returns false if pixel is already dead
1510 UInt_t gloChip = GetGloChip(eq,hs,chip);
1511 if (gloChip>=1200) {
1512 Error("AliITSOnlineCalibrationSPDhandler::SetSparseDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1515 if (col>=32 && row>=256) {
1516 Error("AliITSOnlineCalibrationSPDhandler::SetSparseDeadPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
1519 Int_t key = GetKey(eq,hs,chip,col,row);
1520 // if noisy we dont want to add it...
1521 if (fSparseDeadPixelMap[gloChip]->Find(key) != NULL) return kFALSE;
1522 if (fSparseDeadPixelMap[gloChip]->Insert(key,gloChip)) {
1523 fNrSparseDead[gloChip]++;
1524 //printf(" AliITSOnlineCalibrationSPDhandler::SetSparseDeadPixel nSparse Dead : %i \n",fNrSparseDead[gloChip]);
1529 //____________________________________________________________________________________________
1530 Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1531 // set a noisy pixel, returns false if pixel is already noisy
1532 UInt_t gloChip = GetGloChip(eq,hs,chip);
1533 if (gloChip>=1200) {
1534 Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1537 if (col>=32 && row>=256) {
1538 Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
1541 Int_t key = GetKey(eq,hs,chip,col,row);
1542 // if dead before - remove from the dead list
1543 if (fDeadPixelMap[gloChip]->Remove(key)) {
1546 if (fNoisyPixelMap[gloChip]->Insert(key,gloChip)) {
1547 fNrNoisy[gloChip]++;
1552 //____________________________________________________________________________________________
1553 Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1554 // set a dead pixel, returns false if pixel is already dead
1555 UInt_t eq = GetEqIdFromOffline(module);
1556 UInt_t hs = GetHSFromOffline(module);
1557 UInt_t chip = GetChipFromOffline(module,colM);
1558 UInt_t col = GetColFromOffline(module,colM);
1559 UInt_t row = GetRowFromOffline(module,rowM);
1560 return SetDeadPixel(eq,hs,chip,col,row);
1562 //____________________________________________________________________________________________
1563 Bool_t AliITSOnlineCalibrationSPDhandler::SetSparseDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1564 // set a dead pixel, returns false if pixel is already dead
1565 UInt_t eq = GetEqIdFromOffline(module);
1566 UInt_t hs = GetHSFromOffline(module);
1567 UInt_t chip = GetChipFromOffline(module,colM);
1568 UInt_t col = GetColFromOffline(module,colM);
1569 UInt_t row = GetRowFromOffline(module,rowM);
1570 return SetSparseDeadPixel(eq,hs,chip,col,row);
1572 //____________________________________________________________________________________________
1573 Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1574 // set a noisy pixel, returns false if pixel is already noisy
1575 UInt_t eq = GetEqIdFromOffline(module);
1576 UInt_t hs = GetHSFromOffline(module);
1577 UInt_t chip = GetChipFromOffline(module,colM);
1578 UInt_t col = GetColFromOffline(module,colM);
1579 UInt_t row = GetRowFromOffline(module,rowM);
1580 return SetNoisyPixel(eq,hs,chip,col,row);
1582 //____________________________________________________________________________________________
1583 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1584 // unset a dead pixel, returns false if pixel is not dead
1585 UInt_t gloChip = GetGloChip(eq,hs,chip);
1586 if (gloChip>=1200) {
1587 Error("AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1590 Int_t key = GetKey(eq,hs,chip,col,row);
1591 if (fDeadPixelMap[gloChip]->Remove(key)) {
1597 //____________________________________________________________________________________________
1598 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetSparseDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1599 // unset a dead pixel, returns false if pixel is not dead
1600 UInt_t gloChip = GetGloChip(eq,hs,chip);
1601 if (gloChip>=1200) {
1602 Error("AliITSOnlineCalibrationSPDhandler::UnSetSparseDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1605 Int_t key = GetKey(eq,hs,chip,col,row);
1606 if (fSparseDeadPixelMap[gloChip]->Remove(key)) {
1607 fNrSparseDead[gloChip]--;
1612 //____________________________________________________________________________________________
1613 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1614 // unset a noisy pixel, returns false if pixel is not noisy
1615 UInt_t gloChip = GetGloChip(eq,hs,chip);
1616 if (gloChip>=1200) {
1617 Error("AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1620 Int_t key = GetKey(eq,hs,chip,col,row);
1621 if (fNoisyPixelMap[gloChip]->Remove(key)) {
1622 fNrNoisy[gloChip]--;
1627 //____________________________________________________________________________________________
1628 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1629 // unset a dead pixel, returns false if pixel is not dead
1630 UInt_t eq = GetEqIdFromOffline(module);
1631 UInt_t hs = GetHSFromOffline(module);
1632 UInt_t chip = GetChipFromOffline(module,colM);
1633 UInt_t col = GetColFromOffline(module,colM);
1634 UInt_t row = GetRowFromOffline(module,rowM);
1635 return UnSetDeadPixel(eq,hs,chip,col,row);
1637 //____________________________________________________________________________________________
1638 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetSparseDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1639 // unset a dead pixel, returns false if pixel is not dead
1640 UInt_t eq = GetEqIdFromOffline(module);
1641 UInt_t hs = GetHSFromOffline(module);
1642 UInt_t chip = GetChipFromOffline(module,colM);
1643 UInt_t col = GetColFromOffline(module,colM);
1644 UInt_t row = GetRowFromOffline(module,rowM);
1645 return UnSetSparseDeadPixel(eq,hs,chip,col,row);
1647 //____________________________________________________________________________________________
1648 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1649 // unset a noisy pixel, returns false if pixel is not noisy
1650 UInt_t eq = GetEqIdFromOffline(module);
1651 UInt_t hs = GetHSFromOffline(module);
1652 UInt_t chip = GetChipFromOffline(module,colM);
1653 UInt_t col = GetColFromOffline(module,colM);
1654 UInt_t row = GetRowFromOffline(module,rowM);
1655 return UnSetNoisyPixel(eq,hs,chip,col,row);
1657 //____________________________________________________________________________________________
1658 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBad(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1659 // is the pixel bad (silent or noisy)
1660 return (IsPixelSilent(eq,hs,chip,col,row) || IsPixelNoisy(eq,hs,chip,col,row));
1662 //____________________________________________________________________________________________
1663 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilent(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1664 // is the pixel silent (dead or inactive)?
1665 UInt_t gloChip = GetGloChip(eq,hs,chip);
1666 if (gloChip>=1200 || col>=32 || row>=256) {
1667 Error("AliITSOnlineCalibrationSPDhandler::IsPixelSilent", "eq,hs,chip,col,row nrs (%d,%d,%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
1670 if (IsSilentChip(eq,hs,chip)) return kTRUE;
1671 else return IsPixelDead(eq,hs,chip,col,row);
1673 //____________________________________________________________________________________________
1674 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDead(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1675 // is the pixel dead?
1676 UInt_t gloChip = GetGloChip(eq,hs,chip);
1677 if (gloChip>=1200 || col>=32 || row>=256) {
1678 Error("AliITSOnlineCalibrationSPDhandler::IsPixelDead", "eq,hs,chip,col,row nrs (%d,%d,%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
1681 UInt_t key = GetKey(eq,hs,chip,col,row);
1682 if (IsDeadEq(eq) || IsDeadHS(eq,hs) || IsDeadChip(eq,hs,chip)) return kTRUE;
1684 if ( fDeadPixelMap[gloChip]->Find(key) != NULL ) return kTRUE;
1688 //____________________________________________________________________________________________
1689 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisy(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1690 // is the pixel noisy?
1691 UInt_t gloChip = GetGloChip(eq,hs,chip);
1692 if (gloChip>=1200 || col>=32 || row>=256) {
1693 Error("AliITSOnlineCalibrationSPDhandler::IsPixelNoisy","eq,hs,chip,col,row nrs ( %d, %d, %d, %d, %d ) out of bounds.",eq,hs,chip,col,row);
1696 UInt_t key = GetKey(eq,hs,chip,col,row);
1697 if ( fNoisyPixelMap[gloChip]->Find(key) != NULL ) return kTRUE;
1700 //____________________________________________________________________________________________
1701 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBadM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1702 // is the pixel bad (silent or noisy)?
1703 return (IsPixelSilentM(module,colM,rowM) || IsPixelNoisyM(module,colM,rowM));
1705 //____________________________________________________________________________________________
1706 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilentM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1707 // is the pixel silent (dead or inactive)?
1708 UInt_t eq = GetEqIdFromOffline(module);
1709 UInt_t hs = GetHSFromOffline(module);
1710 UInt_t chip = GetChipFromOffline(module,colM);
1711 UInt_t col = GetColFromOffline(module,colM);
1712 UInt_t row = GetRowFromOffline(module,rowM);
1713 return IsPixelSilent(eq,hs,chip,col,row);
1715 //____________________________________________________________________________________________
1716 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1717 // is the pixel dead?
1718 UInt_t eq = GetEqIdFromOffline(module);
1719 UInt_t hs = GetHSFromOffline(module);
1720 UInt_t chip = GetChipFromOffline(module,colM);
1721 UInt_t col = GetColFromOffline(module,colM);
1722 UInt_t row = GetRowFromOffline(module,rowM);
1723 return IsPixelDead(eq,hs,chip,col,row);
1725 //____________________________________________________________________________________________
1726 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1727 // is the pixel noisy?
1728 UInt_t eq = GetEqIdFromOffline(module);
1729 UInt_t hs = GetHSFromOffline(module);
1730 UInt_t chip = GetChipFromOffline(module,colM);
1731 UInt_t col = GetColFromOffline(module,colM);
1732 UInt_t row = GetRowFromOffline(module,rowM);
1733 return IsPixelNoisy(eq,hs,chip,col,row);
1735 //____________________________________________________________________________________________
1736 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBadKey(Int_t key) const {
1737 // is this pixel silent (dead or inactive)?
1738 UInt_t eq = GetEqIdFromKey(key);
1739 UInt_t hs = GetHSFromKey(key);
1740 UInt_t chip = GetChipFromKey(key);
1741 UInt_t col = GetColFromKey(key);
1742 UInt_t row = GetRowFromKey(key);
1743 return IsPixelBad(eq,hs,chip,col,row);
1745 //____________________________________________________________________________________________
1746 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilentKey(Int_t key) const {
1747 // is this pixel silent (dead or inactive)?
1748 UInt_t eq = GetEqIdFromKey(key);
1749 UInt_t hs = GetHSFromKey(key);
1750 UInt_t chip = GetChipFromKey(key);
1751 UInt_t col = GetColFromKey(key);
1752 UInt_t row = GetRowFromKey(key);
1753 return IsPixelSilent(eq,hs,chip,col,row);
1755 //____________________________________________________________________________________________
1756 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadKey(Int_t key) const {
1757 // is this pixel dead?
1758 UInt_t eq = GetEqIdFromKey(key);
1759 UInt_t hs = GetHSFromKey(key);
1760 UInt_t chip = GetChipFromKey(key);
1761 UInt_t col = GetColFromKey(key);
1762 UInt_t row = GetRowFromKey(key);
1763 return IsPixelDead(eq,hs,chip,col,row);
1765 //____________________________________________________________________________________________
1766 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyKey(Int_t key) const {
1767 // is this pixel noisy?
1768 UInt_t eq = GetEqIdFromKey(key);
1769 UInt_t hs = GetHSFromKey(key);
1770 UInt_t chip = GetChipFromKey(key);
1771 UInt_t col = GetColFromKey(key);
1772 UInt_t row = GetRowFromKey(key);
1773 return IsPixelNoisy(eq,hs,chip,col,row);
1775 //____________________________________________________________________________________________
1776 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBad() const {
1777 // returns the total nr of bad pixels (silent or noisy)
1779 nrBad+=GetNrSilent();
1780 UInt_t nrNoisy = GetNrNoisy();
1781 for (UInt_t i=0; i<nrNoisy; i++) {
1782 UInt_t eq = GetNoisyEqIdAt(i);
1783 UInt_t hs = GetNoisyHSAt(i);
1784 UInt_t chip = GetNoisyChipAt(i);
1785 UInt_t col = GetNoisyColAt(i);
1786 UInt_t row = GetNoisyRowAt(i);
1787 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1791 //____________________________________________________________________________________________
1792 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilent() const {
1793 // returns the total nr of silent pixels (dead or inactive)
1795 for (UInt_t eq=0; eq<20; eq++) {
1796 if (IsSilentEq(eq)) {
1800 for (UInt_t hs=0; hs<6; hs++) {
1801 if (IsSilentHS(eq,hs)) {
1805 for (UInt_t chip=0; chip<10; chip++) {
1806 if (IsSilentChip(eq,hs,chip)) {
1811 UInt_t gloChip = GetGloChip(eq,hs,chip);
1812 nrDead+=fNrDead[gloChip];
1819 //____________________________________________________________________________________________
1820 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead() const {
1821 // returns the total nr of dead pixels
1823 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1824 nrDead+=fNrDead[gloChip];
1828 //____________________________________________________________________________________________
1829 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSparseDead() const {
1830 // returns the total nr of dead pixels
1831 UInt_t nrSparseDead = 0;
1832 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1833 nrSparseDead+=fNrSparseDead[gloChip];
1835 return nrSparseDead;
1837 //____________________________________________________________________________________________
1838 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy() const {
1839 // returns the total nr of noisy pixels
1841 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1842 nrNoisy+=fNrNoisy[gloChip];
1846 //____________________________________________________________________________________________
1847 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t index) const {
1848 // get eq for the dead pixel at position index in list of dead
1851 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1852 return GetDeadEqIdAtC2(gloChip,chipIndex);
1854 //____________________________________________________________________________________________
1855 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t index) const {
1856 // get eq for the noisy pixel at position index in list of noisy
1859 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1860 return GetNoisyEqIdAtC2(gloChip,chipIndex);
1862 //____________________________________________________________________________________________
1863 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t index) const {
1864 // get hs for the dead pixel at position index in list of dead
1867 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1868 return GetDeadHSAtC2(gloChip,chipIndex);
1870 //____________________________________________________________________________________________
1871 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t index) const {
1872 // get hs for the noisy pixel at position index in list of noisy
1875 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1876 return GetNoisyHSAtC2(gloChip,chipIndex);
1878 //____________________________________________________________________________________________
1879 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t index) const {
1880 // get chip for the dead pixel at position index in list of dead
1883 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1884 return GetDeadChipAtC2(gloChip,chipIndex);
1886 //____________________________________________________________________________________________
1887 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t index) const {
1888 // get chip for the noisy pixel at position index in list of noisy
1891 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1892 return GetNoisyChipAtC2(gloChip,chipIndex);
1894 //____________________________________________________________________________________________
1895 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t index) const {
1896 // get hs for the dead pixel at position index in list of dead
1899 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1900 return GetDeadColAtC2(gloChip,chipIndex);
1902 //____________________________________________________________________________________________
1903 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t index) const {
1904 // get hs for the noisy pixel at position index in list of noisy
1907 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1908 return GetNoisyColAtC2(gloChip,chipIndex);
1910 //____________________________________________________________________________________________
1911 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t index) const {
1912 // get hs for the dead pixel at position index in list of dead
1915 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1916 return GetDeadRowAtC2(gloChip,chipIndex);
1918 //____________________________________________________________________________________________
1919 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t index) const {
1920 // get hs for the noisy pixel at position index in list of noisy
1923 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1924 return GetNoisyRowAtC2(gloChip,chipIndex);
1926 //____________________________________________________________________________________________
1927 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBad(UInt_t module) const {
1928 // returns the number of bad pixels for a certain module (silent or noisy)
1930 nrBad+=GetNrSilent(module);
1931 UInt_t nrNoisy = GetNrNoisy(module);
1932 for (UInt_t i=0; i<nrNoisy; i++) {
1933 UInt_t eq = GetNoisyEqIdAt(module,i);
1934 UInt_t hs = GetNoisyHSAt(module,i);
1935 UInt_t chip = GetNoisyChipAt(module,i);
1936 UInt_t col = GetNoisyColAt(module,i);
1937 UInt_t row = GetNoisyRowAt(module,i);
1938 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1942 //____________________________________________________________________________________________
1943 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilent(UInt_t module) const {
1944 // returns the number of silent pixels for a certain module (dead or inactive)
1946 Error("AliITSOnlineCalibrationSPDhandler::GetNrSilent", "module nr (%d) out of bounds.",module);
1949 UInt_t nrSilent = 0;
1950 UInt_t eq = GetEqIdFromOffline(module);
1951 if (IsSilentEq(eq)) return 160*256;
1952 UInt_t hs = GetHSFromOffline(module);
1953 if (IsSilentHS(eq,hs)) return 160*256;
1954 for (UInt_t ch=0; ch<5; ch++) {
1955 UInt_t chip = GetChipFromOffline(module,ch*32);
1956 if (IsSilentChip(eq,hs,chip)) {
1960 UInt_t gloChip = GetGloChip(eq,hs,chip);
1961 nrSilent+=fNrDead[gloChip];
1966 //____________________________________________________________________________________________
1967 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadSingle(UInt_t module) const {
1968 // returns the number of single dead pixels (excluding the ones on silent chips) for a certain module
1970 Error("AliITSOnlineCalibrationSPDhandler::GetNrDeadSingle", "module nr (%d) out of bounds.",module);
1974 UInt_t eq = GetEqIdFromOffline(module);
1975 UInt_t hs = GetHSFromOffline(module);
1976 for (UInt_t ch=0; ch<5; ch++) {
1977 UInt_t chip = GetChipFromOffline(module,ch*32);
1978 if (!IsSilentChip(eq,hs,chip)) {
1979 UInt_t gloChip = GetGloChip(eq,hs,chip);
1980 nrDead+=fNrDead[gloChip];
1985 //____________________________________________________________________________________________
1986 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisySingle(UInt_t module) const {
1987 // returns the number of noisy pixels for a certain module
1988 return GetNrNoisy(module);
1990 //____________________________________________________________________________________________
1991 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead(UInt_t module) const {
1992 // returns the number of dead pixels for a certain module
1994 Error("AliITSOnlineCalibrationSPDhandler::GetNrDead", "module nr (%d) out of bounds.",module);
1998 UInt_t eq = GetEqIdFromOffline(module);
1999 UInt_t hs = GetHSFromOffline(module);
2000 for (UInt_t ch=0; ch<5; ch++) {
2001 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
2002 nrDead+=fNrDead[gloChip];
2006 //____________________________________________________________________________________________
2007 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSparseDead(UInt_t module) const {
2008 // returns the number of sparse dead pixels for a certain module
2010 Error("AliITSOnlineCalibrationSPDhandler::GetNrSparseDead", "module nr (%d) out of bounds.",module);
2014 UInt_t eq = GetEqIdFromOffline(module);
2015 UInt_t hs = GetHSFromOffline(module);
2016 for (UInt_t ch=0; ch<5; ch++) {
2017 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
2018 nrDead+=fNrSparseDead[gloChip];
2022 //____________________________________________________________________________________________
2023 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy(UInt_t module) const {
2024 // returns the number of noisy pixels for a certain module
2026 Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisy", "module nr (%d) out of bounds.",module);
2030 UInt_t eq = GetEqIdFromOffline(module);
2031 UInt_t hs = GetHSFromOffline(module);
2032 for (UInt_t ch=0; ch<5; ch++) {
2033 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
2034 nrNoisy+=fNrNoisy[gloChip];
2038 //____________________________________________________________________________________________
2039 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t module, UInt_t index) const {
2040 // get eq for the dead pixel at position index in list of dead
2043 GetChipAndIndexDead(module,index,gloChip,chipIndex);
2044 return GetDeadEqIdAtC2(gloChip,chipIndex);
2046 //____________________________________________________________________________________________
2047 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t module, UInt_t index) const {
2048 // get eq for the noisy pixel at position index in list of noisy
2051 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
2052 return GetNoisyEqIdAtC2(gloChip,chipIndex);
2054 //____________________________________________________________________________________________
2055 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t module, UInt_t index) const {
2056 // get hs for the dead pixel at position index in list of dead
2059 GetChipAndIndexDead(module,index,gloChip,chipIndex);
2060 return GetDeadHSAtC2(gloChip,chipIndex);
2062 //____________________________________________________________________________________________
2063 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t module, UInt_t index) const {
2064 // get hs for the noisy pixel at position index in list of noisy
2067 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
2068 return GetNoisyHSAtC2(gloChip,chipIndex);
2070 //____________________________________________________________________________________________
2071 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t module, UInt_t index) const {
2072 // get chip for the dead pixel at position index in list of dead
2075 GetChipAndIndexDead(module,index,gloChip,chipIndex);
2076 return GetDeadChipAtC2(gloChip,chipIndex);
2078 //____________________________________________________________________________________________
2079 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t module, UInt_t index) const {
2080 // get chip for the noisy pixel at position index in list of noisy
2083 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
2084 return GetNoisyChipAtC2(gloChip,chipIndex);
2086 //____________________________________________________________________________________________
2087 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t module, UInt_t index) const {
2088 // get hs for the dead pixel at position index in list of dead
2091 GetChipAndIndexDead(module,index,gloChip,chipIndex);
2092 return GetDeadColAtC2(gloChip,chipIndex);
2094 //____________________________________________________________________________________________
2095 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t module, UInt_t index) const {
2096 // get hs for the noisy pixel at position index in list of noisy
2099 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
2100 return GetNoisyColAtC2(gloChip,chipIndex);
2102 //____________________________________________________________________________________________
2103 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t module, UInt_t index) const {
2104 // get hs for the dead pixel at position index in list of dead
2107 GetChipAndIndexDead(module,index,gloChip,chipIndex);
2108 return GetDeadRowAtC2(gloChip,chipIndex);
2110 //____________________________________________________________________________________________
2111 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t module, UInt_t index) const {
2112 // get hs for the noisy pixel at position index in list of noisy
2115 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
2116 return GetNoisyRowAtC2(gloChip,chipIndex);
2118 //____________________________________________________________________________________________
2119 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBadEq(UInt_t eq) const {
2120 // returns nr of bad for eq (silent or noisy)
2122 nrBad+=GetNrSilentEq(eq);
2123 UInt_t nrNoisy = GetNrNoisy(eq);
2124 for (UInt_t i=0; i<nrNoisy; i++) {
2125 UInt_t hs = GetNoisyHSAtEq(eq,i);
2126 UInt_t chip = GetNoisyChipAtEq(eq,i);
2127 UInt_t col = GetNoisyColAtEq(eq,i);
2128 UInt_t row = GetNoisyRowAtEq(eq,i);
2129 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
2133 //____________________________________________________________________________________________
2134 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentEq(UInt_t eq) const {
2135 // returns nr of silent for eq (dead or inactive)
2137 if (IsSilentEq(eq)) return 81920*6;
2138 for (UInt_t hs=0; hs<6; hs++) {
2139 if (IsSilentHS(eq,hs)) {
2143 for (UInt_t chip=0; chip<10; chip++) {
2144 if (IsSilentChip(eq,hs,chip)) {
2149 returnval+=GetNrDeadC(eq,hs,chip);
2155 //____________________________________________________________________________________________
2156 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadEq(UInt_t eq) const {
2157 // returns nr of dead for eq
2159 for (UInt_t hs=0; hs<6; hs++) {
2160 for (UInt_t chip=0; chip<10; chip++) {
2161 returnval+=GetNrDeadC(eq,hs,chip);
2166 //____________________________________________________________________________________________
2167 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSparseDeadEq(UInt_t eq) const {
2168 // returns nr of dead for eq
2170 for (UInt_t hs=0; hs<6; hs++) {
2171 for (UInt_t chip=0; chip<10; chip++) {
2172 returnval+=GetNrSparseDeadC(eq,hs,chip);
2177 //____________________________________________________________________________________________
2178 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyEq(UInt_t eq) const {
2179 // returns nr of noisy for eq
2181 for (UInt_t hs=0; hs<6; hs++) {
2182 for (UInt_t chip=0; chip<10; chip++) {
2183 returnval+=GetNrNoisyC(eq,hs,chip);
2188 //____________________________________________________________________________________________
2189 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtEq(UInt_t eq, UInt_t index) const {
2190 // get eq for the dead pixel at position index in list of dead
2191 if (eq<20 && index<GetNrDeadEq(eq)) {
2198 //____________________________________________________________________________________________
2199 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtEq(UInt_t eq, UInt_t index) const {
2200 // get eq for the noisy pixel at position index in list of noisy
2201 if (eq<20 && index<GetNrNoisyEq(eq)) {
2208 //____________________________________________________________________________________________
2209 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtEq(UInt_t eq, UInt_t index) const {
2210 // get hs for the dead pixel at position index in list of dead
2213 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
2214 return GetDeadHSAtC2(gloChip,chipIndex);
2216 //____________________________________________________________________________________________
2217 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtEq(UInt_t eq, UInt_t index) const {
2218 // get hs for the noisy pixel at position index in list of noisy
2221 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
2222 return GetNoisyHSAtC2(gloChip,chipIndex);
2224 //____________________________________________________________________________________________
2225 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtEq(UInt_t eq, UInt_t index) const {
2226 // get chip for the dead pixel at position index in list of dead
2229 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
2230 return GetDeadChipAtC2(gloChip,chipIndex);
2232 //____________________________________________________________________________________________
2233 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtEq(UInt_t eq, UInt_t index) const {
2234 // get chip for the noisy pixel at position index in list of noisy
2237 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
2238 return GetNoisyChipAtC2(gloChip,chipIndex);
2240 //____________________________________________________________________________________________
2241 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtEq(UInt_t eq, UInt_t index) const {
2242 // get hs for the dead pixel at position index in list of dead
2245 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
2246 return GetDeadColAtC2(gloChip,chipIndex);
2248 //____________________________________________________________________________________________
2249 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtEq(UInt_t eq, UInt_t index) const {
2250 // get hs for the noisy pixel at position index in list of noisy
2253 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
2254 return GetNoisyColAtC2(gloChip,chipIndex);
2256 //____________________________________________________________________________________________
2257 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtEq(UInt_t eq, UInt_t index) const {
2258 // get hs for the dead pixel at position index in list of dead
2261 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
2262 return GetDeadRowAtC2(gloChip,chipIndex);
2264 //____________________________________________________________________________________________
2265 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtEq(UInt_t eq, UInt_t index) const {
2266 // get hs for the noisy pixel at position index in list of noisy
2269 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
2270 return GetNoisyRowAtC2(gloChip,chipIndex);
2272 //____________________________________________________________________________________________
2273 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
2274 // returns nr of bad for chip (silent or noisy)
2276 nrBad+=GetNrSilentC(eq,hs,chip);
2277 UInt_t nrNoisy = GetNrNoisyC(eq,hs,chip);
2278 for (UInt_t i=0; i<nrNoisy; i++) {
2279 UInt_t col = GetNoisyColAtC(eq,hs,chip,i);
2280 UInt_t row = GetNoisyRowAtC(eq,hs,chip,i);
2281 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
2285 //____________________________________________________________________________________________
2286 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentC(UInt_t eq, UInt_t hs, UInt_t chip) const {
2287 // returns nr of silent for chip (dead or inactive)
2288 if (IsSilentChip(eq,hs,chip)) return 8192;
2289 else return GetNrDeadC(eq,hs,chip);
2291 //____________________________________________________________________________________________
2292 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
2293 // returns nr of dead for chip
2294 UInt_t gloChip = GetGloChip(eq,hs,chip);
2295 return GetNrDeadC2(gloChip);
2297 //____________________________________________________________________________________________
2298 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSparseDeadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
2299 // returns nr of sparse dead for chip
2300 UInt_t gloChip = GetGloChip(eq,hs,chip);
2301 return GetNrSparseDeadC2(gloChip);
2303 //____________________________________________________________________________________________
2304 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC(UInt_t eq, UInt_t hs, UInt_t chip) const {
2305 // returns nr of noisy for chip
2306 UInt_t gloChip = GetGloChip(eq,hs,chip);
2307 return GetNrNoisyC2(gloChip);
2309 //____________________________________________________________________________________________
2310 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2311 UInt_t gloChip = GetGloChip(eq,hs,chip);
2312 return GetDeadEqIdAtC2(gloChip,index);
2314 //____________________________________________________________________________________________
2315 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2316 UInt_t gloChip = GetGloChip(eq,hs,chip);
2317 return GetNoisyEqIdAtC2(gloChip,index);
2319 //____________________________________________________________________________________________
2320 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2321 UInt_t gloChip = GetGloChip(eq,hs,chip);
2322 return GetDeadHSAtC2(gloChip,index);
2324 //____________________________________________________________________________________________
2325 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2326 UInt_t gloChip = GetGloChip(eq,hs,chip);
2327 return GetNoisyHSAtC2(gloChip,index);
2329 //____________________________________________________________________________________________
2330 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2331 UInt_t gloChip = GetGloChip(eq,hs,chip);
2332 return GetDeadChipAtC2(gloChip,index);
2334 //____________________________________________________________________________________________
2335 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2336 UInt_t gloChip = GetGloChip(eq,hs,chip);
2337 return GetNoisyChipAtC2(gloChip,index);
2339 //____________________________________________________________________________________________
2340 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2341 UInt_t gloChip = GetGloChip(eq,hs,chip);
2342 return GetDeadColAtC2(gloChip,index);
2344 //____________________________________________________________________________________________
2345 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2346 UInt_t gloChip = GetGloChip(eq,hs,chip);
2347 return GetNoisyColAtC2(gloChip,index);
2349 //____________________________________________________________________________________________
2350 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2351 UInt_t gloChip = GetGloChip(eq,hs,chip);
2352 return GetDeadRowAtC2(gloChip,index);
2354 //____________________________________________________________________________________________
2355 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2356 UInt_t gloChip = GetGloChip(eq,hs,chip);
2357 return GetNoisyRowAtC2(gloChip,index);
2359 //____________________________________________________________________________________________
2360 const Char_t* AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2361 // get a string of dead pixel info
2362 TString returnMess = "";
2363 UInt_t gloChip = GetGloChip(eq,hs,chip);
2364 if (gloChip>=1200) {
2365 Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
2366 return returnMess.Data();
2368 if (index<fNrDead[gloChip]) {
2369 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2370 UInt_t col = GetColFromKey(key);
2371 UInt_t row = GetRowFromKey(key);
2372 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
2373 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
2374 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
2375 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);
2376 return returnMess.Data();
2379 Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "Index %d out of bounds.", index);
2380 return returnMess.Data();
2383 //____________________________________________________________________________________________
2384 const Char_t* AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2385 // get a string of noisy pixel info
2386 TString returnMess = "";
2387 UInt_t gloChip = GetGloChip(eq,hs,chip);
2388 if (gloChip>=1200) {
2389 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
2390 return returnMess.Data();
2392 if (index<fNrNoisy[gloChip]) {
2393 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2394 UInt_t col = GetColFromKey(key);
2395 UInt_t row = GetRowFromKey(key);
2396 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
2397 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
2398 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
2399 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);
2400 return returnMess.Data();
2403 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "Index %d out of bounds.", index);
2404 return returnMess.Data();
2407 //____________________________________________________________________________________________
2408 UInt_t AliITSOnlineCalibrationSPDhandler::AddSilentFrom(AliITSOnlineCalibrationSPDhandler* other) {
2409 // returns number of new silent pixels in this' list (dead or inactive)
2410 UInt_t tmpdead = GetNrSilent();
2412 for (UInt_t eq=0; eq<20; eq++) {
2413 if (!(other->IsActiveEq(eq))) ActivateEq(eq,kFALSE);
2414 if (other->IsDeadEq(eq)) SetDeadEq(eq,kTRUE);
2415 for (UInt_t hs=0; hs<6; hs++) {
2416 if (!(other->IsActiveHS(eq,hs))) ActivateHS(eq,hs,kFALSE);
2417 if (other->IsDeadHS(eq,hs)) SetDeadHS(eq,hs,kTRUE);
2418 for (UInt_t chip=0; chip<10; chip++) {
2419 if (!(other->IsActiveChip(eq,hs,chip))) ActivateChip(eq,hs,chip,kFALSE);
2420 if (other->IsDeadChip(eq,hs,chip)) SetDeadChip(eq,hs,chip,kTRUE);
2427 return GetNrSilent() - tmpdead;
2429 //____________________________________________________________________________________________
2430 UInt_t AliITSOnlineCalibrationSPDhandler::AddDeadFrom(AliITSOnlineCalibrationSPDhandler* other) {
2431 // returns number of new dead pixels in this' list
2433 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2434 for (UInt_t ind1=0; ind1<other->fNrDead[gloChip]; ind1++) {
2435 UInt_t eq = other->GetDeadEqIdAtC2(gloChip,ind1);
2436 UInt_t hs = other->GetDeadHSAtC2(gloChip,ind1);
2437 UInt_t chip = other->GetDeadChipAtC2(gloChip,ind1);
2438 UInt_t col = other->GetDeadColAtC2(gloChip,ind1);
2439 UInt_t row = other->GetDeadRowAtC2(gloChip,ind1);
2440 if (SetDeadPixel(eq,hs,chip,col,row)) {
2447 //____________________________________________________________________________________________
2448 UInt_t AliITSOnlineCalibrationSPDhandler::AddNoisyFrom(AliITSOnlineCalibrationSPDhandler* other) {
2449 // returns number of new noisy pixels in this' list
2451 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2452 for (UInt_t ind1=0; ind1<other->fNrNoisy[gloChip]; ind1++) {
2453 UInt_t eq = other->GetNoisyEqIdAtC2(gloChip,ind1);
2454 UInt_t hs = other->GetNoisyHSAtC2(gloChip,ind1);
2455 UInt_t chip = other->GetNoisyChipAtC2(gloChip,ind1);
2456 UInt_t col = other->GetNoisyColAtC2(gloChip,ind1);
2457 UInt_t row = other->GetNoisyRowAtC2(gloChip,ind1);
2458 if (SetNoisyPixel(eq,hs,chip,col,row)) {
2465 //____________________________________________________________________________________________
2466 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2467 // returns nr of dead/noisy in this' lists and not in other's lists (including inactive)
2468 return GetNrSilentDiff(other) + GetNrNoisyDiff(other);
2470 //____________________________________________________________________________________________
2471 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2472 // returns nr of single silent pixels in this' lists and not in other's lists (dead or inactive)
2474 for (UInt_t eq=0; eq<20; eq++) {
2475 for (UInt_t hs=0; hs<6; hs++) {
2476 for (UInt_t chip=0; chip<10; chip++) {
2477 if (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs) || !IsActiveChip(eq,hs,chip) || IsDeadChip(eq,hs,chip)) {
2478 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)) {
2479 // if this is inactive and the other is active...
2480 returnval+= 8192 - other->GetNrDeadC(eq,hs,chip);
2484 UInt_t gloChip = GetGloChip(eq,hs,chip);
2485 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2486 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2487 UInt_t col = GetColFromKey(key);
2488 UInt_t row = GetRowFromKey(key);
2489 if (!(other->IsPixelSilent(eq,hs,chip,col,row))) {
2499 //____________________________________________________________________________________________
2500 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2501 // returns nr of dead in this' lists and not in other's lists
2503 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2504 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2505 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2506 UInt_t eq = GetEqIdFromKey(key);
2507 UInt_t hs = GetHSFromKey(key);
2508 UInt_t chip = GetChipFromKey(key);
2509 UInt_t col = GetColFromKey(key);
2510 UInt_t row = GetRowFromKey(key);
2511 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2518 //____________________________________________________________________________________________
2519 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2520 // returns nr of noisy in this' lists and not in other's lists
2522 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2523 for (UInt_t ind1=0; ind1<fNrNoisy[gloChip]; ind1++) {
2524 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind1);
2525 UInt_t eq = GetEqIdFromKey(key);
2526 UInt_t hs = GetHSFromKey(key);
2527 UInt_t chip = GetChipFromKey(key);
2528 UInt_t col = GetColFromKey(key);
2529 UInt_t row = GetRowFromKey(key);
2530 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2537 //____________________________________________________________________________________________
2538 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2539 // returns handler with active/dead/noisy in this' lists, removing those that are in other's lists
2540 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2542 for (UInt_t eq=0; eq<20; eq++) {
2543 if (!(IsActiveEq(eq))) {
2544 newHandler->ActivateEq(eq,kFALSE);
2545 if (!other->IsActiveEq(eq)) newHandler->ActivateEq(eq);
2548 newHandler->SetDeadEq(eq);
2549 if (other->IsDeadEq(eq)) newHandler->SetDeadEq(eq,kFALSE);
2551 for (UInt_t hs=0; hs<6; hs++) {
2552 if (!(IsActiveHS(eq,hs))) {
2553 newHandler->ActivateHS(eq,hs,kFALSE);
2554 if (!other->IsActiveHS(eq,hs)) newHandler->ActivateHS(eq,hs);
2556 if (IsDeadHS(eq,hs)) {
2557 newHandler->SetDeadHS(eq,hs);
2558 if (other->IsDeadHS(eq,hs)) newHandler->SetDeadHS(eq,hs,kFALSE);
2560 for (UInt_t chip=0; chip<10; chip++) {
2561 if (!(IsActiveChip(eq,hs,chip))) {
2562 newHandler->ActivateChip(eq,hs,chip,kFALSE);
2563 if (!other->IsActiveChip(eq,hs,chip)) newHandler->ActivateHS(eq,hs,chip);
2565 if (IsDeadChip(eq,hs,chip)) {
2566 newHandler->SetDeadChip(eq,hs,chip);
2567 if (other->IsDeadChip(eq,hs,chip)) newHandler->SetDeadChip(eq,hs,chip,kFALSE);
2573 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2574 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2575 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2576 UInt_t eq = GetEqIdFromKey(key);
2577 UInt_t hs = GetHSFromKey(key);
2578 UInt_t chip = GetChipFromKey(key);
2579 UInt_t col = GetColFromKey(key);
2580 UInt_t row = GetRowFromKey(key);
2581 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2582 newHandler->SetDeadPixel(eq,hs,chip,col,row);
2587 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2588 for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
2589 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
2590 UInt_t eq = GetEqIdFromKey(key);
2591 UInt_t hs = GetHSFromKey(key);
2592 UInt_t chip = GetChipFromKey(key);
2593 UInt_t col = GetColFromKey(key);
2594 UInt_t row = GetRowFromKey(key);
2595 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2596 newHandler->SetNoisyPixel(eq,hs,chip,col,row);
2603 //____________________________________________________________________________________________
2604 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetSilentDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2605 // returns handler with active/dead in this' lists, removing those that are in other's lists
2606 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2608 for (UInt_t eq=0; eq<20; eq++) {
2609 if (!(IsActiveEq(eq))) {
2610 newHandler->ActivateEq(eq,kFALSE);
2611 if (!other->IsActiveEq(eq)) newHandler->ActivateEq(eq);
2614 newHandler->SetDeadEq(eq);
2615 if (other->IsDeadEq(eq)) newHandler->SetDeadEq(eq,kFALSE);
2617 for (UInt_t hs=0; hs<6; hs++) {
2618 if (!(IsActiveHS(eq,hs))) {
2619 newHandler->ActivateHS(eq,hs,kFALSE);
2620 if (!other->IsActiveHS(eq,hs)) newHandler->ActivateHS(eq,hs);
2622 if (IsDeadHS(eq,hs)) {
2623 newHandler->SetDeadHS(eq,hs);
2624 if (other->IsDeadHS(eq,hs)) newHandler->SetDeadHS(eq,hs,kFALSE);
2626 for (UInt_t chip=0; chip<10; chip++) {
2627 if (!(IsActiveChip(eq,hs,chip))) {
2628 newHandler->ActivateChip(eq,hs,chip,kFALSE);
2629 if (!other->IsActiveChip(eq,hs,chip)) newHandler->ActivateHS(eq,hs,chip);
2631 if (IsDeadChip(eq,hs,chip)) {
2632 newHandler->SetDeadChip(eq,hs,chip);
2633 if (other->IsDeadChip(eq,hs,chip)) newHandler->SetDeadChip(eq,hs,chip,kFALSE);
2639 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2640 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2641 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2642 UInt_t eq = GetEqIdFromKey(key);
2643 UInt_t hs = GetHSFromKey(key);
2644 UInt_t chip = GetChipFromKey(key);
2645 UInt_t col = GetColFromKey(key);
2646 UInt_t row = GetRowFromKey(key);
2647 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2648 newHandler->SetDeadPixel(eq,hs,chip,col,row);
2655 //____________________________________________________________________________________________
2656 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2657 // returns handler with dead in this' lists, except for those in other's lists
2658 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2659 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2660 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2661 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2662 UInt_t eq = GetEqIdFromKey(key);
2663 UInt_t hs = GetHSFromKey(key);
2664 UInt_t chip = GetChipFromKey(key);
2665 UInt_t col = GetColFromKey(key);
2666 UInt_t row = GetRowFromKey(key);
2667 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2668 newHandler->SetDeadPixel(eq,hs,chip,col,row);
2674 //____________________________________________________________________________________________
2675 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2676 // returns handler with noisy in this' lists, except for those in other's lists
2677 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2678 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2679 for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
2680 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
2681 UInt_t eq = GetEqIdFromKey(key);
2682 UInt_t hs = GetHSFromKey(key);
2683 UInt_t chip = GetChipFromKey(key);
2684 UInt_t col = GetColFromKey(key);
2685 UInt_t row = GetRowFromKey(key);
2686 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2687 newHandler->SetNoisyPixel(eq,hs,chip,col,row);
2693 //____________________________________________________________________________________________
2694 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2695 // find gloChip and chipIndex from module and index
2696 if (index<GetNrDead(module)) {
2697 UInt_t eq = GetEqIdFromOffline(module);
2698 UInt_t hs = GetHSFromOffline(module);
2701 for (UInt_t ch=0; ch<5; ch++) {
2702 gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
2703 if (glVal+fNrDead[gloChip]>index) {
2704 chipIndex = index-glVal;
2708 glVal+=fNrDead[gloChip];
2714 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead", "Index %d out of bounds.", index);
2717 //____________________________________________________________________________________________
2718 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2719 // find gloChip and chipIndex from module and index
2720 if (index<GetNrNoisy(module)) {
2721 UInt_t eq = GetEqIdFromOffline(module);
2722 UInt_t hs = GetHSFromOffline(module);
2725 for (UInt_t ch=0; ch<5; ch++) {
2726 gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
2727 if (glVal+fNrNoisy[gloChip]>index) {
2728 chipIndex = index-glVal;
2732 glVal+=fNrNoisy[gloChip];
2738 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy", "Index %d out of bounds.", index);
2741 //____________________________________________________________________________________________
2742 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2743 // find gloChip and chipIndex from module and index
2744 if (index<GetNrDeadEq(eq)) {
2747 for (UInt_t hs=0; hs<6; hs++) {
2748 for (UInt_t chip=0; chip<10; chip++) {
2749 gloChip = GetGloChip(eq,hs,chip);
2750 if (glVal+fNrDead[gloChip]>index) {
2751 chipIndex = index-glVal;
2755 glVal+=fNrDead[gloChip];
2762 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead", "Index %d out of bounds.", index);
2765 //____________________________________________________________________________________________
2766 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2767 // find gloChip and chipIndex from module and index
2768 if (index<GetNrNoisyEq(eq)) {
2771 for (UInt_t hs=0; hs<6; hs++) {
2772 for (UInt_t chip=0; chip<10; chip++) {
2773 gloChip = GetGloChip(eq,hs,chip);
2774 if (glVal+fNrNoisy[gloChip]>index) {
2775 chipIndex = index-glVal;
2779 glVal+=fNrNoisy[gloChip];
2786 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy", "Index %d out of bounds.", index);
2789 //____________________________________________________________________________________________
2790 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2791 // find gloChip and chipIndex from global index
2792 if (index<GetNrDead()) {
2795 for (gloChip=0; gloChip<1200; gloChip++) {
2796 if (glVal+fNrDead[gloChip]>index) {
2797 chipIndex = index-glVal;
2801 glVal+=fNrDead[gloChip];
2807 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead", "Index %d out of bounds.", index);
2810 //____________________________________________________________________________________________
2811 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2812 // find gloChip and chipIndex from global index
2813 if (index<GetNrNoisy()) {
2816 for (gloChip=0; gloChip<1200; gloChip++) {
2817 if (glVal+fNrNoisy[gloChip]>index) {
2818 chipIndex = index-glVal;
2822 glVal+=fNrNoisy[gloChip];
2828 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy", "Index %d out of bounds.", index);
2831 //____________________________________________________________________________________________
2832 UInt_t AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline(UInt_t module) const {
2833 // module to eq mapping
2835 Error("AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline", "module nr (%d) out of bounds.",module);
2838 return AliITSRawStreamSPD::GetOnlineEqIdFromOffline(module);
2840 //____________________________________________________________________________________________
2841 UInt_t AliITSOnlineCalibrationSPDhandler::GetHSFromOffline(UInt_t module) const {
2842 // module to hs mapping
2844 Error("AliITSOnlineCalibrationSPDhandler::GetHSFromOffline", "module nr (%d) out of bounds.",module);
2847 return AliITSRawStreamSPD::GetOnlineHSFromOffline(module);
2849 //____________________________________________________________________________________________
2850 UInt_t AliITSOnlineCalibrationSPDhandler::GetChipFromOffline(UInt_t module, UInt_t colM) const {
2851 // module,colM to chip mapping
2852 if (module>=240 || colM>=160) {
2853 Error("AliITSOnlineCalibrationSPDhandler::GetChipFromOffline", "module,colM nrs (%d,%d) out of bounds.",module,colM);
2856 return AliITSRawStreamSPD::GetOnlineChipFromOffline(module,colM);
2858 //____________________________________________________________________________________________
2859 UInt_t AliITSOnlineCalibrationSPDhandler::GetColFromOffline(UInt_t module, UInt_t colM) const {
2860 // colM to col mapping
2862 Error("AliITSOnlineCalibrationSPDhandler::GetColFromOffline", "colM nr (%d) out of bounds.",colM);
2865 return AliITSRawStreamSPD::GetOnlineColFromOffline(module,colM);
2867 //____________________________________________________________________________________________
2868 UInt_t AliITSOnlineCalibrationSPDhandler::GetRowFromOffline(UInt_t module, UInt_t rowM) const {
2869 // rowM to row mapping
2871 Error("AliITSOnlineCalibrationSPDhandler::GetRowFromOffline", "rowM nr (%d) out of bounds.",rowM);
2874 return AliITSRawStreamSPD::GetOnlineRowFromOffline(module,rowM);
2876 //____________________________________________________________________________________________
2877 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC2(UInt_t gloChip) const {
2878 // returns nr of dead pixels on this chip
2879 if (gloChip>=1200) {
2880 Error("AliITSOnlineCalibrationSPDhandler::GetNrDeadC2", "global chip nr (%d) out of bounds.",gloChip);
2883 return fNrDead[gloChip];
2885 //____________________________________________________________________________________________
2886 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSparseDeadC2(UInt_t gloChip) const {
2887 // returns nr of dead pixels on this chip
2888 if (gloChip>=1200) {
2889 Error("AliITSOnlineCalibrationSPDhandler::GetNrSparseDeadC2", "global chip nr (%d) out of bounds.",gloChip);
2892 return fNrSparseDead[gloChip];
2894 //____________________________________________________________________________________________
2895 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2(UInt_t gloChip) const {
2896 // returns nr of noisy pixels on this chip
2897 if (gloChip>=1200) {
2898 Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2", "global chip nr (%d) out of bounds.",gloChip);
2901 return fNrNoisy[gloChip];
2903 //____________________________________________________________________________________________
2904 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC2(UInt_t gloChip, UInt_t index) const {
2905 // get eq for the dead pixel at position index in list of dead
2906 if (gloChip>=1200) {
2907 Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
2910 if (index<fNrDead[gloChip]) {
2911 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2912 return GetEqIdFromKey(key);
2915 Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "Index %d out of bounds.", index);
2919 //____________________________________________________________________________________________
2920 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC2(UInt_t gloChip, UInt_t index) const {
2921 // get eq for the noisy pixel at position index in list of noisy
2922 if (gloChip>=1200) {
2923 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
2926 if (index<fNrNoisy[gloChip]) {
2927 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2928 return GetEqIdFromKey(key);
2931 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "Index %d out of bounds.", index);
2935 //____________________________________________________________________________________________
2936 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC2(UInt_t gloChip, UInt_t index) const {
2937 // get hs for the dead pixel at position index in list of dead
2938 if (gloChip>=1200) {
2939 Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "global chip nr (%d) out of bounds.",gloChip);
2942 if (index<fNrDead[gloChip]) {
2943 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2944 return GetHSFromKey(key);
2947 Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "Index %d out of bounds.", index);
2951 //____________________________________________________________________________________________
2952 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC2(UInt_t gloChip, UInt_t index) const {
2953 // get hs for the noisy pixel at position index in list of noisy
2954 if (gloChip>=1200) {
2955 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "global chip nr (%d) out of bounds.",gloChip);
2958 if (index<fNrNoisy[gloChip]) {
2959 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2960 return GetHSFromKey(key);
2963 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "Index %d out of bounds.", index);
2967 //____________________________________________________________________________________________
2968 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC2(UInt_t gloChip, UInt_t index) const {
2969 // get chip for the dead pixel at position index in list of dead
2970 if (gloChip>=1200) {
2971 Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "global chip nr (%d) out of bounds.",gloChip);
2974 if (index<fNrDead[gloChip]) {
2975 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2976 return GetChipFromKey(key);
2979 Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "Index %d out of bounds.", index);
2983 //____________________________________________________________________________________________
2984 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC2(UInt_t gloChip, UInt_t index) const {
2985 // get chip for the noisy pixel at position index in list of noisy
2986 if (gloChip>=1200) {
2987 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "global chip nr (%d) out of bounds.",gloChip);
2990 if (index<fNrNoisy[gloChip]) {
2991 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2992 return GetChipFromKey(key);
2995 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "Index %d out of bounds.", index);
2999 //____________________________________________________________________________________________
3000 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2(UInt_t gloChip, UInt_t index) const {
3001 // get col for the dead pixel at position index in list of dead
3002 if (gloChip>=1200) {
3003 Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "global chip nr (%d) out of bounds.",gloChip);
3006 if (index<fNrDead[gloChip]) {
3007 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
3008 return GetColFromKey(key);
3011 Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "Index %d out of bounds.", index);
3015 //____________________________________________________________________________________________
3016 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC2(UInt_t gloChip, UInt_t index) const {
3017 // get col for the noisy pixel at position index in list of noisy
3018 if (gloChip>=1200) {
3019 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "global chip nr (%d) out of bounds.",gloChip);
3022 if (index<fNrNoisy[gloChip]) {
3023 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
3024 return GetColFromKey(key);
3027 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "Index %d out of bounds.", index);
3031 //____________________________________________________________________________________________
3032 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC2(UInt_t gloChip, UInt_t index) const {
3033 // get row for the dead pixel at position index in list of dead
3034 if (gloChip>=1200) {
3035 Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "global chip nr (%d) out of bounds.",gloChip);
3038 if (index<fNrDead[gloChip]) {
3039 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
3040 return GetRowFromKey(key);
3043 Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "Index %d out of bounds.", index);
3047 //____________________________________________________________________________________________
3048 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC2(UInt_t gloChip, UInt_t index) const {
3049 // get row for the noisy pixel at position index in list of noisy
3050 if (gloChip>=1200) {
3051 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "global chip nr (%d) out of bounds.",gloChip);
3054 if (index<fNrNoisy[gloChip]) {
3055 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
3056 return GetRowFromKey(key);
3059 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "Index %d out of bounds.", index);
3063 //____________________________________________________________________________________________
3064 void AliITSOnlineCalibrationSPDhandler::ActivateALL() {
3065 // activate all eq,hs,chips
3066 for (UInt_t eq=0; eq<20; eq++) {
3069 for (UInt_t hs=0; hs<6; hs++) {
3071 for (UInt_t chip=0; chip<10; chip++) {
3072 ActivateChip(eq,hs,chip);
3077 //____________________________________________________________________________________________
3078 void AliITSOnlineCalibrationSPDhandler::ActivateEq(UInt_t eq, Bool_t setval) {
3081 Error("AliITSOnlineCalibrationSPDhandler::ActivateEq", "eq (%d) out of bounds.",eq);
3084 fActiveEq[eq] = setval;
3086 //____________________________________________________________________________________________
3087 void AliITSOnlineCalibrationSPDhandler::ActivateHS(UInt_t eq, UInt_t hs, Bool_t setval) {
3089 if (eq>=20 || hs>=6) {
3090 Error("AliITSOnlineCalibrationSPDhandler::ActivateHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
3093 fActiveHS[eq][hs] = setval;
3095 //____________________________________________________________________________________________
3096 void AliITSOnlineCalibrationSPDhandler::ActivateChip(UInt_t eq, UInt_t hs, UInt_t chip, Bool_t setval) {
3098 if (eq>=20 || hs>=6 || chip>=10) {
3099 Error("AliITSOnlineCalibrationSPDhandler::ActivateChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
3102 fActiveChip[eq][hs][chip] = setval;
3104 //____________________________________________________________________________________________
3105 Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveEq(UInt_t eq) const {
3108 Error("AliITSOnlineCalibrationSPDhandler::IsActiveEq", "eq (%d) out of bounds.",eq);
3111 return fActiveEq[eq];
3113 //____________________________________________________________________________________________
3114 Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveHS(UInt_t eq, UInt_t hs) const {
3116 if (eq>=20 || hs>=6) {
3117 Error("AliITSOnlineCalibrationSPDhandler::IsActiveHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
3120 return fActiveHS[eq][hs];
3122 //____________________________________________________________________________________________
3123 Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
3125 if (eq>=20 || hs>=6 || chip>=10) {
3126 Error("AliITSOnlineCalibrationSPDhandler::IsActiveChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
3129 return fActiveChip[eq][hs][chip];
3131 //____________________________________________________________________________________________
3132 void AliITSOnlineCalibrationSPDhandler::UnSetDeadALL() {
3133 // Clear all dead eq,hs,chips
3134 for (UInt_t eq=0; eq<20; eq++) {
3135 SetDeadEq(eq,kFALSE);
3136 for (UInt_t hs=0; hs<6; hs++) {
3137 SetDeadHS(eq,hs,kFALSE);
3138 for (UInt_t chip=0; chip<10; chip++) {
3139 SetDeadChip(eq,hs,chip,kFALSE);
3144 //____________________________________________________________________________________________
3145 void AliITSOnlineCalibrationSPDhandler::SetDeadEq(UInt_t eq, Bool_t setval) {
3148 Error("AliITSOnlineCalibrationSPDhandler::SetDeadEq", "eq (%d) out of bounds.",eq);
3151 fDeadEq[eq] = setval;
3153 //____________________________________________________________________________________________
3154 void AliITSOnlineCalibrationSPDhandler::SetDeadHS(UInt_t eq, UInt_t hs, Bool_t setval) {
3156 if (eq>=20 || hs>=6) {
3157 Error("AliITSOnlineCalibrationSPDhandler::SetDeadHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
3160 fDeadHS[eq][hs] = setval;
3162 //____________________________________________________________________________________________
3163 void AliITSOnlineCalibrationSPDhandler::SetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip, Bool_t setval) {
3165 if (eq>=20 || hs>=6 || chip>=10) {
3166 Error("AliITSOnlineCalibrationSPDhandler::SetDeadChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
3169 fDeadChip[eq][hs][chip] = setval;
3171 //____________________________________________________________________________________________
3172 Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadEq(UInt_t eq) const {
3175 Error("AliITSOnlineCalibrationSPDhandler::IsDeadEq", "eq (%d) out of bounds.",eq);
3180 //____________________________________________________________________________________________
3181 Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadHS(UInt_t eq, UInt_t hs) const {
3183 if (eq>=20 || hs>=6) {
3184 Error("AliITSOnlineCalibrationSPDhandler::IsDeadHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
3187 return fDeadHS[eq][hs];
3189 //____________________________________________________________________________________________
3190 Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
3192 if (eq>=20 || hs>=6 || chip>=10) {
3193 Error("AliITSOnlineCalibrationSPDhandler::IsDeadChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
3196 return fDeadChip[eq][hs][chip];
3198 //____________________________________________________________________________________________
3199 Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentEq(UInt_t eq) const {
3202 Error("AliITSOnlineCalibrationSPDhandler::IsSilentEq", "eq (%d) out of bounds.",eq);
3205 return (!IsActiveEq(eq) || IsDeadEq(eq));
3207 //____________________________________________________________________________________________
3208 Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentHS(UInt_t eq, UInt_t hs) const {
3210 if (eq>=20 || hs>=6) {
3211 Error("AliITSOnlineCalibrationSPDhandler::IsSilentHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
3214 return (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs));
3216 //____________________________________________________________________________________________
3217 Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
3219 if (eq>=20 || hs>=6 || chip>=10) {
3220 Error("AliITSOnlineCalibrationSPDhandler::IsSilentChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
3223 return (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs) || !IsActiveChip(eq,hs,chip) || IsDeadChip(eq,hs,chip));
3225 //____________________________________________________________________________________________
3226 Bool_t AliITSOnlineCalibrationSPDhandler::IsNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
3227 // returns true if there is at least a noisy pixel in the chip
3229 if (eq>=20 || hs>=6 || chip>=10) {
3230 Error("AliITSOnlineCalibrationSPDhandler::IsNoisyChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
3233 Bool_t isNoisy = kFALSE;
3235 UInt_t nrNoisy = GetNrNoisy();
3236 for (UInt_t i=0; i<nrNoisy; i++) {
3237 if(eq == GetNoisyEqIdAt(i)){
3238 if(hs == GetNoisyHSAt(i)){
3239 if(chip == GetNoisyChipAt(i)) {
3240 UInt_t col = GetNoisyColAt(i);
3241 UInt_t row = GetNoisyRowAt(i);
3242 if (IsPixelNoisy(eq,hs,chip,col,row)) isNoisy = kTRUE;
3249 //____________________________________________________________________________________________
3250 Bool_t AliITSOnlineCalibrationSPDhandler::WritePITConditionsToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
3251 // writes noisy pixels to DB for given runNrs
3252 // overwrites any previous entries
3253 AliCDBManager* man = AliCDBManager::Instance();
3254 TString storageSTR = Form("%s",storage);
3255 if (storageSTR.CompareTo("default")==0) {
3256 if(!man->IsDefaultStorageSet()) {
3257 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
3261 storageSTR = Form("%s",storage);
3262 man->SetDefaultStorage(storageSTR.Data());
3264 AliCDBMetaData* metaData = new AliCDBMetaData();
3265 metaData->SetResponsible("Annalisa Mastroserio");
3266 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
3267 AliCDBId idCalSPD("TRIGGER/SPD/PITConditions",runNrStart,runNrEnd);
3268 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)fTriggerConditions,idCalSPD,metaData);
3275 //____________________________________________________________________________________________
3276 Bool_t AliITSOnlineCalibrationSPDhandler::SetInactiveChipInPITmask(UInt_t eq, UInt_t hs, UInt_t chip){
3278 fTriggerConditions->SetInActiveChip(eq,hs,chip);
3281 //____________________________________________________________________________________________
3282 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetInactiveChipInPITmask(UInt_t eq, UInt_t hs, UInt_t chip){
3284 fTriggerConditions->SetInActiveChip(eq,hs,chip);
3287 //____________________________________________________________________________________________
3288 void AliITSOnlineCalibrationSPDhandler::PrintDiffInDead(AliITSOnlineCalibrationSPDhandler *other) const {
3290 // Printout of the differences between two ocdb files for SPD Dead channel map
3293 UInt_t nrDeadChipOk=0;
3294 UInt_t nrDeadHsOk=0;
3296 UInt_t nrDeadChip=0;
3297 UInt_t nrDeadHsInOther =0;
3298 UInt_t nrDeadChipInOther=0;
3299 UInt_t nrMismatch =0;
3300 UInt_t nrMismatchInOther =0;
3301 printf("\n\n ****** loop over chips ***** \n");
3302 for(Int_t eq=0; eq<20; eq++){
3303 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));
3304 for(Int_t hs=0; hs<6; hs++){
3306 Short_t nchipsOther =0;
3308 for(Int_t chip=0; chip<10; chip++){
3309 UInt_t chipkey = AliITSRawStreamSPD::GetOfflineChipKeyFromOnline(eq,hs,chip);
3310 // test if everything is coherent
3311 if(IsDeadChip(eq,hs,chip) && other->IsDeadChip(eq,hs,chip)) {
3316 if(!IsDeadChip(eq,hs,chip) && !other->IsDeadChip(eq,hs,chip)) nrChipOk++;
3317 // now testing if mismatches
3318 if(IsDeadChip(eq,hs,chip)) {
3321 if(!other->IsDeadChip(eq,hs,chip)) {
3323 printf(" mismatch -> eq %i hs %i chip %i is DEAD - ALIVE in the other (chipkey %i)\n",eq,hs,chip,chipkey);
3326 if(other->IsDeadChip(eq,hs,chip)){
3327 nrDeadChipInOther++;
3329 if(!IsDeadChip(eq,hs,chip)) {
3330 nrMismatchInOther++;
3331 printf(" mismatch -> eq %i hs %i chip %i is ALIVE - DEAD in the other (chipkey %i)\n",eq,hs,chip,chipkey);
3335 if(nok==10) nrDeadHsOk++;
3336 if(nchips==10) nrDeadHs++;
3337 if(nchipsOther==10) nrDeadHsInOther++;
3341 printf("\n\n\n*************SUMMARY****************\n");
3342 printf(" BOTH have : %i Dead HS and %i Dead chips with %i coherent chips \n",nrDeadHsOk,nrDeadChipOk,nrChipOk);
3343 printf("\n_________MISMATCH RESULTS___________\n");
3344 printf(" THIS : Nr Dead HS %i - Nr Dead Chip %i \n",nrDeadHs,nrDeadChip);
3345 printf(" OTHER : Nr Dead HS %i - Nr Dead Chip %i \n",nrDeadHsInOther,nrDeadChipInOther);
3346 printf(" N Mismatches in Dead chips (=ALIVE in the other) %i \n",nrMismatch);
3347 printf(" N Mismatches in Alive chips (=DEAD in the other) %i \n",nrMismatchInOther);
3349 //____________________________________________________________________________________________
3350 void AliITSOnlineCalibrationSPDhandler::PrintDiffInPITmask(AliITSOnlineCalibrationSPDhandler *other) const {
3352 // Printout of the differences between two ocdb files for SPD Dead channel map
3357 Int_t nMismatchInOther =0;
3359 printf("\n\n ****** loop over chips in PIT mask***** \n");
3360 for(Int_t eq=0; eq<20; eq++){
3361 for(Int_t hs=0; hs<6; hs++){
3362 for(Int_t chip=0; chip<10; chip++){
3364 UInt_t chipkey = AliITSRawStreamSPD::GetOfflineChipKeyFromOnline(eq,hs,chip);
3366 if(fTriggerConditions->IsChipActive(eq,hs,chip) && (other->GetTriggerConditions())->IsChipActive(eq,hs,chip)) nOk++;
3367 if(fTriggerConditions->IsChipActive(eq,hs,chip) && !(other->GetTriggerConditions())->IsChipActive(eq,hs,chip)) {
3369 printf("Mismatch -> eq %i hs %i chip %i is ACTIVE - INACTIVE in the other (chipkey %i) \n",eq,hs,chip,chipkey);
3371 if(!fTriggerConditions->IsChipActive(eq,hs,chip) && (other->GetTriggerConditions())->IsChipActive(eq,hs,chip)) {
3373 printf("Mismatch -> eq %i hs %i chip %i is INACTIVE - ACTIVE in the other (chipkey %i) \n",eq,hs,chip,chipkey);
3375 if(!fTriggerConditions->IsChipActive(eq,hs,chip) && !(other->GetTriggerConditions())->IsChipActive(eq,hs,chip)) nOk++;
3380 printf("n Chips OK %i : ACTIVE mismatch %i - INACTIVE mismatch in %i \n",nOk,nMismatch,nMismatchInOther);