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"
36 //____________________________________________________________________________________________
37 AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler():
42 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
44 fNrSparseDead[gloChip]=0;
46 fDeadPixelMap[gloChip] = new AliITSIntMap();
47 fSparseDeadPixelMap[gloChip] = new AliITSIntMap();
48 fNoisyPixelMap[gloChip] = new AliITSIntMap();
53 //____________________________________________________________________________________________
54 AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler(const AliITSOnlineCalibrationSPDhandler& handle):
56 fTriggerConditions(handle.fTriggerConditions)
59 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
60 fNrDead[gloChip] = handle.fNrDead[gloChip];
61 fNrSparseDead[gloChip] = handle.fNrSparseDead[gloChip];
62 fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
63 fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
64 fSparseDeadPixelMap[gloChip] = handle.fSparseDeadPixelMap[gloChip]->Clone();
65 fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
67 for (UInt_t eq=0; eq<20; eq++) {
68 fActiveEq[eq] = handle.fActiveEq[eq];
69 fDeadEq[eq]=handle.fDeadEq[eq];
70 for (UInt_t hs=0; hs<6; hs++) {
71 fActiveHS[eq][hs] = handle.fActiveHS[eq][hs];
72 for (UInt_t chip=0; chip<10; chip++) {
73 fActiveChip[eq][hs][chip] = handle.fActiveChip[eq][hs][chip];
77 fFileLocation = handle.fFileLocation;
79 //____________________________________________________________________________________________
80 AliITSOnlineCalibrationSPDhandler::~AliITSOnlineCalibrationSPDhandler() {
82 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
83 delete fDeadPixelMap[gloChip];
84 delete fSparseDeadPixelMap[gloChip];
85 delete fNoisyPixelMap[gloChip];
88 //____________________________________________________________________________________________
89 AliITSOnlineCalibrationSPDhandler& AliITSOnlineCalibrationSPDhandler::operator=(const AliITSOnlineCalibrationSPDhandler& handle) {
90 // assignment operator
93 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
94 fNrDead[gloChip] = handle.fNrDead[gloChip];
95 fNrSparseDead[gloChip] = handle.fNrSparseDead[gloChip];
96 fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
97 fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
98 fSparseDeadPixelMap[gloChip] = handle.fSparseDeadPixelMap[gloChip]->Clone();
99 fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
101 for (UInt_t eq=0; eq<20; eq++) {
102 fActiveEq[eq] = handle.fActiveEq[eq];
103 fDeadEq[eq] = handle.fDeadEq[eq];
104 for (UInt_t hs=0; hs<6; hs++) {
105 fActiveHS[eq][hs] = handle.fActiveHS[eq][hs];
106 for (UInt_t chip=0; chip<10; chip++) {
107 fActiveChip[eq][hs][chip] = handle.fActiveChip[eq][hs][chip];
111 fFileLocation = handle.fFileLocation;
115 //____________________________________________________________________________________________
116 void AliITSOnlineCalibrationSPDhandler::ClearMaps() {
117 // clear the lists of dead and noisy
122 //____________________________________________________________________________________________
123 void AliITSOnlineCalibrationSPDhandler::ResetDead() {
124 // reset the dead pixel map and inactive eq,hs,chip
126 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
128 fNrSparseDead[gloChip]=0;
129 fDeadPixelMap[gloChip]->Clear();
130 fSparseDeadPixelMap[gloChip]->Clear();
133 //____________________________________________________________________________________________
134 void AliITSOnlineCalibrationSPDhandler::ResetNoisy() {
135 // clear the list of noisy pixels
136 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
138 fNoisyPixelMap[gloChip]->Clear();
141 //____________________________________________________________________________________________
142 void AliITSOnlineCalibrationSPDhandler::ResetDeadForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
143 // clear the dead pixels for this chip
144 SetDeadChip(eq,hs,chip,kFALSE);
145 UInt_t gloChip = GetGloChip(eq,hs,chip);
146 for (UInt_t col=0; col<32; col++) {
147 for (UInt_t row=0; row<256; row++) {
148 Int_t key = GetKey(eq,hs,chip,col,row);
149 if (fDeadPixelMap[gloChip]->Remove(key)) {
152 if (fSparseDeadPixelMap[gloChip]->Remove(key)) {
153 fNrSparseDead[gloChip]--;
158 //____________________________________________________________________________________________
159 void AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
160 // clear the noisy pixels for this chip
161 UInt_t gloChip = GetGloChip(eq,hs,chip);
163 Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip","global chip nr (%d) out of bounds\n",gloChip);
166 for (UInt_t col=0; col<32; col++) {
167 for (UInt_t row=0; row<256; row++) {
168 Int_t key = GetKey(eq,hs,chip,col,row);
169 if (fNoisyPixelMap[gloChip]->Remove(key)) {
175 //____________________________________________________________________________________________
176 void AliITSOnlineCalibrationSPDhandler::ResetDeadForEq(UInt_t eq) {
177 // clear the dead pixels for this eq
179 Error("AliITSOnlineCalibrationSPDhandler::ResetDeadForEq", "eq (%d) out of bounds.",eq);
182 for (UInt_t hs=0; hs<6; hs++) {
183 for (UInt_t chip=0; chip<10; chip++) {
184 ResetDeadForChip(eq, hs, chip);
188 //____________________________________________________________________________________________
189 void AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq(UInt_t eq) {
190 // clear the noisy pixels for this eq
192 Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq", "eq (%d) out of bounds.",eq);
195 for (UInt_t hs=0; hs<6; hs++) {
196 for (UInt_t chip=0; chip<10; chip++) {
197 ResetNoisyForChip(eq, hs, chip);
203 //____________________________________________________________________________________________
204 Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromFiles() {
205 // read files from file location (active,dead,noisy info). returns true if at least one file found
206 Bool_t b1 = ReadNoisyFromFiles();
207 Bool_t b2 = ReadSilentFromFiles();
210 //____________________________________________________________________________________________
211 Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFiles() {
212 // read dead,active files from file location. returns true if at least one file found
213 Bool_t returnval=kFALSE;
214 for (UInt_t eq=0; eq<20; eq++) {
215 if (ReadSilentFromFile(eq)) {
221 //____________________________________________________________________________________________
222 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFiles() {
223 // read dead,active files from file location. returns true if at least one file found
224 Bool_t returnval=kFALSE;
225 for (UInt_t eq=0; eq<20; eq++) {
226 if (ReadDeadFromFile(eq)) {
232 //____________________________________________________________________________________________
233 Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFile(UInt_t eq) {
234 // read dead file for eq from file location.
235 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
236 return ReadSilentFromFileName(fileName.Data());
238 //____________________________________________________________________________________________
239 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFile(UInt_t eq) {
240 // read dead file for eq from file location.
241 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
242 return ReadDeadFromFileName(fileName.Data());
244 //____________________________________________________________________________________________
245 Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFileName(const char *fileName) {
246 // read dead from file fileName (including inactive)
247 return ReadDeadFromFileName(fileName, kTRUE);
249 //____________________________________________________________________________________________
250 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFileName(const char *fileName, Bool_t inactive) {
251 // read dead from file fileName
252 AliITSOnlineCalibrationSPD* calib;
253 FILE* fp0 = fopen(fileName, "r");
254 if (fp0 == NULL) {return kFALSE;}
257 TFile file(fileName, "READ");
259 file.GetObject("AliITSOnlineCalibrationSPD", calib);
262 UInt_t nrDead=calib->GetNrBad();
263 for (UInt_t index=0; index<nrDead; index++) {
264 UInt_t key = calib->GetKeyAt(index);
265 UInt_t eq = GetEqIdFromKey(key);
266 UInt_t hs = GetHSFromKey(key);
267 UInt_t chip = GetChipFromKey(key);
268 UInt_t col = GetColFromKey(key);
269 UInt_t row = GetRowFromKey(key);
270 SetDeadPixel(eq,hs,chip,col,row);
272 UInt_t eq1 = calib->GetEqNr();
273 if (calib->IsDeadEq()) SetDeadEq(eq1);
274 else SetDeadEq(eq1,kFALSE);
275 for (UInt_t hs=0; hs<6; hs++) {
276 if (calib->IsDeadHS(hs)) SetDeadHS(eq1,hs);
277 else SetDeadHS(eq1,hs,kFALSE);
278 for (UInt_t chip=0; chip<10; chip++) {
279 if (calib->IsDeadChip(hs,chip)) SetDeadChip(eq1,hs,chip);
280 else SetDeadChip(eq1,hs,chip,kFALSE);
284 UInt_t eq = calib->GetEqNr();
285 if (calib->IsActiveEq()) ActivateEq(eq);
286 else ActivateEq(eq,kFALSE);
287 for (UInt_t hs=0; hs<6; hs++) {
288 if (calib->IsActiveHS(hs)) ActivateHS(eq,hs);
289 else ActivateHS(eq,hs,kFALSE);
290 for (UInt_t chip=0; chip<10; chip++) {
291 if (calib->IsActiveChip(hs,chip)) ActivateChip(eq,hs,chip);
292 else ActivateChip(eq,hs,chip,kFALSE);
301 //____________________________________________________________________________________________
302 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFiles() {
303 // read noisy files from file location. returns true if at least one file found
304 Bool_t returnval=kFALSE;
305 for (UInt_t eq=0; eq<20; eq++) {
306 if (ReadNoisyFromFile(eq)) {
312 //____________________________________________________________________________________________
313 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFile(UInt_t eq) {
314 // read noisy file for eq from file location.
315 TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
316 return ReadNoisyFromFileName(fileName.Data());
318 //____________________________________________________________________________________________
319 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFileName(const char *fileName) {
320 // read noisy from file fileName
321 AliITSOnlineCalibrationSPD* calib;
322 FILE* fp0 = fopen(fileName, "r");
323 if (fp0 == NULL) {return kFALSE;}
326 TFile file(fileName, "READ");
328 file.GetObject("AliITSOnlineCalibrationSPD", calib);
331 UInt_t nrNoisy=calib->GetNrBad();
332 for (UInt_t index=0; index<nrNoisy; index++) {
333 UInt_t key = calib->GetKeyAt(index);
334 UInt_t eq = GetEqIdFromKey(key);
335 UInt_t hs = GetHSFromKey(key);
336 UInt_t chip = GetChipFromKey(key);
337 UInt_t col = GetColFromKey(key);
338 UInt_t row = GetRowFromKey(key);
339 SetNoisyPixel(eq,hs,chip,col,row);
346 //____________________________________________________________________________________________
347 UInt_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromText(const char *fileName, UInt_t module) {
348 // read dead from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
349 // insert only those pixels that belong to module (or all if module=240).
352 textFile.open(fileName, ifstream::in);
353 if (textFile.fail()) {
354 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromText","No dead text file (%s) present.",fileName);
358 UInt_t eq,hs,chip,col,row;
359 textFile >> eq; if (textFile.eof()) break;
360 textFile >> hs; if (textFile.eof()) break;
361 textFile >> chip; if (textFile.eof()) break;
362 textFile >> col; if (textFile.eof()) break;
364 if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){
365 if (SetDeadPixel(eq,hs,chip,col,row)) {
369 if (textFile.eof()) break;
375 //____________________________________________________________________________________________
376 UInt_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText(const char *fileName, UInt_t module) {
377 // read noisy from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
378 // insert only those pixels that belong to module (or all if module=240).
381 textFile.open(fileName, ifstream::in);
382 if (textFile.fail()) {
383 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText","No noisy text file (%s) present.",fileName);
387 UInt_t eq,hs,chip,col,row;
388 textFile >> eq; if (textFile.eof()) break;
389 textFile >> hs; if (textFile.eof()) break;
390 textFile >> chip; if (textFile.eof()) break;
391 textFile >> col; if (textFile.eof()) break;
393 if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){
394 if (SetNoisyPixel(eq,hs,chip,col,row)) {
398 if (textFile.eof()) break;
404 //____________________________________________________________________________________________
405 void AliITSOnlineCalibrationSPDhandler::ReadPITConditionsFromText(const char *fileName) {
406 // read PIT conditions file from text as printed out at P2
407 // !!! please note that the chip numbering goes from 9 to 0 in the text. In PVSS panels is the opposite.
408 if(fTriggerConditions) fTriggerConditions->ResetAll();
409 else fTriggerConditions = new AliITSTriggerConditions();
410 fTriggerConditions->ReadFromTextFile(fileName);
412 //____________________________________________________________________________________________
413 Bool_t AliITSOnlineCalibrationSPDhandler::ReadPITConditionsFromDB(Int_t runNr, const Char_t *storage){
414 // read PIT conditions from the OCDB
416 AliCDBManager* man = AliCDBManager::Instance();
417 TString storageSTR = Form("%s",storage);
418 if (storageSTR.CompareTo("default")==0) {
419 if(!man->IsDefaultStorageSet()) {
420 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
424 storageSTR = Form("%s",storage);
425 man->SetDefaultStorage(storageSTR.Data());
427 AliCDBEntry *cdbEntry = man->Get("TRIGGER/SPD/PITConditions", runNr);
429 fTriggerConditions = (AliITSTriggerConditions*)cdbEntry->GetObject();
431 } else return kFALSE;
433 //____________________________________________________________________________________________
434 void AliITSOnlineCalibrationSPDhandler::WriteToFilesAlways() {
435 // write the lists of active,dead,noisy to files
436 for (UInt_t eq=0; eq<20; eq++) {
437 WriteSilentToFile(eq);
438 WriteNoisyToFile(eq);
441 //____________________________________________________________________________________________
442 UInt_t AliITSOnlineCalibrationSPDhandler::WriteToFiles() {
443 // write the lists of dead and noisy to files (only if there are >0 dead or noisy pixels) , returns nr of files produced
444 return (WriteNoisyToFiles() + WriteSilentToFiles());
446 //____________________________________________________________________________________________
447 void AliITSOnlineCalibrationSPDhandler::WriteSilentToFilesAlways() {
448 // write the lists of silent to files
449 for (UInt_t eq=0; eq<20; eq++) {
450 WriteSilentToFile(eq);
453 //____________________________________________________________________________________________
454 void AliITSOnlineCalibrationSPDhandler::WriteDeadToFilesAlways() {
455 // write the lists of dead to files
456 for (UInt_t eq=0; eq<20; eq++) {
460 //____________________________________________________________________________________________
461 void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFilesAlways() {
462 // write the lists of noisy to files
463 for (UInt_t eq=0; eq<20; eq++) {
464 WriteNoisyToFile(eq);
467 //____________________________________________________________________________________________
468 UInt_t AliITSOnlineCalibrationSPDhandler::WriteSilentToFiles() {
469 // write the list of silent to file (only if there are >0 silent pixels) , returns nr of files produced
471 for (UInt_t eq=0; eq<20; eq++) {
472 if (GetNrSilentEq(eq) > 0) {
473 WriteSilentToFile(eq);
479 //____________________________________________________________________________________________
480 UInt_t AliITSOnlineCalibrationSPDhandler::WriteDeadToFiles() {
481 // write the list of dead to file (only if there are >0 dead pixels) , returns nr of files produced
483 for (UInt_t eq=0; eq<20; eq++) {
484 if (GetNrDeadEq(eq) > 0) {
491 //____________________________________________________________________________________________
492 UInt_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToFiles() {
493 // write the list of noisy to file (only if there are >0 noisy pixels) , returns nr of files produced
495 for (UInt_t eq=0; eq<20; eq++) {
496 if (GetNrNoisyEq(eq) > 0) {
497 WriteNoisyToFile(eq);
503 //____________________________________________________________________________________________
504 void AliITSOnlineCalibrationSPDhandler::WriteSilentToFile(UInt_t eq) {
505 WriteDeadToFile(eq,kTRUE);
507 //____________________________________________________________________________________________
508 void AliITSOnlineCalibrationSPDhandler::WriteDeadToFile(UInt_t eq, Bool_t inactive) {
509 // write the lists of dead (and inactive if input boolean is true) for eq to file
510 AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
512 calib->SetBadList(GetDeadArrayOnline(eq));
513 calib->SetNrBad(GetNrDeadEq(eq));
514 if (IsDeadEq(eq)) calib->SetDeadEq();
515 else calib->SetDeadEq(kFALSE);
516 for (UInt_t hs=0; hs<6; hs++) {
517 if (IsDeadHS(eq,hs)) calib->SetDeadHS(hs);
518 else calib->SetDeadHS(hs,kFALSE);
519 for (UInt_t chip=0; chip<10; chip++) {
520 if (IsDeadChip(eq,hs,chip)) calib->SetDeadChip(hs,chip);
521 else calib->SetDeadChip(hs,chip,kFALSE);
525 if (IsActiveEq(eq)) calib->ActivateEq();
526 else calib->ActivateEq(kFALSE);
527 for (UInt_t hs=0; hs<6; hs++) {
528 if (IsActiveHS(eq,hs)) calib->ActivateHS(hs);
529 else calib->ActivateHS(hs,kFALSE);
530 for (UInt_t chip=0; chip<10; chip++) {
531 if (IsActiveChip(eq,hs,chip)) calib->ActivateChip(hs,chip);
532 else calib->ActivateChip(hs,chip,kFALSE);
536 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
537 TFile file(fileName.Data(), "RECREATE");
538 file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
542 //____________________________________________________________________________________________
543 void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFile(UInt_t eq) {
544 // write the lists of noisy for eq to file
545 AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
547 calib->SetBadList(GetNoisyArrayOnline(eq));
548 calib->SetNrBad(GetNrNoisyEq(eq));
549 TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
550 TFile file(fileName.Data(), "RECREATE");
551 file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
555 //____________________________________________________________________________________________
557 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB(UInt_t module, Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
558 // reads dead pixels from DB for given module and runNr
559 AliCDBManager* man = AliCDBManager::Instance();
560 TString storageSTR = Form("%s",storage);
561 if (storageSTR.CompareTo("default")==0) {
562 if(!man->IsDefaultStorageSet()) {
563 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
567 storageSTR = Form("%s",storage);
568 man->SetDefaultStorage(storageSTR.Data());
570 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
573 spdEntry = (TObjArray*)cdbEntry->GetObject();
574 if(!spdEntry) return kFALSE;
577 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB","Calibration for run %d not found in database.",runNr);
580 AliITSCalibrationSPD* calibSPD;
581 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
583 UInt_t nrDead = calibSPD->GetNrBadSingle();
585 if (!treeSerial) RecursiveInsertDead(calibSPD,module,0,nrDead-1);
587 for (UInt_t index=0; index<nrDead; index++) {
588 UInt_t colM = calibSPD->GetBadColAt(index);
589 UInt_t rowM = calibSPD->GetBadRowAt(index);
590 SetDeadPixelM(module,colM,rowM);
594 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
595 UInt_t eq,hs,chip,col,row;
596 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
597 if (calibSPD->IsChipBad(chipIndex)) {
598 SetDeadChip(eq,hs,chip);
601 SetDeadChip(eq,hs,chip,kFALSE);
605 spdEntry->SetOwner(kTRUE);
609 //____________________________________________________________________________________________
610 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB(UInt_t module, Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
611 // reads noisy pixels from DB for given module and runNr
612 AliCDBManager* man = AliCDBManager::Instance();
613 TString storageSTR = Form("%s",storage);
614 if (storageSTR.CompareTo("default")==0) {
615 if(!man->IsDefaultStorageSet()) {
616 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
620 storageSTR = Form("%s",storage);
621 man->SetDefaultStorage(storageSTR.Data());
623 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
626 spdEntry = (TObjArray*)cdbEntry->GetObject();
627 if(!spdEntry) return kFALSE;
630 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB","Calibration for run %d not found in database.",runNr);
633 AliITSCalibrationSPD* calibSPD;
634 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
635 UInt_t nrNoisy = calibSPD->GetNrBadSingle();
637 if (!treeSerial) RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
639 for (UInt_t index=0; index<nrNoisy; index++) {
640 UInt_t colM = calibSPD->GetBadColAt(index);
641 UInt_t rowM = calibSPD->GetBadRowAt(index);
642 SetNoisyPixelM(module,colM,rowM);
646 spdEntry->SetOwner(kTRUE);
650 //____________________________________________________________________________________________
651 Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromDB(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
652 // reads dead and noisy pixels from DB for given runNr
653 // note that you may want to clear the lists (if they are not empty) before reading
654 return (ReadNoisyFromDB(runNr,storage,treeSerial) && ReadDeadFromDB(runNr,storage,treeSerial));
656 //____________________________________________________________________________________________
657 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
658 // reads dead pixels from DB for given runNr
659 // note that you may want to clear the list (if it is not empty) before reading
660 AliCDBManager* man = AliCDBManager::Instance();
661 TString storageSTR = Form("%s",storage);
662 if (storageSTR.CompareTo("default")==0) {
663 if(!man->IsDefaultStorageSet()) {
664 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
668 storageSTR = Form("%s",storage);
669 man->SetDefaultStorage(storageSTR.Data());
671 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
674 spdEntry = (TObjArray*)cdbEntry->GetObject();
675 if(!spdEntry) return kFALSE;
678 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB","Calibration for run %d not found in database.",runNr);
681 AliITSCalibrationSPD* calibSPD;
682 for (UInt_t module=0; module<240; module++) {
683 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
684 UInt_t nrDead = calibSPD->GetNrBadSingle();
687 RecursiveInsertDead(calibSPD,module,0,nrDead-1);
691 for (UInt_t index=0; index<nrDead; index++) {
692 UInt_t colM = calibSPD->GetBadColAt(index);
693 UInt_t rowM = calibSPD->GetBadRowAt(index);
694 SetDeadPixelM(module,colM,rowM);
698 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
699 UInt_t eq,hs,chip,col,row;
700 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
701 if (calibSPD->IsChipBad(chipIndex)) {
702 SetDeadChip(eq,hs,chip);
705 SetDeadChip(eq,hs,chip,kFALSE);
709 spdEntry->SetOwner(kTRUE);
713 //____________________________________________________________________________________________
714 Bool_t AliITSOnlineCalibrationSPDhandler::ReadSparseDeadFromDB(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
715 // reads dead pixels from DB for given runNr
716 // note that you may want to clear the list (if it is not empty) before reading
717 AliCDBManager* man = AliCDBManager::Instance();
718 TString storageSTR = Form("%s",storage);
719 if (storageSTR.CompareTo("default")==0) {
720 if(!man->IsDefaultStorageSet()) {
721 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
725 storageSTR = Form("%s",storage);
726 man->SetDefaultStorage(storageSTR.Data());
728 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDSparseDead", runNr);
731 spdEntry = (TObjArray*)cdbEntry->GetObject();
732 if(!spdEntry) return kFALSE;
735 Warning("AliITSOnlineCalibrationSPDhandler::ReadSparseDeadFromDB","Calibration for run %d not found in database.",runNr);
738 AliITSCalibrationSPD* calibSPD;
739 for (UInt_t module=0; module<240; module++) {
740 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
741 UInt_t nrDead = calibSPD->GetNrBadSingle();
744 RecursiveInsertSparseDead(calibSPD,module,0,nrDead-1);
748 for (UInt_t index=0; index<nrDead; index++) {
749 UInt_t colM = calibSPD->GetBadColAt(index);
750 UInt_t rowM = calibSPD->GetBadRowAt(index);
751 SetSparseDeadPixelM(module,colM,rowM);
755 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
756 UInt_t eq,hs,chip,col,row;
757 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
758 if (calibSPD->IsChipBad(chipIndex)) {
759 SetDeadChip(eq,hs,chip);
762 SetDeadChip(eq,hs,chip,kFALSE);
766 spdEntry->SetOwner(kTRUE);
770 //____________________________________________________________________________________________
771 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
772 // reads noisy pixels from DB for given runNr
773 // note that you may want to clear the list (if it is not empty) before reading
774 AliCDBManager* man = AliCDBManager::Instance();
775 TString storageSTR = Form("%s",storage);
776 if (storageSTR.CompareTo("default")==0) {
777 if(!man->IsDefaultStorageSet()) {
778 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
782 storageSTR = Form("%s",storage);
783 man->SetDefaultStorage(storageSTR.Data());
785 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
788 spdEntry = (TObjArray*)cdbEntry->GetObject();
789 if(!spdEntry) return kFALSE;
792 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB","Calibration for run %d not found in database.",runNr);
795 AliITSCalibrationSPD* calibSPD;
796 for (UInt_t module=0; module<240; module++) {
797 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
798 UInt_t nrNoisy = calibSPD->GetNrBadSingle();
801 RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
804 for (UInt_t index=0; index<nrNoisy; index++) {
805 UInt_t colM = calibSPD->GetBadColAt(index);
806 UInt_t rowM = calibSPD->GetBadRowAt(index);
807 SetNoisyPixelM(module,colM,rowM);
812 spdEntry->SetOwner(kTRUE);
816 //____________________________________________________________________________________________
817 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDBasNoisy(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
818 // reads dead pixels (put as noisy) from DB for given runNr
819 // note that you may want to clear the list (if it is not empty) before reading
820 AliCDBManager* man = AliCDBManager::Instance();
821 TString storageSTR = Form("%s",storage);
822 if (storageSTR.CompareTo("default")==0) {
823 if(!man->IsDefaultStorageSet()) {
824 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
828 storageSTR = Form("%s",storage);
829 man->SetDefaultStorage(storageSTR.Data());
831 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
834 spdEntry = (TObjArray*)cdbEntry->GetObject();
835 if(!spdEntry) return kFALSE;
838 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromDBasNoisy","Calibration for run %d not found in database.",runNr);
841 AliITSCalibrationSPD* calibSPD;
842 for (UInt_t module=0; module<240; module++) {
843 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
844 UInt_t nrDead = calibSPD->GetNrBadSingle();
847 RecursiveInsertDead(calibSPD,module,0,nrDead-1);
851 for (UInt_t index=0; index<nrDead; index++) {
852 UInt_t colM = calibSPD->GetBadColAt(index);
853 UInt_t rowM = calibSPD->GetBadRowAt(index);
854 SetDeadPixelM(module,colM,rowM);
858 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
859 UInt_t eq,hs,chip,col,row;
860 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
861 if (calibSPD->IsChipBad(chipIndex)) {
862 SetDeadChip(eq,hs,chip);
865 SetDeadChip(eq,hs,chip,kFALSE);
869 spdEntry->SetOwner(kTRUE);
873 //____________________________________________________________________________________________
874 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromCalibObj(const TObjArray* calObj) {
875 // reads dead pixels from calib object
876 for (UInt_t module=0; module<240; module++) {
877 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*)calObj->At(module);
878 for (Int_t i=0; i<calibSPD->GetNrBadSingle(); i++) {
879 SetDeadPixelM(module,calibSPD->GetBadColAt(i),calibSPD->GetBadRowAt(i));
881 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
882 UInt_t eq,hs,chip,col,row;
883 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
884 if (calibSPD->IsChipBad(chipIndex)) {
885 SetDeadChip(eq,hs,chip);
888 SetDeadChip(eq,hs,chip,kFALSE);
894 //____________________________________________________________________________________________
895 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromCalibObj(const TObjArray* calObj) {
896 // reads noisy pixels from calib object
897 for (UInt_t module=0; module<240; module++) {
898 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*)calObj->At(module);
899 for (Int_t i=0; i<calibSPD->GetNrBadSingle(); i++) {
900 SetNoisyPixelM(module,calibSPD->GetBadColAt(i),calibSPD->GetBadRowAt(i));
905 //____________________________________________________________________________________________
906 Bool_t AliITSOnlineCalibrationSPDhandler::WriteToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
907 // writes dead and noisy pixels to DB for given runNrs
908 // overwrites any previous entries
909 return (WriteNoisyToDB(runNrStart,runNrEnd,storage) && WriteDeadToDB(runNrStart,runNrEnd,storage));
911 //____________________________________________________________________________________________
912 Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
913 // writes dead pixels to DB for given runNrs
914 // overwrites any previous entries
915 AliCDBManager* man = AliCDBManager::Instance();
916 TString storageSTR = Form("%s",storage);
917 if (storageSTR.CompareTo("default")==0) {
918 if(!man->IsDefaultStorageSet()) {
919 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
923 storageSTR = Form("%s",storage);
924 man->SetDefaultStorage(storageSTR.Data());
926 AliCDBMetaData* metaData = new AliCDBMetaData();
927 metaData->SetResponsible("Henrik Tydesjo");
928 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
929 AliCDBId idCalSPD("ITS/Calib/SPDDead",runNrStart,runNrEnd);
930 TObjArray* spdEntry = new TObjArray(240);
931 spdEntry->SetOwner(kTRUE);
932 for(UInt_t module=0; module<240; module++){
933 AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
934 spdEntry->Add(calibSPD);
936 for(UInt_t module=0; module<240; module++){
937 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
938 calibSPD->SetNrBadSingle( GetNrDeadSingle(module) );
939 calibSPD->SetBadList( GetDeadArray(module) );
940 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
941 UInt_t eq,hs,chip,col,row;
942 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
943 if (IsSilentChip(eq,hs,chip)) {
944 calibSPD->SetChipBad(chipIndex);
947 calibSPD->UnSetChipBad(chipIndex);
951 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
958 //____________________________________________________________________________________________
959 Bool_t AliITSOnlineCalibrationSPDhandler::WriteSparseDeadToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
960 // writes dead pixels to DB for given runNrs
961 // overwrites any previous entries
962 AliCDBManager* man = AliCDBManager::Instance();
963 TString storageSTR = Form("%s",storage);
964 if (storageSTR.CompareTo("default")==0) {
965 if(!man->IsDefaultStorageSet()) {
966 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
970 storageSTR = Form("%s",storage);
971 man->SetDefaultStorage(storageSTR.Data());
973 AliCDBMetaData* metaData = new AliCDBMetaData();
974 metaData->SetResponsible("Annalisa Mastroserio");
975 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
976 AliCDBId idCalSPD("ITS/Calib/SPDSparseDead",runNrStart,runNrEnd);
977 TObjArray* spdEntry = new TObjArray(240);
978 spdEntry->SetOwner(kTRUE);
979 for(UInt_t module=0; module<240; module++){
980 AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
981 spdEntry->Add(calibSPD);
983 for(UInt_t module=0; module<240; module++){
984 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
985 //printf(" AliITSOnlineCalibrationSPDhandler::WriteSparseDeadToDB : nr Sparse dead in module %i - %i \n",module,GetNrSparseDead(module));
986 calibSPD->SetNrBadSingle( GetNrSparseDead(module) );
987 calibSPD->SetBadList( GetSparseDeadArray(module) );
988 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
989 UInt_t eq,hs,chip,col,row;
990 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
991 if (IsSilentChip(eq,hs,chip)) {
992 calibSPD->SetChipBad(chipIndex);
995 calibSPD->UnSetChipBad(chipIndex);
999 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
1006 //____________________________________________________________________________________________
1007 Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDBasNoisy(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
1008 // writes dead pixels to DB for given runNrs
1009 // overwrites any previous entries
1010 AliCDBManager* man = AliCDBManager::Instance();
1011 TString storageSTR = Form("%s",storage);
1012 if (storageSTR.CompareTo("default")==0) {
1013 if(!man->IsDefaultStorageSet()) {
1014 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
1018 storageSTR = Form("%s",storage);
1019 man->SetDefaultStorage(storageSTR.Data());
1021 AliCDBMetaData* metaData = new AliCDBMetaData();
1022 metaData->SetResponsible("Henrik Tydesjo");
1023 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
1024 AliCDBId idCalSPD("ITS/Calib/SPDNoisy",runNrStart,runNrEnd);
1025 TObjArray* spdEntry = new TObjArray(240);
1026 spdEntry->SetOwner(kTRUE);
1027 for(UInt_t module=0; module<240; module++){
1028 AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
1029 spdEntry->Add(calibSPD);
1031 for(UInt_t module=0; module<240; module++){
1032 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
1033 calibSPD->SetNrBadSingle( GetNrDeadSingle(module) );
1034 calibSPD->SetBadList( GetDeadArray(module) );
1035 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
1036 UInt_t eq,hs,chip,col,row;
1037 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
1038 if (IsSilentChip(eq,hs,chip)) {
1039 calibSPD->SetChipBad(chipIndex);
1042 calibSPD->UnSetChipBad(chipIndex);
1046 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
1053 //____________________________________________________________________________________________
1054 Bool_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
1055 // writes noisy pixels to DB for given runNrs
1056 // overwrites any previous entries
1057 AliCDBManager* man = AliCDBManager::Instance();
1058 TString storageSTR = Form("%s",storage);
1059 if (storageSTR.CompareTo("default")==0) {
1060 if(!man->IsDefaultStorageSet()) {
1061 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
1065 storageSTR = Form("%s",storage);
1066 man->SetDefaultStorage(storageSTR.Data());
1068 AliCDBMetaData* metaData = new AliCDBMetaData();
1069 metaData->SetResponsible("Henrik Tydesjo");
1070 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
1071 AliCDBId idCalSPD("ITS/Calib/SPDNoisy",runNrStart,runNrEnd);
1072 TObjArray* spdEntry = new TObjArray(240);
1073 spdEntry->SetOwner(kTRUE);
1074 for(UInt_t module=0; module<240; module++){
1075 AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
1076 spdEntry->Add(calibSPD);
1078 for(UInt_t module=0; module<240; module++){
1079 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
1080 calibSPD->SetNrBadSingle( GetNrNoisySingle(module) );
1081 calibSPD->SetBadList( GetNoisyArray(module) );
1083 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
1090 //____________________________________________________________________________________________
1091 void AliITSOnlineCalibrationSPDhandler::RecursiveInsertDead(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
1092 // inserts dead pixels recursively, used when reading from db
1093 if (lowInd>highInd) return;
1094 Int_t thisInd = lowInd+(highInd-lowInd)/2;
1095 SetDeadPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
1096 RecursiveInsertDead(calibSPD,module,lowInd,thisInd-1);
1097 RecursiveInsertDead(calibSPD,module,thisInd+1,highInd);
1099 //____________________________________________________________________________________________
1100 void AliITSOnlineCalibrationSPDhandler::RecursiveInsertSparseDead(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
1101 // inserts sparse dead pixels recursively, used when reading from db
1102 if (lowInd>highInd) return;
1103 Int_t thisInd = lowInd+(highInd-lowInd)/2;
1104 SetSparseDeadPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
1105 RecursiveInsertSparseDead(calibSPD,module,lowInd,thisInd-1);
1106 RecursiveInsertSparseDead(calibSPD,module,thisInd+1,highInd);
1108 //____________________________________________________________________________________________
1109 void AliITSOnlineCalibrationSPDhandler::RecursiveInsertNoisy(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
1110 // inserts noisy pixels recursively, used when reading from db
1111 if (lowInd>highInd) return;
1112 Int_t thisInd = lowInd+(highInd-lowInd)/2;
1113 SetNoisyPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
1114 RecursiveInsertNoisy(calibSPD,module,lowInd,thisInd-1);
1115 RecursiveInsertNoisy(calibSPD,module,thisInd+1,highInd);
1119 //____________________________________________________________________________________________
1120 void AliITSOnlineCalibrationSPDhandler::GenerateDCSConfigFile(const Char_t* fileName) {
1121 // generates an ascii file in the format as the one produced by online da (but with dummy runNr=0)
1123 dcsfile.open(fileName);
1124 dcsfile << "[SPD SCAN]\n";
1125 dcsfile << "RunNumber=" << "0" << "\n"; // dummy value
1126 dcsfile << "Type=" << "4" << "\n";
1127 dcsfile << "Router=" << "0" << "\n"; // dummy value
1128 dcsfile << "ActualDetConfiguration=" << "0,-1,-1\n"; // dummy values
1129 dcsfile << "[NOISY]\n";
1130 for (UInt_t module=0; module<240; module++) {
1131 UInt_t headkey=20*10*6;
1132 for (UInt_t ind=0; ind<GetNrNoisy(module); ind++) {
1133 UInt_t newkey = GetNoisyEqIdAt(module,ind)*10*6 +
1134 GetNoisyHSAt(module,ind)*10 +
1135 GetNoisyChipAt(module,ind);
1136 if (newkey!=headkey) { // print eq,hs,chip header
1138 dcsfile << "-" << newkey/(6*10) << "," << (newkey%(6*10))/10 << "," << (newkey%(6*10))%10 << "\n";
1140 dcsfile << GetNoisyColAt(module,ind) << "," << GetNoisyRowAt(module,ind) << "\n";
1145 //____________________________________________________________________________________________
1146 TArrayS AliITSOnlineCalibrationSPDhandler::GetSilentArray(UInt_t module, Bool_t treeSerial) {
1147 // get a TArrayS of the silent=dead+inactive pixels (format for the AliITSCalibrationSPD object)
1148 // NB! with new implementation of AliITSCalibrationSPD this is not needed anymore
1149 TArrayS returnArray;
1151 UInt_t eq = GetEqIdFromOffline(module);
1152 UInt_t hs = GetHSFromOffline(module);
1154 if ( !( IsActiveEq(eq) && IsActiveHS(eq,hs) ) ) {
1158 for (UInt_t ch=0; ch<5; ch++) {
1159 UInt_t chip = GetChipFromOffline(module,ch*32);
1160 if (!(IsActiveChip(eq,hs,chip))) {
1164 UInt_t gloChip = GetGloChip(eq,hs,chip);
1165 size += fNrDead[gloChip];
1169 returnArray.Set(size*2);
1172 if ( !( IsActiveEq(eq) && IsActiveHS(eq,hs) ) ) {
1173 for (UInt_t colM=0; colM<160; colM++) {
1174 for (UInt_t rowM=0; rowM<256; rowM++) {
1175 returnArray.AddAt(colM,gloIndex*2);
1176 returnArray.AddAt(rowM,gloIndex*2+1);
1182 for (UInt_t ch=0; ch<5; ch++) {
1183 UInt_t chip = GetChipFromOffline(module,ch*32);
1184 if (!(IsActiveChip(eq,hs,chip))) {
1185 for (UInt_t colM=ch*32; colM<ch*32+32; colM++) {
1186 for (UInt_t rowM=0; rowM<256; rowM++) {
1187 returnArray.AddAt(colM,gloIndex*2);
1188 returnArray.AddAt(rowM,gloIndex*2+1);
1194 UInt_t gloChip = GetGloChip(eq,hs,chip);
1195 if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1196 else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
1197 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1198 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1199 Int_t colM = GetColMFromKey(key);
1200 Int_t rowM = GetRowMFromKey(key);
1201 returnArray.AddAt(colM,gloIndex*2);
1202 returnArray.AddAt(rowM,gloIndex*2+1);
1210 //____________________________________________________________________________________________
1211 TArrayS AliITSOnlineCalibrationSPDhandler::GetDeadArray(UInt_t module, Bool_t treeSerial) {
1212 // get a TArrayS of the single dead pixels (format for the AliITSCalibrationSPD object)
1213 TArrayS returnArray;
1215 UInt_t eq = GetEqIdFromOffline(module);
1216 UInt_t hs = GetHSFromOffline(module);
1217 UInt_t size=GetNrDeadSingle(module);
1218 returnArray.Set(size*2);
1220 for (UInt_t ch=0; ch<5; ch++) {
1221 UInt_t chip = GetChipFromOffline(module,ch*32);
1222 UInt_t gloChip = GetGloChip(eq,hs,chip);
1223 if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1224 else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
1225 if (!IsSilentChip(eq,hs,chip)) {
1226 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1227 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1228 Int_t colM = GetColMFromKey(key);
1229 Int_t rowM = GetRowMFromKey(key);
1230 returnArray.AddAt(colM,gloIndex*2);
1231 returnArray.AddAt(rowM,gloIndex*2+1);
1238 //____________________________________________________________________________________________
1239 TArrayS AliITSOnlineCalibrationSPDhandler::GetSparseDeadArray(UInt_t module, Bool_t treeSerial) {
1240 // get a TArrayS of the single dead pixels (format for the AliITSCalibrationSPD object)
1241 TArrayS returnArray;
1243 UInt_t eq = GetEqIdFromOffline(module);
1244 UInt_t hs = GetHSFromOffline(module);
1245 UInt_t size=GetNrSparseDead(module);
1246 returnArray.Set(size*2);
1248 for (UInt_t ch=0; ch<5; ch++) {
1249 UInt_t chip = GetChipFromOffline(module,ch*32);
1250 UInt_t gloChip = GetGloChip(eq,hs,chip);
1251 if (treeSerial) fSparseDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1252 else fSparseDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
1253 if (!IsSilentChip(eq,hs,chip)) {
1254 for (UInt_t index=0; index<fNrSparseDead[gloChip]; index++) {
1255 Int_t key = fSparseDeadPixelMap[gloChip]->GetKeyIndex(index);
1256 Int_t colM = GetColMFromKey(key);
1257 Int_t rowM = GetRowMFromKey(key);
1258 returnArray.AddAt(colM,gloIndex*2);
1259 returnArray.AddAt(rowM,gloIndex*2+1);
1266 //____________________________________________________________________________________________
1267 TArrayS AliITSOnlineCalibrationSPDhandler::GetNoisyArray(UInt_t module, Bool_t treeSerial) {
1268 // get a TArrayS of the single noisy pixels (format for the AliITSCalibrationSPD object)
1269 TArrayS returnArray;
1271 UInt_t eq = GetEqIdFromOffline(module);
1272 UInt_t hs = GetHSFromOffline(module);
1273 UInt_t size=GetNrNoisySingle(module);
1274 returnArray.Set(size*2);
1276 for (UInt_t ch=0; ch<5; ch++) {
1277 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
1278 if (treeSerial) fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1279 else fNoisyPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
1280 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
1281 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1282 Int_t colM = GetColMFromKey(key);
1283 Int_t rowM = GetRowMFromKey(key);
1284 returnArray.AddAt(colM,gloIndex*2);
1285 returnArray.AddAt(rowM,gloIndex*2+1);
1291 //____________________________________________________________________________________________
1292 TArrayI AliITSOnlineCalibrationSPDhandler::GetDeadArrayOnline(UInt_t eq) {
1293 // get a TArrayI of the single dead pixels (format for the AliITSOnlineCalibrationSPD object)
1294 TArrayI returnArray;
1295 // fix size of array
1297 for (UInt_t hs=0; hs<6; hs++) {
1298 for (UInt_t chip=0; chip<10; chip++) {
1299 UInt_t gloChip = GetGloChip(eq,hs,chip);
1300 size+=fNrDead[gloChip];
1303 returnArray.Set(size);
1304 // put keys in array
1306 for (UInt_t hs=0; hs<6; hs++) {
1307 for (UInt_t chip=0; chip<10; chip++) {
1308 UInt_t gloChip = GetGloChip(eq,hs,chip);
1309 fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1310 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1311 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1312 returnArray.AddAt(key,gloIndex);
1319 //____________________________________________________________________________________________
1320 TArrayI AliITSOnlineCalibrationSPDhandler::GetNoisyArrayOnline(UInt_t eq) {
1321 // get a TArrayI of the single noisy pixels (format for the AliITSOnlineCalibrationSPD object)
1322 TArrayI returnArray;
1323 // fix size of array
1325 for (UInt_t hs=0; hs<6; hs++) {
1326 for (UInt_t chip=0; chip<10; chip++) {
1327 UInt_t gloChip = GetGloChip(eq,hs,chip);
1328 size+=fNrNoisy[gloChip];
1331 returnArray.Set(size);
1332 // put keys in array
1334 for (UInt_t hs=0; hs<6; hs++) {
1335 for (UInt_t chip=0; chip<10; chip++) {
1336 UInt_t gloChip = GetGloChip(eq,hs,chip);
1337 fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1338 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
1339 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1340 returnArray.AddAt(key,gloIndex);
1347 //____________________________________________________________________________________________
1348 void AliITSOnlineCalibrationSPDhandler::PrintEqSummary() {
1349 // print summary (nr of dead and noisy) for each equipment
1350 printf("-----------\n");
1351 printf("Eq summary:\n");
1352 printf("-----------\n");
1353 for (UInt_t eq=0; eq<20; eq++) {
1354 printf("Eq %*d: %*d silent(dead+inactive) , %*d dead , %*d sparse-dead %*d noisy\n",2,eq,6,GetNrSilentEq(eq),6,GetNrDeadEq(eq),6,GetNrSparseDeadEq(eq),6,GetNrNoisyEq(eq));
1357 //____________________________________________________________________________________________
1358 void AliITSOnlineCalibrationSPDhandler::PrintSilent() const {
1359 // print the inactive and dead pixels to screen
1360 printf("-----------------------------------------------------------\n");
1361 printf("Inactive or dead Equipments: (eq | module1 .. module12)\n");
1362 printf("-----------------------------------------------------------\n");
1363 for (UInt_t eq=0; eq<20; eq++) {
1364 if (IsSilentEq(eq)) {
1365 printf("%*d | ",2,eq);
1366 for (UInt_t hs=0; hs<6; hs++) {
1367 for (UInt_t chip=0; chip<10; chip+=5) {
1368 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1369 if (hs>0 || chip==5) printf(",");
1370 printf("%*d",3,module);
1377 printf("-----------------------------------------------------------\n");
1378 printf("Inactive or dead Half-staves: (eq,hs | module1,module2)\n");
1379 printf("-----------------------------------------------------------\n");
1380 for (UInt_t eq=0; eq<20; eq++) {
1381 if (!IsSilentEq(eq)) {
1382 for (UInt_t hs=0; hs<6; hs++) {
1383 if (IsSilentHS(eq,hs)) {
1384 printf("%*d,%*d | ",2,eq,1,hs);
1385 for (UInt_t chip=0; chip<10; chip+=5) {
1386 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1387 if (chip==5) printf(",");
1388 printf("%*d",3,module);
1396 printf("-----------------------------------------------------------\n");
1397 printf("Inactive or dead Chips: (eq,hs,chip | module,colM1-colM2)\n");
1398 printf("-----------------------------------------------------------\n");
1399 for (UInt_t eq=0; eq<20; eq++) {
1400 if (!IsSilentEq(eq)) {
1401 for (UInt_t hs=0; hs<6; hs++) {
1402 if (!IsSilentHS(eq,hs)) {
1403 for (UInt_t chip=0; chip<10; chip++) {
1404 if (IsSilentChip(eq,hs,chip)) {
1405 printf("%*d,%*d,%*d | ",2,eq,1,hs,1,chip);
1406 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1407 UInt_t colM1 = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,0);
1408 UInt_t colM2 = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,31);
1409 printf("%*d,%*d-%*d\n",3,module,3,colM1,3,colM2);
1420 //____________________________________________________________________________________________
1421 void AliITSOnlineCalibrationSPDhandler::PrintDead() const {
1422 // print the single dead pixels to screen (disregards inactive eq,hs,chip)
1423 printf("------------------------------------------------------\n");
1424 printf("Dead Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
1425 printf("------------------------------------------------------\n");
1426 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1427 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1428 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1429 UInt_t eq = GetEqIdFromKey(key);
1430 UInt_t hs = GetHSFromKey(key);
1431 UInt_t chip = GetChipFromKey(key);
1432 UInt_t col = GetColFromKey(key);
1433 UInt_t row = GetRowFromKey(key);
1435 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1436 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1437 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1439 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);
1443 //____________________________________________________________________________________________
1444 void AliITSOnlineCalibrationSPDhandler::PrintSparseDead() const {
1445 // print the single dead pixels to screen (disregards inactive eq,hs,chip)
1446 printf("------------------------------------------------------\n");
1447 printf("Sparse Dead Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
1448 printf("------------------------------------------------------\n");
1449 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1450 for (UInt_t index=0; index<fNrSparseDead[gloChip]; index++) {
1451 Int_t key = fSparseDeadPixelMap[gloChip]->GetKeyIndex(index);
1452 UInt_t eq = GetEqIdFromKey(key);
1453 UInt_t hs = GetHSFromKey(key);
1454 UInt_t chip = GetChipFromKey(key);
1455 UInt_t col = GetColFromKey(key);
1456 UInt_t row = GetRowFromKey(key);
1458 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1459 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1460 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1462 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);
1466 //____________________________________________________________________________________________
1467 void AliITSOnlineCalibrationSPDhandler::PrintNoisy() const {
1468 // print the dead pixels to screen
1469 printf("-------------------------------------------------------\n");
1470 printf("Noisy Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
1471 printf("-------------------------------------------------------\n");
1472 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1473 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
1474 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1475 UInt_t eq = GetEqIdFromKey(key);
1476 UInt_t hs = GetHSFromKey(key);
1477 UInt_t chip = GetChipFromKey(key);
1478 UInt_t col = GetColFromKey(key);
1479 UInt_t row = GetRowFromKey(key);
1481 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1482 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1483 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1485 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);
1489 //____________________________________________________________________________________________
1490 Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1491 // set a dead pixel, returns false if pixel is already dead
1492 UInt_t gloChip = GetGloChip(eq,hs,chip);
1493 if (gloChip>=1200) {
1494 Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1497 if (col>=32 && row>=256) {
1498 Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
1501 Int_t key = GetKey(eq,hs,chip,col,row);
1502 // if noisy we dont want to add it...
1503 if (fNoisyPixelMap[gloChip]->Find(key) != NULL) return kFALSE;
1504 if (fDeadPixelMap[gloChip]->Insert(key,gloChip)) {
1510 //____________________________________________________________________________________________
1511 Bool_t AliITSOnlineCalibrationSPDhandler::SetSparseDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1512 // set a dead pixel, returns false if pixel is already dead
1513 UInt_t gloChip = GetGloChip(eq,hs,chip);
1514 if (gloChip>=1200) {
1515 Error("AliITSOnlineCalibrationSPDhandler::SetSparseDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1518 if (col>=32 && row>=256) {
1519 Error("AliITSOnlineCalibrationSPDhandler::SetSparseDeadPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
1522 Int_t key = GetKey(eq,hs,chip,col,row);
1523 // if noisy we dont want to add it...
1524 if (fSparseDeadPixelMap[gloChip]->Find(key) != NULL) return kFALSE;
1525 if (fSparseDeadPixelMap[gloChip]->Insert(key,gloChip)) {
1526 fNrSparseDead[gloChip]++;
1527 //printf(" AliITSOnlineCalibrationSPDhandler::SetSparseDeadPixel nSparse Dead : %i \n",fNrSparseDead[gloChip]);
1532 //____________________________________________________________________________________________
1533 Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1534 // set a noisy pixel, returns false if pixel is already noisy
1535 UInt_t gloChip = GetGloChip(eq,hs,chip);
1536 if (gloChip>=1200) {
1537 Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1540 if (col>=32 && row>=256) {
1541 Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
1544 Int_t key = GetKey(eq,hs,chip,col,row);
1545 // if dead before - remove from the dead list
1546 if (fDeadPixelMap[gloChip]->Remove(key)) {
1549 if (fNoisyPixelMap[gloChip]->Insert(key,gloChip)) {
1550 fNrNoisy[gloChip]++;
1555 //____________________________________________________________________________________________
1556 Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1557 // set a dead pixel, returns false if pixel is already dead
1558 UInt_t eq = GetEqIdFromOffline(module);
1559 UInt_t hs = GetHSFromOffline(module);
1560 UInt_t chip = GetChipFromOffline(module,colM);
1561 UInt_t col = GetColFromOffline(module,colM);
1562 UInt_t row = GetRowFromOffline(module,rowM);
1563 return SetDeadPixel(eq,hs,chip,col,row);
1565 //____________________________________________________________________________________________
1566 Bool_t AliITSOnlineCalibrationSPDhandler::SetSparseDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1567 // set a dead pixel, returns false if pixel is already dead
1568 UInt_t eq = GetEqIdFromOffline(module);
1569 UInt_t hs = GetHSFromOffline(module);
1570 UInt_t chip = GetChipFromOffline(module,colM);
1571 UInt_t col = GetColFromOffline(module,colM);
1572 UInt_t row = GetRowFromOffline(module,rowM);
1573 return SetSparseDeadPixel(eq,hs,chip,col,row);
1575 //____________________________________________________________________________________________
1576 Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1577 // set a noisy pixel, returns false if pixel is already noisy
1578 UInt_t eq = GetEqIdFromOffline(module);
1579 UInt_t hs = GetHSFromOffline(module);
1580 UInt_t chip = GetChipFromOffline(module,colM);
1581 UInt_t col = GetColFromOffline(module,colM);
1582 UInt_t row = GetRowFromOffline(module,rowM);
1583 return SetNoisyPixel(eq,hs,chip,col,row);
1585 //____________________________________________________________________________________________
1586 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1587 // unset a dead pixel, returns false if pixel is not dead
1588 UInt_t gloChip = GetGloChip(eq,hs,chip);
1589 if (gloChip>=1200) {
1590 Error("AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1593 Int_t key = GetKey(eq,hs,chip,col,row);
1594 if (fDeadPixelMap[gloChip]->Remove(key)) {
1600 //____________________________________________________________________________________________
1601 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetSparseDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1602 // unset a dead pixel, returns false if pixel is not dead
1603 UInt_t gloChip = GetGloChip(eq,hs,chip);
1604 if (gloChip>=1200) {
1605 Error("AliITSOnlineCalibrationSPDhandler::UnSetSparseDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1608 Int_t key = GetKey(eq,hs,chip,col,row);
1609 if (fSparseDeadPixelMap[gloChip]->Remove(key)) {
1610 fNrSparseDead[gloChip]--;
1615 //____________________________________________________________________________________________
1616 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1617 // unset a noisy pixel, returns false if pixel is not noisy
1618 UInt_t gloChip = GetGloChip(eq,hs,chip);
1619 if (gloChip>=1200) {
1620 Error("AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1623 Int_t key = GetKey(eq,hs,chip,col,row);
1624 if (fNoisyPixelMap[gloChip]->Remove(key)) {
1625 fNrNoisy[gloChip]--;
1630 //____________________________________________________________________________________________
1631 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1632 // unset a dead pixel, returns false if pixel is not dead
1633 UInt_t eq = GetEqIdFromOffline(module);
1634 UInt_t hs = GetHSFromOffline(module);
1635 UInt_t chip = GetChipFromOffline(module,colM);
1636 UInt_t col = GetColFromOffline(module,colM);
1637 UInt_t row = GetRowFromOffline(module,rowM);
1638 return UnSetDeadPixel(eq,hs,chip,col,row);
1640 //____________________________________________________________________________________________
1641 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetSparseDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1642 // unset a dead pixel, returns false if pixel is not dead
1643 UInt_t eq = GetEqIdFromOffline(module);
1644 UInt_t hs = GetHSFromOffline(module);
1645 UInt_t chip = GetChipFromOffline(module,colM);
1646 UInt_t col = GetColFromOffline(module,colM);
1647 UInt_t row = GetRowFromOffline(module,rowM);
1648 return UnSetSparseDeadPixel(eq,hs,chip,col,row);
1650 //____________________________________________________________________________________________
1651 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1652 // unset a noisy pixel, returns false if pixel is not noisy
1653 UInt_t eq = GetEqIdFromOffline(module);
1654 UInt_t hs = GetHSFromOffline(module);
1655 UInt_t chip = GetChipFromOffline(module,colM);
1656 UInt_t col = GetColFromOffline(module,colM);
1657 UInt_t row = GetRowFromOffline(module,rowM);
1658 return UnSetNoisyPixel(eq,hs,chip,col,row);
1660 //____________________________________________________________________________________________
1661 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBad(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1662 // is the pixel bad (silent or noisy)
1663 return (IsPixelSilent(eq,hs,chip,col,row) || IsPixelNoisy(eq,hs,chip,col,row));
1665 //____________________________________________________________________________________________
1666 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilent(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1667 // is the pixel silent (dead or inactive)?
1668 UInt_t gloChip = GetGloChip(eq,hs,chip);
1669 if (gloChip>=1200 || col>=32 || row>=256) {
1670 Error("AliITSOnlineCalibrationSPDhandler::IsPixelSilent", "eq,hs,chip,col,row nrs (%d,%d,%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
1673 if (IsSilentChip(eq,hs,chip)) return kTRUE;
1674 else return IsPixelDead(eq,hs,chip,col,row);
1676 //____________________________________________________________________________________________
1677 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDead(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1678 // is the pixel dead?
1679 UInt_t gloChip = GetGloChip(eq,hs,chip);
1680 if (gloChip>=1200 || col>=32 || row>=256) {
1681 Error("AliITSOnlineCalibrationSPDhandler::IsPixelDead", "eq,hs,chip,col,row nrs (%d,%d,%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
1684 UInt_t key = GetKey(eq,hs,chip,col,row);
1685 if (IsDeadEq(eq) || IsDeadHS(eq,hs) || IsDeadChip(eq,hs,chip)) return kTRUE;
1687 if ( fDeadPixelMap[gloChip]->Find(key) != NULL ) return kTRUE;
1691 //____________________________________________________________________________________________
1692 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisy(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1693 // is the pixel noisy?
1694 UInt_t gloChip = GetGloChip(eq,hs,chip);
1695 if (gloChip>=1200 || col>=32 || row>=256) {
1696 Error("AliITSOnlineCalibrationSPDhandler::IsPixelNoisy","eq,hs,chip,col,row nrs ( %d, %d, %d, %d, %d ) out of bounds.",eq,hs,chip,col,row);
1699 UInt_t key = GetKey(eq,hs,chip,col,row);
1700 if ( fNoisyPixelMap[gloChip]->Find(key) != NULL ) return kTRUE;
1703 //____________________________________________________________________________________________
1704 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBadM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1705 // is the pixel bad (silent or noisy)?
1706 return (IsPixelSilentM(module,colM,rowM) || IsPixelNoisyM(module,colM,rowM));
1708 //____________________________________________________________________________________________
1709 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilentM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1710 // is the pixel silent (dead or inactive)?
1711 UInt_t eq = GetEqIdFromOffline(module);
1712 UInt_t hs = GetHSFromOffline(module);
1713 UInt_t chip = GetChipFromOffline(module,colM);
1714 UInt_t col = GetColFromOffline(module,colM);
1715 UInt_t row = GetRowFromOffline(module,rowM);
1716 return IsPixelSilent(eq,hs,chip,col,row);
1718 //____________________________________________________________________________________________
1719 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1720 // is the pixel dead?
1721 UInt_t eq = GetEqIdFromOffline(module);
1722 UInt_t hs = GetHSFromOffline(module);
1723 UInt_t chip = GetChipFromOffline(module,colM);
1724 UInt_t col = GetColFromOffline(module,colM);
1725 UInt_t row = GetRowFromOffline(module,rowM);
1726 return IsPixelDead(eq,hs,chip,col,row);
1728 //____________________________________________________________________________________________
1729 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1730 // is the pixel noisy?
1731 UInt_t eq = GetEqIdFromOffline(module);
1732 UInt_t hs = GetHSFromOffline(module);
1733 UInt_t chip = GetChipFromOffline(module,colM);
1734 UInt_t col = GetColFromOffline(module,colM);
1735 UInt_t row = GetRowFromOffline(module,rowM);
1736 return IsPixelNoisy(eq,hs,chip,col,row);
1738 //____________________________________________________________________________________________
1739 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBadKey(Int_t key) const {
1740 // is this pixel silent (dead or inactive)?
1741 UInt_t eq = GetEqIdFromKey(key);
1742 UInt_t hs = GetHSFromKey(key);
1743 UInt_t chip = GetChipFromKey(key);
1744 UInt_t col = GetColFromKey(key);
1745 UInt_t row = GetRowFromKey(key);
1746 return IsPixelBad(eq,hs,chip,col,row);
1748 //____________________________________________________________________________________________
1749 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilentKey(Int_t key) const {
1750 // is this pixel silent (dead or inactive)?
1751 UInt_t eq = GetEqIdFromKey(key);
1752 UInt_t hs = GetHSFromKey(key);
1753 UInt_t chip = GetChipFromKey(key);
1754 UInt_t col = GetColFromKey(key);
1755 UInt_t row = GetRowFromKey(key);
1756 return IsPixelSilent(eq,hs,chip,col,row);
1758 //____________________________________________________________________________________________
1759 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadKey(Int_t key) const {
1760 // is this pixel dead?
1761 UInt_t eq = GetEqIdFromKey(key);
1762 UInt_t hs = GetHSFromKey(key);
1763 UInt_t chip = GetChipFromKey(key);
1764 UInt_t col = GetColFromKey(key);
1765 UInt_t row = GetRowFromKey(key);
1766 return IsPixelDead(eq,hs,chip,col,row);
1768 //____________________________________________________________________________________________
1769 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyKey(Int_t key) const {
1770 // is this pixel noisy?
1771 UInt_t eq = GetEqIdFromKey(key);
1772 UInt_t hs = GetHSFromKey(key);
1773 UInt_t chip = GetChipFromKey(key);
1774 UInt_t col = GetColFromKey(key);
1775 UInt_t row = GetRowFromKey(key);
1776 return IsPixelNoisy(eq,hs,chip,col,row);
1778 //____________________________________________________________________________________________
1779 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBad() const {
1780 // returns the total nr of bad pixels (silent or noisy)
1782 nrBad+=GetNrSilent();
1783 UInt_t nrNoisy = GetNrNoisy();
1784 for (UInt_t i=0; i<nrNoisy; i++) {
1785 UInt_t eq = GetNoisyEqIdAt(i);
1786 UInt_t hs = GetNoisyHSAt(i);
1787 UInt_t chip = GetNoisyChipAt(i);
1788 UInt_t col = GetNoisyColAt(i);
1789 UInt_t row = GetNoisyRowAt(i);
1790 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1794 //____________________________________________________________________________________________
1795 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilent() const {
1796 // returns the total nr of silent pixels (dead or inactive)
1798 for (UInt_t eq=0; eq<20; eq++) {
1799 if (IsSilentEq(eq)) {
1803 for (UInt_t hs=0; hs<6; hs++) {
1804 if (IsSilentHS(eq,hs)) {
1808 for (UInt_t chip=0; chip<10; chip++) {
1809 if (IsSilentChip(eq,hs,chip)) {
1814 UInt_t gloChip = GetGloChip(eq,hs,chip);
1815 nrDead+=fNrDead[gloChip];
1822 //____________________________________________________________________________________________
1823 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead() const {
1824 // returns the total nr of dead pixels
1826 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1827 nrDead+=fNrDead[gloChip];
1831 //____________________________________________________________________________________________
1832 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSparseDead() const {
1833 // returns the total nr of dead pixels
1834 UInt_t nrSparseDead = 0;
1835 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1836 nrSparseDead+=fNrSparseDead[gloChip];
1838 return nrSparseDead;
1840 //____________________________________________________________________________________________
1841 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy() const {
1842 // returns the total nr of noisy pixels
1844 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1845 nrNoisy+=fNrNoisy[gloChip];
1849 //____________________________________________________________________________________________
1850 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t index) const {
1851 // get eq for the dead pixel at position index in list of dead
1854 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1855 return GetDeadEqIdAtC2(gloChip,chipIndex);
1857 //____________________________________________________________________________________________
1858 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t index) const {
1859 // get eq for the noisy pixel at position index in list of noisy
1862 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1863 return GetNoisyEqIdAtC2(gloChip,chipIndex);
1865 //____________________________________________________________________________________________
1866 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t index) const {
1867 // get hs for the dead pixel at position index in list of dead
1870 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1871 return GetDeadHSAtC2(gloChip,chipIndex);
1873 //____________________________________________________________________________________________
1874 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t index) const {
1875 // get hs for the noisy pixel at position index in list of noisy
1878 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1879 return GetNoisyHSAtC2(gloChip,chipIndex);
1881 //____________________________________________________________________________________________
1882 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t index) const {
1883 // get chip for the dead pixel at position index in list of dead
1886 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1887 return GetDeadChipAtC2(gloChip,chipIndex);
1889 //____________________________________________________________________________________________
1890 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t index) const {
1891 // get chip for the noisy pixel at position index in list of noisy
1894 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1895 return GetNoisyChipAtC2(gloChip,chipIndex);
1897 //____________________________________________________________________________________________
1898 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t index) const {
1899 // get hs for the dead pixel at position index in list of dead
1902 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1903 return GetDeadColAtC2(gloChip,chipIndex);
1905 //____________________________________________________________________________________________
1906 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t index) const {
1907 // get hs for the noisy pixel at position index in list of noisy
1910 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1911 return GetNoisyColAtC2(gloChip,chipIndex);
1913 //____________________________________________________________________________________________
1914 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t index) const {
1915 // get hs for the dead pixel at position index in list of dead
1918 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1919 return GetDeadRowAtC2(gloChip,chipIndex);
1921 //____________________________________________________________________________________________
1922 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t index) const {
1923 // get hs for the noisy pixel at position index in list of noisy
1926 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1927 return GetNoisyRowAtC2(gloChip,chipIndex);
1929 //____________________________________________________________________________________________
1930 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBad(UInt_t module) const {
1931 // returns the number of bad pixels for a certain module (silent or noisy)
1933 nrBad+=GetNrSilent(module);
1934 UInt_t nrNoisy = GetNrNoisy(module);
1935 for (UInt_t i=0; i<nrNoisy; i++) {
1936 UInt_t eq = GetNoisyEqIdAt(module,i);
1937 UInt_t hs = GetNoisyHSAt(module,i);
1938 UInt_t chip = GetNoisyChipAt(module,i);
1939 UInt_t col = GetNoisyColAt(module,i);
1940 UInt_t row = GetNoisyRowAt(module,i);
1941 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1945 //____________________________________________________________________________________________
1946 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilent(UInt_t module) const {
1947 // returns the number of silent pixels for a certain module (dead or inactive)
1949 Error("AliITSOnlineCalibrationSPDhandler::GetNrSilent", "module nr (%d) out of bounds.",module);
1952 UInt_t nrSilent = 0;
1953 UInt_t eq = GetEqIdFromOffline(module);
1954 if (IsSilentEq(eq)) return 160*256;
1955 UInt_t hs = GetHSFromOffline(module);
1956 if (IsSilentHS(eq,hs)) return 160*256;
1957 for (UInt_t ch=0; ch<5; ch++) {
1958 UInt_t chip = GetChipFromOffline(module,ch*32);
1959 if (IsSilentChip(eq,hs,chip)) {
1963 UInt_t gloChip = GetGloChip(eq,hs,chip);
1964 nrSilent+=fNrDead[gloChip];
1969 //____________________________________________________________________________________________
1970 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadSingle(UInt_t module) const {
1971 // returns the number of single dead pixels (excluding the ones on silent chips) for a certain module
1973 Error("AliITSOnlineCalibrationSPDhandler::GetNrDeadSingle", "module nr (%d) out of bounds.",module);
1977 UInt_t eq = GetEqIdFromOffline(module);
1978 UInt_t hs = GetHSFromOffline(module);
1979 for (UInt_t ch=0; ch<5; ch++) {
1980 UInt_t chip = GetChipFromOffline(module,ch*32);
1981 if (!IsSilentChip(eq,hs,chip)) {
1982 UInt_t gloChip = GetGloChip(eq,hs,chip);
1983 nrDead+=fNrDead[gloChip];
1988 //____________________________________________________________________________________________
1989 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisySingle(UInt_t module) const {
1990 // returns the number of noisy pixels for a certain module
1991 return GetNrNoisy(module);
1993 //____________________________________________________________________________________________
1994 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead(UInt_t module) const {
1995 // returns the number of dead pixels for a certain module
1997 Error("AliITSOnlineCalibrationSPDhandler::GetNrDead", "module nr (%d) out of bounds.",module);
2001 UInt_t eq = GetEqIdFromOffline(module);
2002 UInt_t hs = GetHSFromOffline(module);
2003 for (UInt_t ch=0; ch<5; ch++) {
2004 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
2005 nrDead+=fNrDead[gloChip];
2009 //____________________________________________________________________________________________
2010 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSparseDead(UInt_t module) const {
2011 // returns the number of sparse dead pixels for a certain module
2013 Error("AliITSOnlineCalibrationSPDhandler::GetNrSparseDead", "module nr (%d) out of bounds.",module);
2017 UInt_t eq = GetEqIdFromOffline(module);
2018 UInt_t hs = GetHSFromOffline(module);
2019 for (UInt_t ch=0; ch<5; ch++) {
2020 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
2021 nrDead+=fNrSparseDead[gloChip];
2025 //____________________________________________________________________________________________
2026 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy(UInt_t module) const {
2027 // returns the number of noisy pixels for a certain module
2029 Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisy", "module nr (%d) out of bounds.",module);
2033 UInt_t eq = GetEqIdFromOffline(module);
2034 UInt_t hs = GetHSFromOffline(module);
2035 for (UInt_t ch=0; ch<5; ch++) {
2036 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
2037 nrNoisy+=fNrNoisy[gloChip];
2041 //____________________________________________________________________________________________
2042 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t module, UInt_t index) const {
2043 // get eq for the dead pixel at position index in list of dead
2046 GetChipAndIndexDead(module,index,gloChip,chipIndex);
2047 return GetDeadEqIdAtC2(gloChip,chipIndex);
2049 //____________________________________________________________________________________________
2050 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t module, UInt_t index) const {
2051 // get eq for the noisy pixel at position index in list of noisy
2054 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
2055 return GetNoisyEqIdAtC2(gloChip,chipIndex);
2057 //____________________________________________________________________________________________
2058 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t module, UInt_t index) const {
2059 // get hs for the dead pixel at position index in list of dead
2062 GetChipAndIndexDead(module,index,gloChip,chipIndex);
2063 return GetDeadHSAtC2(gloChip,chipIndex);
2065 //____________________________________________________________________________________________
2066 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t module, UInt_t index) const {
2067 // get hs for the noisy pixel at position index in list of noisy
2070 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
2071 return GetNoisyHSAtC2(gloChip,chipIndex);
2073 //____________________________________________________________________________________________
2074 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t module, UInt_t index) const {
2075 // get chip for the dead pixel at position index in list of dead
2078 GetChipAndIndexDead(module,index,gloChip,chipIndex);
2079 return GetDeadChipAtC2(gloChip,chipIndex);
2081 //____________________________________________________________________________________________
2082 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t module, UInt_t index) const {
2083 // get chip for the noisy pixel at position index in list of noisy
2086 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
2087 return GetNoisyChipAtC2(gloChip,chipIndex);
2089 //____________________________________________________________________________________________
2090 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t module, UInt_t index) const {
2091 // get hs for the dead pixel at position index in list of dead
2094 GetChipAndIndexDead(module,index,gloChip,chipIndex);
2095 return GetDeadColAtC2(gloChip,chipIndex);
2097 //____________________________________________________________________________________________
2098 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t module, UInt_t index) const {
2099 // get hs for the noisy pixel at position index in list of noisy
2102 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
2103 return GetNoisyColAtC2(gloChip,chipIndex);
2105 //____________________________________________________________________________________________
2106 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t module, UInt_t index) const {
2107 // get hs for the dead pixel at position index in list of dead
2110 GetChipAndIndexDead(module,index,gloChip,chipIndex);
2111 return GetDeadRowAtC2(gloChip,chipIndex);
2113 //____________________________________________________________________________________________
2114 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t module, UInt_t index) const {
2115 // get hs for the noisy pixel at position index in list of noisy
2118 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
2119 return GetNoisyRowAtC2(gloChip,chipIndex);
2121 //____________________________________________________________________________________________
2122 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBadEq(UInt_t eq) const {
2123 // returns nr of bad for eq (silent or noisy)
2125 nrBad+=GetNrSilentEq(eq);
2126 UInt_t nrNoisy = GetNrNoisy(eq);
2127 for (UInt_t i=0; i<nrNoisy; i++) {
2128 UInt_t hs = GetNoisyHSAtEq(eq,i);
2129 UInt_t chip = GetNoisyChipAtEq(eq,i);
2130 UInt_t col = GetNoisyColAtEq(eq,i);
2131 UInt_t row = GetNoisyRowAtEq(eq,i);
2132 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
2136 //____________________________________________________________________________________________
2137 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentEq(UInt_t eq) const {
2138 // returns nr of silent for eq (dead or inactive)
2140 if (IsSilentEq(eq)) return 81920*6;
2141 for (UInt_t hs=0; hs<6; hs++) {
2142 if (IsSilentHS(eq,hs)) {
2146 for (UInt_t chip=0; chip<10; chip++) {
2147 if (IsSilentChip(eq,hs,chip)) {
2152 returnval+=GetNrDeadC(eq,hs,chip);
2158 //____________________________________________________________________________________________
2159 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadEq(UInt_t eq) const {
2160 // returns nr of dead for eq
2162 for (UInt_t hs=0; hs<6; hs++) {
2163 for (UInt_t chip=0; chip<10; chip++) {
2164 returnval+=GetNrDeadC(eq,hs,chip);
2169 //____________________________________________________________________________________________
2170 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSparseDeadEq(UInt_t eq) const {
2171 // returns nr of dead for eq
2173 for (UInt_t hs=0; hs<6; hs++) {
2174 for (UInt_t chip=0; chip<10; chip++) {
2175 returnval+=GetNrSparseDeadC(eq,hs,chip);
2180 //____________________________________________________________________________________________
2181 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyEq(UInt_t eq) const {
2182 // returns nr of noisy for eq
2184 for (UInt_t hs=0; hs<6; hs++) {
2185 for (UInt_t chip=0; chip<10; chip++) {
2186 returnval+=GetNrNoisyC(eq,hs,chip);
2191 //____________________________________________________________________________________________
2192 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtEq(UInt_t eq, UInt_t index) const {
2193 // get eq for the dead pixel at position index in list of dead
2194 if (eq<20 && index<GetNrDeadEq(eq)) {
2201 //____________________________________________________________________________________________
2202 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtEq(UInt_t eq, UInt_t index) const {
2203 // get eq for the noisy pixel at position index in list of noisy
2204 if (eq<20 && index<GetNrNoisyEq(eq)) {
2211 //____________________________________________________________________________________________
2212 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtEq(UInt_t eq, UInt_t index) const {
2213 // get hs for the dead pixel at position index in list of dead
2216 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
2217 return GetDeadHSAtC2(gloChip,chipIndex);
2219 //____________________________________________________________________________________________
2220 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtEq(UInt_t eq, UInt_t index) const {
2221 // get hs for the noisy pixel at position index in list of noisy
2224 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
2225 return GetNoisyHSAtC2(gloChip,chipIndex);
2227 //____________________________________________________________________________________________
2228 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtEq(UInt_t eq, UInt_t index) const {
2229 // get chip for the dead pixel at position index in list of dead
2232 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
2233 return GetDeadChipAtC2(gloChip,chipIndex);
2235 //____________________________________________________________________________________________
2236 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtEq(UInt_t eq, UInt_t index) const {
2237 // get chip for the noisy pixel at position index in list of noisy
2240 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
2241 return GetNoisyChipAtC2(gloChip,chipIndex);
2243 //____________________________________________________________________________________________
2244 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtEq(UInt_t eq, UInt_t index) const {
2245 // get hs for the dead pixel at position index in list of dead
2248 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
2249 return GetDeadColAtC2(gloChip,chipIndex);
2251 //____________________________________________________________________________________________
2252 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtEq(UInt_t eq, UInt_t index) const {
2253 // get hs for the noisy pixel at position index in list of noisy
2256 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
2257 return GetNoisyColAtC2(gloChip,chipIndex);
2259 //____________________________________________________________________________________________
2260 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtEq(UInt_t eq, UInt_t index) const {
2261 // get hs for the dead pixel at position index in list of dead
2264 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
2265 return GetDeadRowAtC2(gloChip,chipIndex);
2267 //____________________________________________________________________________________________
2268 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtEq(UInt_t eq, UInt_t index) const {
2269 // get hs for the noisy pixel at position index in list of noisy
2272 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
2273 return GetNoisyRowAtC2(gloChip,chipIndex);
2275 //____________________________________________________________________________________________
2276 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
2277 // returns nr of bad for chip (silent or noisy)
2279 nrBad+=GetNrSilentC(eq,hs,chip);
2280 UInt_t nrNoisy = GetNrNoisyC(eq,hs,chip);
2281 for (UInt_t i=0; i<nrNoisy; i++) {
2282 UInt_t col = GetNoisyColAtC(eq,hs,chip,i);
2283 UInt_t row = GetNoisyRowAtC(eq,hs,chip,i);
2284 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
2288 //____________________________________________________________________________________________
2289 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentC(UInt_t eq, UInt_t hs, UInt_t chip) const {
2290 // returns nr of silent for chip (dead or inactive)
2291 if (IsSilentChip(eq,hs,chip)) return 8192;
2292 else return GetNrDeadC(eq,hs,chip);
2294 //____________________________________________________________________________________________
2295 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
2296 // returns nr of dead for chip
2297 UInt_t gloChip = GetGloChip(eq,hs,chip);
2298 return GetNrDeadC2(gloChip);
2300 //____________________________________________________________________________________________
2301 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSparseDeadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
2302 // returns nr of sparse dead for chip
2303 UInt_t gloChip = GetGloChip(eq,hs,chip);
2304 return GetNrSparseDeadC2(gloChip);
2306 //____________________________________________________________________________________________
2307 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC(UInt_t eq, UInt_t hs, UInt_t chip) const {
2308 // returns nr of noisy for chip
2309 UInt_t gloChip = GetGloChip(eq,hs,chip);
2310 return GetNrNoisyC2(gloChip);
2312 //____________________________________________________________________________________________
2313 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2314 UInt_t gloChip = GetGloChip(eq,hs,chip);
2315 return GetDeadEqIdAtC2(gloChip,index);
2317 //____________________________________________________________________________________________
2318 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2319 UInt_t gloChip = GetGloChip(eq,hs,chip);
2320 return GetNoisyEqIdAtC2(gloChip,index);
2322 //____________________________________________________________________________________________
2323 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2324 UInt_t gloChip = GetGloChip(eq,hs,chip);
2325 return GetDeadHSAtC2(gloChip,index);
2327 //____________________________________________________________________________________________
2328 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2329 UInt_t gloChip = GetGloChip(eq,hs,chip);
2330 return GetNoisyHSAtC2(gloChip,index);
2332 //____________________________________________________________________________________________
2333 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2334 UInt_t gloChip = GetGloChip(eq,hs,chip);
2335 return GetDeadChipAtC2(gloChip,index);
2337 //____________________________________________________________________________________________
2338 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2339 UInt_t gloChip = GetGloChip(eq,hs,chip);
2340 return GetNoisyChipAtC2(gloChip,index);
2342 //____________________________________________________________________________________________
2343 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2344 UInt_t gloChip = GetGloChip(eq,hs,chip);
2345 return GetDeadColAtC2(gloChip,index);
2347 //____________________________________________________________________________________________
2348 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2349 UInt_t gloChip = GetGloChip(eq,hs,chip);
2350 return GetNoisyColAtC2(gloChip,index);
2352 //____________________________________________________________________________________________
2353 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2354 UInt_t gloChip = GetGloChip(eq,hs,chip);
2355 return GetDeadRowAtC2(gloChip,index);
2357 //____________________________________________________________________________________________
2358 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2359 UInt_t gloChip = GetGloChip(eq,hs,chip);
2360 return GetNoisyRowAtC2(gloChip,index);
2362 //____________________________________________________________________________________________
2363 const Char_t* AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2364 // get a string of dead pixel info
2365 TString returnMess = "";
2366 UInt_t gloChip = GetGloChip(eq,hs,chip);
2367 if (gloChip>=1200) {
2368 Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
2369 return returnMess.Data();
2371 if (index<fNrDead[gloChip]) {
2372 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2373 UInt_t col = GetColFromKey(key);
2374 UInt_t row = GetRowFromKey(key);
2375 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
2376 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
2377 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
2378 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);
2379 return returnMess.Data();
2382 Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "Index %d out of bounds.", index);
2383 return returnMess.Data();
2386 //____________________________________________________________________________________________
2387 const Char_t* AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2388 // get a string of noisy pixel info
2389 TString returnMess = "";
2390 UInt_t gloChip = GetGloChip(eq,hs,chip);
2391 if (gloChip>=1200) {
2392 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
2393 return returnMess.Data();
2395 if (index<fNrNoisy[gloChip]) {
2396 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2397 UInt_t col = GetColFromKey(key);
2398 UInt_t row = GetRowFromKey(key);
2399 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
2400 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
2401 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
2402 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);
2403 return returnMess.Data();
2406 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "Index %d out of bounds.", index);
2407 return returnMess.Data();
2410 //____________________________________________________________________________________________
2411 UInt_t AliITSOnlineCalibrationSPDhandler::AddSilentFrom(AliITSOnlineCalibrationSPDhandler* other) {
2412 // returns number of new silent pixels in this' list (dead or inactive)
2413 UInt_t tmpdead = GetNrSilent();
2415 for (UInt_t eq=0; eq<20; eq++) {
2416 if (!(other->IsActiveEq(eq))) ActivateEq(eq,kFALSE);
2417 if (other->IsDeadEq(eq)) SetDeadEq(eq,kTRUE);
2418 for (UInt_t hs=0; hs<6; hs++) {
2419 if (!(other->IsActiveHS(eq,hs))) ActivateHS(eq,hs,kFALSE);
2420 if (other->IsDeadHS(eq,hs)) SetDeadHS(eq,hs,kTRUE);
2421 for (UInt_t chip=0; chip<10; chip++) {
2422 if (!(other->IsActiveChip(eq,hs,chip))) ActivateChip(eq,hs,chip,kFALSE);
2423 if (other->IsDeadChip(eq,hs,chip)) SetDeadChip(eq,hs,chip,kTRUE);
2430 return GetNrSilent() - tmpdead;
2432 //____________________________________________________________________________________________
2433 UInt_t AliITSOnlineCalibrationSPDhandler::AddDeadFrom(const AliITSOnlineCalibrationSPDhandler* other) {
2434 // returns number of new dead pixels in this' list
2436 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2437 for (UInt_t ind1=0; ind1<other->fNrDead[gloChip]; ind1++) {
2438 UInt_t eq = other->GetDeadEqIdAtC2(gloChip,ind1);
2439 UInt_t hs = other->GetDeadHSAtC2(gloChip,ind1);
2440 UInt_t chip = other->GetDeadChipAtC2(gloChip,ind1);
2441 UInt_t col = other->GetDeadColAtC2(gloChip,ind1);
2442 UInt_t row = other->GetDeadRowAtC2(gloChip,ind1);
2443 if (SetDeadPixel(eq,hs,chip,col,row)) {
2450 //____________________________________________________________________________________________
2451 UInt_t AliITSOnlineCalibrationSPDhandler::AddNoisyFrom(const AliITSOnlineCalibrationSPDhandler* other) {
2452 // returns number of new noisy pixels in this' list
2454 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2455 for (UInt_t ind1=0; ind1<other->fNrNoisy[gloChip]; ind1++) {
2456 UInt_t eq = other->GetNoisyEqIdAtC2(gloChip,ind1);
2457 UInt_t hs = other->GetNoisyHSAtC2(gloChip,ind1);
2458 UInt_t chip = other->GetNoisyChipAtC2(gloChip,ind1);
2459 UInt_t col = other->GetNoisyColAtC2(gloChip,ind1);
2460 UInt_t row = other->GetNoisyRowAtC2(gloChip,ind1);
2461 if (SetNoisyPixel(eq,hs,chip,col,row)) {
2468 //____________________________________________________________________________________________
2469 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2470 // returns nr of dead/noisy in this' lists and not in other's lists (including inactive)
2471 return GetNrSilentDiff(other) + GetNrNoisyDiff(other);
2473 //____________________________________________________________________________________________
2474 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2475 // returns nr of single silent pixels in this' lists and not in other's lists (dead or inactive)
2477 for (UInt_t eq=0; eq<20; eq++) {
2478 for (UInt_t hs=0; hs<6; hs++) {
2479 for (UInt_t chip=0; chip<10; chip++) {
2480 if (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs) || !IsActiveChip(eq,hs,chip) || IsDeadChip(eq,hs,chip)) {
2481 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)) {
2482 // if this is inactive and the other is active...
2483 returnval+= 8192 - other->GetNrDeadC(eq,hs,chip);
2487 UInt_t gloChip = GetGloChip(eq,hs,chip);
2488 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2489 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2490 UInt_t col = GetColFromKey(key);
2491 UInt_t row = GetRowFromKey(key);
2492 if (!(other->IsPixelSilent(eq,hs,chip,col,row))) {
2502 //____________________________________________________________________________________________
2503 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadDiff(const AliITSOnlineCalibrationSPDhandler* other) const {
2504 // returns nr of dead in this' lists and not in other's lists
2506 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2507 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2508 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2509 UInt_t eq = GetEqIdFromKey(key);
2510 UInt_t hs = GetHSFromKey(key);
2511 UInt_t chip = GetChipFromKey(key);
2512 UInt_t col = GetColFromKey(key);
2513 UInt_t row = GetRowFromKey(key);
2514 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2521 //____________________________________________________________________________________________
2522 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyDiff(const AliITSOnlineCalibrationSPDhandler* other) const {
2523 // returns nr of noisy in this' lists and not in other's lists
2525 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2526 for (UInt_t ind1=0; ind1<fNrNoisy[gloChip]; ind1++) {
2527 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind1);
2528 UInt_t eq = GetEqIdFromKey(key);
2529 UInt_t hs = GetHSFromKey(key);
2530 UInt_t chip = GetChipFromKey(key);
2531 UInt_t col = GetColFromKey(key);
2532 UInt_t row = GetRowFromKey(key);
2533 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2540 //____________________________________________________________________________________________
2541 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDiff(const AliITSOnlineCalibrationSPDhandler* other) const {
2542 // returns handler with active/dead/noisy in this' lists, removing those that are in other's lists
2543 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2545 for (UInt_t eq=0; eq<20; eq++) {
2546 if (!(IsActiveEq(eq))) {
2547 newHandler->ActivateEq(eq,kFALSE);
2548 if (!other->IsActiveEq(eq)) newHandler->ActivateEq(eq);
2551 newHandler->SetDeadEq(eq);
2552 if (other->IsDeadEq(eq)) newHandler->SetDeadEq(eq,kFALSE);
2554 for (UInt_t hs=0; hs<6; hs++) {
2555 if (!(IsActiveHS(eq,hs))) {
2556 newHandler->ActivateHS(eq,hs,kFALSE);
2557 if (!other->IsActiveHS(eq,hs)) newHandler->ActivateHS(eq,hs);
2559 if (IsDeadHS(eq,hs)) {
2560 newHandler->SetDeadHS(eq,hs);
2561 if (other->IsDeadHS(eq,hs)) newHandler->SetDeadHS(eq,hs,kFALSE);
2563 for (UInt_t chip=0; chip<10; chip++) {
2564 if (!(IsActiveChip(eq,hs,chip))) {
2565 newHandler->ActivateChip(eq,hs,chip,kFALSE);
2566 if (!other->IsActiveChip(eq,hs,chip)) newHandler->ActivateHS(eq,hs,chip);
2568 if (IsDeadChip(eq,hs,chip)) {
2569 newHandler->SetDeadChip(eq,hs,chip);
2570 if (other->IsDeadChip(eq,hs,chip)) newHandler->SetDeadChip(eq,hs,chip,kFALSE);
2576 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2577 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2578 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2579 UInt_t eq = GetEqIdFromKey(key);
2580 UInt_t hs = GetHSFromKey(key);
2581 UInt_t chip = GetChipFromKey(key);
2582 UInt_t col = GetColFromKey(key);
2583 UInt_t row = GetRowFromKey(key);
2584 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2585 newHandler->SetDeadPixel(eq,hs,chip,col,row);
2590 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2591 for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
2592 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
2593 UInt_t eq = GetEqIdFromKey(key);
2594 UInt_t hs = GetHSFromKey(key);
2595 UInt_t chip = GetChipFromKey(key);
2596 UInt_t col = GetColFromKey(key);
2597 UInt_t row = GetRowFromKey(key);
2598 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2599 newHandler->SetNoisyPixel(eq,hs,chip,col,row);
2606 //____________________________________________________________________________________________
2607 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetSilentDiff(const AliITSOnlineCalibrationSPDhandler* other) const {
2608 // returns handler with active/dead in this' lists, removing those that are in other's lists
2609 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2611 for (UInt_t eq=0; eq<20; eq++) {
2612 if (!(IsActiveEq(eq))) {
2613 newHandler->ActivateEq(eq,kFALSE);
2614 if (!other->IsActiveEq(eq)) newHandler->ActivateEq(eq);
2617 newHandler->SetDeadEq(eq);
2618 if (other->IsDeadEq(eq)) newHandler->SetDeadEq(eq,kFALSE);
2620 for (UInt_t hs=0; hs<6; hs++) {
2621 if (!(IsActiveHS(eq,hs))) {
2622 newHandler->ActivateHS(eq,hs,kFALSE);
2623 if (!other->IsActiveHS(eq,hs)) newHandler->ActivateHS(eq,hs);
2625 if (IsDeadHS(eq,hs)) {
2626 newHandler->SetDeadHS(eq,hs);
2627 if (other->IsDeadHS(eq,hs)) newHandler->SetDeadHS(eq,hs,kFALSE);
2629 for (UInt_t chip=0; chip<10; chip++) {
2630 if (!(IsActiveChip(eq,hs,chip))) {
2631 newHandler->ActivateChip(eq,hs,chip,kFALSE);
2632 if (!other->IsActiveChip(eq,hs,chip)) newHandler->ActivateHS(eq,hs,chip);
2634 if (IsDeadChip(eq,hs,chip)) {
2635 newHandler->SetDeadChip(eq,hs,chip);
2636 if (other->IsDeadChip(eq,hs,chip)) newHandler->SetDeadChip(eq,hs,chip,kFALSE);
2642 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2643 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2644 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2645 UInt_t eq = GetEqIdFromKey(key);
2646 UInt_t hs = GetHSFromKey(key);
2647 UInt_t chip = GetChipFromKey(key);
2648 UInt_t col = GetColFromKey(key);
2649 UInt_t row = GetRowFromKey(key);
2650 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2651 newHandler->SetDeadPixel(eq,hs,chip,col,row);
2658 //____________________________________________________________________________________________
2659 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDeadDiff(const AliITSOnlineCalibrationSPDhandler* other) const {
2660 // returns handler with dead in this' lists, except for those in other's lists
2661 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2662 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2663 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2664 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2665 UInt_t eq = GetEqIdFromKey(key);
2666 UInt_t hs = GetHSFromKey(key);
2667 UInt_t chip = GetChipFromKey(key);
2668 UInt_t col = GetColFromKey(key);
2669 UInt_t row = GetRowFromKey(key);
2670 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2671 newHandler->SetDeadPixel(eq,hs,chip,col,row);
2677 //____________________________________________________________________________________________
2678 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetNoisyDiff(const AliITSOnlineCalibrationSPDhandler* other) const {
2679 // returns handler with noisy in this' lists, except for those in other's lists
2680 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2681 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2682 for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
2683 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
2684 UInt_t eq = GetEqIdFromKey(key);
2685 UInt_t hs = GetHSFromKey(key);
2686 UInt_t chip = GetChipFromKey(key);
2687 UInt_t col = GetColFromKey(key);
2688 UInt_t row = GetRowFromKey(key);
2689 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2690 newHandler->SetNoisyPixel(eq,hs,chip,col,row);
2696 //____________________________________________________________________________________________
2697 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2698 // find gloChip and chipIndex from module and index
2699 if (index<GetNrDead(module)) {
2700 UInt_t eq = GetEqIdFromOffline(module);
2701 UInt_t hs = GetHSFromOffline(module);
2704 for (UInt_t ch=0; ch<5; ch++) {
2705 gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
2706 if (glVal+fNrDead[gloChip]>index) {
2707 chipIndex = index-glVal;
2711 glVal+=fNrDead[gloChip];
2717 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead", "Index %d out of bounds.", index);
2720 //____________________________________________________________________________________________
2721 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2722 // find gloChip and chipIndex from module and index
2723 if (index<GetNrNoisy(module)) {
2724 UInt_t eq = GetEqIdFromOffline(module);
2725 UInt_t hs = GetHSFromOffline(module);
2728 for (UInt_t ch=0; ch<5; ch++) {
2729 gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
2730 if (glVal+fNrNoisy[gloChip]>index) {
2731 chipIndex = index-glVal;
2735 glVal+=fNrNoisy[gloChip];
2741 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy", "Index %d out of bounds.", index);
2744 //____________________________________________________________________________________________
2745 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2746 // find gloChip and chipIndex from module and index
2747 if (index<GetNrDeadEq(eq)) {
2750 for (UInt_t hs=0; hs<6; hs++) {
2751 for (UInt_t chip=0; chip<10; chip++) {
2752 gloChip = GetGloChip(eq,hs,chip);
2753 if (glVal+fNrDead[gloChip]>index) {
2754 chipIndex = index-glVal;
2758 glVal+=fNrDead[gloChip];
2765 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead", "Index %d out of bounds.", index);
2768 //____________________________________________________________________________________________
2769 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2770 // find gloChip and chipIndex from module and index
2771 if (index<GetNrNoisyEq(eq)) {
2774 for (UInt_t hs=0; hs<6; hs++) {
2775 for (UInt_t chip=0; chip<10; chip++) {
2776 gloChip = GetGloChip(eq,hs,chip);
2777 if (glVal+fNrNoisy[gloChip]>index) {
2778 chipIndex = index-glVal;
2782 glVal+=fNrNoisy[gloChip];
2789 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy", "Index %d out of bounds.", index);
2792 //____________________________________________________________________________________________
2793 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2794 // find gloChip and chipIndex from global index
2795 if (index<GetNrDead()) {
2798 for (gloChip=0; gloChip<1200; gloChip++) {
2799 if (glVal+fNrDead[gloChip]>index) {
2800 chipIndex = index-glVal;
2804 glVal+=fNrDead[gloChip];
2810 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead", "Index %d out of bounds.", index);
2813 //____________________________________________________________________________________________
2814 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2815 // find gloChip and chipIndex from global index
2816 if (index<GetNrNoisy()) {
2819 for (gloChip=0; gloChip<1200; gloChip++) {
2820 if (glVal+fNrNoisy[gloChip]>index) {
2821 chipIndex = index-glVal;
2825 glVal+=fNrNoisy[gloChip];
2831 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy", "Index %d out of bounds.", index);
2834 //____________________________________________________________________________________________
2835 UInt_t AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline(UInt_t module) const {
2836 // module to eq mapping
2838 Error("AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline", "module nr (%d) out of bounds.",module);
2841 return AliITSRawStreamSPD::GetOnlineEqIdFromOffline(module);
2843 //____________________________________________________________________________________________
2844 UInt_t AliITSOnlineCalibrationSPDhandler::GetHSFromOffline(UInt_t module) const {
2845 // module to hs mapping
2847 Error("AliITSOnlineCalibrationSPDhandler::GetHSFromOffline", "module nr (%d) out of bounds.",module);
2850 return AliITSRawStreamSPD::GetOnlineHSFromOffline(module);
2852 //____________________________________________________________________________________________
2853 UInt_t AliITSOnlineCalibrationSPDhandler::GetChipFromOffline(UInt_t module, UInt_t colM) const {
2854 // module,colM to chip mapping
2855 if (module>=240 || colM>=160) {
2856 Error("AliITSOnlineCalibrationSPDhandler::GetChipFromOffline", "module,colM nrs (%d,%d) out of bounds.",module,colM);
2859 return AliITSRawStreamSPD::GetOnlineChipFromOffline(module,colM);
2861 //____________________________________________________________________________________________
2862 UInt_t AliITSOnlineCalibrationSPDhandler::GetColFromOffline(UInt_t module, UInt_t colM) const {
2863 // colM to col mapping
2865 Error("AliITSOnlineCalibrationSPDhandler::GetColFromOffline", "colM nr (%d) out of bounds.",colM);
2868 return AliITSRawStreamSPD::GetOnlineColFromOffline(module,colM);
2870 //____________________________________________________________________________________________
2871 UInt_t AliITSOnlineCalibrationSPDhandler::GetRowFromOffline(UInt_t module, UInt_t rowM) const {
2872 // rowM to row mapping
2874 Error("AliITSOnlineCalibrationSPDhandler::GetRowFromOffline", "rowM nr (%d) out of bounds.",rowM);
2877 return AliITSRawStreamSPD::GetOnlineRowFromOffline(module,rowM);
2879 //____________________________________________________________________________________________
2880 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC2(UInt_t gloChip) const {
2881 // returns nr of dead pixels on this chip
2882 if (gloChip>=1200) {
2883 Error("AliITSOnlineCalibrationSPDhandler::GetNrDeadC2", "global chip nr (%d) out of bounds.",gloChip);
2886 return fNrDead[gloChip];
2888 //____________________________________________________________________________________________
2889 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSparseDeadC2(UInt_t gloChip) const {
2890 // returns nr of dead pixels on this chip
2891 if (gloChip>=1200) {
2892 Error("AliITSOnlineCalibrationSPDhandler::GetNrSparseDeadC2", "global chip nr (%d) out of bounds.",gloChip);
2895 return fNrSparseDead[gloChip];
2897 //____________________________________________________________________________________________
2898 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2(UInt_t gloChip) const {
2899 // returns nr of noisy pixels on this chip
2900 if (gloChip>=1200) {
2901 Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2", "global chip nr (%d) out of bounds.",gloChip);
2904 return fNrNoisy[gloChip];
2906 //____________________________________________________________________________________________
2907 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC2(UInt_t gloChip, UInt_t index) const {
2908 // get eq for the dead pixel at position index in list of dead
2909 if (gloChip>=1200) {
2910 Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
2913 if (index<fNrDead[gloChip]) {
2914 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2915 return GetEqIdFromKey(key);
2918 Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "Index %d out of bounds.", index);
2922 //____________________________________________________________________________________________
2923 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC2(UInt_t gloChip, UInt_t index) const {
2924 // get eq for the noisy pixel at position index in list of noisy
2925 if (gloChip>=1200) {
2926 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
2929 if (index<fNrNoisy[gloChip]) {
2930 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2931 return GetEqIdFromKey(key);
2934 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "Index %d out of bounds.", index);
2938 //____________________________________________________________________________________________
2939 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC2(UInt_t gloChip, UInt_t index) const {
2940 // get hs for the dead pixel at position index in list of dead
2941 if (gloChip>=1200) {
2942 Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "global chip nr (%d) out of bounds.",gloChip);
2945 if (index<fNrDead[gloChip]) {
2946 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2947 return GetHSFromKey(key);
2950 Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "Index %d out of bounds.", index);
2954 //____________________________________________________________________________________________
2955 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC2(UInt_t gloChip, UInt_t index) const {
2956 // get hs for the noisy pixel at position index in list of noisy
2957 if (gloChip>=1200) {
2958 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "global chip nr (%d) out of bounds.",gloChip);
2961 if (index<fNrNoisy[gloChip]) {
2962 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2963 return GetHSFromKey(key);
2966 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "Index %d out of bounds.", index);
2970 //____________________________________________________________________________________________
2971 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC2(UInt_t gloChip, UInt_t index) const {
2972 // get chip for the dead pixel at position index in list of dead
2973 if (gloChip>=1200) {
2974 Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "global chip nr (%d) out of bounds.",gloChip);
2977 if (index<fNrDead[gloChip]) {
2978 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2979 return GetChipFromKey(key);
2982 Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "Index %d out of bounds.", index);
2986 //____________________________________________________________________________________________
2987 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC2(UInt_t gloChip, UInt_t index) const {
2988 // get chip for the noisy pixel at position index in list of noisy
2989 if (gloChip>=1200) {
2990 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "global chip nr (%d) out of bounds.",gloChip);
2993 if (index<fNrNoisy[gloChip]) {
2994 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2995 return GetChipFromKey(key);
2998 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "Index %d out of bounds.", index);
3002 //____________________________________________________________________________________________
3003 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2(UInt_t gloChip, UInt_t index) const {
3004 // get col for the dead pixel at position index in list of dead
3005 if (gloChip>=1200) {
3006 Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "global chip nr (%d) out of bounds.",gloChip);
3009 if (index<fNrDead[gloChip]) {
3010 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
3011 return GetColFromKey(key);
3014 Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "Index %d out of bounds.", index);
3018 //____________________________________________________________________________________________
3019 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC2(UInt_t gloChip, UInt_t index) const {
3020 // get col for the noisy pixel at position index in list of noisy
3021 if (gloChip>=1200) {
3022 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "global chip nr (%d) out of bounds.",gloChip);
3025 if (index<fNrNoisy[gloChip]) {
3026 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
3027 return GetColFromKey(key);
3030 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "Index %d out of bounds.", index);
3034 //____________________________________________________________________________________________
3035 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC2(UInt_t gloChip, UInt_t index) const {
3036 // get row for the dead pixel at position index in list of dead
3037 if (gloChip>=1200) {
3038 Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "global chip nr (%d) out of bounds.",gloChip);
3041 if (index<fNrDead[gloChip]) {
3042 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
3043 return GetRowFromKey(key);
3046 Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "Index %d out of bounds.", index);
3050 //____________________________________________________________________________________________
3051 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC2(UInt_t gloChip, UInt_t index) const {
3052 // get row for the noisy pixel at position index in list of noisy
3053 if (gloChip>=1200) {
3054 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "global chip nr (%d) out of bounds.",gloChip);
3057 if (index<fNrNoisy[gloChip]) {
3058 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
3059 return GetRowFromKey(key);
3062 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "Index %d out of bounds.", index);
3066 //____________________________________________________________________________________________
3067 void AliITSOnlineCalibrationSPDhandler::ActivateALL() {
3068 // activate all eq,hs,chips
3069 for (UInt_t eq=0; eq<20; eq++) {
3072 for (UInt_t hs=0; hs<6; hs++) {
3074 for (UInt_t chip=0; chip<10; chip++) {
3075 ActivateChip(eq,hs,chip);
3080 //____________________________________________________________________________________________
3081 void AliITSOnlineCalibrationSPDhandler::ActivateEq(UInt_t eq, Bool_t setval) {
3084 Error("AliITSOnlineCalibrationSPDhandler::ActivateEq", "eq (%d) out of bounds.",eq);
3087 fActiveEq[eq] = setval;
3089 //____________________________________________________________________________________________
3090 void AliITSOnlineCalibrationSPDhandler::ActivateHS(UInt_t eq, UInt_t hs, Bool_t setval) {
3092 if (eq>=20 || hs>=6) {
3093 Error("AliITSOnlineCalibrationSPDhandler::ActivateHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
3096 fActiveHS[eq][hs] = setval;
3098 //____________________________________________________________________________________________
3099 void AliITSOnlineCalibrationSPDhandler::ActivateChip(UInt_t eq, UInt_t hs, UInt_t chip, Bool_t setval) {
3101 if (eq>=20 || hs>=6 || chip>=10) {
3102 Error("AliITSOnlineCalibrationSPDhandler::ActivateChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
3105 fActiveChip[eq][hs][chip] = setval;
3107 //____________________________________________________________________________________________
3108 Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveEq(UInt_t eq) const {
3111 Error("AliITSOnlineCalibrationSPDhandler::IsActiveEq", "eq (%d) out of bounds.",eq);
3114 return fActiveEq[eq];
3116 //____________________________________________________________________________________________
3117 Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveHS(UInt_t eq, UInt_t hs) const {
3119 if (eq>=20 || hs>=6) {
3120 Error("AliITSOnlineCalibrationSPDhandler::IsActiveHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
3123 return fActiveHS[eq][hs];
3125 //____________________________________________________________________________________________
3126 Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
3128 if (eq>=20 || hs>=6 || chip>=10) {
3129 Error("AliITSOnlineCalibrationSPDhandler::IsActiveChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
3132 return fActiveChip[eq][hs][chip];
3134 //____________________________________________________________________________________________
3135 void AliITSOnlineCalibrationSPDhandler::UnSetDeadALL() {
3136 // Clear all dead eq,hs,chips
3137 for (UInt_t eq=0; eq<20; eq++) {
3138 SetDeadEq(eq,kFALSE);
3139 for (UInt_t hs=0; hs<6; hs++) {
3140 SetDeadHS(eq,hs,kFALSE);
3141 for (UInt_t chip=0; chip<10; chip++) {
3142 SetDeadChip(eq,hs,chip,kFALSE);
3147 //____________________________________________________________________________________________
3148 void AliITSOnlineCalibrationSPDhandler::SetDeadEq(UInt_t eq, Bool_t setval) {
3151 Error("AliITSOnlineCalibrationSPDhandler::SetDeadEq", "eq (%d) out of bounds.",eq);
3154 fDeadEq[eq] = setval;
3156 //____________________________________________________________________________________________
3157 void AliITSOnlineCalibrationSPDhandler::SetDeadHS(UInt_t eq, UInt_t hs, Bool_t setval) {
3159 if (eq>=20 || hs>=6) {
3160 Error("AliITSOnlineCalibrationSPDhandler::SetDeadHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
3163 fDeadHS[eq][hs] = setval;
3165 //____________________________________________________________________________________________
3166 void AliITSOnlineCalibrationSPDhandler::SetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip, Bool_t setval) {
3168 if (eq>=20 || hs>=6 || chip>=10) {
3169 Error("AliITSOnlineCalibrationSPDhandler::SetDeadChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
3172 fDeadChip[eq][hs][chip] = setval;
3174 //____________________________________________________________________________________________
3175 Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadEq(UInt_t eq) const {
3178 Error("AliITSOnlineCalibrationSPDhandler::IsDeadEq", "eq (%d) out of bounds.",eq);
3183 //____________________________________________________________________________________________
3184 Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadHS(UInt_t eq, UInt_t hs) const {
3186 if (eq>=20 || hs>=6) {
3187 Error("AliITSOnlineCalibrationSPDhandler::IsDeadHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
3190 return fDeadHS[eq][hs];
3192 //____________________________________________________________________________________________
3193 Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
3195 if (eq>=20 || hs>=6 || chip>=10) {
3196 Error("AliITSOnlineCalibrationSPDhandler::IsDeadChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
3199 return fDeadChip[eq][hs][chip];
3201 //____________________________________________________________________________________________
3202 Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentEq(UInt_t eq) const {
3205 Error("AliITSOnlineCalibrationSPDhandler::IsSilentEq", "eq (%d) out of bounds.",eq);
3208 return (!IsActiveEq(eq) || IsDeadEq(eq));
3210 //____________________________________________________________________________________________
3211 Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentHS(UInt_t eq, UInt_t hs) const {
3213 if (eq>=20 || hs>=6) {
3214 Error("AliITSOnlineCalibrationSPDhandler::IsSilentHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
3217 return (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs));
3219 //____________________________________________________________________________________________
3220 Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
3222 if (eq>=20 || hs>=6 || chip>=10) {
3223 Error("AliITSOnlineCalibrationSPDhandler::IsSilentChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
3226 return (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs) || !IsActiveChip(eq,hs,chip) || IsDeadChip(eq,hs,chip));
3228 //____________________________________________________________________________________________
3229 Bool_t AliITSOnlineCalibrationSPDhandler::IsNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
3230 // returns true if there is at least a noisy pixel in the chip
3232 if (eq>=20 || hs>=6 || chip>=10) {
3233 Error("AliITSOnlineCalibrationSPDhandler::IsNoisyChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
3236 Bool_t isNoisy = kFALSE;
3238 UInt_t nrNoisy = GetNrNoisy();
3239 for (UInt_t i=0; i<nrNoisy; i++) {
3240 if(eq == GetNoisyEqIdAt(i)){
3241 if(hs == GetNoisyHSAt(i)){
3242 if(chip == GetNoisyChipAt(i)) {
3243 UInt_t col = GetNoisyColAt(i);
3244 UInt_t row = GetNoisyRowAt(i);
3245 if (IsPixelNoisy(eq,hs,chip,col,row)) isNoisy = kTRUE;
3252 //____________________________________________________________________________________________
3253 Bool_t AliITSOnlineCalibrationSPDhandler::WritePITConditionsToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
3254 // writes noisy pixels to DB for given runNrs
3255 // overwrites any previous entries
3256 AliCDBManager* man = AliCDBManager::Instance();
3257 TString storageSTR = Form("%s",storage);
3258 if (storageSTR.CompareTo("default")==0) {
3259 if(!man->IsDefaultStorageSet()) {
3260 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
3264 storageSTR = Form("%s",storage);
3265 man->SetDefaultStorage(storageSTR.Data());
3267 AliCDBMetaData* metaData = new AliCDBMetaData();
3268 metaData->SetResponsible("Annalisa Mastroserio");
3269 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
3270 AliCDBId idCalSPD("TRIGGER/SPD/PITConditions",runNrStart,runNrEnd);
3271 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)fTriggerConditions,idCalSPD,metaData);
3278 //____________________________________________________________________________________________
3279 Bool_t AliITSOnlineCalibrationSPDhandler::SetInactiveChipInPITmask(UInt_t eq, UInt_t hs, UInt_t chip){
3281 fTriggerConditions->SetInActiveChip(eq,hs,chip);
3284 //____________________________________________________________________________________________
3285 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetInactiveChipInPITmask(UInt_t eq, UInt_t hs, UInt_t chip){
3287 fTriggerConditions->SetInActiveChip(eq,hs,chip);
3290 //____________________________________________________________________________________________
3291 void AliITSOnlineCalibrationSPDhandler::PrintDiffInDead(AliITSOnlineCalibrationSPDhandler *other) const {
3293 // Printout of the differences between two ocdb files for SPD Dead channel map
3296 UInt_t nrDeadChipOk=0;
3297 UInt_t nrDeadHsOk=0;
3299 UInt_t nrDeadChip=0;
3300 UInt_t nrDeadHsInOther =0;
3301 UInt_t nrDeadChipInOther=0;
3302 UInt_t nrMismatch =0;
3303 UInt_t nrMismatchInOther =0;
3304 printf("\n\n ****** loop over chips ***** \n");
3305 for(Int_t eq=0; eq<20; eq++){
3306 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));
3307 for(Int_t hs=0; hs<6; hs++){
3309 Short_t nchipsOther =0;
3311 for(Int_t chip=0; chip<10; chip++){
3312 UInt_t chipkey = AliITSRawStreamSPD::GetOfflineChipKeyFromOnline(eq,hs,chip);
3313 // test if everything is coherent
3314 if(IsDeadChip(eq,hs,chip) && other->IsDeadChip(eq,hs,chip)) {
3319 if(!IsDeadChip(eq,hs,chip) && !other->IsDeadChip(eq,hs,chip)) nrChipOk++;
3320 // now testing if mismatches
3321 if(IsDeadChip(eq,hs,chip)) {
3324 if(!other->IsDeadChip(eq,hs,chip)) {
3326 printf(" mismatch -> eq %i hs %i chip %i is DEAD - ALIVE in the other (chipkey %i)\n",eq,hs,chip,chipkey);
3329 if(other->IsDeadChip(eq,hs,chip)){
3330 nrDeadChipInOther++;
3332 if(!IsDeadChip(eq,hs,chip)) {
3333 nrMismatchInOther++;
3334 printf(" mismatch -> eq %i hs %i chip %i is ALIVE - DEAD in the other (chipkey %i)\n",eq,hs,chip,chipkey);
3338 if(nok==10) nrDeadHsOk++;
3339 if(nchips==10) nrDeadHs++;
3340 if(nchipsOther==10) nrDeadHsInOther++;
3344 printf("\n\n\n*************SUMMARY****************\n");
3345 printf(" BOTH have : %i Dead HS and %i Dead chips with %i coherent chips \n",nrDeadHsOk,nrDeadChipOk,nrChipOk);
3346 printf("\n_________MISMATCH RESULTS___________\n");
3347 printf(" THIS : Nr Dead HS %i - Nr Dead Chip %i \n",nrDeadHs,nrDeadChip);
3348 printf(" OTHER : Nr Dead HS %i - Nr Dead Chip %i \n",nrDeadHsInOther,nrDeadChipInOther);
3349 printf(" N Mismatches in Dead chips (=ALIVE in the other) %i \n",nrMismatch);
3350 printf(" N Mismatches in Alive chips (=DEAD in the other) %i \n",nrMismatchInOther);
3352 //____________________________________________________________________________________________
3353 void AliITSOnlineCalibrationSPDhandler::PrintDiffInPITmask(AliITSOnlineCalibrationSPDhandler *other) const {
3355 // Printout of the differences between two ocdb files for SPD Dead channel map
3360 Int_t nMismatchInOther =0;
3362 printf("\n\n ****** loop over chips in PIT mask***** \n");
3363 for(Int_t eq=0; eq<20; eq++){
3364 for(Int_t hs=0; hs<6; hs++){
3365 for(Int_t chip=0; chip<10; chip++){
3367 UInt_t chipkey = AliITSRawStreamSPD::GetOfflineChipKeyFromOnline(eq,hs,chip);
3369 if(fTriggerConditions->IsChipActive(eq,hs,chip) && (other->GetTriggerConditions())->IsChipActive(eq,hs,chip)) nOk++;
3370 if(fTriggerConditions->IsChipActive(eq,hs,chip) && !(other->GetTriggerConditions())->IsChipActive(eq,hs,chip)) {
3372 printf("Mismatch -> eq %i hs %i chip %i is ACTIVE - INACTIVE in the other (chipkey %i) \n",eq,hs,chip,chipkey);
3374 if(!fTriggerConditions->IsChipActive(eq,hs,chip) && (other->GetTriggerConditions())->IsChipActive(eq,hs,chip)) {
3376 printf("Mismatch -> eq %i hs %i chip %i is INACTIVE - ACTIVE in the other (chipkey %i) \n",eq,hs,chip,chipkey);
3378 if(!fTriggerConditions->IsChipActive(eq,hs,chip) && !(other->GetTriggerConditions())->IsChipActive(eq,hs,chip)) nOk++;
3383 printf("n Chips OK %i : ACTIVE mismatch %i - INACTIVE mismatch in %i \n",nOk,nMismatch,nMismatchInOther);