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 "AliITSIntMap.h"
17 #include <TObjArray.h>
24 #ifndef SPD_DA_OFF // you may want to exclude cdb classes, if using this class outside aliroot
25 #include "AliITSCalibrationSPD.h"
26 #include "AliCDBManager.h"
27 #include "AliCDBEntry.h"
32 //____________________________________________________________________________________________
33 AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler():
37 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
40 fDeadPixelMap[gloChip] = new AliITSIntMap();
41 fNoisyPixelMap[gloChip] = new AliITSIntMap();
46 //____________________________________________________________________________________________
47 AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler(const AliITSOnlineCalibrationSPDhandler& handle):
51 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
52 fNrDead[gloChip] = handle.fNrDead[gloChip];
53 fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
54 fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
55 fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
57 for (UInt_t eq=0; eq<20; eq++) {
58 fActiveEq[eq] = handle.fActiveEq[eq];
59 for (UInt_t hs=0; hs<6; hs++) {
60 fActiveHS[eq][hs] = handle.fActiveHS[eq][hs];
61 for (UInt_t chip=0; chip<10; chip++) {
62 fActiveChip[eq][hs][chip] = handle.fActiveChip[eq][hs][chip];
66 fFileLocation = handle.fFileLocation;
68 //____________________________________________________________________________________________
69 AliITSOnlineCalibrationSPDhandler::~AliITSOnlineCalibrationSPDhandler() {
71 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
72 delete fDeadPixelMap[gloChip];
73 delete fNoisyPixelMap[gloChip];
76 //____________________________________________________________________________________________
77 AliITSOnlineCalibrationSPDhandler& AliITSOnlineCalibrationSPDhandler::operator=(const AliITSOnlineCalibrationSPDhandler& handle) {
78 // assignment operator
81 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
82 fNrDead[gloChip] = handle.fNrDead[gloChip];
83 fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
84 fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
85 fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
87 for (UInt_t eq=0; eq<20; eq++) {
88 fActiveEq[eq] = handle.fActiveEq[eq];
89 for (UInt_t hs=0; hs<6; hs++) {
90 fActiveHS[eq][hs] = handle.fActiveHS[eq][hs];
91 for (UInt_t chip=0; chip<10; chip++) {
92 fActiveChip[eq][hs][chip] = handle.fActiveChip[eq][hs][chip];
96 fFileLocation = handle.fFileLocation;
100 //____________________________________________________________________________________________
101 void AliITSOnlineCalibrationSPDhandler::ClearMaps() {
102 // clear the lists of dead and noisy
107 //____________________________________________________________________________________________
108 void AliITSOnlineCalibrationSPDhandler::ResetDead() {
109 // reset the dead pixel map and inactive eq,hs,chip
111 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
113 fDeadPixelMap[gloChip]->Clear();
116 //____________________________________________________________________________________________
117 void AliITSOnlineCalibrationSPDhandler::ResetNoisy() {
118 // clear the list of noisy pixels
119 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
121 fNoisyPixelMap[gloChip]->Clear();
124 //____________________________________________________________________________________________
125 void AliITSOnlineCalibrationSPDhandler::ResetDeadForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
126 // clear the dead pixels for this chip
127 SetDeadChip(eq,hs,chip,kFALSE);
128 UInt_t gloChip = GetGloChip(eq,hs,chip);
129 for (UInt_t col=0; col<32; col++) {
130 for (UInt_t row=0; row<256; row++) {
131 Int_t key = GetKey(eq,hs,chip,col,row);
132 if (fDeadPixelMap[gloChip]->Remove(key)) {
138 //____________________________________________________________________________________________
139 void AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
140 // clear the noisy pixels for this chip
141 UInt_t gloChip = GetGloChip(eq,hs,chip);
143 Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip","global chip nr (%d) out of bounds\n",gloChip);
146 for (UInt_t col=0; col<32; col++) {
147 for (UInt_t row=0; row<256; row++) {
148 Int_t key = GetKey(eq,hs,chip,col,row);
149 if (fNoisyPixelMap[gloChip]->Remove(key)) {
155 //____________________________________________________________________________________________
156 void AliITSOnlineCalibrationSPDhandler::ResetDeadForEq(UInt_t eq) {
157 // clear the dead pixels for this eq
159 Error("AliITSOnlineCalibrationSPDhandler::ResetDeadForEq", "eq (%d) out of bounds.",eq);
162 for (UInt_t hs=0; hs<6; hs++) {
163 for (UInt_t chip=0; chip<10; chip++) {
164 ResetDeadForChip(eq, hs, chip);
168 //____________________________________________________________________________________________
169 void AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq(UInt_t eq) {
170 // clear the noisy pixels for this eq
172 Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq", "eq (%d) out of bounds.",eq);
175 for (UInt_t hs=0; hs<6; hs++) {
176 for (UInt_t chip=0; chip<10; chip++) {
177 ResetNoisyForChip(eq, hs, chip);
183 //____________________________________________________________________________________________
184 Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromFiles() {
185 // read files from file location (active,dead,noisy info). returns true if at least one file found
186 Bool_t b1 = ReadNoisyFromFiles();
187 Bool_t b2 = ReadSilentFromFiles();
190 //____________________________________________________________________________________________
191 Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFiles() {
192 // read dead,active files from file location. returns true if at least one file found
193 Bool_t returnval=kFALSE;
194 for (UInt_t eq=0; eq<20; eq++) {
195 if (ReadSilentFromFile(eq)) {
201 //____________________________________________________________________________________________
202 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFiles() {
203 // read dead,active files from file location. returns true if at least one file found
204 Bool_t returnval=kFALSE;
205 for (UInt_t eq=0; eq<20; eq++) {
206 if (ReadDeadFromFile(eq)) {
212 //____________________________________________________________________________________________
213 Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFile(UInt_t eq) {
214 // read dead file for eq from file location.
215 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
216 return ReadSilentFromFileName(fileName.Data());
218 //____________________________________________________________________________________________
219 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFile(UInt_t eq) {
220 // read dead file for eq from file location.
221 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
222 return ReadDeadFromFileName(fileName.Data());
224 //____________________________________________________________________________________________
225 Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFileName(const char *fileName) {
226 // read dead from file fileName (including inactive)
227 return ReadDeadFromFileName(fileName, kTRUE);
229 //____________________________________________________________________________________________
230 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFileName(const char *fileName, Bool_t inactive) {
231 // read dead from file fileName
232 AliITSOnlineCalibrationSPD* calib;
233 FILE* fp0 = fopen(fileName, "r");
234 if (fp0 == NULL) {return kFALSE;}
237 TFile file(fileName, "READ");
239 file.GetObject("AliITSOnlineCalibrationSPD", calib);
242 UInt_t nrDead=calib->GetNrBad();
243 for (UInt_t index=0; index<nrDead; index++) {
244 UInt_t key = calib->GetKeyAt(index);
245 UInt_t eq = GetEqIdFromKey(key);
246 UInt_t hs = GetHSFromKey(key);
247 UInt_t chip = GetChipFromKey(key);
248 UInt_t col = GetColFromKey(key);
249 UInt_t row = GetRowFromKey(key);
250 SetDeadPixel(eq,hs,chip,col,row);
252 UInt_t eq1 = calib->GetEqNr();
253 if (calib->IsDeadEq()) SetDeadEq(eq1);
254 else SetDeadEq(eq1,kFALSE);
255 for (UInt_t hs=0; hs<6; hs++) {
256 if (calib->IsDeadHS(hs)) SetDeadHS(eq1,hs);
257 else SetDeadHS(eq1,hs,kFALSE);
258 for (UInt_t chip=0; chip<10; chip++) {
259 if (calib->IsDeadChip(hs,chip)) SetDeadChip(eq1,hs,chip);
260 else SetDeadChip(eq1,hs,chip,kFALSE);
264 UInt_t eq = calib->GetEqNr();
265 if (calib->IsActiveEq()) ActivateEq(eq);
266 else ActivateEq(eq,kFALSE);
267 for (UInt_t hs=0; hs<6; hs++) {
268 if (calib->IsActiveHS(hs)) ActivateHS(eq,hs);
269 else ActivateHS(eq,hs,kFALSE);
270 for (UInt_t chip=0; chip<10; chip++) {
271 if (calib->IsActiveChip(hs,chip)) ActivateChip(eq,hs,chip);
272 else ActivateChip(eq,hs,chip,kFALSE);
281 //____________________________________________________________________________________________
282 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFiles() {
283 // read noisy files from file location. returns true if at least one file found
284 Bool_t returnval=kFALSE;
285 for (UInt_t eq=0; eq<20; eq++) {
286 if (ReadNoisyFromFile(eq)) {
292 //____________________________________________________________________________________________
293 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFile(UInt_t eq) {
294 // read noisy file for eq from file location.
295 TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
296 return ReadNoisyFromFileName(fileName.Data());
298 //____________________________________________________________________________________________
299 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFileName(const char *fileName) {
300 // read noisy from file fileName
301 AliITSOnlineCalibrationSPD* calib;
302 FILE* fp0 = fopen(fileName, "r");
303 if (fp0 == NULL) {return kFALSE;}
306 TFile file(fileName, "READ");
308 file.GetObject("AliITSOnlineCalibrationSPD", calib);
311 UInt_t nrNoisy=calib->GetNrBad();
312 for (UInt_t index=0; index<nrNoisy; index++) {
313 UInt_t key = calib->GetKeyAt(index);
314 UInt_t eq = GetEqIdFromKey(key);
315 UInt_t hs = GetHSFromKey(key);
316 UInt_t chip = GetChipFromKey(key);
317 UInt_t col = GetColFromKey(key);
318 UInt_t row = GetRowFromKey(key);
319 SetNoisyPixel(eq,hs,chip,col,row);
326 //____________________________________________________________________________________________
327 UInt_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromText(const char *fileName, UInt_t module) {
328 // read dead from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
329 // insert only those pixels that belong to module (or all if module=240).
332 textFile.open(fileName, ifstream::in);
333 if (textFile.fail()) {
334 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromText","No dead text file (%s) present.",fileName);
338 UInt_t eq,hs,chip,col,row;
339 textFile >> eq; if (textFile.eof()) break;
340 textFile >> hs; if (textFile.eof()) break;
341 textFile >> chip; if (textFile.eof()) break;
342 textFile >> col; if (textFile.eof()) break;
344 if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){
345 if (SetDeadPixel(eq,hs,chip,col,row)) {
349 if (textFile.eof()) break;
355 //____________________________________________________________________________________________
356 UInt_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText(const char *fileName, UInt_t module) {
357 // read noisy from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
358 // insert only those pixels that belong to module (or all if module=240).
361 textFile.open(fileName, ifstream::in);
362 if (textFile.fail()) {
363 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText","No noisy text file (%s) present.",fileName);
367 UInt_t eq,hs,chip,col,row;
368 textFile >> eq; if (textFile.eof()) break;
369 textFile >> hs; if (textFile.eof()) break;
370 textFile >> chip; if (textFile.eof()) break;
371 textFile >> col; if (textFile.eof()) break;
373 if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){
374 if (SetNoisyPixel(eq,hs,chip,col,row)) {
378 if (textFile.eof()) break;
384 //____________________________________________________________________________________________
385 void AliITSOnlineCalibrationSPDhandler::WriteToFilesAlways() {
386 // write the lists of active,dead,noisy to files
387 for (UInt_t eq=0; eq<20; eq++) {
388 WriteSilentToFile(eq);
389 WriteNoisyToFile(eq);
392 //____________________________________________________________________________________________
393 UInt_t AliITSOnlineCalibrationSPDhandler::WriteToFiles() {
394 // write the lists of dead and noisy to files (only if there are >0 dead or noisy pixels) , returns nr of files produced
395 return (WriteNoisyToFiles() + WriteSilentToFiles());
397 //____________________________________________________________________________________________
398 void AliITSOnlineCalibrationSPDhandler::WriteSilentToFilesAlways() {
399 // write the lists of silent to files
400 for (UInt_t eq=0; eq<20; eq++) {
401 WriteSilentToFile(eq);
404 //____________________________________________________________________________________________
405 void AliITSOnlineCalibrationSPDhandler::WriteDeadToFilesAlways() {
406 // write the lists of dead to files
407 for (UInt_t eq=0; eq<20; eq++) {
411 //____________________________________________________________________________________________
412 void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFilesAlways() {
413 // write the lists of noisy to files
414 for (UInt_t eq=0; eq<20; eq++) {
415 WriteNoisyToFile(eq);
418 //____________________________________________________________________________________________
419 UInt_t AliITSOnlineCalibrationSPDhandler::WriteSilentToFiles() {
420 // write the list of silent to file (only if there are >0 silent pixels) , returns nr of files produced
422 for (UInt_t eq=0; eq<20; eq++) {
423 if (GetNrSilentEq(eq) > 0) {
424 WriteSilentToFile(eq);
430 //____________________________________________________________________________________________
431 UInt_t AliITSOnlineCalibrationSPDhandler::WriteDeadToFiles() {
432 // write the list of dead to file (only if there are >0 dead pixels) , returns nr of files produced
434 for (UInt_t eq=0; eq<20; eq++) {
435 if (GetNrDeadEq(eq) > 0) {
442 //____________________________________________________________________________________________
443 UInt_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToFiles() {
444 // write the list of noisy to file (only if there are >0 noisy pixels) , returns nr of files produced
446 for (UInt_t eq=0; eq<20; eq++) {
447 if (GetNrNoisyEq(eq) > 0) {
448 WriteNoisyToFile(eq);
454 //____________________________________________________________________________________________
455 void AliITSOnlineCalibrationSPDhandler::WriteSilentToFile(UInt_t eq) {
456 WriteDeadToFile(eq,kTRUE);
458 //____________________________________________________________________________________________
459 void AliITSOnlineCalibrationSPDhandler::WriteDeadToFile(UInt_t eq, Bool_t inactive) {
460 // write the lists of dead (and inactive if input boolean is true) for eq to file
461 AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
463 calib->SetBadList(GetDeadArrayOnline(eq));
464 calib->SetNrBad(GetNrDeadEq(eq));
465 if (IsDeadEq(eq)) calib->SetDeadEq();
466 else calib->SetDeadEq(kFALSE);
467 for (UInt_t hs=0; hs<6; hs++) {
468 if (IsDeadHS(eq,hs)) calib->SetDeadHS(hs);
469 else calib->SetDeadHS(hs,kFALSE);
470 for (UInt_t chip=0; chip<10; chip++) {
471 if (IsDeadChip(eq,hs,chip)) calib->SetDeadChip(hs,chip);
472 else calib->SetDeadChip(hs,chip,kFALSE);
476 if (IsActiveEq(eq)) calib->ActivateEq();
477 else calib->ActivateEq(kFALSE);
478 for (UInt_t hs=0; hs<6; hs++) {
479 if (IsActiveHS(eq,hs)) calib->ActivateHS(hs);
480 else calib->ActivateHS(hs,kFALSE);
481 for (UInt_t chip=0; chip<10; chip++) {
482 if (IsActiveChip(eq,hs,chip)) calib->ActivateChip(hs,chip);
483 else calib->ActivateChip(hs,chip,kFALSE);
487 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
488 TFile file(fileName.Data(), "RECREATE");
489 file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
493 //____________________________________________________________________________________________
494 void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFile(UInt_t eq) {
495 // write the lists of noisy for eq to file
496 AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
498 calib->SetBadList(GetNoisyArrayOnline(eq));
499 calib->SetNrBad(GetNrNoisyEq(eq));
500 TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
501 TFile file(fileName.Data(), "RECREATE");
502 file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
506 //____________________________________________________________________________________________
508 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB(UInt_t module, Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
509 // reads dead pixels from DB for given module and runNr
510 AliCDBManager* man = AliCDBManager::Instance();
511 TString storageSTR = Form("%s",storage);
512 if (storageSTR.CompareTo("default")==0) {
513 if(!man->IsDefaultStorageSet()) {
514 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
518 storageSTR = Form("local://%s",storage);
519 man->SetDefaultStorage(storageSTR.Data());
521 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
524 spdEntry = (TObjArray*)cdbEntry->GetObject();
525 if(!spdEntry) return kFALSE;
528 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB","Calibration for run %d not found in database.",runNr);
531 AliITSCalibrationSPD* calibSPD;
532 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
534 UInt_t nrDead = calibSPD->GetNrBadSingle();
536 if (!treeSerial) RecursiveInsertDead(calibSPD,module,0,nrDead-1);
538 for (UInt_t index=0; index<nrDead; index++) {
539 UInt_t colM = calibSPD->GetBadColAt(index);
540 UInt_t rowM = calibSPD->GetBadRowAt(index);
541 SetDeadPixelM(module,colM,rowM);
545 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
546 UInt_t eq,hs,chip,col,row;
547 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
548 if (calibSPD->IsChipBad(chipIndex)) {
549 SetDeadChip(eq,hs,chip);
552 SetDeadChip(eq,hs,chip,kFALSE);
556 spdEntry->SetOwner(kTRUE);
560 //____________________________________________________________________________________________
561 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB(UInt_t module, Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
562 // reads noisy pixels from DB for given module and runNr
563 AliCDBManager* man = AliCDBManager::Instance();
564 TString storageSTR = Form("%s",storage);
565 if (storageSTR.CompareTo("default")==0) {
566 if(!man->IsDefaultStorageSet()) {
567 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
571 storageSTR = Form("local://%s",storage);
572 man->SetDefaultStorage(storageSTR.Data());
574 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
577 spdEntry = (TObjArray*)cdbEntry->GetObject();
578 if(!spdEntry) return kFALSE;
581 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB","Calibration for run %d not found in database.",runNr);
584 AliITSCalibrationSPD* calibSPD;
585 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
586 UInt_t nrNoisy = calibSPD->GetNrBadSingle();
588 if (!treeSerial) RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
590 for (UInt_t index=0; index<nrNoisy; index++) {
591 UInt_t colM = calibSPD->GetBadColAt(index);
592 UInt_t rowM = calibSPD->GetBadRowAt(index);
593 SetNoisyPixelM(module,colM,rowM);
597 spdEntry->SetOwner(kTRUE);
601 //____________________________________________________________________________________________
602 Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromDB(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
603 // reads dead and noisy pixels from DB for given runNr
604 // note that you may want to clear the lists (if they are not empty) before reading
605 return (ReadNoisyFromDB(runNr,storage,treeSerial) && ReadDeadFromDB(runNr,storage,treeSerial));
607 //____________________________________________________________________________________________
608 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
609 // reads dead pixels from DB for given runNr
610 // note that you may want to clear the list (if it is not empty) before reading
611 AliCDBManager* man = AliCDBManager::Instance();
612 TString storageSTR = Form("%s",storage);
613 if (storageSTR.CompareTo("default")==0) {
614 if(!man->IsDefaultStorageSet()) {
615 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
619 storageSTR = Form("local://%s",storage);
620 man->SetDefaultStorage(storageSTR.Data());
622 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
625 spdEntry = (TObjArray*)cdbEntry->GetObject();
626 if(!spdEntry) return kFALSE;
629 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB","Calibration for run %d not found in database.",runNr);
632 AliITSCalibrationSPD* calibSPD;
633 for (UInt_t module=0; module<240; module++) {
634 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
635 UInt_t nrDead = calibSPD->GetNrBadSingle();
638 RecursiveInsertDead(calibSPD,module,0,nrDead-1);
642 for (UInt_t index=0; index<nrDead; index++) {
643 UInt_t colM = calibSPD->GetBadColAt(index);
644 UInt_t rowM = calibSPD->GetBadRowAt(index);
645 SetDeadPixelM(module,colM,rowM);
649 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
650 UInt_t eq,hs,chip,col,row;
651 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
652 if (calibSPD->IsChipBad(chipIndex)) {
653 SetDeadChip(eq,hs,chip);
656 SetDeadChip(eq,hs,chip,kFALSE);
660 spdEntry->SetOwner(kTRUE);
664 //____________________________________________________________________________________________
665 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
666 // reads noisy pixels from DB for given runNr
667 // note that you may want to clear the list (if it is not empty) before reading
668 AliCDBManager* man = AliCDBManager::Instance();
669 TString storageSTR = Form("%s",storage);
670 if (storageSTR.CompareTo("default")==0) {
671 if(!man->IsDefaultStorageSet()) {
672 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
676 storageSTR = Form("local://%s",storage);
677 man->SetDefaultStorage(storageSTR.Data());
679 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
682 spdEntry = (TObjArray*)cdbEntry->GetObject();
683 if(!spdEntry) return kFALSE;
686 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB","Calibration for run %d not found in database.",runNr);
689 AliITSCalibrationSPD* calibSPD;
690 for (UInt_t module=0; module<240; module++) {
691 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
692 UInt_t nrNoisy = calibSPD->GetNrBadSingle();
695 RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
698 for (UInt_t index=0; index<nrNoisy; index++) {
699 UInt_t colM = calibSPD->GetBadColAt(index);
700 UInt_t rowM = calibSPD->GetBadRowAt(index);
701 SetNoisyPixelM(module,colM,rowM);
706 spdEntry->SetOwner(kTRUE);
710 //____________________________________________________________________________________________
711 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDBasNoisy(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
712 // reads dead pixels (put as noisy) 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("local://%s",storage);
723 man->SetDefaultStorage(storageSTR.Data());
725 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
728 spdEntry = (TObjArray*)cdbEntry->GetObject();
729 if(!spdEntry) return kFALSE;
732 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromDBasNoisy","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 RecursiveInsertDead(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 SetDeadPixelM(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::ReadDeadFromCalibObj(TObjArray* calObj) {
769 // reads dead pixels from calib object
770 for (UInt_t module=0; module<240; module++) {
771 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*)calObj->At(module);
772 for (Int_t i=0; i<calibSPD->GetNrBadSingle(); i++) {
773 SetDeadPixelM(module,calibSPD->GetBadColAt(i),calibSPD->GetBadRowAt(i));
775 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
776 UInt_t eq,hs,chip,col,row;
777 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
778 if (calibSPD->IsChipBad(chipIndex)) {
779 SetDeadChip(eq,hs,chip);
782 SetDeadChip(eq,hs,chip,kFALSE);
788 //____________________________________________________________________________________________
789 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromCalibObj(TObjArray* calObj) {
790 // reads noisy pixels from calib object
791 for (UInt_t module=0; module<240; module++) {
792 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*)calObj->At(module);
793 for (Int_t i=0; i<calibSPD->GetNrBadSingle(); i++) {
794 SetNoisyPixelM(module,calibSPD->GetBadColAt(i),calibSPD->GetBadRowAt(i));
799 //____________________________________________________________________________________________
800 Bool_t AliITSOnlineCalibrationSPDhandler::WriteToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
801 // writes dead and noisy pixels to DB for given runNrs
802 // overwrites any previous entries
803 return (WriteNoisyToDB(runNrStart,runNrEnd,storage) && WriteDeadToDB(runNrStart,runNrEnd,storage));
805 //____________________________________________________________________________________________
806 Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
807 // writes dead pixels to DB for given runNrs
808 // overwrites any previous entries
809 AliCDBManager* man = AliCDBManager::Instance();
810 TString storageSTR = Form("%s",storage);
811 if (storageSTR.CompareTo("default")==0) {
812 if(!man->IsDefaultStorageSet()) {
813 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
817 storageSTR = Form("local://%s",storage);
818 man->SetDefaultStorage(storageSTR.Data());
820 AliCDBMetaData* metaData = new AliCDBMetaData();
821 metaData->SetResponsible("Henrik Tydesjo");
822 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
823 AliCDBId idCalSPD("ITS/Calib/SPDDead",runNrStart,runNrEnd);
824 TObjArray* spdEntry = new TObjArray(240);
825 spdEntry->SetOwner(kTRUE);
826 for(UInt_t module=0; module<240; module++){
827 AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
828 spdEntry->Add(calibSPD);
830 for(UInt_t module=0; module<240; module++){
831 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
832 calibSPD->SetNrBadSingle( GetNrDeadSingle(module) );
833 calibSPD->SetBadList( GetDeadArray(module) );
834 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
835 UInt_t eq,hs,chip,col,row;
836 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
837 if (IsSilentChip(eq,hs,chip)) {
838 calibSPD->SetChipBad(chipIndex);
841 calibSPD->UnSetChipBad(chipIndex);
845 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
852 //____________________________________________________________________________________________
853 Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDBasNoisy(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
854 // writes dead pixels to DB for given runNrs
855 // overwrites any previous entries
856 AliCDBManager* man = AliCDBManager::Instance();
857 TString storageSTR = Form("%s",storage);
858 if (storageSTR.CompareTo("default")==0) {
859 if(!man->IsDefaultStorageSet()) {
860 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
864 storageSTR = Form("local://%s",storage);
865 man->SetDefaultStorage(storageSTR.Data());
867 AliCDBMetaData* metaData = new AliCDBMetaData();
868 metaData->SetResponsible("Henrik Tydesjo");
869 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
870 AliCDBId idCalSPD("ITS/Calib/SPDNoisy",runNrStart,runNrEnd);
871 TObjArray* spdEntry = new TObjArray(240);
872 spdEntry->SetOwner(kTRUE);
873 for(UInt_t module=0; module<240; module++){
874 AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
875 spdEntry->Add(calibSPD);
877 for(UInt_t module=0; module<240; module++){
878 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
879 calibSPD->SetNrBadSingle( GetNrDeadSingle(module) );
880 calibSPD->SetBadList( GetDeadArray(module) );
881 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
882 UInt_t eq,hs,chip,col,row;
883 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
884 if (IsSilentChip(eq,hs,chip)) {
885 calibSPD->SetChipBad(chipIndex);
888 calibSPD->UnSetChipBad(chipIndex);
892 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
899 //____________________________________________________________________________________________
900 Bool_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
901 // writes noisy pixels to DB for given runNrs
902 // overwrites any previous entries
903 AliCDBManager* man = AliCDBManager::Instance();
904 TString storageSTR = Form("%s",storage);
905 if (storageSTR.CompareTo("default")==0) {
906 if(!man->IsDefaultStorageSet()) {
907 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
911 storageSTR = Form("local://%s",storage);
912 man->SetDefaultStorage(storageSTR.Data());
914 AliCDBMetaData* metaData = new AliCDBMetaData();
915 metaData->SetResponsible("Henrik Tydesjo");
916 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
917 AliCDBId idCalSPD("ITS/Calib/SPDNoisy",runNrStart,runNrEnd);
918 TObjArray* spdEntry = new TObjArray(240);
919 spdEntry->SetOwner(kTRUE);
920 for(UInt_t module=0; module<240; module++){
921 AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
922 spdEntry->Add(calibSPD);
924 for(UInt_t module=0; module<240; module++){
925 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
926 calibSPD->SetNrBadSingle( GetNrNoisySingle(module) );
927 calibSPD->SetBadList( GetNoisyArray(module) );
929 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
936 //____________________________________________________________________________________________
937 void AliITSOnlineCalibrationSPDhandler::RecursiveInsertDead(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
938 // inserts dead pixels recursively, used when reading from db
939 if (lowInd>highInd) return;
940 Int_t thisInd = lowInd+(highInd-lowInd)/2;
941 SetDeadPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
942 RecursiveInsertDead(calibSPD,module,lowInd,thisInd-1);
943 RecursiveInsertDead(calibSPD,module,thisInd+1,highInd);
945 //____________________________________________________________________________________________
946 void AliITSOnlineCalibrationSPDhandler::RecursiveInsertNoisy(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
947 // inserts noisy pixels recursively, used when reading from db
948 if (lowInd>highInd) return;
949 Int_t thisInd = lowInd+(highInd-lowInd)/2;
950 SetNoisyPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
951 RecursiveInsertNoisy(calibSPD,module,lowInd,thisInd-1);
952 RecursiveInsertNoisy(calibSPD,module,thisInd+1,highInd);
956 //____________________________________________________________________________________________
957 void AliITSOnlineCalibrationSPDhandler::GenerateDCSConfigFile(const Char_t* fileName) {
958 // generates an ascii file in the format as the one produced by online da (but with dummy runNr=0)
960 dcsfile.open(fileName);
961 dcsfile << "[SPD SCAN]\n";
962 dcsfile << "RunNumber=" << "0" << "\n"; // dummy value
963 dcsfile << "Type=" << "4" << "\n";
964 dcsfile << "Router=" << "0" << "\n"; // dummy value
965 dcsfile << "ActualDetConfiguration=" << "0,-1,-1\n"; // dummy values
966 dcsfile << "[NOISY]\n";
967 for (UInt_t module=0; module<240; module++) {
968 UInt_t headkey=20*10*6;
969 for (UInt_t ind=0; ind<GetNrNoisy(module); ind++) {
970 UInt_t newkey = GetNoisyEqIdAt(module,ind)*10*6 +
971 GetNoisyHSAt(module,ind)*10 +
972 GetNoisyChipAt(module,ind);
973 if (newkey!=headkey) { // print eq,hs,chip header
975 dcsfile << "-" << newkey/(6*10) << "," << (newkey%(6*10))/10 << "," << (newkey%(6*10))%10 << "\n";
977 dcsfile << GetNoisyColAt(module,ind) << "," << GetNoisyRowAt(module,ind) << "\n";
982 //____________________________________________________________________________________________
983 TArrayS AliITSOnlineCalibrationSPDhandler::GetSilentArray(UInt_t module, Bool_t treeSerial) {
984 // get a TArrayS of the silent=dead+inactive pixels (format for the AliITSCalibrationSPD object)
985 // NB! with new implementation of AliITSCalibrationSPD this is not needed anymore
988 UInt_t eq = GetEqIdFromOffline(module);
989 UInt_t hs = GetHSFromOffline(module);
991 if ( !( IsActiveEq(eq) && IsActiveHS(eq,hs) ) ) {
995 for (UInt_t ch=0; ch<5; ch++) {
996 UInt_t chip = GetChipFromOffline(module,ch*32);
997 if (!(IsActiveChip(eq,hs,chip))) {
1001 UInt_t gloChip = GetGloChip(eq,hs,chip);
1002 size += fNrDead[gloChip];
1006 returnArray.Set(size*2);
1009 if ( !( IsActiveEq(eq) && IsActiveHS(eq,hs) ) ) {
1010 for (UInt_t colM=0; colM<160; colM++) {
1011 for (UInt_t rowM=0; rowM<256; rowM++) {
1012 returnArray.AddAt(colM,gloIndex*2);
1013 returnArray.AddAt(rowM,gloIndex*2+1);
1019 for (UInt_t ch=0; ch<5; ch++) {
1020 UInt_t chip = GetChipFromOffline(module,ch*32);
1021 if (!(IsActiveChip(eq,hs,chip))) {
1022 for (UInt_t colM=ch*32; colM<ch*32+32; colM++) {
1023 for (UInt_t rowM=0; rowM<256; rowM++) {
1024 returnArray.AddAt(colM,gloIndex*2);
1025 returnArray.AddAt(rowM,gloIndex*2+1);
1031 UInt_t gloChip = GetGloChip(eq,hs,chip);
1032 if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1033 else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
1034 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1035 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1036 Int_t colM = GetColMFromKey(key);
1037 Int_t rowM = GetRowMFromKey(key);
1038 returnArray.AddAt(colM,gloIndex*2);
1039 returnArray.AddAt(rowM,gloIndex*2+1);
1047 //____________________________________________________________________________________________
1048 TArrayS AliITSOnlineCalibrationSPDhandler::GetDeadArray(UInt_t module, Bool_t treeSerial) {
1049 // get a TArrayS of the single dead pixels (format for the AliITSCalibrationSPD object)
1050 TArrayS returnArray;
1052 UInt_t eq = GetEqIdFromOffline(module);
1053 UInt_t hs = GetHSFromOffline(module);
1054 UInt_t size=GetNrDeadSingle(module);
1055 returnArray.Set(size*2);
1057 for (UInt_t ch=0; ch<5; ch++) {
1058 UInt_t chip = GetChipFromOffline(module,ch*32);
1059 UInt_t gloChip = GetGloChip(eq,hs,chip);
1060 if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1061 else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
1062 if (!IsSilentChip(eq,hs,chip)) {
1063 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1064 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1065 Int_t colM = GetColMFromKey(key);
1066 Int_t rowM = GetRowMFromKey(key);
1067 returnArray.AddAt(colM,gloIndex*2);
1068 returnArray.AddAt(rowM,gloIndex*2+1);
1075 //____________________________________________________________________________________________
1076 TArrayS AliITSOnlineCalibrationSPDhandler::GetNoisyArray(UInt_t module, Bool_t treeSerial) {
1077 // get a TArrayS of the single noisy pixels (format for the AliITSCalibrationSPD object)
1078 TArrayS returnArray;
1080 UInt_t eq = GetEqIdFromOffline(module);
1081 UInt_t hs = GetHSFromOffline(module);
1082 UInt_t size=GetNrNoisySingle(module);
1083 returnArray.Set(size*2);
1085 for (UInt_t ch=0; ch<5; ch++) {
1086 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
1087 if (treeSerial) fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1088 else fNoisyPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
1089 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
1090 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1091 Int_t colM = GetColMFromKey(key);
1092 Int_t rowM = GetRowMFromKey(key);
1093 returnArray.AddAt(colM,gloIndex*2);
1094 returnArray.AddAt(rowM,gloIndex*2+1);
1100 //____________________________________________________________________________________________
1101 TArrayI AliITSOnlineCalibrationSPDhandler::GetDeadArrayOnline(UInt_t eq) {
1102 // get a TArrayI of the single dead pixels (format for the AliITSOnlineCalibrationSPD object)
1103 TArrayI returnArray;
1104 // fix size of array
1106 for (UInt_t hs=0; hs<6; hs++) {
1107 for (UInt_t chip=0; chip<10; chip++) {
1108 UInt_t gloChip = GetGloChip(eq,hs,chip);
1109 size+=fNrDead[gloChip];
1112 returnArray.Set(size);
1113 // put keys in array
1115 for (UInt_t hs=0; hs<6; hs++) {
1116 for (UInt_t chip=0; chip<10; chip++) {
1117 UInt_t gloChip = GetGloChip(eq,hs,chip);
1118 fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1119 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1120 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1121 returnArray.AddAt(key,gloIndex);
1128 //____________________________________________________________________________________________
1129 TArrayI AliITSOnlineCalibrationSPDhandler::GetNoisyArrayOnline(UInt_t eq) {
1130 // get a TArrayI of the single noisy pixels (format for the AliITSOnlineCalibrationSPD object)
1131 TArrayI returnArray;
1132 // fix size of array
1134 for (UInt_t hs=0; hs<6; hs++) {
1135 for (UInt_t chip=0; chip<10; chip++) {
1136 UInt_t gloChip = GetGloChip(eq,hs,chip);
1137 size+=fNrNoisy[gloChip];
1140 returnArray.Set(size);
1141 // put keys in array
1143 for (UInt_t hs=0; hs<6; hs++) {
1144 for (UInt_t chip=0; chip<10; chip++) {
1145 UInt_t gloChip = GetGloChip(eq,hs,chip);
1146 fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1147 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
1148 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1149 returnArray.AddAt(key,gloIndex);
1156 //____________________________________________________________________________________________
1157 void AliITSOnlineCalibrationSPDhandler::PrintEqSummary() {
1158 // print summary (nr of dead and noisy) for each equipment
1159 printf("-----------\n");
1160 printf("Eq summary:\n");
1161 printf("-----------\n");
1162 for (UInt_t eq=0; eq<20; eq++) {
1163 printf("Eq %*d: %*d silent(dead+inactive) , %*d dead , %*d noisy\n",2,eq,6,GetNrSilentEq(eq),6,GetNrDeadEq(eq),6,GetNrNoisyEq(eq));
1166 //____________________________________________________________________________________________
1167 void AliITSOnlineCalibrationSPDhandler::PrintSilent() const {
1168 // print the inactive and dead pixels to screen
1169 printf("-----------------------------------------------------------\n");
1170 printf("Inactive or dead Equipments: (eq | module1 .. module12)\n");
1171 printf("-----------------------------------------------------------\n");
1172 for (UInt_t eq=0; eq<20; eq++) {
1173 if (IsSilentEq(eq)) {
1174 printf("%*d | ",2,eq);
1175 for (UInt_t hs=0; hs<6; hs++) {
1176 for (UInt_t chip=0; chip<10; chip+=5) {
1177 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1178 if (hs>0 || chip==5) printf(",");
1179 printf("%*d",3,module);
1186 printf("-----------------------------------------------------------\n");
1187 printf("Inactive or dead Half-staves: (eq,hs | module1,module2)\n");
1188 printf("-----------------------------------------------------------\n");
1189 for (UInt_t eq=0; eq<20; eq++) {
1190 if (!IsSilentEq(eq)) {
1191 for (UInt_t hs=0; hs<6; hs++) {
1192 if (IsSilentHS(eq,hs)) {
1193 printf("%*d,%*d | ",2,eq,1,hs);
1194 for (UInt_t chip=0; chip<10; chip+=5) {
1195 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1196 if (chip==5) printf(",");
1197 printf("%*d",3,module);
1205 printf("-----------------------------------------------------------\n");
1206 printf("Inactive or dead Chips: (eq,hs,chip | module,colM1-colM2)\n");
1207 printf("-----------------------------------------------------------\n");
1208 for (UInt_t eq=0; eq<20; eq++) {
1209 if (!IsSilentEq(eq)) {
1210 for (UInt_t hs=0; hs<6; hs++) {
1211 if (!IsSilentHS(eq,hs)) {
1212 for (UInt_t chip=0; chip<10; chip++) {
1213 if (IsSilentChip(eq,hs,chip)) {
1214 printf("%*d,%*d,%*d | ",2,eq,1,hs,1,chip);
1215 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1216 UInt_t colM1 = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,0);
1217 UInt_t colM2 = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,31);
1218 printf("%*d,%*d-%*d\n",3,module,3,colM1,3,colM2);
1229 //____________________________________________________________________________________________
1230 void AliITSOnlineCalibrationSPDhandler::PrintDead() const {
1231 // print the single dead pixels to screen (disregards inactive eq,hs,chip)
1232 printf("------------------------------------------------------\n");
1233 printf("Dead Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
1234 printf("------------------------------------------------------\n");
1235 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1236 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1237 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1238 UInt_t eq = GetEqIdFromKey(key);
1239 UInt_t hs = GetHSFromKey(key);
1240 UInt_t chip = GetChipFromKey(key);
1241 UInt_t col = GetColFromKey(key);
1242 UInt_t row = GetRowFromKey(key);
1244 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1245 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1246 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1248 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);
1252 //____________________________________________________________________________________________
1253 void AliITSOnlineCalibrationSPDhandler::PrintNoisy() const {
1254 // print the dead pixels to screen
1255 printf("-------------------------------------------------------\n");
1256 printf("Noisy Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
1257 printf("-------------------------------------------------------\n");
1258 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1259 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
1260 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1261 UInt_t eq = GetEqIdFromKey(key);
1262 UInt_t hs = GetHSFromKey(key);
1263 UInt_t chip = GetChipFromKey(key);
1264 UInt_t col = GetColFromKey(key);
1265 UInt_t row = GetRowFromKey(key);
1267 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1268 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1269 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1271 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);
1275 //____________________________________________________________________________________________
1276 Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1277 // set a dead pixel, returns false if pixel is already dead
1278 UInt_t gloChip = GetGloChip(eq,hs,chip);
1279 if (gloChip>=1200) {
1280 Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1283 if (col>=32 && row>=256) {
1284 Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
1287 Int_t key = GetKey(eq,hs,chip,col,row);
1288 // if noisy we dont want to add it...
1289 if (fNoisyPixelMap[gloChip]->Find(key) != NULL) return kFALSE;
1290 if (fDeadPixelMap[gloChip]->Insert(key,gloChip)) {
1296 //____________________________________________________________________________________________
1297 Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1298 // set a noisy pixel, returns false if pixel is already noisy
1299 UInt_t gloChip = GetGloChip(eq,hs,chip);
1300 if (gloChip>=1200) {
1301 Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1304 if (col>=32 && row>=256) {
1305 Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
1308 Int_t key = GetKey(eq,hs,chip,col,row);
1309 // if dead before - remove from the dead list
1310 if (fDeadPixelMap[gloChip]->Remove(key)) {
1313 if (fNoisyPixelMap[gloChip]->Insert(key,gloChip)) {
1314 fNrNoisy[gloChip]++;
1319 //____________________________________________________________________________________________
1320 Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1321 // set a dead pixel, returns false if pixel is already dead
1322 UInt_t eq = GetEqIdFromOffline(module);
1323 UInt_t hs = GetHSFromOffline(module);
1324 UInt_t chip = GetChipFromOffline(module,colM);
1325 UInt_t col = GetColFromOffline(module,colM);
1326 UInt_t row = GetRowFromOffline(module,rowM);
1327 return SetDeadPixel(eq,hs,chip,col,row);
1329 //____________________________________________________________________________________________
1330 Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1331 // set a noisy pixel, returns false if pixel is already noisy
1332 UInt_t eq = GetEqIdFromOffline(module);
1333 UInt_t hs = GetHSFromOffline(module);
1334 UInt_t chip = GetChipFromOffline(module,colM);
1335 UInt_t col = GetColFromOffline(module,colM);
1336 UInt_t row = GetRowFromOffline(module,rowM);
1337 return SetNoisyPixel(eq,hs,chip,col,row);
1339 //____________________________________________________________________________________________
1340 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1341 // unset a dead pixel, returns false if pixel is not dead
1342 UInt_t gloChip = GetGloChip(eq,hs,chip);
1343 if (gloChip>=1200) {
1344 Error("AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1347 Int_t key = GetKey(eq,hs,chip,col,row);
1348 if (fDeadPixelMap[gloChip]->Remove(key)) {
1354 //____________________________________________________________________________________________
1355 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1356 // unset a noisy pixel, returns false if pixel is not noisy
1357 UInt_t gloChip = GetGloChip(eq,hs,chip);
1358 if (gloChip>=1200) {
1359 Error("AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1362 Int_t key = GetKey(eq,hs,chip,col,row);
1363 if (fNoisyPixelMap[gloChip]->Remove(key)) {
1364 fNrNoisy[gloChip]--;
1369 //____________________________________________________________________________________________
1370 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1371 // unset a dead pixel, returns false if pixel is not dead
1372 UInt_t eq = GetEqIdFromOffline(module);
1373 UInt_t hs = GetHSFromOffline(module);
1374 UInt_t chip = GetChipFromOffline(module,colM);
1375 UInt_t col = GetColFromOffline(module,colM);
1376 UInt_t row = GetRowFromOffline(module,rowM);
1377 return UnSetDeadPixel(eq,hs,chip,col,row);
1379 //____________________________________________________________________________________________
1380 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1381 // unset a noisy pixel, returns false if pixel is not noisy
1382 UInt_t eq = GetEqIdFromOffline(module);
1383 UInt_t hs = GetHSFromOffline(module);
1384 UInt_t chip = GetChipFromOffline(module,colM);
1385 UInt_t col = GetColFromOffline(module,colM);
1386 UInt_t row = GetRowFromOffline(module,rowM);
1387 return UnSetNoisyPixel(eq,hs,chip,col,row);
1389 //____________________________________________________________________________________________
1390 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBad(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1391 // is the pixel bad (silent or noisy)
1392 return (IsPixelSilent(eq,hs,chip,col,row) || IsPixelNoisy(eq,hs,chip,col,row));
1394 //____________________________________________________________________________________________
1395 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilent(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1396 // is the pixel silent (dead or inactive)?
1397 UInt_t gloChip = GetGloChip(eq,hs,chip);
1398 if (gloChip>=1200 || col>=32 || row>=256) {
1399 Error("AliITSOnlineCalibrationSPDhandler::IsPixelSilent", "eq,hs,chip,col,row nrs (%d,%d,%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
1402 if (IsSilentChip(eq,hs,chip)) return kTRUE;
1403 else return IsPixelDead(eq,hs,chip,col,row);
1405 //____________________________________________________________________________________________
1406 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDead(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1407 // is the pixel dead?
1408 UInt_t gloChip = GetGloChip(eq,hs,chip);
1409 if (gloChip>=1200 || col>=32 || row>=256) {
1410 Error("AliITSOnlineCalibrationSPDhandler::IsPixelDead", "eq,hs,chip,col,row nrs (%d,%d,%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
1413 UInt_t key = GetKey(eq,hs,chip,col,row);
1414 if (IsDeadEq(eq) || IsDeadHS(eq,hs) || IsDeadChip(eq,hs,chip)) return kTRUE;
1416 if ( fDeadPixelMap[gloChip]->Find(key) != NULL ) return kTRUE;
1420 //____________________________________________________________________________________________
1421 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisy(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1422 // is the pixel noisy?
1423 UInt_t gloChip = GetGloChip(eq,hs,chip);
1424 if (gloChip>=1200 || col>=32 || row>=256) {
1425 Error("AliITSOnlineCalibrationSPDhandler::IsPixelNoisy", "eq,hs,chip,col,row nrs (%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
1428 UInt_t key = GetKey(eq,hs,chip,col,row);
1429 if ( fNoisyPixelMap[gloChip]->Find(key) != NULL ) return kTRUE;
1432 //____________________________________________________________________________________________
1433 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBadM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1434 // is the pixel bad (silent or noisy)?
1435 return (IsPixelSilentM(module,colM,rowM) || IsPixelNoisyM(module,colM,rowM));
1437 //____________________________________________________________________________________________
1438 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilentM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1439 // is the pixel silent (dead or inactive)?
1440 UInt_t eq = GetEqIdFromOffline(module);
1441 UInt_t hs = GetHSFromOffline(module);
1442 UInt_t chip = GetChipFromOffline(module,colM);
1443 UInt_t col = GetColFromOffline(module,colM);
1444 UInt_t row = GetRowFromOffline(module,rowM);
1445 return IsPixelSilent(eq,hs,chip,col,row);
1447 //____________________________________________________________________________________________
1448 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1449 // is the pixel dead?
1450 UInt_t eq = GetEqIdFromOffline(module);
1451 UInt_t hs = GetHSFromOffline(module);
1452 UInt_t chip = GetChipFromOffline(module,colM);
1453 UInt_t col = GetColFromOffline(module,colM);
1454 UInt_t row = GetRowFromOffline(module,rowM);
1455 return IsPixelDead(eq,hs,chip,col,row);
1457 //____________________________________________________________________________________________
1458 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1459 // is the pixel noisy?
1460 UInt_t eq = GetEqIdFromOffline(module);
1461 UInt_t hs = GetHSFromOffline(module);
1462 UInt_t chip = GetChipFromOffline(module,colM);
1463 UInt_t col = GetColFromOffline(module,colM);
1464 UInt_t row = GetRowFromOffline(module,rowM);
1465 return IsPixelNoisy(eq,hs,chip,col,row);
1467 //____________________________________________________________________________________________
1468 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBadKey(Int_t key) const {
1469 // is this pixel silent (dead or inactive)?
1470 UInt_t eq = GetEqIdFromKey(key);
1471 UInt_t hs = GetHSFromKey(key);
1472 UInt_t chip = GetChipFromKey(key);
1473 UInt_t col = GetColFromKey(key);
1474 UInt_t row = GetRowFromKey(key);
1475 return IsPixelBad(eq,hs,chip,col,row);
1477 //____________________________________________________________________________________________
1478 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilentKey(Int_t key) const {
1479 // is this pixel silent (dead or inactive)?
1480 UInt_t eq = GetEqIdFromKey(key);
1481 UInt_t hs = GetHSFromKey(key);
1482 UInt_t chip = GetChipFromKey(key);
1483 UInt_t col = GetColFromKey(key);
1484 UInt_t row = GetRowFromKey(key);
1485 return IsPixelSilent(eq,hs,chip,col,row);
1487 //____________________________________________________________________________________________
1488 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadKey(Int_t key) const {
1489 // is this pixel dead?
1490 UInt_t eq = GetEqIdFromKey(key);
1491 UInt_t hs = GetHSFromKey(key);
1492 UInt_t chip = GetChipFromKey(key);
1493 UInt_t col = GetColFromKey(key);
1494 UInt_t row = GetRowFromKey(key);
1495 return IsPixelDead(eq,hs,chip,col,row);
1497 //____________________________________________________________________________________________
1498 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyKey(Int_t key) const {
1499 // is this pixel noisy?
1500 UInt_t eq = GetEqIdFromKey(key);
1501 UInt_t hs = GetHSFromKey(key);
1502 UInt_t chip = GetChipFromKey(key);
1503 UInt_t col = GetColFromKey(key);
1504 UInt_t row = GetRowFromKey(key);
1505 return IsPixelNoisy(eq,hs,chip,col,row);
1507 //____________________________________________________________________________________________
1508 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBad() const {
1509 // returns the total nr of bad pixels (silent or noisy)
1511 nrBad+=GetNrSilent();
1512 UInt_t nrNoisy = GetNrNoisy();
1513 for (UInt_t i=0; i<nrNoisy; i++) {
1514 UInt_t eq = GetNoisyEqIdAt(i);
1515 UInt_t hs = GetNoisyHSAt(i);
1516 UInt_t chip = GetNoisyChipAt(i);
1517 UInt_t col = GetNoisyColAt(i);
1518 UInt_t row = GetNoisyRowAt(i);
1519 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1523 //____________________________________________________________________________________________
1524 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilent() const {
1525 // returns the total nr of silent pixels (dead or inactive)
1527 for (UInt_t eq=0; eq<20; eq++) {
1528 if (IsSilentEq(eq)) {
1532 for (UInt_t hs=0; hs<6; hs++) {
1533 if (IsSilentHS(eq,hs)) {
1537 for (UInt_t chip=0; chip<10; chip++) {
1538 if (IsSilentChip(eq,hs,chip)) {
1543 UInt_t gloChip = GetGloChip(eq,hs,chip);
1544 nrDead+=fNrDead[gloChip];
1551 //____________________________________________________________________________________________
1552 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead() const {
1553 // returns the total nr of dead pixels
1555 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1556 nrDead+=fNrDead[gloChip];
1560 //____________________________________________________________________________________________
1561 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy() const {
1562 // returns the total nr of noisy pixels
1564 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1565 nrNoisy+=fNrNoisy[gloChip];
1569 //____________________________________________________________________________________________
1570 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t index) const {
1571 // get eq for the dead pixel at position index in list of dead
1574 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1575 return GetDeadEqIdAtC2(gloChip,chipIndex);
1577 //____________________________________________________________________________________________
1578 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t index) const {
1579 // get eq for the noisy pixel at position index in list of noisy
1582 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1583 return GetNoisyEqIdAtC2(gloChip,chipIndex);
1585 //____________________________________________________________________________________________
1586 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t index) const {
1587 // get hs for the dead pixel at position index in list of dead
1590 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1591 return GetDeadHSAtC2(gloChip,chipIndex);
1593 //____________________________________________________________________________________________
1594 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t index) const {
1595 // get hs for the noisy pixel at position index in list of noisy
1598 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1599 return GetNoisyHSAtC2(gloChip,chipIndex);
1601 //____________________________________________________________________________________________
1602 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t index) const {
1603 // get chip for the dead pixel at position index in list of dead
1606 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1607 return GetDeadChipAtC2(gloChip,chipIndex);
1609 //____________________________________________________________________________________________
1610 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t index) const {
1611 // get chip for the noisy pixel at position index in list of noisy
1614 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1615 return GetNoisyChipAtC2(gloChip,chipIndex);
1617 //____________________________________________________________________________________________
1618 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t index) const {
1619 // get hs for the dead pixel at position index in list of dead
1622 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1623 return GetDeadColAtC2(gloChip,chipIndex);
1625 //____________________________________________________________________________________________
1626 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t index) const {
1627 // get hs for the noisy pixel at position index in list of noisy
1630 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1631 return GetNoisyColAtC2(gloChip,chipIndex);
1633 //____________________________________________________________________________________________
1634 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t index) const {
1635 // get hs for the dead pixel at position index in list of dead
1638 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1639 return GetDeadRowAtC2(gloChip,chipIndex);
1641 //____________________________________________________________________________________________
1642 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t index) const {
1643 // get hs for the noisy pixel at position index in list of noisy
1646 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1647 return GetNoisyRowAtC2(gloChip,chipIndex);
1649 //____________________________________________________________________________________________
1650 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBad(UInt_t module) const {
1651 // returns the number of bad pixels for a certain module (silent or noisy)
1653 nrBad+=GetNrSilent(module);
1654 UInt_t nrNoisy = GetNrNoisy(module);
1655 for (UInt_t i=0; i<nrNoisy; i++) {
1656 UInt_t eq = GetNoisyEqIdAt(module,i);
1657 UInt_t hs = GetNoisyHSAt(module,i);
1658 UInt_t chip = GetNoisyChipAt(module,i);
1659 UInt_t col = GetNoisyColAt(module,i);
1660 UInt_t row = GetNoisyRowAt(module,i);
1661 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1665 //____________________________________________________________________________________________
1666 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilent(UInt_t module) const {
1667 // returns the number of silent pixels for a certain module (dead or inactive)
1669 Error("AliITSOnlineCalibrationSPDhandler::GetNrSilent", "module nr (%d) out of bounds.",module);
1672 UInt_t nrSilent = 0;
1673 UInt_t eq = GetEqIdFromOffline(module);
1674 if (IsSilentEq(eq)) return 160*256;
1675 UInt_t hs = GetHSFromOffline(module);
1676 if (IsSilentHS(eq,hs)) return 160*256;
1677 for (UInt_t ch=0; ch<5; ch++) {
1678 UInt_t chip = GetChipFromOffline(module,ch*32);
1679 if (IsSilentChip(eq,hs,chip)) {
1683 UInt_t gloChip = GetGloChip(eq,hs,chip);
1684 nrSilent+=fNrDead[gloChip];
1689 //____________________________________________________________________________________________
1690 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadSingle(UInt_t module) const {
1691 // returns the number of single dead pixels (excluding the ones on silent chips) for a certain module
1693 Error("AliITSOnlineCalibrationSPDhandler::GetNrDeadSingle", "module nr (%d) out of bounds.",module);
1697 UInt_t eq = GetEqIdFromOffline(module);
1698 UInt_t hs = GetHSFromOffline(module);
1699 for (UInt_t ch=0; ch<5; ch++) {
1700 UInt_t chip = GetChipFromOffline(module,ch*32);
1701 if (!IsSilentChip(eq,hs,chip)) {
1702 UInt_t gloChip = GetGloChip(eq,hs,chip);
1703 nrDead+=fNrDead[gloChip];
1708 //____________________________________________________________________________________________
1709 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisySingle(UInt_t module) const {
1710 // returns the number of noisy pixels for a certain module
1711 return GetNrNoisy(module);
1713 //____________________________________________________________________________________________
1714 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead(UInt_t module) const {
1715 // returns the number of dead pixels for a certain module
1717 Error("AliITSOnlineCalibrationSPDhandler::GetNrDead", "module nr (%d) out of bounds.",module);
1721 UInt_t eq = GetEqIdFromOffline(module);
1722 UInt_t hs = GetHSFromOffline(module);
1723 for (UInt_t ch=0; ch<5; ch++) {
1724 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
1725 nrDead+=fNrDead[gloChip];
1729 //____________________________________________________________________________________________
1730 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy(UInt_t module) const {
1731 // returns the number of noisy pixels for a certain module
1733 Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisy", "module nr (%d) out of bounds.",module);
1737 UInt_t eq = GetEqIdFromOffline(module);
1738 UInt_t hs = GetHSFromOffline(module);
1739 for (UInt_t ch=0; ch<5; ch++) {
1740 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
1741 nrNoisy+=fNrNoisy[gloChip];
1745 //____________________________________________________________________________________________
1746 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t module, UInt_t index) const {
1747 // get eq for the dead pixel at position index in list of dead
1750 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1751 return GetDeadEqIdAtC2(gloChip,chipIndex);
1753 //____________________________________________________________________________________________
1754 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t module, UInt_t index) const {
1755 // get eq for the noisy pixel at position index in list of noisy
1758 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1759 return GetNoisyEqIdAtC2(gloChip,chipIndex);
1761 //____________________________________________________________________________________________
1762 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t module, UInt_t index) const {
1763 // get hs for the dead pixel at position index in list of dead
1766 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1767 return GetDeadHSAtC2(gloChip,chipIndex);
1769 //____________________________________________________________________________________________
1770 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t module, UInt_t index) const {
1771 // get hs for the noisy pixel at position index in list of noisy
1774 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1775 return GetNoisyHSAtC2(gloChip,chipIndex);
1777 //____________________________________________________________________________________________
1778 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t module, UInt_t index) const {
1779 // get chip for the dead pixel at position index in list of dead
1782 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1783 return GetDeadChipAtC2(gloChip,chipIndex);
1785 //____________________________________________________________________________________________
1786 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t module, UInt_t index) const {
1787 // get chip for the noisy pixel at position index in list of noisy
1790 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1791 return GetNoisyChipAtC2(gloChip,chipIndex);
1793 //____________________________________________________________________________________________
1794 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t module, UInt_t index) const {
1795 // get hs for the dead pixel at position index in list of dead
1798 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1799 return GetDeadColAtC2(gloChip,chipIndex);
1801 //____________________________________________________________________________________________
1802 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t module, UInt_t index) const {
1803 // get hs for the noisy pixel at position index in list of noisy
1806 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1807 return GetNoisyColAtC2(gloChip,chipIndex);
1809 //____________________________________________________________________________________________
1810 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t module, UInt_t index) const {
1811 // get hs for the dead pixel at position index in list of dead
1814 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1815 return GetDeadRowAtC2(gloChip,chipIndex);
1817 //____________________________________________________________________________________________
1818 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t module, UInt_t index) const {
1819 // get hs for the noisy pixel at position index in list of noisy
1822 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1823 return GetNoisyRowAtC2(gloChip,chipIndex);
1825 //____________________________________________________________________________________________
1826 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBadEq(UInt_t eq) const {
1827 // returns nr of bad for eq (silent or noisy)
1829 nrBad+=GetNrSilentEq(eq);
1830 UInt_t nrNoisy = GetNrNoisy(eq);
1831 for (UInt_t i=0; i<nrNoisy; i++) {
1832 UInt_t hs = GetNoisyHSAtEq(eq,i);
1833 UInt_t chip = GetNoisyChipAtEq(eq,i);
1834 UInt_t col = GetNoisyColAtEq(eq,i);
1835 UInt_t row = GetNoisyRowAtEq(eq,i);
1836 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1840 //____________________________________________________________________________________________
1841 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentEq(UInt_t eq) const {
1842 // returns nr of silent for eq (dead or inactive)
1844 if (IsSilentEq(eq)) return 81920*6;
1845 for (UInt_t hs=0; hs<6; hs++) {
1846 if (IsSilentHS(eq,hs)) {
1850 for (UInt_t chip=0; chip<10; chip++) {
1851 if (IsSilentChip(eq,hs,chip)) {
1856 returnval+=GetNrDeadC(eq,hs,chip);
1862 //____________________________________________________________________________________________
1863 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadEq(UInt_t eq) const {
1864 // returns nr of dead for eq
1866 for (UInt_t hs=0; hs<6; hs++) {
1867 for (UInt_t chip=0; chip<10; chip++) {
1868 returnval+=GetNrDeadC(eq,hs,chip);
1873 //____________________________________________________________________________________________
1874 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyEq(UInt_t eq) const {
1875 // returns nr of noisy for eq
1877 for (UInt_t hs=0; hs<6; hs++) {
1878 for (UInt_t chip=0; chip<10; chip++) {
1879 returnval+=GetNrNoisyC(eq,hs,chip);
1884 //____________________________________________________________________________________________
1885 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtEq(UInt_t eq, UInt_t index) const {
1886 // get eq for the dead pixel at position index in list of dead
1887 if (eq<20 && index<GetNrDeadEq(eq)) {
1894 //____________________________________________________________________________________________
1895 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtEq(UInt_t eq, UInt_t index) const {
1896 // get eq for the noisy pixel at position index in list of noisy
1897 if (eq<20 && index<GetNrNoisyEq(eq)) {
1904 //____________________________________________________________________________________________
1905 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtEq(UInt_t eq, UInt_t index) const {
1906 // get hs for the dead pixel at position index in list of dead
1909 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1910 return GetDeadHSAtC2(gloChip,chipIndex);
1912 //____________________________________________________________________________________________
1913 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtEq(UInt_t eq, UInt_t index) const {
1914 // get hs for the noisy pixel at position index in list of noisy
1917 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1918 return GetNoisyHSAtC2(gloChip,chipIndex);
1920 //____________________________________________________________________________________________
1921 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtEq(UInt_t eq, UInt_t index) const {
1922 // get chip for the dead pixel at position index in list of dead
1925 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1926 return GetDeadChipAtC2(gloChip,chipIndex);
1928 //____________________________________________________________________________________________
1929 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtEq(UInt_t eq, UInt_t index) const {
1930 // get chip for the noisy pixel at position index in list of noisy
1933 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1934 return GetNoisyChipAtC2(gloChip,chipIndex);
1936 //____________________________________________________________________________________________
1937 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtEq(UInt_t eq, UInt_t index) const {
1938 // get hs for the dead pixel at position index in list of dead
1941 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1942 return GetDeadColAtC2(gloChip,chipIndex);
1944 //____________________________________________________________________________________________
1945 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtEq(UInt_t eq, UInt_t index) const {
1946 // get hs for the noisy pixel at position index in list of noisy
1949 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1950 return GetNoisyColAtC2(gloChip,chipIndex);
1952 //____________________________________________________________________________________________
1953 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtEq(UInt_t eq, UInt_t index) const {
1954 // get hs for the dead pixel at position index in list of dead
1957 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1958 return GetDeadRowAtC2(gloChip,chipIndex);
1960 //____________________________________________________________________________________________
1961 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtEq(UInt_t eq, UInt_t index) const {
1962 // get hs for the noisy pixel at position index in list of noisy
1965 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1966 return GetNoisyRowAtC2(gloChip,chipIndex);
1968 //____________________________________________________________________________________________
1969 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
1970 // returns nr of bad for chip (silent or noisy)
1972 nrBad+=GetNrSilentC(eq,hs,chip);
1973 UInt_t nrNoisy = GetNrNoisyC(eq,hs,chip);
1974 for (UInt_t i=0; i<nrNoisy; i++) {
1975 UInt_t col = GetNoisyColAtC(eq,hs,chip,i);
1976 UInt_t row = GetNoisyRowAtC(eq,hs,chip,i);
1977 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1981 //____________________________________________________________________________________________
1982 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentC(UInt_t eq, UInt_t hs, UInt_t chip) const {
1983 // returns nr of silent for chip (dead or inactive)
1984 if (IsSilentChip(eq,hs,chip)) return 8192;
1985 else return GetNrDeadC(eq,hs,chip);
1987 //____________________________________________________________________________________________
1988 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
1989 // returns nr of dead for chip
1990 UInt_t gloChip = GetGloChip(eq,hs,chip);
1991 return GetNrDeadC2(gloChip);
1993 //____________________________________________________________________________________________
1994 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC(UInt_t eq, UInt_t hs, UInt_t chip) const {
1995 // returns nr of noisy for chip
1996 UInt_t gloChip = GetGloChip(eq,hs,chip);
1997 return GetNrNoisyC2(gloChip);
1999 //____________________________________________________________________________________________
2000 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2001 UInt_t gloChip = GetGloChip(eq,hs,chip);
2002 return GetDeadEqIdAtC2(gloChip,index);
2004 //____________________________________________________________________________________________
2005 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2006 UInt_t gloChip = GetGloChip(eq,hs,chip);
2007 return GetNoisyEqIdAtC2(gloChip,index);
2009 //____________________________________________________________________________________________
2010 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2011 UInt_t gloChip = GetGloChip(eq,hs,chip);
2012 return GetDeadHSAtC2(gloChip,index);
2014 //____________________________________________________________________________________________
2015 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2016 UInt_t gloChip = GetGloChip(eq,hs,chip);
2017 return GetNoisyHSAtC2(gloChip,index);
2019 //____________________________________________________________________________________________
2020 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2021 UInt_t gloChip = GetGloChip(eq,hs,chip);
2022 return GetDeadChipAtC2(gloChip,index);
2024 //____________________________________________________________________________________________
2025 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2026 UInt_t gloChip = GetGloChip(eq,hs,chip);
2027 return GetNoisyChipAtC2(gloChip,index);
2029 //____________________________________________________________________________________________
2030 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2031 UInt_t gloChip = GetGloChip(eq,hs,chip);
2032 return GetDeadColAtC2(gloChip,index);
2034 //____________________________________________________________________________________________
2035 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2036 UInt_t gloChip = GetGloChip(eq,hs,chip);
2037 return GetNoisyColAtC2(gloChip,index);
2039 //____________________________________________________________________________________________
2040 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2041 UInt_t gloChip = GetGloChip(eq,hs,chip);
2042 return GetDeadRowAtC2(gloChip,index);
2044 //____________________________________________________________________________________________
2045 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2046 UInt_t gloChip = GetGloChip(eq,hs,chip);
2047 return GetNoisyRowAtC2(gloChip,index);
2049 //____________________________________________________________________________________________
2050 const Char_t* AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2051 // get a string of dead pixel info
2052 TString returnMess = "";
2053 UInt_t gloChip = GetGloChip(eq,hs,chip);
2054 if (gloChip>=1200) {
2055 Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
2056 return returnMess.Data();
2058 if (index<fNrDead[gloChip]) {
2059 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2060 UInt_t col = GetColFromKey(key);
2061 UInt_t row = GetRowFromKey(key);
2062 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
2063 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
2064 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
2065 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);
2066 return returnMess.Data();
2069 Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "Index %d out of bounds.", index);
2070 return returnMess.Data();
2073 //____________________________________________________________________________________________
2074 const Char_t* AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2075 // get a string of noisy pixel info
2076 TString returnMess = "";
2077 UInt_t gloChip = GetGloChip(eq,hs,chip);
2078 if (gloChip>=1200) {
2079 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
2080 return returnMess.Data();
2082 if (index<fNrNoisy[gloChip]) {
2083 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2084 UInt_t col = GetColFromKey(key);
2085 UInt_t row = GetRowFromKey(key);
2086 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
2087 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
2088 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
2089 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);
2090 return returnMess.Data();
2093 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "Index %d out of bounds.", index);
2094 return returnMess.Data();
2097 //____________________________________________________________________________________________
2098 UInt_t AliITSOnlineCalibrationSPDhandler::AddSilentFrom(AliITSOnlineCalibrationSPDhandler* other) {
2099 // returns number of new silent pixels in this' list (dead or inactive)
2100 UInt_t tmpdead = GetNrSilent();
2102 for (UInt_t eq=0; eq<20; eq++) {
2103 if (!(other->IsActiveEq(eq))) ActivateEq(eq,kFALSE);
2104 if (other->IsDeadEq(eq)) SetDeadEq(eq,kTRUE);
2105 for (UInt_t hs=0; hs<6; hs++) {
2106 if (!(other->IsActiveHS(eq,hs))) ActivateHS(eq,hs,kFALSE);
2107 if (other->IsDeadHS(eq,hs)) SetDeadHS(eq,hs,kTRUE);
2108 for (UInt_t chip=0; chip<10; chip++) {
2109 if (!(other->IsActiveChip(eq,hs,chip))) ActivateChip(eq,hs,chip,kFALSE);
2110 if (other->IsDeadChip(eq,hs,chip)) SetDeadChip(eq,hs,chip,kTRUE);
2117 return GetNrSilent() - tmpdead;
2119 //____________________________________________________________________________________________
2120 UInt_t AliITSOnlineCalibrationSPDhandler::AddDeadFrom(AliITSOnlineCalibrationSPDhandler* other) {
2121 // returns number of new dead pixels in this' list
2123 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2124 for (UInt_t ind1=0; ind1<other->fNrDead[gloChip]; ind1++) {
2125 UInt_t eq = other->GetDeadEqIdAtC2(gloChip,ind1);
2126 UInt_t hs = other->GetDeadHSAtC2(gloChip,ind1);
2127 UInt_t chip = other->GetDeadChipAtC2(gloChip,ind1);
2128 UInt_t col = other->GetDeadColAtC2(gloChip,ind1);
2129 UInt_t row = other->GetDeadRowAtC2(gloChip,ind1);
2130 if (SetDeadPixel(eq,hs,chip,col,row)) {
2137 //____________________________________________________________________________________________
2138 UInt_t AliITSOnlineCalibrationSPDhandler::AddNoisyFrom(AliITSOnlineCalibrationSPDhandler* other) {
2139 // returns number of new noisy pixels in this' list
2141 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2142 for (UInt_t ind1=0; ind1<other->fNrNoisy[gloChip]; ind1++) {
2143 UInt_t eq = other->GetNoisyEqIdAtC2(gloChip,ind1);
2144 UInt_t hs = other->GetNoisyHSAtC2(gloChip,ind1);
2145 UInt_t chip = other->GetNoisyChipAtC2(gloChip,ind1);
2146 UInt_t col = other->GetNoisyColAtC2(gloChip,ind1);
2147 UInt_t row = other->GetNoisyRowAtC2(gloChip,ind1);
2148 if (SetNoisyPixel(eq,hs,chip,col,row)) {
2155 //____________________________________________________________________________________________
2156 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2157 // returns nr of dead/noisy in this' lists and not in other's lists (including inactive)
2158 return GetNrSilentDiff(other) + GetNrNoisyDiff(other);
2160 //____________________________________________________________________________________________
2161 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2162 // returns nr of single silent pixels in this' lists and not in other's lists (dead or inactive)
2164 for (UInt_t eq=0; eq<20; eq++) {
2165 for (UInt_t hs=0; hs<6; hs++) {
2166 for (UInt_t chip=0; chip<10; chip++) {
2167 if (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs) || !IsActiveChip(eq,hs,chip) || IsDeadChip(eq,hs,chip)) {
2168 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)) {
2169 // if this is inactive and the other is active...
2170 returnval+= 8192 - other->GetNrDeadC(eq,hs,chip);
2174 UInt_t gloChip = GetGloChip(eq,hs,chip);
2175 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2176 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2177 UInt_t col = GetColFromKey(key);
2178 UInt_t row = GetRowFromKey(key);
2179 if (!(other->IsPixelSilent(eq,hs,chip,col,row))) {
2189 //____________________________________________________________________________________________
2190 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2191 // returns nr of dead in this' lists and not in other's lists
2193 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2194 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2195 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2196 UInt_t eq = GetEqIdFromKey(key);
2197 UInt_t hs = GetHSFromKey(key);
2198 UInt_t chip = GetChipFromKey(key);
2199 UInt_t col = GetColFromKey(key);
2200 UInt_t row = GetRowFromKey(key);
2201 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2208 //____________________________________________________________________________________________
2209 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2210 // returns nr of noisy in this' lists and not in other's lists
2212 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2213 for (UInt_t ind1=0; ind1<fNrNoisy[gloChip]; ind1++) {
2214 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind1);
2215 UInt_t eq = GetEqIdFromKey(key);
2216 UInt_t hs = GetHSFromKey(key);
2217 UInt_t chip = GetChipFromKey(key);
2218 UInt_t col = GetColFromKey(key);
2219 UInt_t row = GetRowFromKey(key);
2220 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2227 //____________________________________________________________________________________________
2228 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2229 // returns handler with active/dead/noisy in this' lists, removing those that are in other's lists
2230 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2232 for (UInt_t eq=0; eq<20; eq++) {
2233 if (!(IsActiveEq(eq))) {
2234 newHandler->ActivateEq(eq,kFALSE);
2235 if (!other->IsActiveEq(eq)) newHandler->ActivateEq(eq);
2238 newHandler->SetDeadEq(eq);
2239 if (other->IsDeadEq(eq)) newHandler->SetDeadEq(eq,kFALSE);
2241 for (UInt_t hs=0; hs<6; hs++) {
2242 if (!(IsActiveHS(eq,hs))) {
2243 newHandler->ActivateHS(eq,hs,kFALSE);
2244 if (!other->IsActiveHS(eq,hs)) newHandler->ActivateHS(eq,hs);
2246 if (IsDeadHS(eq,hs)) {
2247 newHandler->SetDeadHS(eq,hs);
2248 if (other->IsDeadHS(eq,hs)) newHandler->SetDeadHS(eq,hs,kFALSE);
2250 for (UInt_t chip=0; chip<10; chip++) {
2251 if (!(IsActiveChip(eq,hs,chip))) {
2252 newHandler->ActivateChip(eq,hs,chip,kFALSE);
2253 if (!other->IsActiveChip(eq,hs,chip)) newHandler->ActivateHS(eq,hs,chip);
2255 if (IsDeadChip(eq,hs,chip)) {
2256 newHandler->SetDeadChip(eq,hs,chip);
2257 if (other->IsDeadChip(eq,hs,chip)) newHandler->SetDeadChip(eq,hs,chip,kFALSE);
2263 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2264 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2265 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2266 UInt_t eq = GetEqIdFromKey(key);
2267 UInt_t hs = GetHSFromKey(key);
2268 UInt_t chip = GetChipFromKey(key);
2269 UInt_t col = GetColFromKey(key);
2270 UInt_t row = GetRowFromKey(key);
2271 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2272 newHandler->SetDeadPixel(eq,hs,chip,col,row);
2277 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2278 for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
2279 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
2280 UInt_t eq = GetEqIdFromKey(key);
2281 UInt_t hs = GetHSFromKey(key);
2282 UInt_t chip = GetChipFromKey(key);
2283 UInt_t col = GetColFromKey(key);
2284 UInt_t row = GetRowFromKey(key);
2285 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2286 newHandler->SetNoisyPixel(eq,hs,chip,col,row);
2293 //____________________________________________________________________________________________
2294 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetSilentDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2295 // returns handler with active/dead in this' lists, removing those that are in other's lists
2296 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2298 for (UInt_t eq=0; eq<20; eq++) {
2299 if (!(IsActiveEq(eq))) {
2300 newHandler->ActivateEq(eq,kFALSE);
2301 if (!other->IsActiveEq(eq)) newHandler->ActivateEq(eq);
2304 newHandler->SetDeadEq(eq);
2305 if (other->IsDeadEq(eq)) newHandler->SetDeadEq(eq,kFALSE);
2307 for (UInt_t hs=0; hs<6; hs++) {
2308 if (!(IsActiveHS(eq,hs))) {
2309 newHandler->ActivateHS(eq,hs,kFALSE);
2310 if (!other->IsActiveHS(eq,hs)) newHandler->ActivateHS(eq,hs);
2312 if (IsDeadHS(eq,hs)) {
2313 newHandler->SetDeadHS(eq,hs);
2314 if (other->IsDeadHS(eq,hs)) newHandler->SetDeadHS(eq,hs,kFALSE);
2316 for (UInt_t chip=0; chip<10; chip++) {
2317 if (!(IsActiveChip(eq,hs,chip))) {
2318 newHandler->ActivateChip(eq,hs,chip,kFALSE);
2319 if (!other->IsActiveChip(eq,hs,chip)) newHandler->ActivateHS(eq,hs,chip);
2321 if (IsDeadChip(eq,hs,chip)) {
2322 newHandler->SetDeadChip(eq,hs,chip);
2323 if (other->IsDeadChip(eq,hs,chip)) newHandler->SetDeadChip(eq,hs,chip,kFALSE);
2329 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2330 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2331 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2332 UInt_t eq = GetEqIdFromKey(key);
2333 UInt_t hs = GetHSFromKey(key);
2334 UInt_t chip = GetChipFromKey(key);
2335 UInt_t col = GetColFromKey(key);
2336 UInt_t row = GetRowFromKey(key);
2337 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2338 newHandler->SetDeadPixel(eq,hs,chip,col,row);
2345 //____________________________________________________________________________________________
2346 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2347 // returns handler with dead in this' lists, except for those in other's lists
2348 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2349 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2350 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2351 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2352 UInt_t eq = GetEqIdFromKey(key);
2353 UInt_t hs = GetHSFromKey(key);
2354 UInt_t chip = GetChipFromKey(key);
2355 UInt_t col = GetColFromKey(key);
2356 UInt_t row = GetRowFromKey(key);
2357 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2358 newHandler->SetDeadPixel(eq,hs,chip,col,row);
2364 //____________________________________________________________________________________________
2365 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2366 // returns handler with noisy in this' lists, except for those in other's lists
2367 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2368 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2369 for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
2370 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
2371 UInt_t eq = GetEqIdFromKey(key);
2372 UInt_t hs = GetHSFromKey(key);
2373 UInt_t chip = GetChipFromKey(key);
2374 UInt_t col = GetColFromKey(key);
2375 UInt_t row = GetRowFromKey(key);
2376 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2377 newHandler->SetNoisyPixel(eq,hs,chip,col,row);
2383 //____________________________________________________________________________________________
2384 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2385 // find gloChip and chipIndex from module and index
2386 if (index<GetNrDead(module)) {
2387 UInt_t eq = GetEqIdFromOffline(module);
2388 UInt_t hs = GetHSFromOffline(module);
2391 for (UInt_t ch=0; ch<5; ch++) {
2392 gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
2393 if (glVal+fNrDead[gloChip]>index) {
2394 chipIndex = index-glVal;
2398 glVal+=fNrDead[gloChip];
2404 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead", "Index %d out of bounds.", index);
2407 //____________________________________________________________________________________________
2408 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2409 // find gloChip and chipIndex from module and index
2410 if (index<GetNrNoisy(module)) {
2411 UInt_t eq = GetEqIdFromOffline(module);
2412 UInt_t hs = GetHSFromOffline(module);
2415 for (UInt_t ch=0; ch<5; ch++) {
2416 gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
2417 if (glVal+fNrNoisy[gloChip]>index) {
2418 chipIndex = index-glVal;
2422 glVal+=fNrNoisy[gloChip];
2428 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy", "Index %d out of bounds.", index);
2431 //____________________________________________________________________________________________
2432 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2433 // find gloChip and chipIndex from module and index
2434 if (index<GetNrDeadEq(eq)) {
2437 for (UInt_t hs=0; hs<6; hs++) {
2438 for (UInt_t chip=0; chip<10; chip++) {
2439 gloChip = GetGloChip(eq,hs,chip);
2440 if (glVal+fNrDead[gloChip]>index) {
2441 chipIndex = index-glVal;
2445 glVal+=fNrDead[gloChip];
2452 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead", "Index %d out of bounds.", index);
2455 //____________________________________________________________________________________________
2456 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2457 // find gloChip and chipIndex from module and index
2458 if (index<GetNrNoisyEq(eq)) {
2461 for (UInt_t hs=0; hs<6; hs++) {
2462 for (UInt_t chip=0; chip<10; chip++) {
2463 gloChip = GetGloChip(eq,hs,chip);
2464 if (glVal+fNrNoisy[gloChip]>index) {
2465 chipIndex = index-glVal;
2469 glVal+=fNrNoisy[gloChip];
2476 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy", "Index %d out of bounds.", index);
2479 //____________________________________________________________________________________________
2480 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2481 // find gloChip and chipIndex from global index
2482 if (index<GetNrDead()) {
2485 for (gloChip=0; gloChip<1200; gloChip++) {
2486 if (glVal+fNrDead[gloChip]>index) {
2487 chipIndex = index-glVal;
2491 glVal+=fNrDead[gloChip];
2497 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead", "Index %d out of bounds.", index);
2500 //____________________________________________________________________________________________
2501 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2502 // find gloChip and chipIndex from global index
2503 if (index<GetNrNoisy()) {
2506 for (gloChip=0; gloChip<1200; gloChip++) {
2507 if (glVal+fNrNoisy[gloChip]>index) {
2508 chipIndex = index-glVal;
2512 glVal+=fNrNoisy[gloChip];
2518 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy", "Index %d out of bounds.", index);
2521 //____________________________________________________________________________________________
2522 UInt_t AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline(UInt_t module) const {
2523 // module to eq mapping
2525 Error("AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline", "module nr (%d) out of bounds.",module);
2528 return AliITSRawStreamSPD::GetOnlineEqIdFromOffline(module);
2530 //____________________________________________________________________________________________
2531 UInt_t AliITSOnlineCalibrationSPDhandler::GetHSFromOffline(UInt_t module) const {
2532 // module to hs mapping
2534 Error("AliITSOnlineCalibrationSPDhandler::GetHSFromOffline", "module nr (%d) out of bounds.",module);
2537 return AliITSRawStreamSPD::GetOnlineHSFromOffline(module);
2539 //____________________________________________________________________________________________
2540 UInt_t AliITSOnlineCalibrationSPDhandler::GetChipFromOffline(UInt_t module, UInt_t colM) const {
2541 // module,colM to chip mapping
2542 if (module>=240 || colM>=160) {
2543 Error("AliITSOnlineCalibrationSPDhandler::GetChipFromOffline", "module,colM nrs (%d,%d) out of bounds.",module,colM);
2546 return AliITSRawStreamSPD::GetOnlineChipFromOffline(module,colM);
2548 //____________________________________________________________________________________________
2549 UInt_t AliITSOnlineCalibrationSPDhandler::GetColFromOffline(UInt_t module, UInt_t colM) const {
2550 // colM to col mapping
2552 Error("AliITSOnlineCalibrationSPDhandler::GetColFromOffline", "colM nr (%d) out of bounds.",colM);
2555 return AliITSRawStreamSPD::GetOnlineColFromOffline(module,colM);
2557 //____________________________________________________________________________________________
2558 UInt_t AliITSOnlineCalibrationSPDhandler::GetRowFromOffline(UInt_t module, UInt_t rowM) const {
2559 // rowM to row mapping
2561 Error("AliITSOnlineCalibrationSPDhandler::GetRowFromOffline", "rowM nr (%d) out of bounds.",rowM);
2564 return AliITSRawStreamSPD::GetOnlineRowFromOffline(module,rowM);
2566 //____________________________________________________________________________________________
2567 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC2(UInt_t gloChip) const {
2568 // returns nr of dead pixels on this chip
2569 if (gloChip>=1200) {
2570 Error("AliITSOnlineCalibrationSPDhandler::GetNrDeadC2", "global chip nr (%d) out of bounds.",gloChip);
2573 return fNrDead[gloChip];
2575 //____________________________________________________________________________________________
2576 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2(UInt_t gloChip) const {
2577 // returns nr of noisy pixels on this chip
2578 if (gloChip>=1200) {
2579 Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2", "global chip nr (%d) out of bounds.",gloChip);
2582 return fNrNoisy[gloChip];
2584 //____________________________________________________________________________________________
2585 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC2(UInt_t gloChip, UInt_t index) const {
2586 // get eq for the dead pixel at position index in list of dead
2587 if (gloChip>=1200) {
2588 Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
2591 if (index<fNrDead[gloChip]) {
2592 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2593 return GetEqIdFromKey(key);
2596 Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "Index %d out of bounds.", index);
2600 //____________________________________________________________________________________________
2601 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC2(UInt_t gloChip, UInt_t index) const {
2602 // get eq for the noisy pixel at position index in list of noisy
2603 if (gloChip>=1200) {
2604 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
2607 if (index<fNrNoisy[gloChip]) {
2608 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2609 return GetEqIdFromKey(key);
2612 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "Index %d out of bounds.", index);
2616 //____________________________________________________________________________________________
2617 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC2(UInt_t gloChip, UInt_t index) const {
2618 // get hs for the dead pixel at position index in list of dead
2619 if (gloChip>=1200) {
2620 Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "global chip nr (%d) out of bounds.",gloChip);
2623 if (index<fNrDead[gloChip]) {
2624 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2625 return GetHSFromKey(key);
2628 Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "Index %d out of bounds.", index);
2632 //____________________________________________________________________________________________
2633 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC2(UInt_t gloChip, UInt_t index) const {
2634 // get hs for the noisy pixel at position index in list of noisy
2635 if (gloChip>=1200) {
2636 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "global chip nr (%d) out of bounds.",gloChip);
2639 if (index<fNrNoisy[gloChip]) {
2640 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2641 return GetHSFromKey(key);
2644 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "Index %d out of bounds.", index);
2648 //____________________________________________________________________________________________
2649 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC2(UInt_t gloChip, UInt_t index) const {
2650 // get chip for the dead pixel at position index in list of dead
2651 if (gloChip>=1200) {
2652 Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "global chip nr (%d) out of bounds.",gloChip);
2655 if (index<fNrDead[gloChip]) {
2656 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2657 return GetChipFromKey(key);
2660 Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "Index %d out of bounds.", index);
2664 //____________________________________________________________________________________________
2665 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC2(UInt_t gloChip, UInt_t index) const {
2666 // get chip for the noisy pixel at position index in list of noisy
2667 if (gloChip>=1200) {
2668 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "global chip nr (%d) out of bounds.",gloChip);
2671 if (index<fNrNoisy[gloChip]) {
2672 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2673 return GetChipFromKey(key);
2676 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "Index %d out of bounds.", index);
2680 //____________________________________________________________________________________________
2681 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2(UInt_t gloChip, UInt_t index) const {
2682 // get col for the dead pixel at position index in list of dead
2683 if (gloChip>=1200) {
2684 Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "global chip nr (%d) out of bounds.",gloChip);
2687 if (index<fNrDead[gloChip]) {
2688 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2689 return GetColFromKey(key);
2692 Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "Index %d out of bounds.", index);
2696 //____________________________________________________________________________________________
2697 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC2(UInt_t gloChip, UInt_t index) const {
2698 // get col for the noisy pixel at position index in list of noisy
2699 if (gloChip>=1200) {
2700 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "global chip nr (%d) out of bounds.",gloChip);
2703 if (index<fNrNoisy[gloChip]) {
2704 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2705 return GetColFromKey(key);
2708 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "Index %d out of bounds.", index);
2712 //____________________________________________________________________________________________
2713 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC2(UInt_t gloChip, UInt_t index) const {
2714 // get row for the dead pixel at position index in list of dead
2715 if (gloChip>=1200) {
2716 Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "global chip nr (%d) out of bounds.",gloChip);
2719 if (index<fNrDead[gloChip]) {
2720 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2721 return GetRowFromKey(key);
2724 Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "Index %d out of bounds.", index);
2728 //____________________________________________________________________________________________
2729 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC2(UInt_t gloChip, UInt_t index) const {
2730 // get row for the noisy pixel at position index in list of noisy
2731 if (gloChip>=1200) {
2732 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "global chip nr (%d) out of bounds.",gloChip);
2735 if (index<fNrNoisy[gloChip]) {
2736 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2737 return GetRowFromKey(key);
2740 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "Index %d out of bounds.", index);
2744 //____________________________________________________________________________________________
2745 void AliITSOnlineCalibrationSPDhandler::ActivateALL() {
2746 // activate all eq,hs,chips
2747 for (UInt_t eq=0; eq<20; eq++) {
2749 for (UInt_t hs=0; hs<6; hs++) {
2751 for (UInt_t chip=0; chip<10; chip++) {
2752 ActivateChip(eq,hs,chip);
2757 //____________________________________________________________________________________________
2758 void AliITSOnlineCalibrationSPDhandler::ActivateEq(UInt_t eq, Bool_t setval) {
2761 Error("AliITSOnlineCalibrationSPDhandler::ActivateEq", "eq (%d) out of bounds.",eq);
2764 fActiveEq[eq] = setval;
2766 //____________________________________________________________________________________________
2767 void AliITSOnlineCalibrationSPDhandler::ActivateHS(UInt_t eq, UInt_t hs, Bool_t setval) {
2769 if (eq>=20 || hs>=6) {
2770 Error("AliITSOnlineCalibrationSPDhandler::ActivateHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2773 fActiveHS[eq][hs] = setval;
2775 //____________________________________________________________________________________________
2776 void AliITSOnlineCalibrationSPDhandler::ActivateChip(UInt_t eq, UInt_t hs, UInt_t chip, Bool_t setval) {
2778 if (eq>=20 || hs>=6 || chip>=10) {
2779 Error("AliITSOnlineCalibrationSPDhandler::ActivateChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2782 fActiveChip[eq][hs][chip] = setval;
2784 //____________________________________________________________________________________________
2785 Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveEq(UInt_t eq) const {
2788 Error("AliITSOnlineCalibrationSPDhandler::IsActiveEq", "eq (%d) out of bounds.",eq);
2791 return fActiveEq[eq];
2793 //____________________________________________________________________________________________
2794 Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveHS(UInt_t eq, UInt_t hs) const {
2796 if (eq>=20 || hs>=6) {
2797 Error("AliITSOnlineCalibrationSPDhandler::IsActiveHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2800 return fActiveHS[eq][hs];
2802 //____________________________________________________________________________________________
2803 Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
2805 if (eq>=20 || hs>=6 || chip>=10) {
2806 Error("AliITSOnlineCalibrationSPDhandler::IsActiveChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2809 return fActiveChip[eq][hs][chip];
2811 //____________________________________________________________________________________________
2812 void AliITSOnlineCalibrationSPDhandler::UnSetDeadALL() {
2813 // Clear all dead eq,hs,chips
2814 for (UInt_t eq=0; eq<20; eq++) {
2815 SetDeadEq(eq,kFALSE);
2816 for (UInt_t hs=0; hs<6; hs++) {
2817 SetDeadHS(eq,hs,kFALSE);
2818 for (UInt_t chip=0; chip<10; chip++) {
2819 SetDeadChip(eq,hs,chip,kFALSE);
2824 //____________________________________________________________________________________________
2825 void AliITSOnlineCalibrationSPDhandler::SetDeadEq(UInt_t eq, Bool_t setval) {
2828 Error("AliITSOnlineCalibrationSPDhandler::SetDeadEq", "eq (%d) out of bounds.",eq);
2831 fDeadEq[eq] = setval;
2833 //____________________________________________________________________________________________
2834 void AliITSOnlineCalibrationSPDhandler::SetDeadHS(UInt_t eq, UInt_t hs, Bool_t setval) {
2836 if (eq>=20 || hs>=6) {
2837 Error("AliITSOnlineCalibrationSPDhandler::SetDeadHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2840 fDeadHS[eq][hs] = setval;
2842 //____________________________________________________________________________________________
2843 void AliITSOnlineCalibrationSPDhandler::SetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip, Bool_t setval) {
2845 if (eq>=20 || hs>=6 || chip>=10) {
2846 Error("AliITSOnlineCalibrationSPDhandler::SetDeadChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2849 fDeadChip[eq][hs][chip] = setval;
2851 //____________________________________________________________________________________________
2852 Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadEq(UInt_t eq) const {
2855 Error("AliITSOnlineCalibrationSPDhandler::IsDeadEq", "eq (%d) out of bounds.",eq);
2860 //____________________________________________________________________________________________
2861 Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadHS(UInt_t eq, UInt_t hs) const {
2863 if (eq>=20 || hs>=6) {
2864 Error("AliITSOnlineCalibrationSPDhandler::IsDeadHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2867 return fDeadHS[eq][hs];
2869 //____________________________________________________________________________________________
2870 Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
2872 if (eq>=20 || hs>=6 || chip>=10) {
2873 Error("AliITSOnlineCalibrationSPDhandler::IsDeadChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2876 return fDeadChip[eq][hs][chip];
2878 //____________________________________________________________________________________________
2879 Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentEq(UInt_t eq) const {
2882 Error("AliITSOnlineCalibrationSPDhandler::IsSilentEq", "eq (%d) out of bounds.",eq);
2885 return (!IsActiveEq(eq) || IsDeadEq(eq));
2887 //____________________________________________________________________________________________
2888 Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentHS(UInt_t eq, UInt_t hs) const {
2890 if (eq>=20 || hs>=6) {
2891 Error("AliITSOnlineCalibrationSPDhandler::IsSilentHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2894 return (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs));
2896 //____________________________________________________________________________________________
2897 Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
2899 if (eq>=20 || hs>=6 || chip>=10) {
2900 Error("AliITSOnlineCalibrationSPDhandler::IsSilentChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2903 return (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs) || !IsActiveChip(eq,hs,chip) || IsDeadChip(eq,hs,chip));
2905 //____________________________________________________________________________________________
2906 Bool_t AliITSOnlineCalibrationSPDhandler::IsNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
2907 // returns true if there is at least a noisy pixel in the chip
2909 if (eq>=20 || hs>=6 || chip>=10) {
2910 Error("AliITSOnlineCalibrationSPDhandler::IsNoisyChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2913 Bool_t isNoisy = kFALSE;
2915 UInt_t nrNoisy = GetNrNoisy();
2916 for (UInt_t i=0; i<nrNoisy; i++) {
2917 if(eq == GetNoisyEqIdAt(i)){
2918 if(hs == GetNoisyHSAt(i)){
2919 if(chip == GetNoisyChipAt(i)) {
2920 UInt_t col = GetNoisyColAt(i);
2921 UInt_t row = GetNoisyRowAt(i);
2922 if (IsPixelNoisy(eq,hs,chip,col,row)) isNoisy = kTRUE;