1 //////////////////////////////////////////////////////////////////////
2 // Author: Henrik Tydesjo //
3 // For easier handling of dead and noisy pixels they are kept in //
4 // container maps (AliITSIntMap). //
5 // Handling of inactive equipments,HSs,chips have been added. //
6 // A pixel that is either dead or inactive is called SILENT here. //
7 // The lists of single dead and noisy pixels are separated from the //
8 // information about which eq/hs/chip are inactive. //
9 // The TArrayS objects that are put in the AliITSCalibrationSPD //
10 // objects can be obtained from the methods GetDeadArray and //
12 //////////////////////////////////////////////////////////////////////
14 #include "AliITSOnlineCalibrationSPDhandler.h"
15 #include "AliITSOnlineCalibrationSPD.h"
16 #include "AliITSIntMap.h"
17 #include <TObjArray.h>
24 #ifndef SPD_DA_OFF // you may want to exclude cdb classes, if using this class outside aliroot
25 #include "AliITSCalibrationSPD.h"
26 #include "AliCDBManager.h"
27 #include "AliCDBEntry.h"
31 //____________________________________________________________________________________________
32 AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler():
36 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
39 fDeadPixelMap[gloChip] = new AliITSIntMap();
40 fNoisyPixelMap[gloChip] = new AliITSIntMap();
44 //____________________________________________________________________________________________
45 AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler(const AliITSOnlineCalibrationSPDhandler& handle):
49 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
50 fNrDead[gloChip] = handle.fNrDead[gloChip];
51 fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
52 fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
53 fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
55 for (UInt_t eq=0; eq<20; eq++) {
56 fActiveEq[eq] = handle.fActiveEq[eq];
57 for (UInt_t hs=0; hs<6; hs++) {
58 fActiveHS[eq][hs] = handle.fActiveHS[eq][hs];
59 for (UInt_t chip=0; chip<10; chip++) {
60 fActiveChip[eq][hs][chip] = handle.fActiveChip[eq][hs][chip];
64 fFileLocation = handle.fFileLocation;
66 //____________________________________________________________________________________________
67 AliITSOnlineCalibrationSPDhandler::~AliITSOnlineCalibrationSPDhandler() {
69 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
70 delete fDeadPixelMap[gloChip];
71 delete fNoisyPixelMap[gloChip];
74 //____________________________________________________________________________________________
75 AliITSOnlineCalibrationSPDhandler& AliITSOnlineCalibrationSPDhandler::operator=(const AliITSOnlineCalibrationSPDhandler& handle) {
76 // assignment operator
79 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
80 fNrDead[gloChip] = handle.fNrDead[gloChip];
81 fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
82 fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
83 fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
85 for (UInt_t eq=0; eq<20; eq++) {
86 fActiveEq[eq] = handle.fActiveEq[eq];
87 for (UInt_t hs=0; hs<6; hs++) {
88 fActiveHS[eq][hs] = handle.fActiveHS[eq][hs];
89 for (UInt_t chip=0; chip<10; chip++) {
90 fActiveChip[eq][hs][chip] = handle.fActiveChip[eq][hs][chip];
94 fFileLocation = handle.fFileLocation;
98 //____________________________________________________________________________________________
99 void AliITSOnlineCalibrationSPDhandler::ClearMaps() {
100 // clear the lists of dead and noisy
105 //____________________________________________________________________________________________
106 void AliITSOnlineCalibrationSPDhandler::ResetDead() {
107 // reset the dead pixel map and inactive eq,hs,chip
108 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
110 fDeadPixelMap[gloChip]->Clear();
113 //____________________________________________________________________________________________
114 void AliITSOnlineCalibrationSPDhandler::ResetNoisy() {
115 // clear the list of noisy pixels
116 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
118 fNoisyPixelMap[gloChip]->Clear();
121 //____________________________________________________________________________________________
122 void AliITSOnlineCalibrationSPDhandler::ResetDeadForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
123 // clear the dead pixels for this chip
124 UInt_t gloChip = GetGloChip(eq,hs,chip);
125 for (UInt_t col=0; col<32; col++) {
126 for (UInt_t row=0; row<256; row++) {
127 Int_t key = GetKey(eq,hs,chip,col,row);
128 if (fDeadPixelMap[gloChip]->Remove(key)) {
134 //____________________________________________________________________________________________
135 void AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
136 // clear the noisy pixels for this chip
137 UInt_t gloChip = GetGloChip(eq,hs,chip);
139 Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip","global chip nr (%d) out of bounds\n",gloChip);
142 for (UInt_t col=0; col<32; col++) {
143 for (UInt_t row=0; row<256; row++) {
144 Int_t key = GetKey(eq,hs,chip,col,row);
145 if (fNoisyPixelMap[gloChip]->Remove(key)) {
151 //____________________________________________________________________________________________
152 void AliITSOnlineCalibrationSPDhandler::ResetDeadForEq(UInt_t eq) {
153 // clear the dead pixels for this eq
155 Error("AliITSOnlineCalibrationSPDhandler::ResetDeadForEq", "eq (%d) out of bounds.",eq);
158 for (UInt_t hs=0; hs<6; hs++) {
159 for (UInt_t chip=0; chip<10; chip++) {
160 ResetDeadForChip(eq, hs, chip);
164 //____________________________________________________________________________________________
165 void AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq(UInt_t eq) {
166 // clear the noisy pixels for this eq
168 Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq", "eq (%d) out of bounds.",eq);
171 for (UInt_t hs=0; hs<6; hs++) {
172 for (UInt_t chip=0; chip<10; chip++) {
173 ResetNoisyForChip(eq, hs, chip);
179 //____________________________________________________________________________________________
180 Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromFiles() {
181 // read files from file location (active,dead,noisy info). returns true if at least one file found
182 Bool_t b1 = ReadNoisyFromFiles();
183 Bool_t b2 = ReadSilentFromFiles();
186 //____________________________________________________________________________________________
187 Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFiles() {
188 // read dead,active files from file location. returns true if at least one file found
189 Bool_t returnval=kFALSE;
190 for (UInt_t eq=0; eq<20; eq++) {
191 if (ReadSilentFromFile(eq)) {
197 //____________________________________________________________________________________________
198 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFiles() {
199 // read dead,active files from file location. returns true if at least one file found
200 Bool_t returnval=kFALSE;
201 for (UInt_t eq=0; eq<20; eq++) {
202 if (ReadDeadFromFile(eq)) {
208 //____________________________________________________________________________________________
209 Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFile(UInt_t eq) {
210 // read dead file for eq from file location.
211 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
212 return ReadSilentFromFileName(fileName.Data());
214 //____________________________________________________________________________________________
215 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFile(UInt_t eq) {
216 // read dead file for eq from file location.
217 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
218 return ReadDeadFromFileName(fileName.Data());
220 //____________________________________________________________________________________________
221 Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFileName(const char *fileName) {
222 // read dead from file fileName (including inactive)
223 return ReadDeadFromFileName(fileName, kTRUE);
225 //____________________________________________________________________________________________
226 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFileName(const char *fileName, Bool_t inactive) {
227 // read dead from file fileName
228 AliITSOnlineCalibrationSPD* calib;
229 FILE* fp0 = fopen(fileName, "r");
230 if (fp0 == NULL) {return kFALSE;}
233 TFile file(fileName, "READ");
235 file.GetObject("AliITSOnlineCalibrationSPD", calib);
238 UInt_t nrDead=calib->GetNrBad();
239 for (UInt_t index=0; index<nrDead; index++) {
240 UInt_t key = calib->GetKeyAt(index);
241 UInt_t eq = GetEqIdFromKey(key);
242 UInt_t hs = GetHSFromKey(key);
243 UInt_t chip = GetChipFromKey(key);
244 UInt_t col = GetColFromKey(key);
245 UInt_t row = GetRowFromKey(key);
246 SetDeadPixel(eq,hs,chip,col,row);
249 UInt_t eq = calib->GetEqNr();
250 if (calib->IsActiveEq()) ActivateEq(eq);
251 else ActivateEq(eq,kFALSE);
252 for (UInt_t hs=0; hs<6; hs++) {
253 if (calib->IsActiveHS(hs)) ActivateHS(eq,hs);
254 else ActivateHS(eq,hs,kFALSE);
255 for (UInt_t chip=0; chip<10; chip++) {
256 if (calib->IsActiveChip(hs,chip)) ActivateChip(eq,hs,chip);
257 else ActivateChip(eq,hs,chip,kFALSE);
266 //____________________________________________________________________________________________
267 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFiles() {
268 // read noisy files from file location. returns true if at least one file found
269 Bool_t returnval=kFALSE;
270 for (UInt_t eq=0; eq<20; eq++) {
271 if (ReadNoisyFromFile(eq)) {
277 //____________________________________________________________________________________________
278 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFile(UInt_t eq) {
279 // read noisy file for eq from file location.
280 TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
281 return ReadNoisyFromFileName(fileName.Data());
283 //____________________________________________________________________________________________
284 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFileName(const char *fileName) {
285 // read noisy from file fileName
286 AliITSOnlineCalibrationSPD* calib;
287 FILE* fp0 = fopen(fileName, "r");
288 if (fp0 == NULL) {return kFALSE;}
291 TFile file(fileName, "READ");
293 file.GetObject("AliITSOnlineCalibrationSPD", calib);
296 UInt_t nrNoisy=calib->GetNrBad();
297 for (UInt_t index=0; index<nrNoisy; index++) {
298 UInt_t key = calib->GetKeyAt(index);
299 UInt_t eq = GetEqIdFromKey(key);
300 UInt_t hs = GetHSFromKey(key);
301 UInt_t chip = GetChipFromKey(key);
302 UInt_t col = GetColFromKey(key);
303 UInt_t row = GetRowFromKey(key);
304 SetNoisyPixel(eq,hs,chip,col,row);
311 //____________________________________________________________________________________________
312 UInt_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromText(const char *fileName, UInt_t module) {
313 // read dead from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
314 // insert only those pixels that belong to module (or all if module=240).
317 textFile.open(fileName, ifstream::in);
318 if (textFile.fail()) {
319 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromText","No dead text file (%s) present.",fileName);
323 UInt_t eq,hs,chip,col,row;
324 textFile >> eq; if (textFile.eof()) break;
325 textFile >> hs; if (textFile.eof()) break;
326 textFile >> chip; if (textFile.eof()) break;
327 textFile >> col; if (textFile.eof()) break;
329 if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){
330 if (SetDeadPixel(eq,hs,chip,col,row)) {
334 if (textFile.eof()) break;
340 //____________________________________________________________________________________________
341 UInt_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText(const char *fileName, UInt_t module) {
342 // read noisy from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
343 // insert only those pixels that belong to module (or all if module=240).
346 textFile.open(fileName, ifstream::in);
347 if (textFile.fail()) {
348 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText","No noisy text file (%s) present.",fileName);
352 UInt_t eq,hs,chip,col,row;
353 textFile >> eq; if (textFile.eof()) break;
354 textFile >> hs; if (textFile.eof()) break;
355 textFile >> chip; if (textFile.eof()) break;
356 textFile >> col; if (textFile.eof()) break;
358 if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){
359 if (SetNoisyPixel(eq,hs,chip,col,row)) {
363 if (textFile.eof()) break;
369 //____________________________________________________________________________________________
370 void AliITSOnlineCalibrationSPDhandler::WriteToFilesAlways() {
371 // write the lists of active,dead,noisy to files
372 for (UInt_t eq=0; eq<20; eq++) {
373 WriteSilentToFile(eq);
374 WriteNoisyToFile(eq);
377 //____________________________________________________________________________________________
378 UInt_t AliITSOnlineCalibrationSPDhandler::WriteToFiles() {
379 // write the lists of dead and noisy to files (only if there are >0 dead or noisy pixels) , returns nr of files produced
380 return (WriteNoisyToFiles() + WriteSilentToFiles());
382 //____________________________________________________________________________________________
383 void AliITSOnlineCalibrationSPDhandler::WriteSilentToFilesAlways() {
384 // write the lists of silent to files
385 for (UInt_t eq=0; eq<20; eq++) {
386 WriteSilentToFile(eq);
389 //____________________________________________________________________________________________
390 void AliITSOnlineCalibrationSPDhandler::WriteDeadToFilesAlways() {
391 // write the lists of dead to files
392 for (UInt_t eq=0; eq<20; eq++) {
396 //____________________________________________________________________________________________
397 void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFilesAlways() {
398 // write the lists of noisy to files
399 for (UInt_t eq=0; eq<20; eq++) {
400 WriteNoisyToFile(eq);
403 //____________________________________________________________________________________________
404 UInt_t AliITSOnlineCalibrationSPDhandler::WriteSilentToFiles() {
405 // write the list of silent to file (only if there are >0 silent pixels) , returns nr of files produced
407 for (UInt_t eq=0; eq<20; eq++) {
408 if (GetNrSilentEq(eq) > 0) {
409 WriteSilentToFile(eq);
415 //____________________________________________________________________________________________
416 UInt_t AliITSOnlineCalibrationSPDhandler::WriteDeadToFiles() {
417 // write the list of dead to file (only if there are >0 dead pixels) , returns nr of files produced
419 for (UInt_t eq=0; eq<20; eq++) {
420 if (GetNrDeadEq(eq) > 0) {
427 //____________________________________________________________________________________________
428 UInt_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToFiles() {
429 // write the list of noisy to file (only if there are >0 noisy pixels) , returns nr of files produced
431 for (UInt_t eq=0; eq<20; eq++) {
432 if (GetNrNoisyEq(eq) > 0) {
433 WriteNoisyToFile(eq);
439 //____________________________________________________________________________________________
440 void AliITSOnlineCalibrationSPDhandler::WriteSilentToFile(UInt_t eq) {
441 WriteDeadToFile(eq,kTRUE);
443 //____________________________________________________________________________________________
444 void AliITSOnlineCalibrationSPDhandler::WriteDeadToFile(UInt_t eq, Bool_t inactive) {
445 // write the lists of dead (and inactive if input boolean is true) for eq to file
446 AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
448 calib->SetBadList(GetDeadArrayOnline(eq));
449 calib->SetNrBad(GetNrDeadEq(eq));
451 if (IsActiveEq(eq)) calib->ActivateEq();
452 else calib->ActivateEq(kFALSE);
453 for (UInt_t hs=0; hs<6; hs++) {
454 if (IsActiveHS(eq,hs)) calib->ActivateHS(hs);
455 else calib->ActivateHS(hs,kFALSE);
456 for (UInt_t chip=0; chip<10; chip++) {
457 if (IsActiveChip(eq,hs,chip)) calib->ActivateChip(hs,chip);
458 else calib->ActivateChip(hs,chip,kFALSE);
462 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
463 TFile file(fileName.Data(), "RECREATE");
464 file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
468 //____________________________________________________________________________________________
469 void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFile(UInt_t eq) {
470 // write the lists of noisy for eq to file
471 AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
473 calib->SetBadList(GetNoisyArrayOnline(eq));
474 calib->SetNrBad(GetNrNoisyEq(eq));
475 TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
476 TFile file(fileName.Data(), "RECREATE");
477 file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
481 //____________________________________________________________________________________________
483 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB(UInt_t module, Int_t runNr, Bool_t treeSerial) {
484 // reads dead pixels from DB for given module and runNr
485 AliCDBManager* man = AliCDBManager::Instance();
486 if(!man->IsDefaultStorageSet()) {
487 man->SetDefaultStorage("local://$ALICE_ROOT");
489 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
492 spdEntry = (TObjArray*)cdbEntry->GetObject();
493 if(!spdEntry) return kFALSE;
496 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB","Calibration for run %d not found in database.",runNr);
499 AliITSCalibrationSPD* calibSPD;
500 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
501 UInt_t nrDead = calibSPD->GetNrBad();
503 if (!treeSerial) RecursiveInsertDead(calibSPD,module,0,nrDead-1);
505 for (UInt_t index=0; index<nrDead; index++) {
506 UInt_t colM = calibSPD->GetBadColAt(index);
507 UInt_t rowM = calibSPD->GetBadRowAt(index);
508 SetDeadPixelM(module,colM,rowM);
512 spdEntry->SetOwner(kTRUE);
516 //____________________________________________________________________________________________
517 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB(UInt_t module, Int_t runNr, Bool_t treeSerial) {
518 // reads noisy pixels from DB for given module and runNr
519 AliCDBManager* man = AliCDBManager::Instance();
520 if(!man->IsDefaultStorageSet()) {
521 man->SetDefaultStorage("local://$ALICE_ROOT");
523 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
526 spdEntry = (TObjArray*)cdbEntry->GetObject();
527 if(!spdEntry) return kFALSE;
530 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB","Calibration for run %d not found in database.",runNr);
533 AliITSCalibrationSPD* calibSPD;
534 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
535 UInt_t nrNoisy = calibSPD->GetNrBad();
537 if (!treeSerial) RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
539 for (UInt_t index=0; index<nrNoisy; index++) {
540 UInt_t colM = calibSPD->GetBadColAt(index);
541 UInt_t rowM = calibSPD->GetBadRowAt(index);
542 SetNoisyPixelM(module,colM,rowM);
546 spdEntry->SetOwner(kTRUE);
550 //____________________________________________________________________________________________
551 Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromDB(Int_t runNr, Bool_t treeSerial) {
552 // reads dead and noisy pixels from DB for given runNr
553 // note that you may want to clear the lists (if they are not empty) before reading
554 return (ReadNoisyFromDB(runNr,treeSerial) && ReadDeadFromDB(runNr,treeSerial));
556 //____________________________________________________________________________________________
557 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB(Int_t runNr, Bool_t treeSerial) {
558 // reads dead pixels from DB for given runNr
559 // note that you may want to clear the list (if it is not empty) before reading
560 AliCDBManager* man = AliCDBManager::Instance();
561 if(!man->IsDefaultStorageSet()) {
562 man->SetDefaultStorage("local://$ALICE_ROOT");
564 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
567 spdEntry = (TObjArray*)cdbEntry->GetObject();
568 if(!spdEntry) return kFALSE;
571 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB","Calibration for run %d not found in database.",runNr);
574 AliITSCalibrationSPD* calibSPD;
575 for (UInt_t module=0; module<240; module++) {
576 // printf("Reading module %d\n",module);
577 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
578 UInt_t nrDead = calibSPD->GetNrBad();
580 if (!treeSerial) RecursiveInsertDead(calibSPD,module,0,nrDead-1);
582 for (UInt_t index=0; index<nrDead; index++) {
583 UInt_t colM = calibSPD->GetBadColAt(index);
584 UInt_t rowM = calibSPD->GetBadRowAt(index);
585 SetDeadPixelM(module,colM,rowM);
590 spdEntry->SetOwner(kTRUE);
594 //____________________________________________________________________________________________
595 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB(Int_t runNr, Bool_t treeSerial) {
596 // reads noisy pixels from DB for given runNr
597 // note that you may want to clear the list (if it is not empty) before reading
598 AliCDBManager* man = AliCDBManager::Instance();
599 if(!man->IsDefaultStorageSet()) {
600 man->SetDefaultStorage("local://$ALICE_ROOT");
602 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
605 spdEntry = (TObjArray*)cdbEntry->GetObject();
606 if(!spdEntry) return kFALSE;
609 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB","Calibration for run %d not found in database.",runNr);
612 AliITSCalibrationSPD* calibSPD;
613 for (UInt_t module=0; module<240; module++) {
614 // printf("Reading module %d\n",module);
615 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
616 UInt_t nrNoisy = calibSPD->GetNrBad();
619 printf("*** mod %d nrnoisy=%d\n",module,nrNoisy);
620 RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
623 for (UInt_t index=0; index<nrNoisy; index++) {
624 UInt_t colM = calibSPD->GetBadColAt(index);
625 UInt_t rowM = calibSPD->GetBadRowAt(index);
626 SetNoisyPixelM(module,colM,rowM);
631 spdEntry->SetOwner(kTRUE);
635 //____________________________________________________________________________________________
636 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromCalibObj(TObjArray* calObj) {
637 // reads dead pixels from calib object
638 for (UInt_t module=0; module<240; module++) {
639 for (Int_t i=0; i<((AliITSCalibrationSPD*)calObj->At(module))->GetNrBad(); i++) {
640 SetDeadPixelM(module,
641 ((AliITSCalibrationSPD*)calObj->At(module))->GetBadColAt(i),
642 ((AliITSCalibrationSPD*)calObj->At(module))->GetBadRowAt(i));
647 //____________________________________________________________________________________________
648 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromCalibObj(TObjArray* calObj) {
649 // reads noisy pixels from calib object
650 for (UInt_t module=0; module<240; module++) {
651 for (Int_t i=0; i<((AliITSCalibrationSPD*)calObj->At(module))->GetNrBad(); i++) {
652 SetNoisyPixelM(module,
653 ((AliITSCalibrationSPD*)calObj->At(module))->GetBadColAt(i),
654 ((AliITSCalibrationSPD*)calObj->At(module))->GetBadRowAt(i));
659 //____________________________________________________________________________________________
660 Bool_t AliITSOnlineCalibrationSPDhandler::WriteToDB(Int_t runNrStart, Int_t runNrEnd) {
661 // writes dead and noisy pixels to DB for given runNrs
662 // overwrites any previous entries
663 return (WriteNoisyToDB(runNrStart,runNrEnd) && WriteDeadToDB(runNrStart,runNrEnd));
665 //____________________________________________________________________________________________
666 Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDB(Int_t runNrStart, Int_t runNrEnd) {
667 // writes dead pixels to DB for given runNrs
668 // overwrites any previous entries
669 AliCDBManager* man = AliCDBManager::Instance();
670 if(!man->IsDefaultStorageSet()) {
671 man->SetDefaultStorage("local://$ALICE_ROOT");
673 AliCDBMetaData* metaData = new AliCDBMetaData();
674 metaData->SetResponsible("Henrik Tydesjo");
675 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
676 AliCDBId idCalSPD("ITS/Calib/SPDDead",runNrStart,runNrEnd);
677 TObjArray* spdEntry = new TObjArray(240);
678 spdEntry->SetOwner(kTRUE);
679 for(UInt_t module=0; module<240; module++){
680 AliITSCalibrationSPD* calObj = new AliITSCalibrationSPD();
682 // *** this is temporarily hard coded here ********************
683 // (later these parameters will be separated from the cal.obj.)
684 calObj->SetThresholds(3000, 250);
685 calObj->SetBiasVoltage(18.182);
686 calObj->SetNoiseParam(0,0);
687 calObj->SetCouplingParam(0.,0.055);
688 // *** remove later...
689 // ************************************************************
691 spdEntry->Add(calObj);
693 for(UInt_t module=0; module<240; module++){
694 ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNrBad( GetNrSilent(module) );
695 ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetBadList( GetSilentArray(module) );
697 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
704 //____________________________________________________________________________________________
705 Bool_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToDB(Int_t runNrStart, Int_t runNrEnd) {
706 // writes noisy pixels to DB for given runNrs
707 // overwrites any previous entries
708 AliCDBManager* man = AliCDBManager::Instance();
709 if(!man->IsDefaultStorageSet()) {
710 man->SetDefaultStorage("local://$ALICE_ROOT");
712 AliCDBMetaData* metaData = new AliCDBMetaData();
713 metaData->SetResponsible("Henrik Tydesjo");
714 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
715 AliCDBId idCalSPD("ITS/Calib/SPDNoisy",runNrStart,runNrEnd);
716 TObjArray* spdEntry = new TObjArray(240);
717 spdEntry->SetOwner(kTRUE);
718 for(UInt_t module=0; module<240; module++){
719 AliITSCalibrationSPD* calObj = new AliITSCalibrationSPD();
721 // *** this is temporarily hard coded here ********************
722 // (later these parameters will be separated from the cal.obj.)
723 calObj->SetThresholds(3000, 250);
724 calObj->SetBiasVoltage(18.182);
725 calObj->SetNoiseParam(0,0);
726 calObj->SetCouplingParam(0.,0.055);
727 // *** remove later...
728 // ************************************************************
730 spdEntry->Add(calObj);
732 for(UInt_t module=0; module<240; module++){
733 ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNrBad( GetNrNoisy(module) );
734 ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetBadList( GetNoisyArray(module) );
736 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
743 //____________________________________________________________________________________________
744 void AliITSOnlineCalibrationSPDhandler::RecursiveInsertDead(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
745 // inserts dead pixels recursively, used when reading from db
746 if (lowInd>highInd) return;
747 Int_t thisInd = lowInd+(highInd-lowInd)/2;
748 SetDeadPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
749 RecursiveInsertDead(calibSPD,module,lowInd,thisInd-1);
750 RecursiveInsertDead(calibSPD,module,thisInd+1,highInd);
752 //____________________________________________________________________________________________
753 void AliITSOnlineCalibrationSPDhandler::RecursiveInsertNoisy(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
754 // inserts noisy pixels recursively, used when reading from db
755 if (lowInd>highInd) return;
756 Int_t thisInd = lowInd+(highInd-lowInd)/2;
757 SetNoisyPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
758 RecursiveInsertNoisy(calibSPD,module,lowInd,thisInd-1);
759 RecursiveInsertNoisy(calibSPD,module,thisInd+1,highInd);
763 //____________________________________________________________________________________________
764 void AliITSOnlineCalibrationSPDhandler::GenerateDCSConfigFile(const Char_t* fileName) {
765 // generates an ascii file in the format as the one produced by online da (but with dummy runNr=0)
767 dcsfile.open(fileName);
768 dcsfile << "[SPD SCAN]\n";
769 dcsfile << "RunNumber=" << "0" << "\n"; // dummy value
770 dcsfile << "Type=" << "4" << "\n";
771 dcsfile << "Router=" << "0" << "\n"; // dummy value
772 dcsfile << "ActualDetConfiguration=" << "0,-1,-1\n"; // dummy values
773 dcsfile << "[NOISY]\n";
774 for (UInt_t module=0; module<240; module++) {
775 UInt_t headkey=20*10*6;
776 for (UInt_t ind=0; ind<GetNrNoisy(module); ind++) {
777 UInt_t newkey = GetNoisyEqIdAt(module,ind)*10*6 +
778 GetNoisyHSAt(module,ind)*10 +
779 GetNoisyChipAt(module,ind);
780 if (newkey!=headkey) { // print eq,hs,chip header
782 dcsfile << "-" << newkey/(6*10) << "," << (newkey%(6*10))/10 << "," << (newkey%(6*10))%10 << "\n";
784 dcsfile << GetNoisyColAt(module,ind) << "," << GetNoisyRowAt(module,ind) << "\n";
789 //____________________________________________________________________________________________
790 TArrayS AliITSOnlineCalibrationSPDhandler::GetSilentArray(UInt_t module, Bool_t treeSerial) {
791 // get a TArrayS of the silent=dead+inactive pixels (format for the AliITSCalibrationSPD object)
794 UInt_t eq = GetEqIdFromOffline(module);
795 UInt_t hs = GetHSFromOffline(module);
797 if ( !( IsActiveEq(eq) && IsActiveHS(eq,hs) ) ) {
801 for (UInt_t ch=0; ch<5; ch++) {
802 UInt_t chip = GetChipFromOffline(module,ch*32);
803 if (!(IsActiveChip(eq,hs,chip))) {
807 UInt_t gloChip = GetGloChip(eq,hs,chip);
808 size += fNrDead[gloChip];
812 returnArray.Set(size*2);
815 if ( !( IsActiveEq(eq) && IsActiveHS(eq,hs) ) ) {
816 for (UInt_t colM=0; colM<160; colM++) {
817 for (UInt_t rowM=0; rowM<256; rowM++) {
818 returnArray.AddAt(colM,gloIndex*2);
819 returnArray.AddAt(rowM,gloIndex*2+1);
825 for (UInt_t ch=0; ch<5; ch++) {
826 UInt_t chip = GetChipFromOffline(module,ch*32);
827 if (!(IsActiveChip(eq,hs,chip))) {
828 for (UInt_t colM=ch*32; colM<ch*32+32; colM++) {
829 for (UInt_t rowM=0; rowM<256; rowM++) {
830 returnArray.AddAt(colM,gloIndex*2);
831 returnArray.AddAt(rowM,gloIndex*2+1);
837 UInt_t gloChip = GetGloChip(eq,hs,chip);
838 if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
839 else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
840 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
841 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
842 Int_t colM = GetColMFromKey(key);
843 Int_t rowM = GetRowMFromKey(key);
844 returnArray.AddAt(colM,gloIndex*2);
845 returnArray.AddAt(rowM,gloIndex*2+1);
853 //____________________________________________________________________________________________
854 TArrayS AliITSOnlineCalibrationSPDhandler::GetDeadArray(UInt_t module, Bool_t treeSerial) {
855 // get a TArrayS of the dead pixels (format for the AliITSCalibrationSPD object)
858 UInt_t eq = GetEqIdFromOffline(module);
859 UInt_t hs = GetHSFromOffline(module);
861 for (UInt_t ch=0; ch<5; ch++) {
862 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
863 size += fNrDead[gloChip];
865 returnArray.Set(size*2);
867 for (UInt_t ch=0; ch<5; ch++) {
868 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
869 if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
870 else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
871 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
872 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
873 Int_t colM = GetColMFromKey(key);
874 Int_t rowM = GetRowMFromKey(key);
875 returnArray.AddAt(colM,gloIndex*2);
876 returnArray.AddAt(rowM,gloIndex*2+1);
882 //____________________________________________________________________________________________
883 TArrayS AliITSOnlineCalibrationSPDhandler::GetNoisyArray(UInt_t module, Bool_t treeSerial) {
884 // get a TArrayS of the noisy pixels (format for the AliITSCalibrationSPD object)
887 UInt_t eq = GetEqIdFromOffline(module);
888 UInt_t hs = GetHSFromOffline(module);
890 for (UInt_t ch=0; ch<5; ch++) {
891 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
892 size += fNrNoisy[gloChip];
894 returnArray.Set(size*2);
896 for (UInt_t ch=0; ch<5; ch++) {
897 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
898 if (treeSerial) fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
899 else fNoisyPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
900 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
901 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
902 Int_t colM = GetColMFromKey(key);
903 Int_t rowM = GetRowMFromKey(key);
904 returnArray.AddAt(colM,gloIndex*2);
905 returnArray.AddAt(rowM,gloIndex*2+1);
911 //____________________________________________________________________________________________
912 TArrayI AliITSOnlineCalibrationSPDhandler::GetDeadArrayOnline(UInt_t eq) {
913 // get a TArrayI of the dead pixels (format for the AliITSOnlineCalibrationSPD object)
917 for (UInt_t hs=0; hs<6; hs++) {
918 for (UInt_t chip=0; chip<10; chip++) {
919 UInt_t gloChip = GetGloChip(eq,hs,chip);
920 size+=fNrDead[gloChip];
923 returnArray.Set(size);
926 for (UInt_t hs=0; hs<6; hs++) {
927 for (UInt_t chip=0; chip<10; chip++) {
928 UInt_t gloChip = GetGloChip(eq,hs,chip);
929 fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
930 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
931 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
932 returnArray.AddAt(key,gloIndex);
939 //____________________________________________________________________________________________
940 TArrayI AliITSOnlineCalibrationSPDhandler::GetNoisyArrayOnline(UInt_t eq) {
941 // get a TArrayI of the noisy pixels (format for the AliITSOnlineCalibrationSPD object)
945 for (UInt_t hs=0; hs<6; hs++) {
946 for (UInt_t chip=0; chip<10; chip++) {
947 UInt_t gloChip = GetGloChip(eq,hs,chip);
948 size+=fNrNoisy[gloChip];
951 returnArray.Set(size);
954 for (UInt_t hs=0; hs<6; hs++) {
955 for (UInt_t chip=0; chip<10; chip++) {
956 UInt_t gloChip = GetGloChip(eq,hs,chip);
957 fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
958 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
959 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
960 returnArray.AddAt(key,gloIndex);
967 //____________________________________________________________________________________________
968 void AliITSOnlineCalibrationSPDhandler::PrintEqSummary() {
969 // print summary (nr of dead and noisy) for each equipment
970 printf("-----------\n");
971 printf("Eq summary:\n");
972 printf("-----------\n");
973 for (UInt_t eq=0; eq<20; eq++) {
974 printf("Eq %*d: %*d silent(dead+inactive) , %*d dead , %*d noisy\n",2,eq,5,GetNrSilentEq(eq),5,GetNrDeadEq(eq),5,GetNrNoisyEq(eq));
977 //____________________________________________________________________________________________
978 void AliITSOnlineCalibrationSPDhandler::PrintSilent() const {
979 // print the inactive and dead pixels to screen
980 printf("------------------------------------------------------\n");
981 printf("Inactive Equipments: (eq | module1 .. module12)\n");
982 printf("------------------------------------------------------\n");
983 for (UInt_t eq=0; eq<20; eq++) {
984 if (!IsActiveEq(eq)) {
985 printf("%*d | ",2,eq);
986 for (UInt_t hs=0; hs<6; hs++) {
987 for (UInt_t chip=0; chip<10; chip+=5) {
988 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
989 if (hs>0 || chip==5) printf(",");
990 printf("%*d",3,module);
997 printf("------------------------------------------------------\n");
998 printf("Inactive Half-staves: (eq,hs | module1,module2)\n");
999 printf("------------------------------------------------------\n");
1000 for (UInt_t eq=0; eq<20; eq++) {
1001 if (IsActiveEq(eq)) {
1002 for (UInt_t hs=0; hs<6; hs++) {
1003 if (!IsActiveHS(eq,hs)) {
1004 printf("%*d,%*d | ",2,eq,1,hs);
1005 for (UInt_t chip=0; chip<10; chip+=5) {
1006 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1007 if (chip==5) printf(",");
1008 printf("%*d",3,module);
1016 printf("------------------------------------------------------\n");
1017 printf("Inactive Chips: (eq,hs,chip | module,colM1-colM2)\n");
1018 printf("------------------------------------------------------\n");
1019 for (UInt_t eq=0; eq<20; eq++) {
1020 if (IsActiveEq(eq)) {
1021 for (UInt_t hs=0; hs<6; hs++) {
1022 if (IsActiveHS(eq,hs)) {
1023 for (UInt_t chip=0; chip<10; chip++) {
1024 if (!IsActiveChip(eq,hs,chip)) {
1025 printf("%*d,%*d,%*d | ",2,eq,1,hs,1,chip);
1026 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1027 UInt_t colM1 = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,0);
1028 UInt_t colM2 = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,31);
1029 printf("%*d,%*d-%*d\n",3,module,3,colM1,3,colM2);
1039 //!!! printf("------------------------------------------------------\n");
1040 //!!! printf("Dead Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
1041 //!!! printf("------------------------------------------------------\n");
1042 //!!! for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1043 //!!! for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1044 //!!! Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1045 //!!! UInt_t eq = GetEqIdFromKey(key);
1046 //!!! UInt_t hs = GetHSFromKey(key);
1047 //!!! UInt_t chip = GetChipFromKey(key);
1048 //!!! if (!( IsActiveEq(eq) && IsActiveHS(eq,hs) && IsActiveChip(eq,hs,chip) )) continue;
1049 //!!! UInt_t col = GetColFromKey(key);
1050 //!!! UInt_t row = GetRowFromKey(key);
1052 //!!! UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1053 //!!! UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1054 //!!! UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1056 //!!! 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);
1061 //____________________________________________________________________________________________
1062 void AliITSOnlineCalibrationSPDhandler::PrintDead() const {
1063 // print the single dead pixels to screen (disregards inactive eq,hs,chip)
1064 printf("------------------------------------------------------\n");
1065 printf("Dead Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
1066 printf("------------------------------------------------------\n");
1067 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1068 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1069 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1070 UInt_t eq = GetEqIdFromKey(key);
1071 UInt_t hs = GetHSFromKey(key);
1072 UInt_t chip = GetChipFromKey(key);
1073 UInt_t col = GetColFromKey(key);
1074 UInt_t row = GetRowFromKey(key);
1076 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1077 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1078 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1080 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);
1084 //____________________________________________________________________________________________
1085 void AliITSOnlineCalibrationSPDhandler::PrintNoisy() const {
1086 // print the dead pixels to screen
1087 printf("-------------------------------------------------------\n");
1088 printf("Noisy Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
1089 printf("-------------------------------------------------------\n");
1090 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1091 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
1092 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1093 UInt_t eq = GetEqIdFromKey(key);
1094 UInt_t hs = GetHSFromKey(key);
1095 UInt_t chip = GetChipFromKey(key);
1096 UInt_t col = GetColFromKey(key);
1097 UInt_t row = GetRowFromKey(key);
1099 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1100 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1101 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1103 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);
1107 //____________________________________________________________________________________________
1108 Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1109 // set a dead pixel, returns false if pixel is already dead
1110 UInt_t gloChip = GetGloChip(eq,hs,chip);
1111 if (gloChip>=1200) {
1112 Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1115 if (col>=32 && row>=256) {
1116 Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
1119 Int_t key = GetKey(eq,hs,chip,col,row);
1120 // if noisy we dont want to add it...
1121 if (fNoisyPixelMap[gloChip]->Find(key) != NULL) return kFALSE;
1122 if (fDeadPixelMap[gloChip]->Insert(key,gloChip)) {
1128 //____________________________________________________________________________________________
1129 Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1130 // set a noisy pixel, returns false if pixel is already noisy
1131 UInt_t gloChip = GetGloChip(eq,hs,chip);
1132 if (gloChip>=1200) {
1133 Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1136 if (col>=32 && row>=256) {
1137 Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
1140 Int_t key = GetKey(eq,hs,chip,col,row);
1141 // if dead before - remove from the dead list
1142 if (fDeadPixelMap[gloChip]->Remove(key)) {
1145 if (fNoisyPixelMap[gloChip]->Insert(key,gloChip)) {
1146 fNrNoisy[gloChip]++;
1151 //____________________________________________________________________________________________
1152 Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1153 // set a dead pixel, returns false if pixel is already dead
1154 UInt_t eq = GetEqIdFromOffline(module);
1155 UInt_t hs = GetHSFromOffline(module);
1156 UInt_t chip = GetChipFromOffline(module,colM);
1157 UInt_t col = GetColFromOffline(module,colM);
1158 UInt_t row = GetRowFromOffline(module,rowM);
1159 return SetDeadPixel(eq,hs,chip,col,row);
1161 //____________________________________________________________________________________________
1162 Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1163 // set a noisy pixel, returns false if pixel is already noisy
1164 UInt_t eq = GetEqIdFromOffline(module);
1165 UInt_t hs = GetHSFromOffline(module);
1166 UInt_t chip = GetChipFromOffline(module,colM);
1167 UInt_t col = GetColFromOffline(module,colM);
1168 UInt_t row = GetRowFromOffline(module,rowM);
1169 return SetNoisyPixel(eq,hs,chip,col,row);
1171 //____________________________________________________________________________________________
1172 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1173 // unset a dead pixel, returns false if pixel is not dead
1174 UInt_t gloChip = GetGloChip(eq,hs,chip);
1175 if (gloChip>=1200) {
1176 Error("AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1179 Int_t key = GetKey(eq,hs,chip,col,row);
1180 if (fDeadPixelMap[gloChip]->Remove(key)) {
1186 //____________________________________________________________________________________________
1187 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1188 // unset a noisy pixel, returns false if pixel is not noisy
1189 UInt_t gloChip = GetGloChip(eq,hs,chip);
1190 if (gloChip>=1200) {
1191 Error("AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1194 Int_t key = GetKey(eq,hs,chip,col,row);
1195 if (fNoisyPixelMap[gloChip]->Remove(key)) {
1196 fNrNoisy[gloChip]--;
1201 //____________________________________________________________________________________________
1202 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1203 // unset a dead pixel, returns false if pixel is not dead
1204 UInt_t eq = GetEqIdFromOffline(module);
1205 UInt_t hs = GetHSFromOffline(module);
1206 UInt_t chip = GetChipFromOffline(module,colM);
1207 UInt_t col = GetColFromOffline(module,colM);
1208 UInt_t row = GetRowFromOffline(module,rowM);
1209 return UnSetDeadPixel(eq,hs,chip,col,row);
1211 //____________________________________________________________________________________________
1212 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1213 // unset a noisy pixel, returns false if pixel is not noisy
1214 UInt_t eq = GetEqIdFromOffline(module);
1215 UInt_t hs = GetHSFromOffline(module);
1216 UInt_t chip = GetChipFromOffline(module,colM);
1217 UInt_t col = GetColFromOffline(module,colM);
1218 UInt_t row = GetRowFromOffline(module,rowM);
1219 return UnSetNoisyPixel(eq,hs,chip,col,row);
1221 //____________________________________________________________________________________________
1222 UInt_t AliITSOnlineCalibrationSPDhandler::SetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip) {
1223 // set a full chip dead, returns nr of new dead pixels
1225 for (UInt_t col=0; col<32; col++) {
1226 for (UInt_t row=0; row<256; row++) {
1227 if (SetDeadPixel(eq,hs,chip,col,row)) {
1234 //____________________________________________________________________________________________
1235 UInt_t AliITSOnlineCalibrationSPDhandler::SetNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip) {
1236 // set a full chip noisy, returns nr of new noisy pixels
1238 for (UInt_t col=0; col<32; col++) {
1239 for (UInt_t row=0; row<256; row++) {
1240 if (SetNoisyPixel(eq,hs,chip,col,row)) {
1247 //____________________________________________________________________________________________
1248 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip) {
1249 // unset a full dead chip, returns false if it was not all dead before
1251 for (UInt_t col=0; col<32; col++) {
1252 for (UInt_t row=0; row<256; row++) {
1253 if (UnSetDeadPixel(eq,hs,chip,col,row)) {
1258 if (nrUnset+GetNrNoisyC(eq,hs,chip)<8192) return kFALSE;
1261 //____________________________________________________________________________________________
1262 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip) {
1263 // unset a full noisy chip, returns false if it was not all noisy before
1265 for (UInt_t col=0; col<32; col++) {
1266 for (UInt_t row=0; row<256; row++) {
1267 if (UnSetNoisyPixel(eq,hs,chip,col,row)) {
1272 if (nrUnset<8192) return kFALSE;
1275 //____________________________________________________________________________________________
1276 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilent(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1277 // is the pixel silent (dead or inactive)?
1278 UInt_t gloChip = GetGloChip(eq,hs,chip);
1279 if (gloChip>=1200 || col>=32 || row>=256) {
1280 Error("AliITSOnlineCalibrationSPDhandler::IsPixelSilent", "eq,hs,chip,col,row nrs (%d,%d,%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
1283 if (!(IsActiveEq(eq) && IsActiveHS(eq,hs) && IsActiveChip(eq,hs,chip))) return kTRUE;
1284 else return IsPixelDead(eq,hs,chip,col,row);
1286 //____________________________________________________________________________________________
1287 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDead(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1289 UInt_t gloChip = GetGloChip(eq,hs,chip);
1290 if (gloChip>=1200 || col>=32 || row>=256) {
1291 Error("AliITSOnlineCalibrationSPDhandler::IsPixelDead", "eq,hs,chip,col,row nrs (%d,%d,%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
1294 UInt_t key = GetKey(eq,hs,chip,col,row);
1295 if ( fDeadPixelMap[gloChip]->Find(key) != NULL ) return kTRUE;
1298 //____________________________________________________________________________________________
1299 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisy(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1300 // is the pixel noisy?
1301 UInt_t gloChip = GetGloChip(eq,hs,chip);
1302 if (gloChip>=1200 || col>=32 || row>=256) {
1303 Error("AliITSOnlineCalibrationSPDhandler::IsPixelNoisy", "eq,hs,chip,col,row nrs (%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
1306 UInt_t key = GetKey(eq,hs,chip,col,row);
1307 if ( fNoisyPixelMap[gloChip]->Find(key) != NULL ) return kTRUE;
1310 //____________________________________________________________________________________________
1311 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilentM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1312 // is the pixel silent (dead or inactive)?
1313 UInt_t eq = GetEqIdFromOffline(module);
1314 UInt_t hs = GetHSFromOffline(module);
1315 UInt_t chip = GetChipFromOffline(module,colM);
1316 UInt_t col = GetColFromOffline(module,colM);
1317 UInt_t row = GetRowFromOffline(module,rowM);
1318 return IsPixelSilent(eq,hs,chip,col,row);
1320 //____________________________________________________________________________________________
1321 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1322 // is the pixel dead?
1323 UInt_t eq = GetEqIdFromOffline(module);
1324 UInt_t hs = GetHSFromOffline(module);
1325 UInt_t chip = GetChipFromOffline(module,colM);
1326 UInt_t col = GetColFromOffline(module,colM);
1327 UInt_t row = GetRowFromOffline(module,rowM);
1328 return IsPixelDead(eq,hs,chip,col,row);
1330 //____________________________________________________________________________________________
1331 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1332 // is the pixel noisy?
1333 UInt_t eq = GetEqIdFromOffline(module);
1334 UInt_t hs = GetHSFromOffline(module);
1335 UInt_t chip = GetChipFromOffline(module,colM);
1336 UInt_t col = GetColFromOffline(module,colM);
1337 UInt_t row = GetRowFromOffline(module,rowM);
1338 return IsPixelNoisy(eq,hs,chip,col,row);
1340 //____________________________________________________________________________________________
1341 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilentKey(Int_t key) const {
1342 // is this pixel silent (dead or inactive)?
1343 UInt_t eq = GetEqIdFromKey(key);
1344 UInt_t hs = GetHSFromKey(key);
1345 UInt_t chip = GetChipFromKey(key);
1346 UInt_t col = GetColFromKey(key);
1347 UInt_t row = GetRowFromKey(key);
1348 return IsPixelSilent(eq,hs,chip,col,row);
1350 //____________________________________________________________________________________________
1351 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadKey(Int_t key) const {
1352 // is this pixel dead?
1353 UInt_t eq = GetEqIdFromKey(key);
1354 UInt_t hs = GetHSFromKey(key);
1355 UInt_t chip = GetChipFromKey(key);
1356 UInt_t col = GetColFromKey(key);
1357 UInt_t row = GetRowFromKey(key);
1358 return IsPixelDead(eq,hs,chip,col,row);
1360 //____________________________________________________________________________________________
1361 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyKey(Int_t key) const {
1362 // is this pixel noisy?
1363 UInt_t eq = GetEqIdFromKey(key);
1364 UInt_t hs = GetHSFromKey(key);
1365 UInt_t chip = GetChipFromKey(key);
1366 UInt_t col = GetColFromKey(key);
1367 UInt_t row = GetRowFromKey(key);
1368 return IsPixelNoisy(eq,hs,chip,col,row);
1370 //____________________________________________________________________________________________
1371 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilent() const {
1372 // returns the total nr of silent pixels (dead or inactive)
1374 for (UInt_t eq=0; eq<20; eq++) {
1375 if (!IsActiveEq(eq)) {
1379 for (UInt_t hs=0; hs<6; hs++) {
1380 if (!IsActiveHS(eq,hs)) {
1384 for (UInt_t chip=0; chip<10; chip++) {
1385 if (!IsActiveChip(eq,hs,chip)) {
1390 UInt_t gloChip = GetGloChip(eq,hs,chip);
1391 nrDead+=fNrDead[gloChip];
1398 //____________________________________________________________________________________________
1399 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead() const {
1400 // returns the total nr of dead pixels
1402 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1403 nrDead+=fNrDead[gloChip];
1407 //____________________________________________________________________________________________
1408 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy() const {
1409 // returns the total nr of noisy pixels
1411 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1412 nrNoisy+=fNrNoisy[gloChip];
1416 //____________________________________________________________________________________________
1417 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t index) {
1418 // get eq for the dead pixel at position index in list of dead
1421 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1422 return GetDeadEqIdAtC2(gloChip,chipIndex);
1424 //____________________________________________________________________________________________
1425 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t index) {
1426 // get eq for the noisy pixel at position index in list of noisy
1429 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1430 return GetNoisyEqIdAtC2(gloChip,chipIndex);
1432 //____________________________________________________________________________________________
1433 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t index) {
1434 // get hs for the dead pixel at position index in list of dead
1437 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1438 return GetDeadHSAtC2(gloChip,chipIndex);
1440 //____________________________________________________________________________________________
1441 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t index) {
1442 // get hs for the noisy pixel at position index in list of noisy
1445 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1446 return GetNoisyHSAtC2(gloChip,chipIndex);
1448 //____________________________________________________________________________________________
1449 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t index) {
1450 // get chip for the dead pixel at position index in list of dead
1453 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1454 return GetDeadChipAtC2(gloChip,chipIndex);
1456 //____________________________________________________________________________________________
1457 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t index) {
1458 // get chip for the noisy pixel at position index in list of noisy
1461 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1462 return GetNoisyChipAtC2(gloChip,chipIndex);
1464 //____________________________________________________________________________________________
1465 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t index) {
1466 // get hs for the dead pixel at position index in list of dead
1469 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1470 return GetDeadColAtC2(gloChip,chipIndex);
1472 //____________________________________________________________________________________________
1473 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t index) {
1474 // get hs for the noisy pixel at position index in list of noisy
1477 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1478 return GetNoisyColAtC2(gloChip,chipIndex);
1480 //____________________________________________________________________________________________
1481 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t index) {
1482 // get hs for the dead pixel at position index in list of dead
1485 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1486 return GetDeadRowAtC2(gloChip,chipIndex);
1488 //____________________________________________________________________________________________
1489 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t index) {
1490 // get hs for the noisy pixel at position index in list of noisy
1493 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1494 return GetNoisyRowAtC2(gloChip,chipIndex);
1496 //____________________________________________________________________________________________
1497 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilent(UInt_t module) const {
1498 // returns the number of silent pixels for a certain module (dead or inactive)
1500 Error("AliITSOnlineCalibrationSPDhandler::GetNrSilent", "module nr (%d) out of bounds.",module);
1503 UInt_t nrSilent = 0;
1504 UInt_t eq = GetEqIdFromOffline(module);
1505 if (!IsActiveEq(eq)) return 160*256;
1506 UInt_t hs = GetHSFromOffline(module);
1507 if (!IsActiveHS(eq,hs)) return 160*256;
1508 for (UInt_t ch=0; ch<5; ch++) {
1509 UInt_t chip = GetChipFromOffline(module,ch*32);
1510 if (!IsActiveChip(eq,hs,chip)) {
1514 UInt_t gloChip = GetGloChip(eq,hs,chip);
1515 nrSilent+=fNrDead[gloChip];
1520 //____________________________________________________________________________________________
1521 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead(UInt_t module) const {
1522 // returns the number of dead pixels for a certain module
1524 Error("AliITSOnlineCalibrationSPDhandler::GetNrDead", "module nr (%d) out of bounds.",module);
1528 UInt_t eq = GetEqIdFromOffline(module);
1529 UInt_t hs = GetHSFromOffline(module);
1530 for (UInt_t ch=0; ch<5; ch++) {
1531 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
1532 nrDead+=fNrDead[gloChip];
1536 //____________________________________________________________________________________________
1537 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy(UInt_t module) const {
1538 // returns the number of noisy pixels for a certain module
1540 Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisy", "module nr (%d) out of bounds.",module);
1544 UInt_t eq = GetEqIdFromOffline(module);
1545 UInt_t hs = GetHSFromOffline(module);
1546 for (UInt_t ch=0; ch<5; ch++) {
1547 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
1548 nrNoisy+=fNrNoisy[gloChip];
1552 //____________________________________________________________________________________________
1553 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t module, UInt_t index) {
1554 // get eq for the dead pixel at position index in list of dead
1557 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1558 return GetDeadEqIdAtC2(gloChip,chipIndex);
1560 //____________________________________________________________________________________________
1561 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t module, UInt_t index) {
1562 // get eq for the noisy pixel at position index in list of noisy
1565 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1566 return GetNoisyEqIdAtC2(gloChip,chipIndex);
1568 //____________________________________________________________________________________________
1569 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t module, UInt_t index) {
1570 // get hs for the dead pixel at position index in list of dead
1573 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1574 return GetDeadHSAtC2(gloChip,chipIndex);
1576 //____________________________________________________________________________________________
1577 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t module, UInt_t index) {
1578 // get hs for the noisy pixel at position index in list of noisy
1581 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1582 return GetNoisyHSAtC2(gloChip,chipIndex);
1584 //____________________________________________________________________________________________
1585 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t module, UInt_t index) {
1586 // get chip for the dead pixel at position index in list of dead
1589 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1590 return GetDeadChipAtC2(gloChip,chipIndex);
1592 //____________________________________________________________________________________________
1593 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t module, UInt_t index) {
1594 // get chip for the noisy pixel at position index in list of noisy
1597 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1598 return GetNoisyChipAtC2(gloChip,chipIndex);
1600 //____________________________________________________________________________________________
1601 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t module, UInt_t index) {
1602 // get hs for the dead pixel at position index in list of dead
1605 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1606 return GetDeadColAtC2(gloChip,chipIndex);
1608 //____________________________________________________________________________________________
1609 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t module, UInt_t index) {
1610 // get hs for the noisy pixel at position index in list of noisy
1613 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1614 return GetNoisyColAtC2(gloChip,chipIndex);
1616 //____________________________________________________________________________________________
1617 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t module, UInt_t index) {
1618 // get hs for the dead pixel at position index in list of dead
1621 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1622 return GetDeadRowAtC2(gloChip,chipIndex);
1624 //____________________________________________________________________________________________
1625 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t module, UInt_t index) {
1626 // get hs for the noisy pixel at position index in list of noisy
1629 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1630 return GetNoisyRowAtC2(gloChip,chipIndex);
1632 //____________________________________________________________________________________________
1633 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentEq(UInt_t eq) const {
1634 // returns nr of silent for eq (dead or inactive)
1636 if (!IsActiveEq(eq)) return 81920*6;
1637 for (UInt_t hs=0; hs<6; hs++) {
1638 if (!IsActiveHS(eq,hs)) {
1642 for (UInt_t chip=0; chip<10; chip++) {
1643 if (!IsActiveChip(eq,hs,chip)) {
1648 returnval+=GetNrDeadC(eq,hs,chip);
1654 //____________________________________________________________________________________________
1655 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadEq(UInt_t eq) const {
1656 // returns nr of dead for eq
1658 for (UInt_t hs=0; hs<6; hs++) {
1659 for (UInt_t chip=0; chip<10; chip++) {
1660 returnval+=GetNrDeadC(eq,hs,chip);
1665 //____________________________________________________________________________________________
1666 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyEq(UInt_t eq) const {
1667 // returns nr of noisy for eq
1669 for (UInt_t hs=0; hs<6; hs++) {
1670 for (UInt_t chip=0; chip<10; chip++) {
1671 returnval+=GetNrNoisyC(eq,hs,chip);
1676 //____________________________________________________________________________________________
1677 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtEq(UInt_t eq, UInt_t index) const {
1678 // get eq for the dead pixel at position index in list of dead
1679 if (eq<20 && index<GetNrDeadEq(eq)) {
1686 //____________________________________________________________________________________________
1687 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtEq(UInt_t eq, UInt_t index) const {
1688 // get eq for the noisy pixel at position index in list of noisy
1689 if (eq<20 && index<GetNrNoisyEq(eq)) {
1696 //____________________________________________________________________________________________
1697 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtEq(UInt_t eq, UInt_t index) {
1698 // get hs for the dead pixel at position index in list of dead
1701 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1702 return GetDeadHSAtC2(gloChip,chipIndex);
1704 //____________________________________________________________________________________________
1705 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtEq(UInt_t eq, UInt_t index) {
1706 // get hs for the noisy pixel at position index in list of noisy
1709 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1710 return GetNoisyHSAtC2(gloChip,chipIndex);
1712 //____________________________________________________________________________________________
1713 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtEq(UInt_t eq, UInt_t index) {
1714 // get chip for the dead pixel at position index in list of dead
1717 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1718 return GetDeadChipAtC2(gloChip,chipIndex);
1720 //____________________________________________________________________________________________
1721 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtEq(UInt_t eq, UInt_t index) {
1722 // get chip for the noisy pixel at position index in list of noisy
1725 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1726 return GetNoisyChipAtC2(gloChip,chipIndex);
1728 //____________________________________________________________________________________________
1729 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtEq(UInt_t eq, UInt_t index) {
1730 // get hs for the dead pixel at position index in list of dead
1733 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1734 return GetDeadColAtC2(gloChip,chipIndex);
1736 //____________________________________________________________________________________________
1737 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtEq(UInt_t eq, UInt_t index) {
1738 // get hs for the noisy pixel at position index in list of noisy
1741 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1742 return GetNoisyColAtC2(gloChip,chipIndex);
1744 //____________________________________________________________________________________________
1745 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtEq(UInt_t eq, UInt_t index) {
1746 // get hs for the dead pixel at position index in list of dead
1749 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1750 return GetDeadRowAtC2(gloChip,chipIndex);
1752 //____________________________________________________________________________________________
1753 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtEq(UInt_t eq, UInt_t index) {
1754 // get hs for the noisy pixel at position index in list of noisy
1757 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1758 return GetNoisyRowAtC2(gloChip,chipIndex);
1760 //____________________________________________________________________________________________
1761 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentC(UInt_t eq, UInt_t hs, UInt_t chip) const {
1762 // returns nr of silent for chip (dead or inactive)
1763 if (!(IsActiveEq(eq) && IsActiveHS(eq,hs) && IsActiveChip(eq,hs,chip))) return 8192;
1764 else return GetNrDeadC(eq,hs,chip);
1766 //____________________________________________________________________________________________
1767 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
1768 // returns nr of dead for chip
1769 UInt_t gloChip = GetGloChip(eq,hs,chip);
1770 return GetNrDeadC2(gloChip);
1772 //____________________________________________________________________________________________
1773 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC(UInt_t eq, UInt_t hs, UInt_t chip) const {
1774 // returns nr of noisy for chip
1775 UInt_t gloChip = GetGloChip(eq,hs,chip);
1776 return GetNrNoisyC2(gloChip);
1778 //____________________________________________________________________________________________
1779 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1780 UInt_t gloChip = GetGloChip(eq,hs,chip);
1781 return GetDeadEqIdAtC2(gloChip,index);
1783 //____________________________________________________________________________________________
1784 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1785 UInt_t gloChip = GetGloChip(eq,hs,chip);
1786 return GetNoisyEqIdAtC2(gloChip,index);
1788 //____________________________________________________________________________________________
1789 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1790 UInt_t gloChip = GetGloChip(eq,hs,chip);
1791 return GetDeadHSAtC2(gloChip,index);
1793 //____________________________________________________________________________________________
1794 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1795 UInt_t gloChip = GetGloChip(eq,hs,chip);
1796 return GetNoisyHSAtC2(gloChip,index);
1798 //____________________________________________________________________________________________
1799 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1800 UInt_t gloChip = GetGloChip(eq,hs,chip);
1801 return GetDeadChipAtC2(gloChip,index);
1803 //____________________________________________________________________________________________
1804 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1805 UInt_t gloChip = GetGloChip(eq,hs,chip);
1806 return GetNoisyChipAtC2(gloChip,index);
1808 //____________________________________________________________________________________________
1809 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1810 UInt_t gloChip = GetGloChip(eq,hs,chip);
1811 return GetDeadColAtC2(gloChip,index);
1813 //____________________________________________________________________________________________
1814 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1815 UInt_t gloChip = GetGloChip(eq,hs,chip);
1816 return GetNoisyColAtC2(gloChip,index);
1818 //____________________________________________________________________________________________
1819 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1820 UInt_t gloChip = GetGloChip(eq,hs,chip);
1821 return GetDeadRowAtC2(gloChip,index);
1823 //____________________________________________________________________________________________
1824 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1825 UInt_t gloChip = GetGloChip(eq,hs,chip);
1826 return GetNoisyRowAtC2(gloChip,index);
1828 //____________________________________________________________________________________________
1829 const Char_t* AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1830 // get a string of dead pixel info
1831 TString returnMess = "";
1832 UInt_t gloChip = GetGloChip(eq,hs,chip);
1833 if (gloChip>=1200) {
1834 Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
1835 return returnMess.Data();
1837 if (index<fNrDead[gloChip]) {
1838 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1839 UInt_t col = GetColFromKey(key);
1840 UInt_t row = GetRowFromKey(key);
1841 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1842 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1843 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1844 returnMess = Form("%*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);
1845 return returnMess.Data();
1848 Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "Index %d out of bounds.", index);
1849 return returnMess.Data();
1852 //____________________________________________________________________________________________
1853 const Char_t* AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1854 // get a string of noisy pixel info
1855 TString returnMess = "";
1856 UInt_t gloChip = GetGloChip(eq,hs,chip);
1857 if (gloChip>=1200) {
1858 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
1859 return returnMess.Data();
1861 if (index<fNrNoisy[gloChip]) {
1862 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1863 UInt_t col = GetColFromKey(key);
1864 UInt_t row = GetRowFromKey(key);
1865 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1866 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1867 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1868 returnMess = Form("%*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);
1869 return returnMess.Data();
1872 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "Index %d out of bounds.", index);
1873 return returnMess.Data();
1876 //____________________________________________________________________________________________
1877 UInt_t AliITSOnlineCalibrationSPDhandler::AddSilentFrom(AliITSOnlineCalibrationSPDhandler* other) {
1878 // returns number of new silent pixels in this' list (dead or inactive)
1879 UInt_t tmpdead = GetNrSilent();
1881 for (UInt_t eq=0; eq<20; eq++) {
1882 if (!(other->IsActiveEq(eq))) ActivateEq(eq,kFALSE);
1883 for (UInt_t hs=0; hs<6; hs++) {
1884 if (!(other->IsActiveHS(eq,hs))) ActivateHS(eq,hs,kFALSE);
1885 for (UInt_t chip=0; chip<10; chip++) {
1886 if (!(other->IsActiveChip(eq,hs,chip))) ActivateChip(eq,hs,chip,kFALSE);
1893 return GetNrSilent() - tmpdead;
1895 //____________________________________________________________________________________________
1896 UInt_t AliITSOnlineCalibrationSPDhandler::AddDeadFrom(AliITSOnlineCalibrationSPDhandler* other) {
1897 // returns number of new dead pixels in this' list
1899 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1900 for (UInt_t ind1=0; ind1<other->fNrDead[gloChip]; ind1++) {
1901 UInt_t eq = other->GetDeadEqIdAtC2(gloChip,ind1);
1902 UInt_t hs = other->GetDeadHSAtC2(gloChip,ind1);
1903 UInt_t chip = other->GetDeadChipAtC2(gloChip,ind1);
1904 UInt_t col = other->GetDeadColAtC2(gloChip,ind1);
1905 UInt_t row = other->GetDeadRowAtC2(gloChip,ind1);
1906 if (SetDeadPixel(eq,hs,chip,col,row)) {
1913 //____________________________________________________________________________________________
1914 UInt_t AliITSOnlineCalibrationSPDhandler::AddNoisyFrom(AliITSOnlineCalibrationSPDhandler* other) {
1915 // returns number of new noisy pixels in this' list
1917 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1918 for (UInt_t ind1=0; ind1<other->fNrNoisy[gloChip]; ind1++) {
1919 UInt_t eq = other->GetNoisyEqIdAtC2(gloChip,ind1);
1920 UInt_t hs = other->GetNoisyHSAtC2(gloChip,ind1);
1921 UInt_t chip = other->GetNoisyChipAtC2(gloChip,ind1);
1922 UInt_t col = other->GetNoisyColAtC2(gloChip,ind1);
1923 UInt_t row = other->GetNoisyRowAtC2(gloChip,ind1);
1924 if (SetNoisyPixel(eq,hs,chip,col,row)) {
1931 //____________________________________________________________________________________________
1932 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDiff(AliITSOnlineCalibrationSPDhandler* other) const {
1933 // returns nr of dead/noisy in this' lists and not in other's lists (including inactive)
1934 return GetNrSilentDiff(other) + GetNrNoisyDiff(other);
1936 //____________________________________________________________________________________________
1937 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentDiff(AliITSOnlineCalibrationSPDhandler* other) const {
1938 // returns nr of single silent pixels in this' lists and not in other's lists (dead or inactive)
1940 for (UInt_t eq=0; eq<20; eq++) {
1941 for (UInt_t hs=0; hs<6; hs++) {
1942 for (UInt_t chip=0; chip<10; chip++) {
1943 if (!(IsActiveEq(eq) && IsActiveHS(eq,hs) && IsActiveChip(eq,hs,chip))) {
1944 if (other->IsActiveEq(eq) && other->IsActiveHS(eq,hs) && other->IsActiveChip(eq,hs,chip)) {
1945 // if this is inactive and the other is active...
1946 returnval+= 8192 - other->GetNrDeadC(eq,hs,chip);
1950 UInt_t gloChip = GetGloChip(eq,hs,chip);
1951 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
1952 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
1953 UInt_t col = GetColFromKey(key);
1954 UInt_t row = GetRowFromKey(key);
1955 if (!(other->IsPixelSilent(eq,hs,chip,col,row))) {
1965 //____________________________________________________________________________________________
1966 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
1967 // returns nr of dead in this' lists and not in other's lists
1969 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1970 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
1971 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
1972 UInt_t eq = GetEqIdFromKey(key);
1973 UInt_t hs = GetHSFromKey(key);
1974 UInt_t chip = GetChipFromKey(key);
1975 UInt_t col = GetColFromKey(key);
1976 UInt_t row = GetRowFromKey(key);
1977 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
1984 //____________________________________________________________________________________________
1985 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
1986 // returns nr of noisy in this' lists and not in other's lists
1988 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1989 for (UInt_t ind1=0; ind1<fNrNoisy[gloChip]; ind1++) {
1990 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind1);
1991 UInt_t eq = GetEqIdFromKey(key);
1992 UInt_t hs = GetHSFromKey(key);
1993 UInt_t chip = GetChipFromKey(key);
1994 UInt_t col = GetColFromKey(key);
1995 UInt_t row = GetRowFromKey(key);
1996 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2003 //____________________________________________________________________________________________
2004 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2005 // returns handler with active/dead/noisy in this' lists, removing those that are in other's lists
2006 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2008 for (UInt_t eq=0; eq<20; eq++) {
2009 if (!(IsActiveEq(eq))) {
2010 newHandler->ActivateEq(eq,kFALSE);
2011 if (!other->IsActiveEq(eq)) newHandler->ActivateEq(eq);
2013 for (UInt_t hs=0; hs<6; hs++) {
2014 if (!(IsActiveHS(eq,hs))) {
2015 newHandler->ActivateHS(eq,hs,kFALSE);
2016 if (!other->IsActiveHS(eq,hs)) newHandler->ActivateHS(eq,hs);
2018 for (UInt_t chip=0; chip<10; chip++) {
2019 if (!(IsActiveChip(eq,hs,chip))) {
2020 newHandler->ActivateChip(eq,hs,chip,kFALSE);
2021 if (!other->IsActiveChip(eq,hs,chip)) newHandler->ActivateHS(eq,hs,chip);
2027 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2028 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2029 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2030 UInt_t eq = GetEqIdFromKey(key);
2031 UInt_t hs = GetHSFromKey(key);
2032 UInt_t chip = GetChipFromKey(key);
2033 UInt_t col = GetColFromKey(key);
2034 UInt_t row = GetRowFromKey(key);
2035 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2036 newHandler->SetDeadPixel(eq,hs,chip,col,row);
2041 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2042 for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
2043 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
2044 UInt_t eq = GetEqIdFromKey(key);
2045 UInt_t hs = GetHSFromKey(key);
2046 UInt_t chip = GetChipFromKey(key);
2047 UInt_t col = GetColFromKey(key);
2048 UInt_t row = GetRowFromKey(key);
2049 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2050 newHandler->SetNoisyPixel(eq,hs,chip,col,row);
2057 //____________________________________________________________________________________________
2058 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetSilentDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2059 // returns handler with active/dead in this' lists, removing those that are in other's lists
2060 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2062 for (UInt_t eq=0; eq<20; eq++) {
2063 if (!(IsActiveEq(eq))) {
2064 newHandler->ActivateEq(eq,kFALSE);
2065 if (!other->IsActiveEq(eq)) newHandler->ActivateEq(eq);
2067 for (UInt_t hs=0; hs<6; hs++) {
2068 if (!(IsActiveHS(eq,hs))) {
2069 newHandler->ActivateHS(eq,hs,kFALSE);
2070 if (!other->IsActiveHS(eq,hs)) newHandler->ActivateHS(eq,hs);
2072 for (UInt_t chip=0; chip<10; chip++) {
2073 if (!(IsActiveChip(eq,hs,chip))) {
2074 newHandler->ActivateChip(eq,hs,chip,kFALSE);
2075 if (!other->IsActiveChip(eq,hs,chip)) newHandler->ActivateHS(eq,hs,chip);
2081 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2082 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2083 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2084 UInt_t eq = GetEqIdFromKey(key);
2085 UInt_t hs = GetHSFromKey(key);
2086 UInt_t chip = GetChipFromKey(key);
2087 UInt_t col = GetColFromKey(key);
2088 UInt_t row = GetRowFromKey(key);
2089 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2090 newHandler->SetDeadPixel(eq,hs,chip,col,row);
2097 //____________________________________________________________________________________________
2098 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2099 // returns handler with dead in this' lists, except for those in other's lists
2100 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2101 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2102 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2103 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2104 UInt_t eq = GetEqIdFromKey(key);
2105 UInt_t hs = GetHSFromKey(key);
2106 UInt_t chip = GetChipFromKey(key);
2107 UInt_t col = GetColFromKey(key);
2108 UInt_t row = GetRowFromKey(key);
2109 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2110 newHandler->SetDeadPixel(eq,hs,chip,col,row);
2116 //____________________________________________________________________________________________
2117 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2118 // returns handler with noisy in this' lists, except for those in other's lists
2119 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2120 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2121 for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
2122 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
2123 UInt_t eq = GetEqIdFromKey(key);
2124 UInt_t hs = GetHSFromKey(key);
2125 UInt_t chip = GetChipFromKey(key);
2126 UInt_t col = GetColFromKey(key);
2127 UInt_t row = GetRowFromKey(key);
2128 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2129 newHandler->SetNoisyPixel(eq,hs,chip,col,row);
2135 //____________________________________________________________________________________________
2136 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
2137 // find gloChip and chipIndex from module and index
2138 if (index<GetNrDead(module)) {
2139 UInt_t eq = GetEqIdFromOffline(module);
2140 UInt_t hs = GetHSFromOffline(module);
2143 for (UInt_t ch=0; ch<5; ch++) {
2144 gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
2145 if (glVal+fNrDead[gloChip]>index) {
2146 chipIndex = index-glVal;
2150 glVal+=fNrDead[gloChip];
2156 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead", "Index %d out of bounds.", index);
2159 //____________________________________________________________________________________________
2160 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
2161 // find gloChip and chipIndex from module and index
2162 if (index<GetNrNoisy(module)) {
2163 UInt_t eq = GetEqIdFromOffline(module);
2164 UInt_t hs = GetHSFromOffline(module);
2167 for (UInt_t ch=0; ch<5; ch++) {
2168 gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
2169 if (glVal+fNrNoisy[gloChip]>index) {
2170 chipIndex = index-glVal;
2174 glVal+=fNrNoisy[gloChip];
2180 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy", "Index %d out of bounds.", index);
2183 //____________________________________________________________________________________________
2184 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
2185 // find gloChip and chipIndex from module and index
2186 if (index<GetNrDeadEq(eq)) {
2189 for (UInt_t hs=0; hs<6; hs++) {
2190 for (UInt_t chip=0; chip<10; chip++) {
2191 gloChip = GetGloChip(eq,hs,chip);
2192 if (glVal+fNrDead[gloChip]>index) {
2193 chipIndex = index-glVal;
2197 glVal+=fNrDead[gloChip];
2204 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead", "Index %d out of bounds.", index);
2207 //____________________________________________________________________________________________
2208 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
2209 // find gloChip and chipIndex from module and index
2210 if (index<GetNrNoisyEq(eq)) {
2213 for (UInt_t hs=0; hs<6; hs++) {
2214 for (UInt_t chip=0; chip<10; chip++) {
2215 gloChip = GetGloChip(eq,hs,chip);
2216 if (glVal+fNrNoisy[gloChip]>index) {
2217 chipIndex = index-glVal;
2221 glVal+=fNrNoisy[gloChip];
2228 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy", "Index %d out of bounds.", index);
2231 //____________________________________________________________________________________________
2232 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
2233 // find gloChip and chipIndex from global index
2234 if (index<GetNrDead()) {
2237 for (gloChip=0; gloChip<1200; gloChip++) {
2238 if (glVal+fNrDead[gloChip]>index) {
2239 chipIndex = index-glVal;
2243 glVal+=fNrDead[gloChip];
2249 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead", "Index %d out of bounds.", index);
2252 //____________________________________________________________________________________________
2253 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
2254 // find gloChip and chipIndex from global index
2255 if (index<GetNrNoisy()) {
2258 for (gloChip=0; gloChip<1200; gloChip++) {
2259 if (glVal+fNrNoisy[gloChip]>index) {
2260 chipIndex = index-glVal;
2264 glVal+=fNrNoisy[gloChip];
2270 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy", "Index %d out of bounds.", index);
2273 //____________________________________________________________________________________________
2274 UInt_t AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline(UInt_t module) const {
2275 // module to eq mapping
2277 Error("AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline", "module nr (%d) out of bounds.",module);
2280 return AliITSRawStreamSPD::GetOnlineEqIdFromOffline(module);
2282 //____________________________________________________________________________________________
2283 UInt_t AliITSOnlineCalibrationSPDhandler::GetHSFromOffline(UInt_t module) const {
2284 // module to hs mapping
2286 Error("AliITSOnlineCalibrationSPDhandler::GetHSFromOffline", "module nr (%d) out of bounds.",module);
2289 return AliITSRawStreamSPD::GetOnlineHSFromOffline(module);
2291 //____________________________________________________________________________________________
2292 UInt_t AliITSOnlineCalibrationSPDhandler::GetChipFromOffline(UInt_t module, UInt_t colM) const {
2293 // module,colM to chip mapping
2294 if (module>=240 || colM>=160) {
2295 Error("AliITSOnlineCalibrationSPDhandler::GetChipFromOffline", "module,colM nrs (%d,%d) out of bounds.",module,colM);
2298 return AliITSRawStreamSPD::GetOnlineChipFromOffline(module,colM);
2300 //____________________________________________________________________________________________
2301 UInt_t AliITSOnlineCalibrationSPDhandler::GetColFromOffline(UInt_t module, UInt_t colM) const {
2302 // colM to col mapping
2304 Error("AliITSOnlineCalibrationSPDhandler::GetColFromOffline", "colM nr (%d) out of bounds.",colM);
2307 return AliITSRawStreamSPD::GetOnlineColFromOffline(module,colM);
2309 //____________________________________________________________________________________________
2310 UInt_t AliITSOnlineCalibrationSPDhandler::GetRowFromOffline(UInt_t module, UInt_t rowM) const {
2311 // rowM to row mapping
2313 Error("AliITSOnlineCalibrationSPDhandler::GetRowFromOffline", "rowM nr (%d) out of bounds.",rowM);
2316 return AliITSRawStreamSPD::GetOnlineRowFromOffline(module,rowM);
2318 //____________________________________________________________________________________________
2319 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC2(UInt_t gloChip) const {
2320 // returns nr of dead pixels on this chip
2321 if (gloChip>=1200) {
2322 Error("AliITSOnlineCalibrationSPDhandler::GetNrDeadC2", "global chip nr (%d) out of bounds.",gloChip);
2325 return fNrDead[gloChip];
2327 //____________________________________________________________________________________________
2328 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2(UInt_t gloChip) const {
2329 // returns nr of noisy pixels on this chip
2330 if (gloChip>=1200) {
2331 Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2", "global chip nr (%d) out of bounds.",gloChip);
2334 return fNrNoisy[gloChip];
2336 //____________________________________________________________________________________________
2337 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC2(UInt_t gloChip, UInt_t index) const {
2338 // get eq for the dead pixel at position index in list of dead
2339 if (gloChip>=1200) {
2340 Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
2343 if (index<fNrDead[gloChip]) {
2344 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2345 return GetEqIdFromKey(key);
2348 Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "Index %d out of bounds.", index);
2352 //____________________________________________________________________________________________
2353 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC2(UInt_t gloChip, UInt_t index) const {
2354 // get eq for the noisy pixel at position index in list of noisy
2355 if (gloChip>=1200) {
2356 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
2359 if (index<fNrNoisy[gloChip]) {
2360 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2361 return GetEqIdFromKey(key);
2364 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "Index %d out of bounds.", index);
2368 //____________________________________________________________________________________________
2369 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC2(UInt_t gloChip, UInt_t index) const {
2370 // get hs for the dead pixel at position index in list of dead
2371 if (gloChip>=1200) {
2372 Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "global chip nr (%d) out of bounds.",gloChip);
2375 if (index<fNrDead[gloChip]) {
2376 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2377 return GetHSFromKey(key);
2380 Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "Index %d out of bounds.", index);
2384 //____________________________________________________________________________________________
2385 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC2(UInt_t gloChip, UInt_t index) const {
2386 // get hs for the noisy pixel at position index in list of noisy
2387 if (gloChip>=1200) {
2388 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "global chip nr (%d) out of bounds.",gloChip);
2391 if (index<fNrNoisy[gloChip]) {
2392 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2393 return GetHSFromKey(key);
2396 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "Index %d out of bounds.", index);
2400 //____________________________________________________________________________________________
2401 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC2(UInt_t gloChip, UInt_t index) const {
2402 // get chip for the dead pixel at position index in list of dead
2403 if (gloChip>=1200) {
2404 Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "global chip nr (%d) out of bounds.",gloChip);
2407 if (index<fNrDead[gloChip]) {
2408 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2409 return GetChipFromKey(key);
2412 Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "Index %d out of bounds.", index);
2416 //____________________________________________________________________________________________
2417 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC2(UInt_t gloChip, UInt_t index) const {
2418 // get chip for the noisy pixel at position index in list of noisy
2419 if (gloChip>=1200) {
2420 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "global chip nr (%d) out of bounds.",gloChip);
2423 if (index<fNrNoisy[gloChip]) {
2424 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2425 return GetChipFromKey(key);
2428 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "Index %d out of bounds.", index);
2432 //____________________________________________________________________________________________
2433 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2(UInt_t gloChip, UInt_t index) const {
2434 // get col for the dead pixel at position index in list of dead
2435 if (gloChip>=1200) {
2436 Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "global chip nr (%d) out of bounds.",gloChip);
2439 if (index<fNrDead[gloChip]) {
2440 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2441 return GetColFromKey(key);
2444 Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "Index %d out of bounds.", index);
2448 //____________________________________________________________________________________________
2449 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC2(UInt_t gloChip, UInt_t index) const {
2450 // get col for the noisy pixel at position index in list of noisy
2451 if (gloChip>=1200) {
2452 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "global chip nr (%d) out of bounds.",gloChip);
2455 if (index<fNrNoisy[gloChip]) {
2456 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2457 return GetColFromKey(key);
2460 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "Index %d out of bounds.", index);
2464 //____________________________________________________________________________________________
2465 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC2(UInt_t gloChip, UInt_t index) const {
2466 // get row for the dead pixel at position index in list of dead
2467 if (gloChip>=1200) {
2468 Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "global chip nr (%d) out of bounds.",gloChip);
2471 if (index<fNrDead[gloChip]) {
2472 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2473 return GetRowFromKey(key);
2476 Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "Index %d out of bounds.", index);
2480 //____________________________________________________________________________________________
2481 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC2(UInt_t gloChip, UInt_t index) const {
2482 // get row for the noisy pixel at position index in list of noisy
2483 if (gloChip>=1200) {
2484 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "global chip nr (%d) out of bounds.",gloChip);
2487 if (index<fNrNoisy[gloChip]) {
2488 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2489 return GetRowFromKey(key);
2492 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "Index %d out of bounds.", index);
2496 //____________________________________________________________________________________________
2497 void AliITSOnlineCalibrationSPDhandler::ActivateALL() {
2498 for (UInt_t eq=0; eq<20; eq++) {
2500 for (UInt_t hs=0; hs<6; hs++) {
2502 for (UInt_t chip=0; chip<10; chip++) {
2503 ActivateChip(eq,hs,chip);
2508 //____________________________________________________________________________________________
2509 void AliITSOnlineCalibrationSPDhandler::ActivateEq(UInt_t eq, Bool_t setval) {
2511 Error("AliITSOnlineCalibrationSPDhandler::ActivateEq", "eq (%d) out of bounds.",eq);
2514 fActiveEq[eq] = setval;
2516 //____________________________________________________________________________________________
2517 void AliITSOnlineCalibrationSPDhandler::ActivateHS(UInt_t eq, UInt_t hs, Bool_t setval) {
2518 if (eq>=20 || hs>=6) {
2519 Error("AliITSOnlineCalibrationSPDhandler::ActivateHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2522 fActiveHS[eq][hs] = setval;
2524 //____________________________________________________________________________________________
2525 void AliITSOnlineCalibrationSPDhandler::ActivateChip(UInt_t eq, UInt_t hs, UInt_t chip, Bool_t setval) {
2526 if (eq>=20 || hs>=6 || chip>=10) {
2527 Error("AliITSOnlineCalibrationSPDhandler::ActivateChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2530 fActiveChip[eq][hs][chip] = setval;
2532 //____________________________________________________________________________________________
2533 Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveEq(UInt_t eq) const {
2535 Error("AliITSOnlineCalibrationSPDhandler::IsActiveEq", "eq (%d) out of bounds.",eq);
2538 return fActiveEq[eq];
2540 //____________________________________________________________________________________________
2541 Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveHS(UInt_t eq, UInt_t hs) const {
2542 if (eq>=20 || hs>=6) {
2543 Error("AliITSOnlineCalibrationSPDhandler::IsActiveHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2546 return fActiveHS[eq][hs];
2548 //____________________________________________________________________________________________
2549 Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
2550 if (eq>=20 || hs>=6 || chip>=10) {
2551 Error("AliITSOnlineCalibrationSPDhandler::IsActiveChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2554 return fActiveChip[eq][hs][chip];