1 //////////////////////////////////////////////////////////////////////
2 // Author: Henrik Tydesjo //
3 // For easier handling of dead and noisy pixels they are kept in //
4 // container maps (AliITSIntMap). //
5 // Handling of inactive equipments,HSs,chips have been added. //
6 // A pixel that is either dead or inactive is called SILENT here. //
7 // The lists of single dead and noisy pixels are separated from the //
8 // information about which eq/hs/chip are inactive. //
9 // The TArrayS objects that are put in the AliITSCalibrationSPD //
10 // objects can be obtained from the methods GetDeadArray and //
12 //////////////////////////////////////////////////////////////////////
14 #include "AliITSOnlineCalibrationSPDhandler.h"
15 #include "AliITSOnlineCalibrationSPD.h"
16 #include "AliITSTriggerConditions.h"
17 #include "AliITSIntMap.h"
18 #include <TObjArray.h>
25 #ifndef SPD_DA_OFF // you may want to exclude cdb classes, if using this class outside aliroot
26 #include "AliITSCalibrationSPD.h"
27 #include "AliCDBManager.h"
28 #include "AliCDBEntry.h"
33 //____________________________________________________________________________________________
34 AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler():
39 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
42 fDeadPixelMap[gloChip] = new AliITSIntMap();
43 fNoisyPixelMap[gloChip] = new AliITSIntMap();
48 //____________________________________________________________________________________________
49 AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler(const AliITSOnlineCalibrationSPDhandler& handle):
51 fTriggerConditions(handle.fTriggerConditions)
54 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
55 fNrDead[gloChip] = handle.fNrDead[gloChip];
56 fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
57 fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
58 fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
60 for (UInt_t eq=0; eq<20; eq++) {
61 fActiveEq[eq] = handle.fActiveEq[eq];
62 for (UInt_t hs=0; hs<6; hs++) {
63 fActiveHS[eq][hs] = handle.fActiveHS[eq][hs];
64 for (UInt_t chip=0; chip<10; chip++) {
65 fActiveChip[eq][hs][chip] = handle.fActiveChip[eq][hs][chip];
69 fFileLocation = handle.fFileLocation;
71 //____________________________________________________________________________________________
72 AliITSOnlineCalibrationSPDhandler::~AliITSOnlineCalibrationSPDhandler() {
74 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
75 delete fDeadPixelMap[gloChip];
76 delete fNoisyPixelMap[gloChip];
79 //____________________________________________________________________________________________
80 AliITSOnlineCalibrationSPDhandler& AliITSOnlineCalibrationSPDhandler::operator=(const AliITSOnlineCalibrationSPDhandler& handle) {
81 // assignment operator
84 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
85 fNrDead[gloChip] = handle.fNrDead[gloChip];
86 fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
87 fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
88 fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
90 for (UInt_t eq=0; eq<20; eq++) {
91 fActiveEq[eq] = handle.fActiveEq[eq];
92 for (UInt_t hs=0; hs<6; hs++) {
93 fActiveHS[eq][hs] = handle.fActiveHS[eq][hs];
94 for (UInt_t chip=0; chip<10; chip++) {
95 fActiveChip[eq][hs][chip] = handle.fActiveChip[eq][hs][chip];
99 fFileLocation = handle.fFileLocation;
103 //____________________________________________________________________________________________
104 void AliITSOnlineCalibrationSPDhandler::ClearMaps() {
105 // clear the lists of dead and noisy
110 //____________________________________________________________________________________________
111 void AliITSOnlineCalibrationSPDhandler::ResetDead() {
112 // reset the dead pixel map and inactive eq,hs,chip
114 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
116 fDeadPixelMap[gloChip]->Clear();
119 //____________________________________________________________________________________________
120 void AliITSOnlineCalibrationSPDhandler::ResetNoisy() {
121 // clear the list of noisy pixels
122 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
124 fNoisyPixelMap[gloChip]->Clear();
127 //____________________________________________________________________________________________
128 void AliITSOnlineCalibrationSPDhandler::ResetDeadForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
129 // clear the dead pixels for this chip
130 SetDeadChip(eq,hs,chip,kFALSE);
131 UInt_t gloChip = GetGloChip(eq,hs,chip);
132 for (UInt_t col=0; col<32; col++) {
133 for (UInt_t row=0; row<256; row++) {
134 Int_t key = GetKey(eq,hs,chip,col,row);
135 if (fDeadPixelMap[gloChip]->Remove(key)) {
141 //____________________________________________________________________________________________
142 void AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
143 // clear the noisy pixels for this chip
144 UInt_t gloChip = GetGloChip(eq,hs,chip);
146 Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip","global chip nr (%d) out of bounds\n",gloChip);
149 for (UInt_t col=0; col<32; col++) {
150 for (UInt_t row=0; row<256; row++) {
151 Int_t key = GetKey(eq,hs,chip,col,row);
152 if (fNoisyPixelMap[gloChip]->Remove(key)) {
158 //____________________________________________________________________________________________
159 void AliITSOnlineCalibrationSPDhandler::ResetDeadForEq(UInt_t eq) {
160 // clear the dead pixels for this eq
162 Error("AliITSOnlineCalibrationSPDhandler::ResetDeadForEq", "eq (%d) out of bounds.",eq);
165 for (UInt_t hs=0; hs<6; hs++) {
166 for (UInt_t chip=0; chip<10; chip++) {
167 ResetDeadForChip(eq, hs, chip);
171 //____________________________________________________________________________________________
172 void AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq(UInt_t eq) {
173 // clear the noisy pixels for this eq
175 Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq", "eq (%d) out of bounds.",eq);
178 for (UInt_t hs=0; hs<6; hs++) {
179 for (UInt_t chip=0; chip<10; chip++) {
180 ResetNoisyForChip(eq, hs, chip);
186 //____________________________________________________________________________________________
187 Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromFiles() {
188 // read files from file location (active,dead,noisy info). returns true if at least one file found
189 Bool_t b1 = ReadNoisyFromFiles();
190 Bool_t b2 = ReadSilentFromFiles();
193 //____________________________________________________________________________________________
194 Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFiles() {
195 // read dead,active files from file location. returns true if at least one file found
196 Bool_t returnval=kFALSE;
197 for (UInt_t eq=0; eq<20; eq++) {
198 if (ReadSilentFromFile(eq)) {
204 //____________________________________________________________________________________________
205 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFiles() {
206 // read dead,active files from file location. returns true if at least one file found
207 Bool_t returnval=kFALSE;
208 for (UInt_t eq=0; eq<20; eq++) {
209 if (ReadDeadFromFile(eq)) {
215 //____________________________________________________________________________________________
216 Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFile(UInt_t eq) {
217 // read dead file for eq from file location.
218 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
219 return ReadSilentFromFileName(fileName.Data());
221 //____________________________________________________________________________________________
222 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFile(UInt_t eq) {
223 // read dead file for eq from file location.
224 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
225 return ReadDeadFromFileName(fileName.Data());
227 //____________________________________________________________________________________________
228 Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFileName(const char *fileName) {
229 // read dead from file fileName (including inactive)
230 return ReadDeadFromFileName(fileName, kTRUE);
232 //____________________________________________________________________________________________
233 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFileName(const char *fileName, Bool_t inactive) {
234 // read dead from file fileName
235 AliITSOnlineCalibrationSPD* calib;
236 FILE* fp0 = fopen(fileName, "r");
237 if (fp0 == NULL) {return kFALSE;}
240 TFile file(fileName, "READ");
242 file.GetObject("AliITSOnlineCalibrationSPD", calib);
245 UInt_t nrDead=calib->GetNrBad();
246 for (UInt_t index=0; index<nrDead; index++) {
247 UInt_t key = calib->GetKeyAt(index);
248 UInt_t eq = GetEqIdFromKey(key);
249 UInt_t hs = GetHSFromKey(key);
250 UInt_t chip = GetChipFromKey(key);
251 UInt_t col = GetColFromKey(key);
252 UInt_t row = GetRowFromKey(key);
253 SetDeadPixel(eq,hs,chip,col,row);
255 UInt_t eq1 = calib->GetEqNr();
256 if (calib->IsDeadEq()) SetDeadEq(eq1);
257 else SetDeadEq(eq1,kFALSE);
258 for (UInt_t hs=0; hs<6; hs++) {
259 if (calib->IsDeadHS(hs)) SetDeadHS(eq1,hs);
260 else SetDeadHS(eq1,hs,kFALSE);
261 for (UInt_t chip=0; chip<10; chip++) {
262 if (calib->IsDeadChip(hs,chip)) SetDeadChip(eq1,hs,chip);
263 else SetDeadChip(eq1,hs,chip,kFALSE);
267 UInt_t eq = calib->GetEqNr();
268 if (calib->IsActiveEq()) ActivateEq(eq);
269 else ActivateEq(eq,kFALSE);
270 for (UInt_t hs=0; hs<6; hs++) {
271 if (calib->IsActiveHS(hs)) ActivateHS(eq,hs);
272 else ActivateHS(eq,hs,kFALSE);
273 for (UInt_t chip=0; chip<10; chip++) {
274 if (calib->IsActiveChip(hs,chip)) ActivateChip(eq,hs,chip);
275 else ActivateChip(eq,hs,chip,kFALSE);
284 //____________________________________________________________________________________________
285 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFiles() {
286 // read noisy files from file location. returns true if at least one file found
287 Bool_t returnval=kFALSE;
288 for (UInt_t eq=0; eq<20; eq++) {
289 if (ReadNoisyFromFile(eq)) {
295 //____________________________________________________________________________________________
296 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFile(UInt_t eq) {
297 // read noisy file for eq from file location.
298 TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
299 return ReadNoisyFromFileName(fileName.Data());
301 //____________________________________________________________________________________________
302 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFileName(const char *fileName) {
303 // read noisy from file fileName
304 AliITSOnlineCalibrationSPD* calib;
305 FILE* fp0 = fopen(fileName, "r");
306 if (fp0 == NULL) {return kFALSE;}
309 TFile file(fileName, "READ");
311 file.GetObject("AliITSOnlineCalibrationSPD", calib);
314 UInt_t nrNoisy=calib->GetNrBad();
315 for (UInt_t index=0; index<nrNoisy; index++) {
316 UInt_t key = calib->GetKeyAt(index);
317 UInt_t eq = GetEqIdFromKey(key);
318 UInt_t hs = GetHSFromKey(key);
319 UInt_t chip = GetChipFromKey(key);
320 UInt_t col = GetColFromKey(key);
321 UInt_t row = GetRowFromKey(key);
322 SetNoisyPixel(eq,hs,chip,col,row);
329 //____________________________________________________________________________________________
330 UInt_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromText(const char *fileName, UInt_t module) {
331 // read dead from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
332 // insert only those pixels that belong to module (or all if module=240).
335 textFile.open(fileName, ifstream::in);
336 if (textFile.fail()) {
337 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromText","No dead text file (%s) present.",fileName);
341 UInt_t eq,hs,chip,col,row;
342 textFile >> eq; if (textFile.eof()) break;
343 textFile >> hs; if (textFile.eof()) break;
344 textFile >> chip; if (textFile.eof()) break;
345 textFile >> col; if (textFile.eof()) break;
347 if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){
348 if (SetDeadPixel(eq,hs,chip,col,row)) {
352 if (textFile.eof()) break;
358 //____________________________________________________________________________________________
359 UInt_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText(const char *fileName, UInt_t module) {
360 // read noisy from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
361 // insert only those pixels that belong to module (or all if module=240).
364 textFile.open(fileName, ifstream::in);
365 if (textFile.fail()) {
366 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText","No noisy text file (%s) present.",fileName);
370 UInt_t eq,hs,chip,col,row;
371 textFile >> eq; if (textFile.eof()) break;
372 textFile >> hs; if (textFile.eof()) break;
373 textFile >> chip; if (textFile.eof()) break;
374 textFile >> col; if (textFile.eof()) break;
376 if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){
377 if (SetNoisyPixel(eq,hs,chip,col,row)) {
381 if (textFile.eof()) break;
387 //____________________________________________________________________________________________
388 void AliITSOnlineCalibrationSPDhandler::ReadPITConditionsFromText(const char *fileName) {
389 // read PIT conditions file from text as printed out at P2
390 // !!! please note that the chip numbering goes from 9 to 0 in the text. In PVSS panels is the opposite.
391 if(fTriggerConditions) fTriggerConditions->ResetAll();
392 else fTriggerConditions = new AliITSTriggerConditions();
393 fTriggerConditions->ReadFromTextFile(fileName);
395 //____________________________________________________________________________________________
396 Bool_t AliITSOnlineCalibrationSPDhandler::ReadPITConditionsFromDB(Int_t runNr, const Char_t *storage){
397 // read PIT conditions from the OCDB
399 AliCDBManager* man = AliCDBManager::Instance();
400 TString storageSTR = Form("%s",storage);
401 if (storageSTR.CompareTo("default")==0) {
402 if(!man->IsDefaultStorageSet()) {
403 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
407 storageSTR = Form("%s",storage);
408 man->SetDefaultStorage(storageSTR.Data());
410 AliCDBEntry *cdbEntry = man->Get("TRIGGER/SPD/PITConditions", runNr);
412 fTriggerConditions = (AliITSTriggerConditions*)cdbEntry->GetObject();
414 } else return kFALSE;
416 //____________________________________________________________________________________________
417 void AliITSOnlineCalibrationSPDhandler::WriteToFilesAlways() {
418 // write the lists of active,dead,noisy to files
419 for (UInt_t eq=0; eq<20; eq++) {
420 WriteSilentToFile(eq);
421 WriteNoisyToFile(eq);
424 //____________________________________________________________________________________________
425 UInt_t AliITSOnlineCalibrationSPDhandler::WriteToFiles() {
426 // write the lists of dead and noisy to files (only if there are >0 dead or noisy pixels) , returns nr of files produced
427 return (WriteNoisyToFiles() + WriteSilentToFiles());
429 //____________________________________________________________________________________________
430 void AliITSOnlineCalibrationSPDhandler::WriteSilentToFilesAlways() {
431 // write the lists of silent to files
432 for (UInt_t eq=0; eq<20; eq++) {
433 WriteSilentToFile(eq);
436 //____________________________________________________________________________________________
437 void AliITSOnlineCalibrationSPDhandler::WriteDeadToFilesAlways() {
438 // write the lists of dead to files
439 for (UInt_t eq=0; eq<20; eq++) {
443 //____________________________________________________________________________________________
444 void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFilesAlways() {
445 // write the lists of noisy to files
446 for (UInt_t eq=0; eq<20; eq++) {
447 WriteNoisyToFile(eq);
450 //____________________________________________________________________________________________
451 UInt_t AliITSOnlineCalibrationSPDhandler::WriteSilentToFiles() {
452 // write the list of silent to file (only if there are >0 silent pixels) , returns nr of files produced
454 for (UInt_t eq=0; eq<20; eq++) {
455 if (GetNrSilentEq(eq) > 0) {
456 WriteSilentToFile(eq);
462 //____________________________________________________________________________________________
463 UInt_t AliITSOnlineCalibrationSPDhandler::WriteDeadToFiles() {
464 // write the list of dead to file (only if there are >0 dead pixels) , returns nr of files produced
466 for (UInt_t eq=0; eq<20; eq++) {
467 if (GetNrDeadEq(eq) > 0) {
474 //____________________________________________________________________________________________
475 UInt_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToFiles() {
476 // write the list of noisy to file (only if there are >0 noisy pixels) , returns nr of files produced
478 for (UInt_t eq=0; eq<20; eq++) {
479 if (GetNrNoisyEq(eq) > 0) {
480 WriteNoisyToFile(eq);
486 //____________________________________________________________________________________________
487 void AliITSOnlineCalibrationSPDhandler::WriteSilentToFile(UInt_t eq) {
488 WriteDeadToFile(eq,kTRUE);
490 //____________________________________________________________________________________________
491 void AliITSOnlineCalibrationSPDhandler::WriteDeadToFile(UInt_t eq, Bool_t inactive) {
492 // write the lists of dead (and inactive if input boolean is true) for eq to file
493 AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
495 calib->SetBadList(GetDeadArrayOnline(eq));
496 calib->SetNrBad(GetNrDeadEq(eq));
497 if (IsDeadEq(eq)) calib->SetDeadEq();
498 else calib->SetDeadEq(kFALSE);
499 for (UInt_t hs=0; hs<6; hs++) {
500 if (IsDeadHS(eq,hs)) calib->SetDeadHS(hs);
501 else calib->SetDeadHS(hs,kFALSE);
502 for (UInt_t chip=0; chip<10; chip++) {
503 if (IsDeadChip(eq,hs,chip)) calib->SetDeadChip(hs,chip);
504 else calib->SetDeadChip(hs,chip,kFALSE);
508 if (IsActiveEq(eq)) calib->ActivateEq();
509 else calib->ActivateEq(kFALSE);
510 for (UInt_t hs=0; hs<6; hs++) {
511 if (IsActiveHS(eq,hs)) calib->ActivateHS(hs);
512 else calib->ActivateHS(hs,kFALSE);
513 for (UInt_t chip=0; chip<10; chip++) {
514 if (IsActiveChip(eq,hs,chip)) calib->ActivateChip(hs,chip);
515 else calib->ActivateChip(hs,chip,kFALSE);
519 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
520 TFile file(fileName.Data(), "RECREATE");
521 file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
525 //____________________________________________________________________________________________
526 void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFile(UInt_t eq) {
527 // write the lists of noisy for eq to file
528 AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
530 calib->SetBadList(GetNoisyArrayOnline(eq));
531 calib->SetNrBad(GetNrNoisyEq(eq));
532 TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
533 TFile file(fileName.Data(), "RECREATE");
534 file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
538 //____________________________________________________________________________________________
540 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB(UInt_t module, Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
541 // reads dead pixels from DB for given module and runNr
542 AliCDBManager* man = AliCDBManager::Instance();
543 TString storageSTR = Form("%s",storage);
544 if (storageSTR.CompareTo("default")==0) {
545 if(!man->IsDefaultStorageSet()) {
546 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
550 storageSTR = Form("%s",storage);
551 man->SetDefaultStorage(storageSTR.Data());
553 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
556 spdEntry = (TObjArray*)cdbEntry->GetObject();
557 if(!spdEntry) return kFALSE;
560 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB","Calibration for run %d not found in database.",runNr);
563 AliITSCalibrationSPD* calibSPD;
564 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
566 UInt_t nrDead = calibSPD->GetNrBadSingle();
568 if (!treeSerial) RecursiveInsertDead(calibSPD,module,0,nrDead-1);
570 for (UInt_t index=0; index<nrDead; index++) {
571 UInt_t colM = calibSPD->GetBadColAt(index);
572 UInt_t rowM = calibSPD->GetBadRowAt(index);
573 SetDeadPixelM(module,colM,rowM);
577 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
578 UInt_t eq,hs,chip,col,row;
579 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
580 if (calibSPD->IsChipBad(chipIndex)) {
581 SetDeadChip(eq,hs,chip);
584 SetDeadChip(eq,hs,chip,kFALSE);
588 spdEntry->SetOwner(kTRUE);
592 //____________________________________________________________________________________________
593 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB(UInt_t module, Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
594 // reads noisy pixels from DB for given module and runNr
595 AliCDBManager* man = AliCDBManager::Instance();
596 TString storageSTR = Form("%s",storage);
597 if (storageSTR.CompareTo("default")==0) {
598 if(!man->IsDefaultStorageSet()) {
599 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
603 storageSTR = Form("%s",storage);
604 man->SetDefaultStorage(storageSTR.Data());
606 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
609 spdEntry = (TObjArray*)cdbEntry->GetObject();
610 if(!spdEntry) return kFALSE;
613 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB","Calibration for run %d not found in database.",runNr);
616 AliITSCalibrationSPD* calibSPD;
617 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
618 UInt_t nrNoisy = calibSPD->GetNrBadSingle();
620 if (!treeSerial) RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
622 for (UInt_t index=0; index<nrNoisy; index++) {
623 UInt_t colM = calibSPD->GetBadColAt(index);
624 UInt_t rowM = calibSPD->GetBadRowAt(index);
625 SetNoisyPixelM(module,colM,rowM);
629 spdEntry->SetOwner(kTRUE);
633 //____________________________________________________________________________________________
634 Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromDB(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
635 // reads dead and noisy pixels from DB for given runNr
636 // note that you may want to clear the lists (if they are not empty) before reading
637 return (ReadNoisyFromDB(runNr,storage,treeSerial) && ReadDeadFromDB(runNr,storage,treeSerial));
639 //____________________________________________________________________________________________
640 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
641 // reads dead pixels from DB for given runNr
642 // note that you may want to clear the list (if it is not empty) before reading
643 AliCDBManager* man = AliCDBManager::Instance();
644 TString storageSTR = Form("%s",storage);
645 if (storageSTR.CompareTo("default")==0) {
646 if(!man->IsDefaultStorageSet()) {
647 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
651 storageSTR = Form("%s",storage);
652 man->SetDefaultStorage(storageSTR.Data());
654 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
657 spdEntry = (TObjArray*)cdbEntry->GetObject();
658 if(!spdEntry) return kFALSE;
661 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB","Calibration for run %d not found in database.",runNr);
664 AliITSCalibrationSPD* calibSPD;
665 for (UInt_t module=0; module<240; module++) {
666 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
667 UInt_t nrDead = calibSPD->GetNrBadSingle();
670 RecursiveInsertDead(calibSPD,module,0,nrDead-1);
674 for (UInt_t index=0; index<nrDead; index++) {
675 UInt_t colM = calibSPD->GetBadColAt(index);
676 UInt_t rowM = calibSPD->GetBadRowAt(index);
677 SetDeadPixelM(module,colM,rowM);
681 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
682 UInt_t eq,hs,chip,col,row;
683 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
684 if (calibSPD->IsChipBad(chipIndex)) {
685 SetDeadChip(eq,hs,chip);
688 SetDeadChip(eq,hs,chip,kFALSE);
692 spdEntry->SetOwner(kTRUE);
696 //____________________________________________________________________________________________
697 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
698 // reads noisy pixels from DB for given runNr
699 // note that you may want to clear the list (if it is not empty) before reading
700 AliCDBManager* man = AliCDBManager::Instance();
701 TString storageSTR = Form("%s",storage);
702 if (storageSTR.CompareTo("default")==0) {
703 if(!man->IsDefaultStorageSet()) {
704 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
708 storageSTR = Form("%s",storage);
709 man->SetDefaultStorage(storageSTR.Data());
711 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
714 spdEntry = (TObjArray*)cdbEntry->GetObject();
715 if(!spdEntry) return kFALSE;
718 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB","Calibration for run %d not found in database.",runNr);
721 AliITSCalibrationSPD* calibSPD;
722 for (UInt_t module=0; module<240; module++) {
723 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
724 UInt_t nrNoisy = calibSPD->GetNrBadSingle();
727 RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
730 for (UInt_t index=0; index<nrNoisy; index++) {
731 UInt_t colM = calibSPD->GetBadColAt(index);
732 UInt_t rowM = calibSPD->GetBadRowAt(index);
733 SetNoisyPixelM(module,colM,rowM);
738 spdEntry->SetOwner(kTRUE);
742 //____________________________________________________________________________________________
743 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDBasNoisy(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
744 // reads dead pixels (put as noisy) from DB for given runNr
745 // note that you may want to clear the list (if it is not empty) before reading
746 AliCDBManager* man = AliCDBManager::Instance();
747 TString storageSTR = Form("%s",storage);
748 if (storageSTR.CompareTo("default")==0) {
749 if(!man->IsDefaultStorageSet()) {
750 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
754 storageSTR = Form("%s",storage);
755 man->SetDefaultStorage(storageSTR.Data());
757 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
760 spdEntry = (TObjArray*)cdbEntry->GetObject();
761 if(!spdEntry) return kFALSE;
764 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromDBasNoisy","Calibration for run %d not found in database.",runNr);
767 AliITSCalibrationSPD* calibSPD;
768 for (UInt_t module=0; module<240; module++) {
769 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
770 UInt_t nrDead = calibSPD->GetNrBadSingle();
773 RecursiveInsertDead(calibSPD,module,0,nrDead-1);
777 for (UInt_t index=0; index<nrDead; index++) {
778 UInt_t colM = calibSPD->GetBadColAt(index);
779 UInt_t rowM = calibSPD->GetBadRowAt(index);
780 SetDeadPixelM(module,colM,rowM);
784 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
785 UInt_t eq,hs,chip,col,row;
786 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
787 if (calibSPD->IsChipBad(chipIndex)) {
788 SetDeadChip(eq,hs,chip);
791 SetDeadChip(eq,hs,chip,kFALSE);
795 spdEntry->SetOwner(kTRUE);
799 //____________________________________________________________________________________________
800 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromCalibObj(TObjArray* calObj) {
801 // reads dead pixels from calib object
802 for (UInt_t module=0; module<240; module++) {
803 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*)calObj->At(module);
804 for (Int_t i=0; i<calibSPD->GetNrBadSingle(); i++) {
805 SetDeadPixelM(module,calibSPD->GetBadColAt(i),calibSPD->GetBadRowAt(i));
807 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
808 UInt_t eq,hs,chip,col,row;
809 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
810 if (calibSPD->IsChipBad(chipIndex)) {
811 SetDeadChip(eq,hs,chip);
814 SetDeadChip(eq,hs,chip,kFALSE);
820 //____________________________________________________________________________________________
821 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromCalibObj(TObjArray* calObj) {
822 // reads noisy pixels from calib object
823 for (UInt_t module=0; module<240; module++) {
824 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*)calObj->At(module);
825 for (Int_t i=0; i<calibSPD->GetNrBadSingle(); i++) {
826 SetNoisyPixelM(module,calibSPD->GetBadColAt(i),calibSPD->GetBadRowAt(i));
831 //____________________________________________________________________________________________
832 Bool_t AliITSOnlineCalibrationSPDhandler::WriteToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
833 // writes dead and noisy pixels to DB for given runNrs
834 // overwrites any previous entries
835 return (WriteNoisyToDB(runNrStart,runNrEnd,storage) && WriteDeadToDB(runNrStart,runNrEnd,storage));
837 //____________________________________________________________________________________________
838 Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
839 // writes dead pixels to DB for given runNrs
840 // overwrites any previous entries
841 AliCDBManager* man = AliCDBManager::Instance();
842 TString storageSTR = Form("%s",storage);
843 if (storageSTR.CompareTo("default")==0) {
844 if(!man->IsDefaultStorageSet()) {
845 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
849 storageSTR = Form("%s",storage);
850 man->SetDefaultStorage(storageSTR.Data());
852 AliCDBMetaData* metaData = new AliCDBMetaData();
853 metaData->SetResponsible("Henrik Tydesjo");
854 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
855 AliCDBId idCalSPD("ITS/Calib/SPDDead",runNrStart,runNrEnd);
856 TObjArray* spdEntry = new TObjArray(240);
857 spdEntry->SetOwner(kTRUE);
858 for(UInt_t module=0; module<240; module++){
859 AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
860 spdEntry->Add(calibSPD);
862 for(UInt_t module=0; module<240; module++){
863 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
864 calibSPD->SetNrBadSingle( GetNrDeadSingle(module) );
865 calibSPD->SetBadList( GetDeadArray(module) );
866 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
867 UInt_t eq,hs,chip,col,row;
868 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
869 if (IsSilentChip(eq,hs,chip)) {
870 calibSPD->SetChipBad(chipIndex);
873 calibSPD->UnSetChipBad(chipIndex);
877 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
884 //____________________________________________________________________________________________
885 Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDBasNoisy(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
886 // writes dead pixels to DB for given runNrs
887 // overwrites any previous entries
888 AliCDBManager* man = AliCDBManager::Instance();
889 TString storageSTR = Form("%s",storage);
890 if (storageSTR.CompareTo("default")==0) {
891 if(!man->IsDefaultStorageSet()) {
892 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
896 storageSTR = Form("%s",storage);
897 man->SetDefaultStorage(storageSTR.Data());
899 AliCDBMetaData* metaData = new AliCDBMetaData();
900 metaData->SetResponsible("Henrik Tydesjo");
901 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
902 AliCDBId idCalSPD("ITS/Calib/SPDNoisy",runNrStart,runNrEnd);
903 TObjArray* spdEntry = new TObjArray(240);
904 spdEntry->SetOwner(kTRUE);
905 for(UInt_t module=0; module<240; module++){
906 AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
907 spdEntry->Add(calibSPD);
909 for(UInt_t module=0; module<240; module++){
910 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
911 calibSPD->SetNrBadSingle( GetNrDeadSingle(module) );
912 calibSPD->SetBadList( GetDeadArray(module) );
913 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
914 UInt_t eq,hs,chip,col,row;
915 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
916 if (IsSilentChip(eq,hs,chip)) {
917 calibSPD->SetChipBad(chipIndex);
920 calibSPD->UnSetChipBad(chipIndex);
924 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
931 //____________________________________________________________________________________________
932 Bool_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
933 // writes noisy pixels to DB for given runNrs
934 // overwrites any previous entries
935 AliCDBManager* man = AliCDBManager::Instance();
936 TString storageSTR = Form("%s",storage);
937 if (storageSTR.CompareTo("default")==0) {
938 if(!man->IsDefaultStorageSet()) {
939 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
943 storageSTR = Form("%s",storage);
944 man->SetDefaultStorage(storageSTR.Data());
946 AliCDBMetaData* metaData = new AliCDBMetaData();
947 metaData->SetResponsible("Henrik Tydesjo");
948 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
949 AliCDBId idCalSPD("ITS/Calib/SPDNoisy",runNrStart,runNrEnd);
950 TObjArray* spdEntry = new TObjArray(240);
951 spdEntry->SetOwner(kTRUE);
952 for(UInt_t module=0; module<240; module++){
953 AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
954 spdEntry->Add(calibSPD);
956 for(UInt_t module=0; module<240; module++){
957 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
958 calibSPD->SetNrBadSingle( GetNrNoisySingle(module) );
959 calibSPD->SetBadList( GetNoisyArray(module) );
961 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
968 //____________________________________________________________________________________________
969 void AliITSOnlineCalibrationSPDhandler::RecursiveInsertDead(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
970 // inserts dead pixels recursively, used when reading from db
971 if (lowInd>highInd) return;
972 Int_t thisInd = lowInd+(highInd-lowInd)/2;
973 SetDeadPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
974 RecursiveInsertDead(calibSPD,module,lowInd,thisInd-1);
975 RecursiveInsertDead(calibSPD,module,thisInd+1,highInd);
977 //____________________________________________________________________________________________
978 void AliITSOnlineCalibrationSPDhandler::RecursiveInsertNoisy(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
979 // inserts noisy pixels recursively, used when reading from db
980 if (lowInd>highInd) return;
981 Int_t thisInd = lowInd+(highInd-lowInd)/2;
982 SetNoisyPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
983 RecursiveInsertNoisy(calibSPD,module,lowInd,thisInd-1);
984 RecursiveInsertNoisy(calibSPD,module,thisInd+1,highInd);
988 //____________________________________________________________________________________________
989 void AliITSOnlineCalibrationSPDhandler::GenerateDCSConfigFile(const Char_t* fileName) {
990 // generates an ascii file in the format as the one produced by online da (but with dummy runNr=0)
992 dcsfile.open(fileName);
993 dcsfile << "[SPD SCAN]\n";
994 dcsfile << "RunNumber=" << "0" << "\n"; // dummy value
995 dcsfile << "Type=" << "4" << "\n";
996 dcsfile << "Router=" << "0" << "\n"; // dummy value
997 dcsfile << "ActualDetConfiguration=" << "0,-1,-1\n"; // dummy values
998 dcsfile << "[NOISY]\n";
999 for (UInt_t module=0; module<240; module++) {
1000 UInt_t headkey=20*10*6;
1001 for (UInt_t ind=0; ind<GetNrNoisy(module); ind++) {
1002 UInt_t newkey = GetNoisyEqIdAt(module,ind)*10*6 +
1003 GetNoisyHSAt(module,ind)*10 +
1004 GetNoisyChipAt(module,ind);
1005 if (newkey!=headkey) { // print eq,hs,chip header
1007 dcsfile << "-" << newkey/(6*10) << "," << (newkey%(6*10))/10 << "," << (newkey%(6*10))%10 << "\n";
1009 dcsfile << GetNoisyColAt(module,ind) << "," << GetNoisyRowAt(module,ind) << "\n";
1014 //____________________________________________________________________________________________
1015 TArrayS AliITSOnlineCalibrationSPDhandler::GetSilentArray(UInt_t module, Bool_t treeSerial) {
1016 // get a TArrayS of the silent=dead+inactive pixels (format for the AliITSCalibrationSPD object)
1017 // NB! with new implementation of AliITSCalibrationSPD this is not needed anymore
1018 TArrayS returnArray;
1020 UInt_t eq = GetEqIdFromOffline(module);
1021 UInt_t hs = GetHSFromOffline(module);
1023 if ( !( IsActiveEq(eq) && IsActiveHS(eq,hs) ) ) {
1027 for (UInt_t ch=0; ch<5; ch++) {
1028 UInt_t chip = GetChipFromOffline(module,ch*32);
1029 if (!(IsActiveChip(eq,hs,chip))) {
1033 UInt_t gloChip = GetGloChip(eq,hs,chip);
1034 size += fNrDead[gloChip];
1038 returnArray.Set(size*2);
1041 if ( !( IsActiveEq(eq) && IsActiveHS(eq,hs) ) ) {
1042 for (UInt_t colM=0; colM<160; colM++) {
1043 for (UInt_t rowM=0; rowM<256; rowM++) {
1044 returnArray.AddAt(colM,gloIndex*2);
1045 returnArray.AddAt(rowM,gloIndex*2+1);
1051 for (UInt_t ch=0; ch<5; ch++) {
1052 UInt_t chip = GetChipFromOffline(module,ch*32);
1053 if (!(IsActiveChip(eq,hs,chip))) {
1054 for (UInt_t colM=ch*32; colM<ch*32+32; colM++) {
1055 for (UInt_t rowM=0; rowM<256; rowM++) {
1056 returnArray.AddAt(colM,gloIndex*2);
1057 returnArray.AddAt(rowM,gloIndex*2+1);
1063 UInt_t gloChip = GetGloChip(eq,hs,chip);
1064 if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1065 else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
1066 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1067 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1068 Int_t colM = GetColMFromKey(key);
1069 Int_t rowM = GetRowMFromKey(key);
1070 returnArray.AddAt(colM,gloIndex*2);
1071 returnArray.AddAt(rowM,gloIndex*2+1);
1079 //____________________________________________________________________________________________
1080 TArrayS AliITSOnlineCalibrationSPDhandler::GetDeadArray(UInt_t module, Bool_t treeSerial) {
1081 // get a TArrayS of the single dead pixels (format for the AliITSCalibrationSPD object)
1082 TArrayS returnArray;
1084 UInt_t eq = GetEqIdFromOffline(module);
1085 UInt_t hs = GetHSFromOffline(module);
1086 UInt_t size=GetNrDeadSingle(module);
1087 returnArray.Set(size*2);
1089 for (UInt_t ch=0; ch<5; ch++) {
1090 UInt_t chip = GetChipFromOffline(module,ch*32);
1091 UInt_t gloChip = GetGloChip(eq,hs,chip);
1092 if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1093 else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
1094 if (!IsSilentChip(eq,hs,chip)) {
1095 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1096 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1097 Int_t colM = GetColMFromKey(key);
1098 Int_t rowM = GetRowMFromKey(key);
1099 returnArray.AddAt(colM,gloIndex*2);
1100 returnArray.AddAt(rowM,gloIndex*2+1);
1107 //____________________________________________________________________________________________
1108 TArrayS AliITSOnlineCalibrationSPDhandler::GetNoisyArray(UInt_t module, Bool_t treeSerial) {
1109 // get a TArrayS of the single noisy pixels (format for the AliITSCalibrationSPD object)
1110 TArrayS returnArray;
1112 UInt_t eq = GetEqIdFromOffline(module);
1113 UInt_t hs = GetHSFromOffline(module);
1114 UInt_t size=GetNrNoisySingle(module);
1115 returnArray.Set(size*2);
1117 for (UInt_t ch=0; ch<5; ch++) {
1118 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
1119 if (treeSerial) fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1120 else fNoisyPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
1121 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
1122 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1123 Int_t colM = GetColMFromKey(key);
1124 Int_t rowM = GetRowMFromKey(key);
1125 returnArray.AddAt(colM,gloIndex*2);
1126 returnArray.AddAt(rowM,gloIndex*2+1);
1132 //____________________________________________________________________________________________
1133 TArrayI AliITSOnlineCalibrationSPDhandler::GetDeadArrayOnline(UInt_t eq) {
1134 // get a TArrayI of the single dead pixels (format for the AliITSOnlineCalibrationSPD object)
1135 TArrayI returnArray;
1136 // fix size of array
1138 for (UInt_t hs=0; hs<6; hs++) {
1139 for (UInt_t chip=0; chip<10; chip++) {
1140 UInt_t gloChip = GetGloChip(eq,hs,chip);
1141 size+=fNrDead[gloChip];
1144 returnArray.Set(size);
1145 // put keys in array
1147 for (UInt_t hs=0; hs<6; hs++) {
1148 for (UInt_t chip=0; chip<10; chip++) {
1149 UInt_t gloChip = GetGloChip(eq,hs,chip);
1150 fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1151 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1152 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1153 returnArray.AddAt(key,gloIndex);
1160 //____________________________________________________________________________________________
1161 TArrayI AliITSOnlineCalibrationSPDhandler::GetNoisyArrayOnline(UInt_t eq) {
1162 // get a TArrayI of the single noisy pixels (format for the AliITSOnlineCalibrationSPD object)
1163 TArrayI returnArray;
1164 // fix size of array
1166 for (UInt_t hs=0; hs<6; hs++) {
1167 for (UInt_t chip=0; chip<10; chip++) {
1168 UInt_t gloChip = GetGloChip(eq,hs,chip);
1169 size+=fNrNoisy[gloChip];
1172 returnArray.Set(size);
1173 // put keys in array
1175 for (UInt_t hs=0; hs<6; hs++) {
1176 for (UInt_t chip=0; chip<10; chip++) {
1177 UInt_t gloChip = GetGloChip(eq,hs,chip);
1178 fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1179 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
1180 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1181 returnArray.AddAt(key,gloIndex);
1188 //____________________________________________________________________________________________
1189 void AliITSOnlineCalibrationSPDhandler::PrintEqSummary() {
1190 // print summary (nr of dead and noisy) for each equipment
1191 printf("-----------\n");
1192 printf("Eq summary:\n");
1193 printf("-----------\n");
1194 for (UInt_t eq=0; eq<20; eq++) {
1195 printf("Eq %*d: %*d silent(dead+inactive) , %*d dead , %*d noisy\n",2,eq,6,GetNrSilentEq(eq),6,GetNrDeadEq(eq),6,GetNrNoisyEq(eq));
1198 //____________________________________________________________________________________________
1199 void AliITSOnlineCalibrationSPDhandler::PrintSilent() const {
1200 // print the inactive and dead pixels to screen
1201 printf("-----------------------------------------------------------\n");
1202 printf("Inactive or dead Equipments: (eq | module1 .. module12)\n");
1203 printf("-----------------------------------------------------------\n");
1204 for (UInt_t eq=0; eq<20; eq++) {
1205 if (IsSilentEq(eq)) {
1206 printf("%*d | ",2,eq);
1207 for (UInt_t hs=0; hs<6; hs++) {
1208 for (UInt_t chip=0; chip<10; chip+=5) {
1209 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1210 if (hs>0 || chip==5) printf(",");
1211 printf("%*d",3,module);
1218 printf("-----------------------------------------------------------\n");
1219 printf("Inactive or dead Half-staves: (eq,hs | module1,module2)\n");
1220 printf("-----------------------------------------------------------\n");
1221 for (UInt_t eq=0; eq<20; eq++) {
1222 if (!IsSilentEq(eq)) {
1223 for (UInt_t hs=0; hs<6; hs++) {
1224 if (IsSilentHS(eq,hs)) {
1225 printf("%*d,%*d | ",2,eq,1,hs);
1226 for (UInt_t chip=0; chip<10; chip+=5) {
1227 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1228 if (chip==5) printf(",");
1229 printf("%*d",3,module);
1237 printf("-----------------------------------------------------------\n");
1238 printf("Inactive or dead Chips: (eq,hs,chip | module,colM1-colM2)\n");
1239 printf("-----------------------------------------------------------\n");
1240 for (UInt_t eq=0; eq<20; eq++) {
1241 if (!IsSilentEq(eq)) {
1242 for (UInt_t hs=0; hs<6; hs++) {
1243 if (!IsSilentHS(eq,hs)) {
1244 for (UInt_t chip=0; chip<10; chip++) {
1245 if (IsSilentChip(eq,hs,chip)) {
1246 printf("%*d,%*d,%*d | ",2,eq,1,hs,1,chip);
1247 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1248 UInt_t colM1 = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,0);
1249 UInt_t colM2 = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,31);
1250 printf("%*d,%*d-%*d\n",3,module,3,colM1,3,colM2);
1261 //____________________________________________________________________________________________
1262 void AliITSOnlineCalibrationSPDhandler::PrintDead() const {
1263 // print the single dead pixels to screen (disregards inactive eq,hs,chip)
1264 printf("------------------------------------------------------\n");
1265 printf("Dead Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
1266 printf("------------------------------------------------------\n");
1267 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1268 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1269 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1270 UInt_t eq = GetEqIdFromKey(key);
1271 UInt_t hs = GetHSFromKey(key);
1272 UInt_t chip = GetChipFromKey(key);
1273 UInt_t col = GetColFromKey(key);
1274 UInt_t row = GetRowFromKey(key);
1276 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1277 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1278 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1280 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);
1284 //____________________________________________________________________________________________
1285 void AliITSOnlineCalibrationSPDhandler::PrintNoisy() const {
1286 // print the dead pixels to screen
1287 printf("-------------------------------------------------------\n");
1288 printf("Noisy Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
1289 printf("-------------------------------------------------------\n");
1290 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1291 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
1292 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1293 UInt_t eq = GetEqIdFromKey(key);
1294 UInt_t hs = GetHSFromKey(key);
1295 UInt_t chip = GetChipFromKey(key);
1296 UInt_t col = GetColFromKey(key);
1297 UInt_t row = GetRowFromKey(key);
1299 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1300 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1301 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1303 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);
1307 //____________________________________________________________________________________________
1308 Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1309 // set a dead pixel, returns false if pixel is already dead
1310 UInt_t gloChip = GetGloChip(eq,hs,chip);
1311 if (gloChip>=1200) {
1312 Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1315 if (col>=32 && row>=256) {
1316 Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
1319 Int_t key = GetKey(eq,hs,chip,col,row);
1320 // if noisy we dont want to add it...
1321 if (fNoisyPixelMap[gloChip]->Find(key) != NULL) return kFALSE;
1322 if (fDeadPixelMap[gloChip]->Insert(key,gloChip)) {
1328 //____________________________________________________________________________________________
1329 Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1330 // set a noisy pixel, returns false if pixel is already noisy
1331 UInt_t gloChip = GetGloChip(eq,hs,chip);
1332 if (gloChip>=1200) {
1333 Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1336 if (col>=32 && row>=256) {
1337 Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
1340 Int_t key = GetKey(eq,hs,chip,col,row);
1341 // if dead before - remove from the dead list
1342 if (fDeadPixelMap[gloChip]->Remove(key)) {
1345 if (fNoisyPixelMap[gloChip]->Insert(key,gloChip)) {
1346 fNrNoisy[gloChip]++;
1351 //____________________________________________________________________________________________
1352 Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1353 // set a dead pixel, returns false if pixel is already dead
1354 UInt_t eq = GetEqIdFromOffline(module);
1355 UInt_t hs = GetHSFromOffline(module);
1356 UInt_t chip = GetChipFromOffline(module,colM);
1357 UInt_t col = GetColFromOffline(module,colM);
1358 UInt_t row = GetRowFromOffline(module,rowM);
1359 return SetDeadPixel(eq,hs,chip,col,row);
1361 //____________________________________________________________________________________________
1362 Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1363 // set a noisy pixel, returns false if pixel is already noisy
1364 UInt_t eq = GetEqIdFromOffline(module);
1365 UInt_t hs = GetHSFromOffline(module);
1366 UInt_t chip = GetChipFromOffline(module,colM);
1367 UInt_t col = GetColFromOffline(module,colM);
1368 UInt_t row = GetRowFromOffline(module,rowM);
1369 return SetNoisyPixel(eq,hs,chip,col,row);
1371 //____________________________________________________________________________________________
1372 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1373 // unset a dead pixel, returns false if pixel is not dead
1374 UInt_t gloChip = GetGloChip(eq,hs,chip);
1375 if (gloChip>=1200) {
1376 Error("AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1379 Int_t key = GetKey(eq,hs,chip,col,row);
1380 if (fDeadPixelMap[gloChip]->Remove(key)) {
1386 //____________________________________________________________________________________________
1387 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1388 // unset a noisy pixel, returns false if pixel is not noisy
1389 UInt_t gloChip = GetGloChip(eq,hs,chip);
1390 if (gloChip>=1200) {
1391 Error("AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1394 Int_t key = GetKey(eq,hs,chip,col,row);
1395 if (fNoisyPixelMap[gloChip]->Remove(key)) {
1396 fNrNoisy[gloChip]--;
1401 //____________________________________________________________________________________________
1402 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1403 // unset a dead pixel, returns false if pixel is not dead
1404 UInt_t eq = GetEqIdFromOffline(module);
1405 UInt_t hs = GetHSFromOffline(module);
1406 UInt_t chip = GetChipFromOffline(module,colM);
1407 UInt_t col = GetColFromOffline(module,colM);
1408 UInt_t row = GetRowFromOffline(module,rowM);
1409 return UnSetDeadPixel(eq,hs,chip,col,row);
1411 //____________________________________________________________________________________________
1412 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1413 // unset a noisy pixel, returns false if pixel is not noisy
1414 UInt_t eq = GetEqIdFromOffline(module);
1415 UInt_t hs = GetHSFromOffline(module);
1416 UInt_t chip = GetChipFromOffline(module,colM);
1417 UInt_t col = GetColFromOffline(module,colM);
1418 UInt_t row = GetRowFromOffline(module,rowM);
1419 return UnSetNoisyPixel(eq,hs,chip,col,row);
1421 //____________________________________________________________________________________________
1422 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBad(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1423 // is the pixel bad (silent or noisy)
1424 return (IsPixelSilent(eq,hs,chip,col,row) || IsPixelNoisy(eq,hs,chip,col,row));
1426 //____________________________________________________________________________________________
1427 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilent(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1428 // is the pixel silent (dead or inactive)?
1429 UInt_t gloChip = GetGloChip(eq,hs,chip);
1430 if (gloChip>=1200 || col>=32 || row>=256) {
1431 Error("AliITSOnlineCalibrationSPDhandler::IsPixelSilent", "eq,hs,chip,col,row nrs (%d,%d,%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
1434 if (IsSilentChip(eq,hs,chip)) return kTRUE;
1435 else return IsPixelDead(eq,hs,chip,col,row);
1437 //____________________________________________________________________________________________
1438 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDead(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1439 // is the pixel dead?
1440 UInt_t gloChip = GetGloChip(eq,hs,chip);
1441 if (gloChip>=1200 || col>=32 || row>=256) {
1442 Error("AliITSOnlineCalibrationSPDhandler::IsPixelDead", "eq,hs,chip,col,row nrs (%d,%d,%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
1445 UInt_t key = GetKey(eq,hs,chip,col,row);
1446 if (IsDeadEq(eq) || IsDeadHS(eq,hs) || IsDeadChip(eq,hs,chip)) return kTRUE;
1448 if ( fDeadPixelMap[gloChip]->Find(key) != NULL ) return kTRUE;
1452 //____________________________________________________________________________________________
1453 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisy(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1454 // is the pixel noisy?
1455 UInt_t gloChip = GetGloChip(eq,hs,chip);
1456 if (gloChip>=1200 || col>=32 || row>=256) {
1457 Error("AliITSOnlineCalibrationSPDhandler::IsPixelNoisy",Form("eq,hs,chip,col,row nrs (%d,%d,%d,%d,%d) out of bounds.",eq,hs,chip,col,row));
1460 UInt_t key = GetKey(eq,hs,chip,col,row);
1461 if ( fNoisyPixelMap[gloChip]->Find(key) != NULL ) return kTRUE;
1464 //____________________________________________________________________________________________
1465 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBadM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1466 // is the pixel bad (silent or noisy)?
1467 return (IsPixelSilentM(module,colM,rowM) || IsPixelNoisyM(module,colM,rowM));
1469 //____________________________________________________________________________________________
1470 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilentM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1471 // is the pixel silent (dead or inactive)?
1472 UInt_t eq = GetEqIdFromOffline(module);
1473 UInt_t hs = GetHSFromOffline(module);
1474 UInt_t chip = GetChipFromOffline(module,colM);
1475 UInt_t col = GetColFromOffline(module,colM);
1476 UInt_t row = GetRowFromOffline(module,rowM);
1477 return IsPixelSilent(eq,hs,chip,col,row);
1479 //____________________________________________________________________________________________
1480 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1481 // is the pixel dead?
1482 UInt_t eq = GetEqIdFromOffline(module);
1483 UInt_t hs = GetHSFromOffline(module);
1484 UInt_t chip = GetChipFromOffline(module,colM);
1485 UInt_t col = GetColFromOffline(module,colM);
1486 UInt_t row = GetRowFromOffline(module,rowM);
1487 return IsPixelDead(eq,hs,chip,col,row);
1489 //____________________________________________________________________________________________
1490 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1491 // is the pixel noisy?
1492 UInt_t eq = GetEqIdFromOffline(module);
1493 UInt_t hs = GetHSFromOffline(module);
1494 UInt_t chip = GetChipFromOffline(module,colM);
1495 UInt_t col = GetColFromOffline(module,colM);
1496 UInt_t row = GetRowFromOffline(module,rowM);
1497 return IsPixelNoisy(eq,hs,chip,col,row);
1499 //____________________________________________________________________________________________
1500 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBadKey(Int_t key) const {
1501 // is this pixel silent (dead or inactive)?
1502 UInt_t eq = GetEqIdFromKey(key);
1503 UInt_t hs = GetHSFromKey(key);
1504 UInt_t chip = GetChipFromKey(key);
1505 UInt_t col = GetColFromKey(key);
1506 UInt_t row = GetRowFromKey(key);
1507 return IsPixelBad(eq,hs,chip,col,row);
1509 //____________________________________________________________________________________________
1510 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilentKey(Int_t key) const {
1511 // is this pixel silent (dead or inactive)?
1512 UInt_t eq = GetEqIdFromKey(key);
1513 UInt_t hs = GetHSFromKey(key);
1514 UInt_t chip = GetChipFromKey(key);
1515 UInt_t col = GetColFromKey(key);
1516 UInt_t row = GetRowFromKey(key);
1517 return IsPixelSilent(eq,hs,chip,col,row);
1519 //____________________________________________________________________________________________
1520 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadKey(Int_t key) const {
1521 // is this pixel dead?
1522 UInt_t eq = GetEqIdFromKey(key);
1523 UInt_t hs = GetHSFromKey(key);
1524 UInt_t chip = GetChipFromKey(key);
1525 UInt_t col = GetColFromKey(key);
1526 UInt_t row = GetRowFromKey(key);
1527 return IsPixelDead(eq,hs,chip,col,row);
1529 //____________________________________________________________________________________________
1530 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyKey(Int_t key) const {
1531 // is this pixel noisy?
1532 UInt_t eq = GetEqIdFromKey(key);
1533 UInt_t hs = GetHSFromKey(key);
1534 UInt_t chip = GetChipFromKey(key);
1535 UInt_t col = GetColFromKey(key);
1536 UInt_t row = GetRowFromKey(key);
1537 return IsPixelNoisy(eq,hs,chip,col,row);
1539 //____________________________________________________________________________________________
1540 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBad() const {
1541 // returns the total nr of bad pixels (silent or noisy)
1543 nrBad+=GetNrSilent();
1544 UInt_t nrNoisy = GetNrNoisy();
1545 for (UInt_t i=0; i<nrNoisy; i++) {
1546 UInt_t eq = GetNoisyEqIdAt(i);
1547 UInt_t hs = GetNoisyHSAt(i);
1548 UInt_t chip = GetNoisyChipAt(i);
1549 UInt_t col = GetNoisyColAt(i);
1550 UInt_t row = GetNoisyRowAt(i);
1551 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1555 //____________________________________________________________________________________________
1556 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilent() const {
1557 // returns the total nr of silent pixels (dead or inactive)
1559 for (UInt_t eq=0; eq<20; eq++) {
1560 if (IsSilentEq(eq)) {
1564 for (UInt_t hs=0; hs<6; hs++) {
1565 if (IsSilentHS(eq,hs)) {
1569 for (UInt_t chip=0; chip<10; chip++) {
1570 if (IsSilentChip(eq,hs,chip)) {
1575 UInt_t gloChip = GetGloChip(eq,hs,chip);
1576 nrDead+=fNrDead[gloChip];
1583 //____________________________________________________________________________________________
1584 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead() const {
1585 // returns the total nr of dead pixels
1587 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1588 nrDead+=fNrDead[gloChip];
1592 //____________________________________________________________________________________________
1593 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy() const {
1594 // returns the total nr of noisy pixels
1596 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1597 nrNoisy+=fNrNoisy[gloChip];
1601 //____________________________________________________________________________________________
1602 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t index) const {
1603 // get eq for the dead pixel at position index in list of dead
1606 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1607 return GetDeadEqIdAtC2(gloChip,chipIndex);
1609 //____________________________________________________________________________________________
1610 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t index) const {
1611 // get eq for the noisy pixel at position index in list of noisy
1614 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1615 return GetNoisyEqIdAtC2(gloChip,chipIndex);
1617 //____________________________________________________________________________________________
1618 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(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 GetDeadHSAtC2(gloChip,chipIndex);
1625 //____________________________________________________________________________________________
1626 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(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 GetNoisyHSAtC2(gloChip,chipIndex);
1633 //____________________________________________________________________________________________
1634 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t index) const {
1635 // get chip for the dead pixel at position index in list of dead
1638 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1639 return GetDeadChipAtC2(gloChip,chipIndex);
1641 //____________________________________________________________________________________________
1642 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t index) const {
1643 // get chip for the noisy pixel at position index in list of noisy
1646 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1647 return GetNoisyChipAtC2(gloChip,chipIndex);
1649 //____________________________________________________________________________________________
1650 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t index) const {
1651 // get hs for the dead pixel at position index in list of dead
1654 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1655 return GetDeadColAtC2(gloChip,chipIndex);
1657 //____________________________________________________________________________________________
1658 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t index) const {
1659 // get hs for the noisy pixel at position index in list of noisy
1662 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1663 return GetNoisyColAtC2(gloChip,chipIndex);
1665 //____________________________________________________________________________________________
1666 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t index) const {
1667 // get hs for the dead pixel at position index in list of dead
1670 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1671 return GetDeadRowAtC2(gloChip,chipIndex);
1673 //____________________________________________________________________________________________
1674 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t index) const {
1675 // get hs for the noisy pixel at position index in list of noisy
1678 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1679 return GetNoisyRowAtC2(gloChip,chipIndex);
1681 //____________________________________________________________________________________________
1682 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBad(UInt_t module) const {
1683 // returns the number of bad pixels for a certain module (silent or noisy)
1685 nrBad+=GetNrSilent(module);
1686 UInt_t nrNoisy = GetNrNoisy(module);
1687 for (UInt_t i=0; i<nrNoisy; i++) {
1688 UInt_t eq = GetNoisyEqIdAt(module,i);
1689 UInt_t hs = GetNoisyHSAt(module,i);
1690 UInt_t chip = GetNoisyChipAt(module,i);
1691 UInt_t col = GetNoisyColAt(module,i);
1692 UInt_t row = GetNoisyRowAt(module,i);
1693 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1697 //____________________________________________________________________________________________
1698 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilent(UInt_t module) const {
1699 // returns the number of silent pixels for a certain module (dead or inactive)
1701 Error("AliITSOnlineCalibrationSPDhandler::GetNrSilent", "module nr (%d) out of bounds.",module);
1704 UInt_t nrSilent = 0;
1705 UInt_t eq = GetEqIdFromOffline(module);
1706 if (IsSilentEq(eq)) return 160*256;
1707 UInt_t hs = GetHSFromOffline(module);
1708 if (IsSilentHS(eq,hs)) return 160*256;
1709 for (UInt_t ch=0; ch<5; ch++) {
1710 UInt_t chip = GetChipFromOffline(module,ch*32);
1711 if (IsSilentChip(eq,hs,chip)) {
1715 UInt_t gloChip = GetGloChip(eq,hs,chip);
1716 nrSilent+=fNrDead[gloChip];
1721 //____________________________________________________________________________________________
1722 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadSingle(UInt_t module) const {
1723 // returns the number of single dead pixels (excluding the ones on silent chips) for a certain module
1725 Error("AliITSOnlineCalibrationSPDhandler::GetNrDeadSingle", "module nr (%d) out of bounds.",module);
1729 UInt_t eq = GetEqIdFromOffline(module);
1730 UInt_t hs = GetHSFromOffline(module);
1731 for (UInt_t ch=0; ch<5; ch++) {
1732 UInt_t chip = GetChipFromOffline(module,ch*32);
1733 if (!IsSilentChip(eq,hs,chip)) {
1734 UInt_t gloChip = GetGloChip(eq,hs,chip);
1735 nrDead+=fNrDead[gloChip];
1740 //____________________________________________________________________________________________
1741 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisySingle(UInt_t module) const {
1742 // returns the number of noisy pixels for a certain module
1743 return GetNrNoisy(module);
1745 //____________________________________________________________________________________________
1746 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead(UInt_t module) const {
1747 // returns the number of dead pixels for a certain module
1749 Error("AliITSOnlineCalibrationSPDhandler::GetNrDead", "module nr (%d) out of bounds.",module);
1753 UInt_t eq = GetEqIdFromOffline(module);
1754 UInt_t hs = GetHSFromOffline(module);
1755 for (UInt_t ch=0; ch<5; ch++) {
1756 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
1757 nrDead+=fNrDead[gloChip];
1761 //____________________________________________________________________________________________
1762 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy(UInt_t module) const {
1763 // returns the number of noisy pixels for a certain module
1765 Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisy", "module nr (%d) out of bounds.",module);
1769 UInt_t eq = GetEqIdFromOffline(module);
1770 UInt_t hs = GetHSFromOffline(module);
1771 for (UInt_t ch=0; ch<5; ch++) {
1772 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
1773 nrNoisy+=fNrNoisy[gloChip];
1777 //____________________________________________________________________________________________
1778 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t module, UInt_t index) const {
1779 // get eq for the dead pixel at position index in list of dead
1782 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1783 return GetDeadEqIdAtC2(gloChip,chipIndex);
1785 //____________________________________________________________________________________________
1786 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t module, UInt_t index) const {
1787 // get eq for the noisy pixel at position index in list of noisy
1790 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1791 return GetNoisyEqIdAtC2(gloChip,chipIndex);
1793 //____________________________________________________________________________________________
1794 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(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 GetDeadHSAtC2(gloChip,chipIndex);
1801 //____________________________________________________________________________________________
1802 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(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 GetNoisyHSAtC2(gloChip,chipIndex);
1809 //____________________________________________________________________________________________
1810 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t module, UInt_t index) const {
1811 // get chip for the dead pixel at position index in list of dead
1814 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1815 return GetDeadChipAtC2(gloChip,chipIndex);
1817 //____________________________________________________________________________________________
1818 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t module, UInt_t index) const {
1819 // get chip for the noisy pixel at position index in list of noisy
1822 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1823 return GetNoisyChipAtC2(gloChip,chipIndex);
1825 //____________________________________________________________________________________________
1826 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t module, UInt_t index) const {
1827 // get hs for the dead pixel at position index in list of dead
1830 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1831 return GetDeadColAtC2(gloChip,chipIndex);
1833 //____________________________________________________________________________________________
1834 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t module, UInt_t index) const {
1835 // get hs for the noisy pixel at position index in list of noisy
1838 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1839 return GetNoisyColAtC2(gloChip,chipIndex);
1841 //____________________________________________________________________________________________
1842 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t module, UInt_t index) const {
1843 // get hs for the dead pixel at position index in list of dead
1846 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1847 return GetDeadRowAtC2(gloChip,chipIndex);
1849 //____________________________________________________________________________________________
1850 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t module, UInt_t index) const {
1851 // get hs for the noisy pixel at position index in list of noisy
1854 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1855 return GetNoisyRowAtC2(gloChip,chipIndex);
1857 //____________________________________________________________________________________________
1858 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBadEq(UInt_t eq) const {
1859 // returns nr of bad for eq (silent or noisy)
1861 nrBad+=GetNrSilentEq(eq);
1862 UInt_t nrNoisy = GetNrNoisy(eq);
1863 for (UInt_t i=0; i<nrNoisy; i++) {
1864 UInt_t hs = GetNoisyHSAtEq(eq,i);
1865 UInt_t chip = GetNoisyChipAtEq(eq,i);
1866 UInt_t col = GetNoisyColAtEq(eq,i);
1867 UInt_t row = GetNoisyRowAtEq(eq,i);
1868 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1872 //____________________________________________________________________________________________
1873 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentEq(UInt_t eq) const {
1874 // returns nr of silent for eq (dead or inactive)
1876 if (IsSilentEq(eq)) return 81920*6;
1877 for (UInt_t hs=0; hs<6; hs++) {
1878 if (IsSilentHS(eq,hs)) {
1882 for (UInt_t chip=0; chip<10; chip++) {
1883 if (IsSilentChip(eq,hs,chip)) {
1888 returnval+=GetNrDeadC(eq,hs,chip);
1894 //____________________________________________________________________________________________
1895 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadEq(UInt_t eq) const {
1896 // returns nr of dead for eq
1898 for (UInt_t hs=0; hs<6; hs++) {
1899 for (UInt_t chip=0; chip<10; chip++) {
1900 returnval+=GetNrDeadC(eq,hs,chip);
1905 //____________________________________________________________________________________________
1906 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyEq(UInt_t eq) const {
1907 // returns nr of noisy for eq
1909 for (UInt_t hs=0; hs<6; hs++) {
1910 for (UInt_t chip=0; chip<10; chip++) {
1911 returnval+=GetNrNoisyC(eq,hs,chip);
1916 //____________________________________________________________________________________________
1917 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtEq(UInt_t eq, UInt_t index) const {
1918 // get eq for the dead pixel at position index in list of dead
1919 if (eq<20 && index<GetNrDeadEq(eq)) {
1926 //____________________________________________________________________________________________
1927 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtEq(UInt_t eq, UInt_t index) const {
1928 // get eq for the noisy pixel at position index in list of noisy
1929 if (eq<20 && index<GetNrNoisyEq(eq)) {
1936 //____________________________________________________________________________________________
1937 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtEq(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 GetDeadHSAtC2(gloChip,chipIndex);
1944 //____________________________________________________________________________________________
1945 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtEq(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 GetNoisyHSAtC2(gloChip,chipIndex);
1952 //____________________________________________________________________________________________
1953 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtEq(UInt_t eq, UInt_t index) const {
1954 // get chip for the dead pixel at position index in list of dead
1957 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1958 return GetDeadChipAtC2(gloChip,chipIndex);
1960 //____________________________________________________________________________________________
1961 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtEq(UInt_t eq, UInt_t index) const {
1962 // get chip for the noisy pixel at position index in list of noisy
1965 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1966 return GetNoisyChipAtC2(gloChip,chipIndex);
1968 //____________________________________________________________________________________________
1969 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtEq(UInt_t eq, UInt_t index) const {
1970 // get hs for the dead pixel at position index in list of dead
1973 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1974 return GetDeadColAtC2(gloChip,chipIndex);
1976 //____________________________________________________________________________________________
1977 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtEq(UInt_t eq, UInt_t index) const {
1978 // get hs for the noisy pixel at position index in list of noisy
1981 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1982 return GetNoisyColAtC2(gloChip,chipIndex);
1984 //____________________________________________________________________________________________
1985 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtEq(UInt_t eq, UInt_t index) const {
1986 // get hs for the dead pixel at position index in list of dead
1989 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1990 return GetDeadRowAtC2(gloChip,chipIndex);
1992 //____________________________________________________________________________________________
1993 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtEq(UInt_t eq, UInt_t index) const {
1994 // get hs for the noisy pixel at position index in list of noisy
1997 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1998 return GetNoisyRowAtC2(gloChip,chipIndex);
2000 //____________________________________________________________________________________________
2001 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
2002 // returns nr of bad for chip (silent or noisy)
2004 nrBad+=GetNrSilentC(eq,hs,chip);
2005 UInt_t nrNoisy = GetNrNoisyC(eq,hs,chip);
2006 for (UInt_t i=0; i<nrNoisy; i++) {
2007 UInt_t col = GetNoisyColAtC(eq,hs,chip,i);
2008 UInt_t row = GetNoisyRowAtC(eq,hs,chip,i);
2009 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
2013 //____________________________________________________________________________________________
2014 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentC(UInt_t eq, UInt_t hs, UInt_t chip) const {
2015 // returns nr of silent for chip (dead or inactive)
2016 if (IsSilentChip(eq,hs,chip)) return 8192;
2017 else return GetNrDeadC(eq,hs,chip);
2019 //____________________________________________________________________________________________
2020 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
2021 // returns nr of dead for chip
2022 UInt_t gloChip = GetGloChip(eq,hs,chip);
2023 return GetNrDeadC2(gloChip);
2025 //____________________________________________________________________________________________
2026 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC(UInt_t eq, UInt_t hs, UInt_t chip) const {
2027 // returns nr of noisy for chip
2028 UInt_t gloChip = GetGloChip(eq,hs,chip);
2029 return GetNrNoisyC2(gloChip);
2031 //____________________________________________________________________________________________
2032 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2033 UInt_t gloChip = GetGloChip(eq,hs,chip);
2034 return GetDeadEqIdAtC2(gloChip,index);
2036 //____________________________________________________________________________________________
2037 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2038 UInt_t gloChip = GetGloChip(eq,hs,chip);
2039 return GetNoisyEqIdAtC2(gloChip,index);
2041 //____________________________________________________________________________________________
2042 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2043 UInt_t gloChip = GetGloChip(eq,hs,chip);
2044 return GetDeadHSAtC2(gloChip,index);
2046 //____________________________________________________________________________________________
2047 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2048 UInt_t gloChip = GetGloChip(eq,hs,chip);
2049 return GetNoisyHSAtC2(gloChip,index);
2051 //____________________________________________________________________________________________
2052 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2053 UInt_t gloChip = GetGloChip(eq,hs,chip);
2054 return GetDeadChipAtC2(gloChip,index);
2056 //____________________________________________________________________________________________
2057 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2058 UInt_t gloChip = GetGloChip(eq,hs,chip);
2059 return GetNoisyChipAtC2(gloChip,index);
2061 //____________________________________________________________________________________________
2062 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2063 UInt_t gloChip = GetGloChip(eq,hs,chip);
2064 return GetDeadColAtC2(gloChip,index);
2066 //____________________________________________________________________________________________
2067 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2068 UInt_t gloChip = GetGloChip(eq,hs,chip);
2069 return GetNoisyColAtC2(gloChip,index);
2071 //____________________________________________________________________________________________
2072 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2073 UInt_t gloChip = GetGloChip(eq,hs,chip);
2074 return GetDeadRowAtC2(gloChip,index);
2076 //____________________________________________________________________________________________
2077 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2078 UInt_t gloChip = GetGloChip(eq,hs,chip);
2079 return GetNoisyRowAtC2(gloChip,index);
2081 //____________________________________________________________________________________________
2082 const Char_t* AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2083 // get a string of dead pixel info
2084 TString returnMess = "";
2085 UInt_t gloChip = GetGloChip(eq,hs,chip);
2086 if (gloChip>=1200) {
2087 Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
2088 return returnMess.Data();
2090 if (index<fNrDead[gloChip]) {
2091 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2092 UInt_t col = GetColFromKey(key);
2093 UInt_t row = GetRowFromKey(key);
2094 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
2095 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
2096 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
2097 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);
2098 return returnMess.Data();
2101 Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "Index %d out of bounds.", index);
2102 return returnMess.Data();
2105 //____________________________________________________________________________________________
2106 const Char_t* AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2107 // get a string of noisy pixel info
2108 TString returnMess = "";
2109 UInt_t gloChip = GetGloChip(eq,hs,chip);
2110 if (gloChip>=1200) {
2111 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
2112 return returnMess.Data();
2114 if (index<fNrNoisy[gloChip]) {
2115 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2116 UInt_t col = GetColFromKey(key);
2117 UInt_t row = GetRowFromKey(key);
2118 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
2119 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
2120 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
2121 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);
2122 return returnMess.Data();
2125 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "Index %d out of bounds.", index);
2126 return returnMess.Data();
2129 //____________________________________________________________________________________________
2130 UInt_t AliITSOnlineCalibrationSPDhandler::AddSilentFrom(AliITSOnlineCalibrationSPDhandler* other) {
2131 // returns number of new silent pixels in this' list (dead or inactive)
2132 UInt_t tmpdead = GetNrSilent();
2134 for (UInt_t eq=0; eq<20; eq++) {
2135 if (!(other->IsActiveEq(eq))) ActivateEq(eq,kFALSE);
2136 if (other->IsDeadEq(eq)) SetDeadEq(eq,kTRUE);
2137 for (UInt_t hs=0; hs<6; hs++) {
2138 if (!(other->IsActiveHS(eq,hs))) ActivateHS(eq,hs,kFALSE);
2139 if (other->IsDeadHS(eq,hs)) SetDeadHS(eq,hs,kTRUE);
2140 for (UInt_t chip=0; chip<10; chip++) {
2141 if (!(other->IsActiveChip(eq,hs,chip))) ActivateChip(eq,hs,chip,kFALSE);
2142 if (other->IsDeadChip(eq,hs,chip)) SetDeadChip(eq,hs,chip,kTRUE);
2149 return GetNrSilent() - tmpdead;
2151 //____________________________________________________________________________________________
2152 UInt_t AliITSOnlineCalibrationSPDhandler::AddDeadFrom(AliITSOnlineCalibrationSPDhandler* other) {
2153 // returns number of new dead pixels in this' list
2155 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2156 for (UInt_t ind1=0; ind1<other->fNrDead[gloChip]; ind1++) {
2157 UInt_t eq = other->GetDeadEqIdAtC2(gloChip,ind1);
2158 UInt_t hs = other->GetDeadHSAtC2(gloChip,ind1);
2159 UInt_t chip = other->GetDeadChipAtC2(gloChip,ind1);
2160 UInt_t col = other->GetDeadColAtC2(gloChip,ind1);
2161 UInt_t row = other->GetDeadRowAtC2(gloChip,ind1);
2162 if (SetDeadPixel(eq,hs,chip,col,row)) {
2169 //____________________________________________________________________________________________
2170 UInt_t AliITSOnlineCalibrationSPDhandler::AddNoisyFrom(AliITSOnlineCalibrationSPDhandler* other) {
2171 // returns number of new noisy pixels in this' list
2173 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2174 for (UInt_t ind1=0; ind1<other->fNrNoisy[gloChip]; ind1++) {
2175 UInt_t eq = other->GetNoisyEqIdAtC2(gloChip,ind1);
2176 UInt_t hs = other->GetNoisyHSAtC2(gloChip,ind1);
2177 UInt_t chip = other->GetNoisyChipAtC2(gloChip,ind1);
2178 UInt_t col = other->GetNoisyColAtC2(gloChip,ind1);
2179 UInt_t row = other->GetNoisyRowAtC2(gloChip,ind1);
2180 if (SetNoisyPixel(eq,hs,chip,col,row)) {
2187 //____________________________________________________________________________________________
2188 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2189 // returns nr of dead/noisy in this' lists and not in other's lists (including inactive)
2190 return GetNrSilentDiff(other) + GetNrNoisyDiff(other);
2192 //____________________________________________________________________________________________
2193 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2194 // returns nr of single silent pixels in this' lists and not in other's lists (dead or inactive)
2196 for (UInt_t eq=0; eq<20; eq++) {
2197 for (UInt_t hs=0; hs<6; hs++) {
2198 for (UInt_t chip=0; chip<10; chip++) {
2199 if (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs) || !IsActiveChip(eq,hs,chip) || IsDeadChip(eq,hs,chip)) {
2200 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)) {
2201 // if this is inactive and the other is active...
2202 returnval+= 8192 - other->GetNrDeadC(eq,hs,chip);
2206 UInt_t gloChip = GetGloChip(eq,hs,chip);
2207 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2208 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2209 UInt_t col = GetColFromKey(key);
2210 UInt_t row = GetRowFromKey(key);
2211 if (!(other->IsPixelSilent(eq,hs,chip,col,row))) {
2221 //____________________________________________________________________________________________
2222 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2223 // returns nr of dead in this' lists and not in other's lists
2225 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2226 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2227 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2228 UInt_t eq = GetEqIdFromKey(key);
2229 UInt_t hs = GetHSFromKey(key);
2230 UInt_t chip = GetChipFromKey(key);
2231 UInt_t col = GetColFromKey(key);
2232 UInt_t row = GetRowFromKey(key);
2233 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2240 //____________________________________________________________________________________________
2241 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2242 // returns nr of noisy in this' lists and not in other's lists
2244 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2245 for (UInt_t ind1=0; ind1<fNrNoisy[gloChip]; ind1++) {
2246 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind1);
2247 UInt_t eq = GetEqIdFromKey(key);
2248 UInt_t hs = GetHSFromKey(key);
2249 UInt_t chip = GetChipFromKey(key);
2250 UInt_t col = GetColFromKey(key);
2251 UInt_t row = GetRowFromKey(key);
2252 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2259 //____________________________________________________________________________________________
2260 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2261 // returns handler with active/dead/noisy in this' lists, removing those that are in other's lists
2262 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2264 for (UInt_t eq=0; eq<20; eq++) {
2265 if (!(IsActiveEq(eq))) {
2266 newHandler->ActivateEq(eq,kFALSE);
2267 if (!other->IsActiveEq(eq)) newHandler->ActivateEq(eq);
2270 newHandler->SetDeadEq(eq);
2271 if (other->IsDeadEq(eq)) newHandler->SetDeadEq(eq,kFALSE);
2273 for (UInt_t hs=0; hs<6; hs++) {
2274 if (!(IsActiveHS(eq,hs))) {
2275 newHandler->ActivateHS(eq,hs,kFALSE);
2276 if (!other->IsActiveHS(eq,hs)) newHandler->ActivateHS(eq,hs);
2278 if (IsDeadHS(eq,hs)) {
2279 newHandler->SetDeadHS(eq,hs);
2280 if (other->IsDeadHS(eq,hs)) newHandler->SetDeadHS(eq,hs,kFALSE);
2282 for (UInt_t chip=0; chip<10; chip++) {
2283 if (!(IsActiveChip(eq,hs,chip))) {
2284 newHandler->ActivateChip(eq,hs,chip,kFALSE);
2285 if (!other->IsActiveChip(eq,hs,chip)) newHandler->ActivateHS(eq,hs,chip);
2287 if (IsDeadChip(eq,hs,chip)) {
2288 newHandler->SetDeadChip(eq,hs,chip);
2289 if (other->IsDeadChip(eq,hs,chip)) newHandler->SetDeadChip(eq,hs,chip,kFALSE);
2295 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2296 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2297 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2298 UInt_t eq = GetEqIdFromKey(key);
2299 UInt_t hs = GetHSFromKey(key);
2300 UInt_t chip = GetChipFromKey(key);
2301 UInt_t col = GetColFromKey(key);
2302 UInt_t row = GetRowFromKey(key);
2303 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2304 newHandler->SetDeadPixel(eq,hs,chip,col,row);
2309 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2310 for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
2311 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
2312 UInt_t eq = GetEqIdFromKey(key);
2313 UInt_t hs = GetHSFromKey(key);
2314 UInt_t chip = GetChipFromKey(key);
2315 UInt_t col = GetColFromKey(key);
2316 UInt_t row = GetRowFromKey(key);
2317 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2318 newHandler->SetNoisyPixel(eq,hs,chip,col,row);
2325 //____________________________________________________________________________________________
2326 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetSilentDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2327 // returns handler with active/dead in this' lists, removing those that are in other's lists
2328 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2330 for (UInt_t eq=0; eq<20; eq++) {
2331 if (!(IsActiveEq(eq))) {
2332 newHandler->ActivateEq(eq,kFALSE);
2333 if (!other->IsActiveEq(eq)) newHandler->ActivateEq(eq);
2336 newHandler->SetDeadEq(eq);
2337 if (other->IsDeadEq(eq)) newHandler->SetDeadEq(eq,kFALSE);
2339 for (UInt_t hs=0; hs<6; hs++) {
2340 if (!(IsActiveHS(eq,hs))) {
2341 newHandler->ActivateHS(eq,hs,kFALSE);
2342 if (!other->IsActiveHS(eq,hs)) newHandler->ActivateHS(eq,hs);
2344 if (IsDeadHS(eq,hs)) {
2345 newHandler->SetDeadHS(eq,hs);
2346 if (other->IsDeadHS(eq,hs)) newHandler->SetDeadHS(eq,hs,kFALSE);
2348 for (UInt_t chip=0; chip<10; chip++) {
2349 if (!(IsActiveChip(eq,hs,chip))) {
2350 newHandler->ActivateChip(eq,hs,chip,kFALSE);
2351 if (!other->IsActiveChip(eq,hs,chip)) newHandler->ActivateHS(eq,hs,chip);
2353 if (IsDeadChip(eq,hs,chip)) {
2354 newHandler->SetDeadChip(eq,hs,chip);
2355 if (other->IsDeadChip(eq,hs,chip)) newHandler->SetDeadChip(eq,hs,chip,kFALSE);
2361 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2362 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2363 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2364 UInt_t eq = GetEqIdFromKey(key);
2365 UInt_t hs = GetHSFromKey(key);
2366 UInt_t chip = GetChipFromKey(key);
2367 UInt_t col = GetColFromKey(key);
2368 UInt_t row = GetRowFromKey(key);
2369 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2370 newHandler->SetDeadPixel(eq,hs,chip,col,row);
2377 //____________________________________________________________________________________________
2378 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2379 // returns handler with dead in this' lists, except for those in other's lists
2380 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2381 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2382 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2383 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2384 UInt_t eq = GetEqIdFromKey(key);
2385 UInt_t hs = GetHSFromKey(key);
2386 UInt_t chip = GetChipFromKey(key);
2387 UInt_t col = GetColFromKey(key);
2388 UInt_t row = GetRowFromKey(key);
2389 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2390 newHandler->SetDeadPixel(eq,hs,chip,col,row);
2396 //____________________________________________________________________________________________
2397 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2398 // returns handler with noisy in this' lists, except for those in other's lists
2399 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2400 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2401 for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
2402 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
2403 UInt_t eq = GetEqIdFromKey(key);
2404 UInt_t hs = GetHSFromKey(key);
2405 UInt_t chip = GetChipFromKey(key);
2406 UInt_t col = GetColFromKey(key);
2407 UInt_t row = GetRowFromKey(key);
2408 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2409 newHandler->SetNoisyPixel(eq,hs,chip,col,row);
2415 //____________________________________________________________________________________________
2416 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2417 // find gloChip and chipIndex from module and index
2418 if (index<GetNrDead(module)) {
2419 UInt_t eq = GetEqIdFromOffline(module);
2420 UInt_t hs = GetHSFromOffline(module);
2423 for (UInt_t ch=0; ch<5; ch++) {
2424 gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
2425 if (glVal+fNrDead[gloChip]>index) {
2426 chipIndex = index-glVal;
2430 glVal+=fNrDead[gloChip];
2436 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead", "Index %d out of bounds.", index);
2439 //____________________________________________________________________________________________
2440 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2441 // find gloChip and chipIndex from module and index
2442 if (index<GetNrNoisy(module)) {
2443 UInt_t eq = GetEqIdFromOffline(module);
2444 UInt_t hs = GetHSFromOffline(module);
2447 for (UInt_t ch=0; ch<5; ch++) {
2448 gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
2449 if (glVal+fNrNoisy[gloChip]>index) {
2450 chipIndex = index-glVal;
2454 glVal+=fNrNoisy[gloChip];
2460 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy", "Index %d out of bounds.", index);
2463 //____________________________________________________________________________________________
2464 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2465 // find gloChip and chipIndex from module and index
2466 if (index<GetNrDeadEq(eq)) {
2469 for (UInt_t hs=0; hs<6; hs++) {
2470 for (UInt_t chip=0; chip<10; chip++) {
2471 gloChip = GetGloChip(eq,hs,chip);
2472 if (glVal+fNrDead[gloChip]>index) {
2473 chipIndex = index-glVal;
2477 glVal+=fNrDead[gloChip];
2484 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead", "Index %d out of bounds.", index);
2487 //____________________________________________________________________________________________
2488 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2489 // find gloChip and chipIndex from module and index
2490 if (index<GetNrNoisyEq(eq)) {
2493 for (UInt_t hs=0; hs<6; hs++) {
2494 for (UInt_t chip=0; chip<10; chip++) {
2495 gloChip = GetGloChip(eq,hs,chip);
2496 if (glVal+fNrNoisy[gloChip]>index) {
2497 chipIndex = index-glVal;
2501 glVal+=fNrNoisy[gloChip];
2508 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy", "Index %d out of bounds.", index);
2511 //____________________________________________________________________________________________
2512 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2513 // find gloChip and chipIndex from global index
2514 if (index<GetNrDead()) {
2517 for (gloChip=0; gloChip<1200; gloChip++) {
2518 if (glVal+fNrDead[gloChip]>index) {
2519 chipIndex = index-glVal;
2523 glVal+=fNrDead[gloChip];
2529 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead", "Index %d out of bounds.", index);
2532 //____________________________________________________________________________________________
2533 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2534 // find gloChip and chipIndex from global index
2535 if (index<GetNrNoisy()) {
2538 for (gloChip=0; gloChip<1200; gloChip++) {
2539 if (glVal+fNrNoisy[gloChip]>index) {
2540 chipIndex = index-glVal;
2544 glVal+=fNrNoisy[gloChip];
2550 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy", "Index %d out of bounds.", index);
2553 //____________________________________________________________________________________________
2554 UInt_t AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline(UInt_t module) const {
2555 // module to eq mapping
2557 Error("AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline", "module nr (%d) out of bounds.",module);
2560 return AliITSRawStreamSPD::GetOnlineEqIdFromOffline(module);
2562 //____________________________________________________________________________________________
2563 UInt_t AliITSOnlineCalibrationSPDhandler::GetHSFromOffline(UInt_t module) const {
2564 // module to hs mapping
2566 Error("AliITSOnlineCalibrationSPDhandler::GetHSFromOffline", "module nr (%d) out of bounds.",module);
2569 return AliITSRawStreamSPD::GetOnlineHSFromOffline(module);
2571 //____________________________________________________________________________________________
2572 UInt_t AliITSOnlineCalibrationSPDhandler::GetChipFromOffline(UInt_t module, UInt_t colM) const {
2573 // module,colM to chip mapping
2574 if (module>=240 || colM>=160) {
2575 Error("AliITSOnlineCalibrationSPDhandler::GetChipFromOffline", "module,colM nrs (%d,%d) out of bounds.",module,colM);
2578 return AliITSRawStreamSPD::GetOnlineChipFromOffline(module,colM);
2580 //____________________________________________________________________________________________
2581 UInt_t AliITSOnlineCalibrationSPDhandler::GetColFromOffline(UInt_t module, UInt_t colM) const {
2582 // colM to col mapping
2584 Error("AliITSOnlineCalibrationSPDhandler::GetColFromOffline", "colM nr (%d) out of bounds.",colM);
2587 return AliITSRawStreamSPD::GetOnlineColFromOffline(module,colM);
2589 //____________________________________________________________________________________________
2590 UInt_t AliITSOnlineCalibrationSPDhandler::GetRowFromOffline(UInt_t module, UInt_t rowM) const {
2591 // rowM to row mapping
2593 Error("AliITSOnlineCalibrationSPDhandler::GetRowFromOffline", "rowM nr (%d) out of bounds.",rowM);
2596 return AliITSRawStreamSPD::GetOnlineRowFromOffline(module,rowM);
2598 //____________________________________________________________________________________________
2599 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC2(UInt_t gloChip) const {
2600 // returns nr of dead pixels on this chip
2601 if (gloChip>=1200) {
2602 Error("AliITSOnlineCalibrationSPDhandler::GetNrDeadC2", "global chip nr (%d) out of bounds.",gloChip);
2605 return fNrDead[gloChip];
2607 //____________________________________________________________________________________________
2608 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2(UInt_t gloChip) const {
2609 // returns nr of noisy pixels on this chip
2610 if (gloChip>=1200) {
2611 Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2", "global chip nr (%d) out of bounds.",gloChip);
2614 return fNrNoisy[gloChip];
2616 //____________________________________________________________________________________________
2617 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC2(UInt_t gloChip, UInt_t index) const {
2618 // get eq for the dead pixel at position index in list of dead
2619 if (gloChip>=1200) {
2620 Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
2623 if (index<fNrDead[gloChip]) {
2624 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2625 return GetEqIdFromKey(key);
2628 Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "Index %d out of bounds.", index);
2632 //____________________________________________________________________________________________
2633 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC2(UInt_t gloChip, UInt_t index) const {
2634 // get eq for the noisy pixel at position index in list of noisy
2635 if (gloChip>=1200) {
2636 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
2639 if (index<fNrNoisy[gloChip]) {
2640 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2641 return GetEqIdFromKey(key);
2644 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "Index %d out of bounds.", index);
2648 //____________________________________________________________________________________________
2649 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC2(UInt_t gloChip, UInt_t index) const {
2650 // get hs for the dead pixel at position index in list of dead
2651 if (gloChip>=1200) {
2652 Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "global chip nr (%d) out of bounds.",gloChip);
2655 if (index<fNrDead[gloChip]) {
2656 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2657 return GetHSFromKey(key);
2660 Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "Index %d out of bounds.", index);
2664 //____________________________________________________________________________________________
2665 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC2(UInt_t gloChip, UInt_t index) const {
2666 // get hs for the noisy pixel at position index in list of noisy
2667 if (gloChip>=1200) {
2668 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "global chip nr (%d) out of bounds.",gloChip);
2671 if (index<fNrNoisy[gloChip]) {
2672 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2673 return GetHSFromKey(key);
2676 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "Index %d out of bounds.", index);
2680 //____________________________________________________________________________________________
2681 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC2(UInt_t gloChip, UInt_t index) const {
2682 // get chip for the dead pixel at position index in list of dead
2683 if (gloChip>=1200) {
2684 Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "global chip nr (%d) out of bounds.",gloChip);
2687 if (index<fNrDead[gloChip]) {
2688 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2689 return GetChipFromKey(key);
2692 Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "Index %d out of bounds.", index);
2696 //____________________________________________________________________________________________
2697 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC2(UInt_t gloChip, UInt_t index) const {
2698 // get chip for the noisy pixel at position index in list of noisy
2699 if (gloChip>=1200) {
2700 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "global chip nr (%d) out of bounds.",gloChip);
2703 if (index<fNrNoisy[gloChip]) {
2704 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2705 return GetChipFromKey(key);
2708 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "Index %d out of bounds.", index);
2712 //____________________________________________________________________________________________
2713 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2(UInt_t gloChip, UInt_t index) const {
2714 // get col for the dead pixel at position index in list of dead
2715 if (gloChip>=1200) {
2716 Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "global chip nr (%d) out of bounds.",gloChip);
2719 if (index<fNrDead[gloChip]) {
2720 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2721 return GetColFromKey(key);
2724 Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "Index %d out of bounds.", index);
2728 //____________________________________________________________________________________________
2729 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC2(UInt_t gloChip, UInt_t index) const {
2730 // get col for the noisy pixel at position index in list of noisy
2731 if (gloChip>=1200) {
2732 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "global chip nr (%d) out of bounds.",gloChip);
2735 if (index<fNrNoisy[gloChip]) {
2736 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2737 return GetColFromKey(key);
2740 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "Index %d out of bounds.", index);
2744 //____________________________________________________________________________________________
2745 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC2(UInt_t gloChip, UInt_t index) const {
2746 // get row for the dead pixel at position index in list of dead
2747 if (gloChip>=1200) {
2748 Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "global chip nr (%d) out of bounds.",gloChip);
2751 if (index<fNrDead[gloChip]) {
2752 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2753 return GetRowFromKey(key);
2756 Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "Index %d out of bounds.", index);
2760 //____________________________________________________________________________________________
2761 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC2(UInt_t gloChip, UInt_t index) const {
2762 // get row for the noisy pixel at position index in list of noisy
2763 if (gloChip>=1200) {
2764 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "global chip nr (%d) out of bounds.",gloChip);
2767 if (index<fNrNoisy[gloChip]) {
2768 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2769 return GetRowFromKey(key);
2772 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "Index %d out of bounds.", index);
2776 //____________________________________________________________________________________________
2777 void AliITSOnlineCalibrationSPDhandler::ActivateALL() {
2778 // activate all eq,hs,chips
2779 for (UInt_t eq=0; eq<20; eq++) {
2781 for (UInt_t hs=0; hs<6; hs++) {
2783 for (UInt_t chip=0; chip<10; chip++) {
2784 ActivateChip(eq,hs,chip);
2789 //____________________________________________________________________________________________
2790 void AliITSOnlineCalibrationSPDhandler::ActivateEq(UInt_t eq, Bool_t setval) {
2793 Error("AliITSOnlineCalibrationSPDhandler::ActivateEq", "eq (%d) out of bounds.",eq);
2796 fActiveEq[eq] = setval;
2798 //____________________________________________________________________________________________
2799 void AliITSOnlineCalibrationSPDhandler::ActivateHS(UInt_t eq, UInt_t hs, Bool_t setval) {
2801 if (eq>=20 || hs>=6) {
2802 Error("AliITSOnlineCalibrationSPDhandler::ActivateHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2805 fActiveHS[eq][hs] = setval;
2807 //____________________________________________________________________________________________
2808 void AliITSOnlineCalibrationSPDhandler::ActivateChip(UInt_t eq, UInt_t hs, UInt_t chip, Bool_t setval) {
2810 if (eq>=20 || hs>=6 || chip>=10) {
2811 Error("AliITSOnlineCalibrationSPDhandler::ActivateChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2814 fActiveChip[eq][hs][chip] = setval;
2816 //____________________________________________________________________________________________
2817 Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveEq(UInt_t eq) const {
2820 Error("AliITSOnlineCalibrationSPDhandler::IsActiveEq", "eq (%d) out of bounds.",eq);
2823 return fActiveEq[eq];
2825 //____________________________________________________________________________________________
2826 Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveHS(UInt_t eq, UInt_t hs) const {
2828 if (eq>=20 || hs>=6) {
2829 Error("AliITSOnlineCalibrationSPDhandler::IsActiveHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2832 return fActiveHS[eq][hs];
2834 //____________________________________________________________________________________________
2835 Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
2837 if (eq>=20 || hs>=6 || chip>=10) {
2838 Error("AliITSOnlineCalibrationSPDhandler::IsActiveChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2841 return fActiveChip[eq][hs][chip];
2843 //____________________________________________________________________________________________
2844 void AliITSOnlineCalibrationSPDhandler::UnSetDeadALL() {
2845 // Clear all dead eq,hs,chips
2846 for (UInt_t eq=0; eq<20; eq++) {
2847 SetDeadEq(eq,kFALSE);
2848 for (UInt_t hs=0; hs<6; hs++) {
2849 SetDeadHS(eq,hs,kFALSE);
2850 for (UInt_t chip=0; chip<10; chip++) {
2851 SetDeadChip(eq,hs,chip,kFALSE);
2856 //____________________________________________________________________________________________
2857 void AliITSOnlineCalibrationSPDhandler::SetDeadEq(UInt_t eq, Bool_t setval) {
2860 Error("AliITSOnlineCalibrationSPDhandler::SetDeadEq", "eq (%d) out of bounds.",eq);
2863 fDeadEq[eq] = setval;
2865 //____________________________________________________________________________________________
2866 void AliITSOnlineCalibrationSPDhandler::SetDeadHS(UInt_t eq, UInt_t hs, Bool_t setval) {
2868 if (eq>=20 || hs>=6) {
2869 Error("AliITSOnlineCalibrationSPDhandler::SetDeadHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2872 fDeadHS[eq][hs] = setval;
2874 //____________________________________________________________________________________________
2875 void AliITSOnlineCalibrationSPDhandler::SetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip, Bool_t setval) {
2877 if (eq>=20 || hs>=6 || chip>=10) {
2878 Error("AliITSOnlineCalibrationSPDhandler::SetDeadChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2881 fDeadChip[eq][hs][chip] = setval;
2883 //____________________________________________________________________________________________
2884 Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadEq(UInt_t eq) const {
2887 Error("AliITSOnlineCalibrationSPDhandler::IsDeadEq", "eq (%d) out of bounds.",eq);
2892 //____________________________________________________________________________________________
2893 Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadHS(UInt_t eq, UInt_t hs) const {
2895 if (eq>=20 || hs>=6) {
2896 Error("AliITSOnlineCalibrationSPDhandler::IsDeadHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2899 return fDeadHS[eq][hs];
2901 //____________________________________________________________________________________________
2902 Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
2904 if (eq>=20 || hs>=6 || chip>=10) {
2905 Error("AliITSOnlineCalibrationSPDhandler::IsDeadChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2908 return fDeadChip[eq][hs][chip];
2910 //____________________________________________________________________________________________
2911 Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentEq(UInt_t eq) const {
2914 Error("AliITSOnlineCalibrationSPDhandler::IsSilentEq", "eq (%d) out of bounds.",eq);
2917 return (!IsActiveEq(eq) || IsDeadEq(eq));
2919 //____________________________________________________________________________________________
2920 Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentHS(UInt_t eq, UInt_t hs) const {
2922 if (eq>=20 || hs>=6) {
2923 Error("AliITSOnlineCalibrationSPDhandler::IsSilentHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2926 return (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs));
2928 //____________________________________________________________________________________________
2929 Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
2931 if (eq>=20 || hs>=6 || chip>=10) {
2932 Error("AliITSOnlineCalibrationSPDhandler::IsSilentChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2935 return (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs) || !IsActiveChip(eq,hs,chip) || IsDeadChip(eq,hs,chip));
2937 //____________________________________________________________________________________________
2938 Bool_t AliITSOnlineCalibrationSPDhandler::IsNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
2939 // returns true if there is at least a noisy pixel in the chip
2941 if (eq>=20 || hs>=6 || chip>=10) {
2942 Error("AliITSOnlineCalibrationSPDhandler::IsNoisyChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2945 Bool_t isNoisy = kFALSE;
2947 UInt_t nrNoisy = GetNrNoisy();
2948 for (UInt_t i=0; i<nrNoisy; i++) {
2949 if(eq == GetNoisyEqIdAt(i)){
2950 if(hs == GetNoisyHSAt(i)){
2951 if(chip == GetNoisyChipAt(i)) {
2952 UInt_t col = GetNoisyColAt(i);
2953 UInt_t row = GetNoisyRowAt(i);
2954 if (IsPixelNoisy(eq,hs,chip,col,row)) isNoisy = kTRUE;
2961 //____________________________________________________________________________________________
2962 Bool_t AliITSOnlineCalibrationSPDhandler::WritePITConditionsToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
2963 // writes noisy pixels to DB for given runNrs
2964 // overwrites any previous entries
2965 AliCDBManager* man = AliCDBManager::Instance();
2966 TString storageSTR = Form("%s",storage);
2967 if (storageSTR.CompareTo("default")==0) {
2968 if(!man->IsDefaultStorageSet()) {
2969 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
2973 storageSTR = Form("%s",storage);
2974 man->SetDefaultStorage(storageSTR.Data());
2976 AliCDBMetaData* metaData = new AliCDBMetaData();
2977 metaData->SetResponsible("Annalisa Mastroserio");
2978 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
2979 AliCDBId idCalSPD("TRIGGER/SPD/PITConditions",runNrStart,runNrEnd);
2980 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)fTriggerConditions,idCalSPD,metaData);
2987 //____________________________________________________________________________________________
2988 Bool_t AliITSOnlineCalibrationSPDhandler::SetInactiveChipInPITmask(UInt_t eq, UInt_t hs, UInt_t chip){
2990 fTriggerConditions->SetInActiveChip(eq,hs,chip);
2993 //____________________________________________________________________________________________
2994 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetInactiveChipInPITmask(UInt_t eq, UInt_t hs, UInt_t chip){
2996 fTriggerConditions->SetInActiveChip(eq,hs,chip);
2999 //____________________________________________________________________________________________
3000 void AliITSOnlineCalibrationSPDhandler::PrintDiffInDead(AliITSOnlineCalibrationSPDhandler *other) const {
3002 // Printout of the differences between two ocdb files for SPD Dead channel map
3005 UInt_t nrDeadChipOk=0;
3006 UInt_t nrDeadHsOk=0;
3008 UInt_t nrDeadChip=0;
3009 UInt_t nrDeadHsInOther =0;
3010 UInt_t nrDeadChipInOther=0;
3011 UInt_t nrMismatch =0;
3012 UInt_t nrMismatchInOther =0;
3013 printf("\n\n ****** loop over chips ***** \n");
3014 for(Int_t eq=0; eq<20; eq++){
3015 if(TMath::Abs((Int_t)GetNrBadEq(eq) - (Int_t)other->GetNrBadEq(eq)) >0) printf("-----> dead pixels differ in eq %i! %i - %i in the other \n",eq,GetNrBadEq(eq),other->GetNrBadEq(eq));
3016 for(Int_t hs=0; hs<6; hs++){
3018 Short_t nchipsOther =0;
3020 for(Int_t chip=0; chip<10; chip++){
3021 UInt_t chipkey = AliITSRawStreamSPD::GetOfflineChipKeyFromOnline(eq,hs,chip);
3022 // test if everything is coherent
3023 if(IsDeadChip(eq,hs,chip) && other->IsDeadChip(eq,hs,chip)) {
3028 if(!IsDeadChip(eq,hs,chip) && !other->IsDeadChip(eq,hs,chip)) nrChipOk++;
3029 // now testing if mismatches
3030 if(IsDeadChip(eq,hs,chip)) {
3033 if(!other->IsDeadChip(eq,hs,chip)) {
3035 printf(" mismatch -> eq %i hs %i chip %i is DEAD - ALIVE in the other (chipkey %i)\n",eq,hs,chip,chipkey);
3038 if(other->IsDeadChip(eq,hs,chip)){
3039 nrDeadChipInOther++;
3041 if(!IsDeadChip(eq,hs,chip)) {
3042 nrMismatchInOther++;
3043 printf(" mismatch -> eq %i hs %i chip %i is ALIVE - DEAD in the other (chipkey %i)\n",eq,hs,chip,chipkey);
3047 if(nok==10) nrDeadHsOk++;
3048 if(nchips==10) nrDeadHs++;
3049 if(nchipsOther==10) nrDeadHsInOther++;
3053 printf("\n\n\n*************SUMMARY****************\n");
3054 printf(" BOTH have : %i Dead HS and %i Dead chips with %i coherent chips \n",nrDeadHsOk,nrDeadChipOk,nrChipOk);
3055 printf("\n_________MISMATCH RESULTS___________\n");
3056 printf(" THIS : Nr Dead HS %i - Nr Dead Chip %i \n",nrDeadHs,nrDeadChip);
3057 printf(" OTHER : Nr Dead HS %i - Nr Dead Chip %i \n",nrDeadHsInOther,nrDeadChipInOther);
3058 printf(" N Mismatches in Dead chips (=ALIVE in the other) %i \n",nrMismatch);
3059 printf(" N Mismatches in Alive chips (=DEAD in the other) %i \n",nrMismatchInOther);
3061 //____________________________________________________________________________________________
3062 void AliITSOnlineCalibrationSPDhandler::PrintDiffInPITmask(AliITSOnlineCalibrationSPDhandler *other) const {
3064 // Printout of the differences between two ocdb files for SPD Dead channel map
3069 Int_t nMismatchInOther =0;
3071 printf("\n\n ****** loop over chips in PIT mask***** \n");
3072 for(Int_t eq=0; eq<20; eq++){
3073 for(Int_t hs=0; hs<6; hs++){
3074 for(Int_t chip=0; chip<10; chip++){
3076 UInt_t chipkey = AliITSRawStreamSPD::GetOfflineChipKeyFromOnline(eq,hs,chip);
3078 if(fTriggerConditions->IsChipActive(eq,hs,chip) && (other->GetTriggerConditions())->IsChipActive(eq,hs,chip)) nOk++;
3079 if(fTriggerConditions->IsChipActive(eq,hs,chip) && !(other->GetTriggerConditions())->IsChipActive(eq,hs,chip)) {
3081 printf("Mismatch -> eq %i hs %i chip %i is ACTIVE - INACTIVE in the other (chipkey %i) \n",eq,hs,chip,chipkey);
3083 if(!fTriggerConditions->IsChipActive(eq,hs,chip) && (other->GetTriggerConditions())->IsChipActive(eq,hs,chip)) {
3085 printf("Mismatch -> eq %i hs %i chip %i is INACTIVE - ACTIVE in the other (chipkey %i) \n",eq,hs,chip,chipkey);
3087 if(!fTriggerConditions->IsChipActive(eq,hs,chip) && !(other->GetTriggerConditions())->IsChipActive(eq,hs,chip)) nOk++;
3092 printf("n Chips OK %i : ACTIVE mismatch %i - INACTIVE mismatch in %i \n",nOk,nMismatch,nMismatchInOther);