1 //////////////////////////////////////////////////////////////////////
2 // Author: Henrik Tydesjo //
3 // For easier handling of dead and noisy pixels they are kept in //
4 // container maps (AliITSIntMap). //
5 // Handling of inactive equipments,HSs,chips have been added. //
6 // A pixel that is either dead or inactive is called SILENT here. //
7 // The lists of single dead and noisy pixels are separated from the //
8 // information about which eq/hs/chip are inactive. //
9 // The TArrayS objects that are put in the AliITSCalibrationSPD //
10 // objects can be obtained from the methods GetDeadArray and //
12 //////////////////////////////////////////////////////////////////////
14 #include "AliITSOnlineCalibrationSPDhandler.h"
15 #include "AliITSOnlineCalibrationSPD.h"
16 #include "AliITSTriggerConditions.h"
17 #include "AliITSIntMap.h"
18 #include <TObjArray.h>
25 #ifndef SPD_DA_OFF // you may want to exclude cdb classes, if using this class outside aliroot
26 #include "AliITSCalibrationSPD.h"
27 #include "AliCDBManager.h"
28 #include "AliCDBEntry.h"
33 //____________________________________________________________________________________________
34 AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler():
39 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
42 fDeadPixelMap[gloChip] = new AliITSIntMap();
43 fNoisyPixelMap[gloChip] = new AliITSIntMap();
49 //____________________________________________________________________________________________
50 AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler(const AliITSOnlineCalibrationSPDhandler& handle):
52 fTriggerConditions(handle.fTriggerConditions)
55 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
56 fNrDead[gloChip] = handle.fNrDead[gloChip];
57 fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
58 fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
59 fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
61 for (UInt_t eq=0; eq<20; eq++) {
62 fActiveEq[eq] = handle.fActiveEq[eq];
63 for (UInt_t hs=0; hs<6; hs++) {
64 fActiveHS[eq][hs] = handle.fActiveHS[eq][hs];
65 for (UInt_t chip=0; chip<10; chip++) {
66 fActiveChip[eq][hs][chip] = handle.fActiveChip[eq][hs][chip];
70 fFileLocation = handle.fFileLocation;
72 //____________________________________________________________________________________________
73 AliITSOnlineCalibrationSPDhandler::~AliITSOnlineCalibrationSPDhandler() {
75 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
76 delete fDeadPixelMap[gloChip];
77 delete fNoisyPixelMap[gloChip];
80 //____________________________________________________________________________________________
81 AliITSOnlineCalibrationSPDhandler& AliITSOnlineCalibrationSPDhandler::operator=(const AliITSOnlineCalibrationSPDhandler& handle) {
82 // assignment operator
85 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
86 fNrDead[gloChip] = handle.fNrDead[gloChip];
87 fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
88 fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
89 fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
91 for (UInt_t eq=0; eq<20; eq++) {
92 fActiveEq[eq] = handle.fActiveEq[eq];
93 for (UInt_t hs=0; hs<6; hs++) {
94 fActiveHS[eq][hs] = handle.fActiveHS[eq][hs];
95 for (UInt_t chip=0; chip<10; chip++) {
96 fActiveChip[eq][hs][chip] = handle.fActiveChip[eq][hs][chip];
100 fFileLocation = handle.fFileLocation;
104 //____________________________________________________________________________________________
105 void AliITSOnlineCalibrationSPDhandler::ClearMaps() {
106 // clear the lists of dead and noisy
111 //____________________________________________________________________________________________
112 void AliITSOnlineCalibrationSPDhandler::ResetDead() {
113 // reset the dead pixel map and inactive eq,hs,chip
115 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
117 fDeadPixelMap[gloChip]->Clear();
120 //____________________________________________________________________________________________
121 void AliITSOnlineCalibrationSPDhandler::ResetNoisy() {
122 // clear the list of noisy pixels
123 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
125 fNoisyPixelMap[gloChip]->Clear();
128 //____________________________________________________________________________________________
129 void AliITSOnlineCalibrationSPDhandler::ResetDeadForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
130 // clear the dead pixels for this chip
131 SetDeadChip(eq,hs,chip,kFALSE);
132 UInt_t gloChip = GetGloChip(eq,hs,chip);
133 for (UInt_t col=0; col<32; col++) {
134 for (UInt_t row=0; row<256; row++) {
135 Int_t key = GetKey(eq,hs,chip,col,row);
136 if (fDeadPixelMap[gloChip]->Remove(key)) {
142 //____________________________________________________________________________________________
143 void AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
144 // clear the noisy pixels for this chip
145 UInt_t gloChip = GetGloChip(eq,hs,chip);
147 Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip","global chip nr (%d) out of bounds\n",gloChip);
150 for (UInt_t col=0; col<32; col++) {
151 for (UInt_t row=0; row<256; row++) {
152 Int_t key = GetKey(eq,hs,chip,col,row);
153 if (fNoisyPixelMap[gloChip]->Remove(key)) {
159 //____________________________________________________________________________________________
160 void AliITSOnlineCalibrationSPDhandler::ResetDeadForEq(UInt_t eq) {
161 // clear the dead pixels for this eq
163 Error("AliITSOnlineCalibrationSPDhandler::ResetDeadForEq", "eq (%d) out of bounds.",eq);
166 for (UInt_t hs=0; hs<6; hs++) {
167 for (UInt_t chip=0; chip<10; chip++) {
168 ResetDeadForChip(eq, hs, chip);
172 //____________________________________________________________________________________________
173 void AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq(UInt_t eq) {
174 // clear the noisy pixels for this eq
176 Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq", "eq (%d) out of bounds.",eq);
179 for (UInt_t hs=0; hs<6; hs++) {
180 for (UInt_t chip=0; chip<10; chip++) {
181 ResetNoisyForChip(eq, hs, chip);
187 //____________________________________________________________________________________________
188 Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromFiles() {
189 // read files from file location (active,dead,noisy info). returns true if at least one file found
190 Bool_t b1 = ReadNoisyFromFiles();
191 Bool_t b2 = ReadSilentFromFiles();
194 //____________________________________________________________________________________________
195 Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFiles() {
196 // read dead,active files from file location. returns true if at least one file found
197 Bool_t returnval=kFALSE;
198 for (UInt_t eq=0; eq<20; eq++) {
199 if (ReadSilentFromFile(eq)) {
205 //____________________________________________________________________________________________
206 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFiles() {
207 // read dead,active files from file location. returns true if at least one file found
208 Bool_t returnval=kFALSE;
209 for (UInt_t eq=0; eq<20; eq++) {
210 if (ReadDeadFromFile(eq)) {
216 //____________________________________________________________________________________________
217 Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFile(UInt_t eq) {
218 // read dead file for eq from file location.
219 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
220 return ReadSilentFromFileName(fileName.Data());
222 //____________________________________________________________________________________________
223 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFile(UInt_t eq) {
224 // read dead file for eq from file location.
225 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
226 return ReadDeadFromFileName(fileName.Data());
228 //____________________________________________________________________________________________
229 Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFileName(const char *fileName) {
230 // read dead from file fileName (including inactive)
231 return ReadDeadFromFileName(fileName, kTRUE);
233 //____________________________________________________________________________________________
234 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFileName(const char *fileName, Bool_t inactive) {
235 // read dead from file fileName
236 AliITSOnlineCalibrationSPD* calib;
237 FILE* fp0 = fopen(fileName, "r");
238 if (fp0 == NULL) {return kFALSE;}
241 TFile file(fileName, "READ");
243 file.GetObject("AliITSOnlineCalibrationSPD", calib);
246 UInt_t nrDead=calib->GetNrBad();
247 for (UInt_t index=0; index<nrDead; index++) {
248 UInt_t key = calib->GetKeyAt(index);
249 UInt_t eq = GetEqIdFromKey(key);
250 UInt_t hs = GetHSFromKey(key);
251 UInt_t chip = GetChipFromKey(key);
252 UInt_t col = GetColFromKey(key);
253 UInt_t row = GetRowFromKey(key);
254 SetDeadPixel(eq,hs,chip,col,row);
256 UInt_t eq1 = calib->GetEqNr();
257 if (calib->IsDeadEq()) SetDeadEq(eq1);
258 else SetDeadEq(eq1,kFALSE);
259 for (UInt_t hs=0; hs<6; hs++) {
260 if (calib->IsDeadHS(hs)) SetDeadHS(eq1,hs);
261 else SetDeadHS(eq1,hs,kFALSE);
262 for (UInt_t chip=0; chip<10; chip++) {
263 if (calib->IsDeadChip(hs,chip)) SetDeadChip(eq1,hs,chip);
264 else SetDeadChip(eq1,hs,chip,kFALSE);
268 UInt_t eq = calib->GetEqNr();
269 if (calib->IsActiveEq()) ActivateEq(eq);
270 else ActivateEq(eq,kFALSE);
271 for (UInt_t hs=0; hs<6; hs++) {
272 if (calib->IsActiveHS(hs)) ActivateHS(eq,hs);
273 else ActivateHS(eq,hs,kFALSE);
274 for (UInt_t chip=0; chip<10; chip++) {
275 if (calib->IsActiveChip(hs,chip)) ActivateChip(eq,hs,chip);
276 else ActivateChip(eq,hs,chip,kFALSE);
285 //____________________________________________________________________________________________
286 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFiles() {
287 // read noisy files from file location. returns true if at least one file found
288 Bool_t returnval=kFALSE;
289 for (UInt_t eq=0; eq<20; eq++) {
290 if (ReadNoisyFromFile(eq)) {
296 //____________________________________________________________________________________________
297 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFile(UInt_t eq) {
298 // read noisy file for eq from file location.
299 TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
300 return ReadNoisyFromFileName(fileName.Data());
302 //____________________________________________________________________________________________
303 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFileName(const char *fileName) {
304 // read noisy from file fileName
305 AliITSOnlineCalibrationSPD* calib;
306 FILE* fp0 = fopen(fileName, "r");
307 if (fp0 == NULL) {return kFALSE;}
310 TFile file(fileName, "READ");
312 file.GetObject("AliITSOnlineCalibrationSPD", calib);
315 UInt_t nrNoisy=calib->GetNrBad();
316 for (UInt_t index=0; index<nrNoisy; index++) {
317 UInt_t key = calib->GetKeyAt(index);
318 UInt_t eq = GetEqIdFromKey(key);
319 UInt_t hs = GetHSFromKey(key);
320 UInt_t chip = GetChipFromKey(key);
321 UInt_t col = GetColFromKey(key);
322 UInt_t row = GetRowFromKey(key);
323 SetNoisyPixel(eq,hs,chip,col,row);
330 //____________________________________________________________________________________________
331 UInt_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromText(const char *fileName, UInt_t module) {
332 // read dead from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
333 // insert only those pixels that belong to module (or all if module=240).
336 textFile.open(fileName, ifstream::in);
337 if (textFile.fail()) {
338 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromText","No dead text file (%s) present.",fileName);
342 UInt_t eq,hs,chip,col,row;
343 textFile >> eq; if (textFile.eof()) break;
344 textFile >> hs; if (textFile.eof()) break;
345 textFile >> chip; if (textFile.eof()) break;
346 textFile >> col; if (textFile.eof()) break;
348 if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){
349 if (SetDeadPixel(eq,hs,chip,col,row)) {
353 if (textFile.eof()) break;
359 //____________________________________________________________________________________________
360 UInt_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText(const char *fileName, UInt_t module) {
361 // read noisy from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
362 // insert only those pixels that belong to module (or all if module=240).
365 textFile.open(fileName, ifstream::in);
366 if (textFile.fail()) {
367 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText","No noisy text file (%s) present.",fileName);
371 UInt_t eq,hs,chip,col,row;
372 textFile >> eq; if (textFile.eof()) break;
373 textFile >> hs; if (textFile.eof()) break;
374 textFile >> chip; if (textFile.eof()) break;
375 textFile >> col; if (textFile.eof()) break;
377 if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){
378 if (SetNoisyPixel(eq,hs,chip,col,row)) {
382 if (textFile.eof()) break;
388 //____________________________________________________________________________________________
389 void AliITSOnlineCalibrationSPDhandler::ReadPITConditionsFromText(const char *fileName) {
390 // read PIT conditions file from text as printed out at P2
391 // !!! please note that the chip numbering goes from 9 to 0 in the text. In PVSS panels is the opposite.
392 if(fTriggerConditions) fTriggerConditions->ResetAll();
393 else fTriggerConditions = new AliITSTriggerConditions();
394 fTriggerConditions->ReadFromTextFile(fileName);
396 //____________________________________________________________________________________________
397 Bool_t AliITSOnlineCalibrationSPDhandler::ReadPITConditionsFromDB(Int_t runNr, const Char_t *storage){
398 // read PIT conditions from the OCDB
400 AliCDBManager* man = AliCDBManager::Instance();
401 TString storageSTR = Form("%s",storage);
402 if (storageSTR.CompareTo("default")==0) {
403 if(!man->IsDefaultStorageSet()) {
404 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
408 storageSTR = Form("%s",storage);
409 man->SetDefaultStorage(storageSTR.Data());
411 AliCDBEntry *cdbEntry = man->Get("TRIGGER/SPD/PITConditions", runNr);
413 fTriggerConditions = (AliITSTriggerConditions*)cdbEntry->GetObject();
415 } else return kFALSE;
417 //____________________________________________________________________________________________
418 void AliITSOnlineCalibrationSPDhandler::WriteToFilesAlways() {
419 // write the lists of active,dead,noisy to files
420 for (UInt_t eq=0; eq<20; eq++) {
421 WriteSilentToFile(eq);
422 WriteNoisyToFile(eq);
425 //____________________________________________________________________________________________
426 UInt_t AliITSOnlineCalibrationSPDhandler::WriteToFiles() {
427 // write the lists of dead and noisy to files (only if there are >0 dead or noisy pixels) , returns nr of files produced
428 return (WriteNoisyToFiles() + WriteSilentToFiles());
430 //____________________________________________________________________________________________
431 void AliITSOnlineCalibrationSPDhandler::WriteSilentToFilesAlways() {
432 // write the lists of silent to files
433 for (UInt_t eq=0; eq<20; eq++) {
434 WriteSilentToFile(eq);
437 //____________________________________________________________________________________________
438 void AliITSOnlineCalibrationSPDhandler::WriteDeadToFilesAlways() {
439 // write the lists of dead to files
440 for (UInt_t eq=0; eq<20; eq++) {
444 //____________________________________________________________________________________________
445 void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFilesAlways() {
446 // write the lists of noisy to files
447 for (UInt_t eq=0; eq<20; eq++) {
448 WriteNoisyToFile(eq);
451 //____________________________________________________________________________________________
452 UInt_t AliITSOnlineCalibrationSPDhandler::WriteSilentToFiles() {
453 // write the list of silent to file (only if there are >0 silent pixels) , returns nr of files produced
455 for (UInt_t eq=0; eq<20; eq++) {
456 if (GetNrSilentEq(eq) > 0) {
457 WriteSilentToFile(eq);
463 //____________________________________________________________________________________________
464 UInt_t AliITSOnlineCalibrationSPDhandler::WriteDeadToFiles() {
465 // write the list of dead to file (only if there are >0 dead pixels) , returns nr of files produced
467 for (UInt_t eq=0; eq<20; eq++) {
468 if (GetNrDeadEq(eq) > 0) {
475 //____________________________________________________________________________________________
476 UInt_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToFiles() {
477 // write the list of noisy to file (only if there are >0 noisy pixels) , returns nr of files produced
479 for (UInt_t eq=0; eq<20; eq++) {
480 if (GetNrNoisyEq(eq) > 0) {
481 WriteNoisyToFile(eq);
487 //____________________________________________________________________________________________
488 void AliITSOnlineCalibrationSPDhandler::WriteSilentToFile(UInt_t eq) {
489 WriteDeadToFile(eq,kTRUE);
491 //____________________________________________________________________________________________
492 void AliITSOnlineCalibrationSPDhandler::WriteDeadToFile(UInt_t eq, Bool_t inactive) {
493 // write the lists of dead (and inactive if input boolean is true) for eq to file
494 AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
496 calib->SetBadList(GetDeadArrayOnline(eq));
497 calib->SetNrBad(GetNrDeadEq(eq));
498 if (IsDeadEq(eq)) calib->SetDeadEq();
499 else calib->SetDeadEq(kFALSE);
500 for (UInt_t hs=0; hs<6; hs++) {
501 if (IsDeadHS(eq,hs)) calib->SetDeadHS(hs);
502 else calib->SetDeadHS(hs,kFALSE);
503 for (UInt_t chip=0; chip<10; chip++) {
504 if (IsDeadChip(eq,hs,chip)) calib->SetDeadChip(hs,chip);
505 else calib->SetDeadChip(hs,chip,kFALSE);
509 if (IsActiveEq(eq)) calib->ActivateEq();
510 else calib->ActivateEq(kFALSE);
511 for (UInt_t hs=0; hs<6; hs++) {
512 if (IsActiveHS(eq,hs)) calib->ActivateHS(hs);
513 else calib->ActivateHS(hs,kFALSE);
514 for (UInt_t chip=0; chip<10; chip++) {
515 if (IsActiveChip(eq,hs,chip)) calib->ActivateChip(hs,chip);
516 else calib->ActivateChip(hs,chip,kFALSE);
520 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
521 TFile file(fileName.Data(), "RECREATE");
522 file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
526 //____________________________________________________________________________________________
527 void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFile(UInt_t eq) {
528 // write the lists of noisy for eq to file
529 AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
531 calib->SetBadList(GetNoisyArrayOnline(eq));
532 calib->SetNrBad(GetNrNoisyEq(eq));
533 TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
534 TFile file(fileName.Data(), "RECREATE");
535 file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
539 //____________________________________________________________________________________________
541 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB(UInt_t module, Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
542 // reads dead pixels from DB for given module and runNr
543 AliCDBManager* man = AliCDBManager::Instance();
544 TString storageSTR = Form("%s",storage);
545 if (storageSTR.CompareTo("default")==0) {
546 if(!man->IsDefaultStorageSet()) {
547 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
551 storageSTR = Form("%s",storage);
552 man->SetDefaultStorage(storageSTR.Data());
554 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
557 spdEntry = (TObjArray*)cdbEntry->GetObject();
558 if(!spdEntry) return kFALSE;
561 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB","Calibration for run %d not found in database.",runNr);
564 AliITSCalibrationSPD* calibSPD;
565 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
567 UInt_t nrDead = calibSPD->GetNrBadSingle();
569 if (!treeSerial) RecursiveInsertDead(calibSPD,module,0,nrDead-1);
571 for (UInt_t index=0; index<nrDead; index++) {
572 UInt_t colM = calibSPD->GetBadColAt(index);
573 UInt_t rowM = calibSPD->GetBadRowAt(index);
574 SetDeadPixelM(module,colM,rowM);
578 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
579 UInt_t eq,hs,chip,col,row;
580 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
581 if (calibSPD->IsChipBad(chipIndex)) {
582 SetDeadChip(eq,hs,chip);
585 SetDeadChip(eq,hs,chip,kFALSE);
589 spdEntry->SetOwner(kTRUE);
593 //____________________________________________________________________________________________
594 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB(UInt_t module, Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
595 // reads noisy pixels from DB for given module and runNr
596 AliCDBManager* man = AliCDBManager::Instance();
597 TString storageSTR = Form("%s",storage);
598 if (storageSTR.CompareTo("default")==0) {
599 if(!man->IsDefaultStorageSet()) {
600 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
604 storageSTR = Form("%s",storage);
605 man->SetDefaultStorage(storageSTR.Data());
607 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
610 spdEntry = (TObjArray*)cdbEntry->GetObject();
611 if(!spdEntry) return kFALSE;
614 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB","Calibration for run %d not found in database.",runNr);
617 AliITSCalibrationSPD* calibSPD;
618 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
619 UInt_t nrNoisy = calibSPD->GetNrBadSingle();
621 if (!treeSerial) 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);
630 spdEntry->SetOwner(kTRUE);
634 //____________________________________________________________________________________________
635 Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromDB(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
636 // reads dead and noisy pixels from DB for given runNr
637 // note that you may want to clear the lists (if they are not empty) before reading
638 return (ReadNoisyFromDB(runNr,storage,treeSerial) && ReadDeadFromDB(runNr,storage,treeSerial));
640 //____________________________________________________________________________________________
641 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
642 // reads dead pixels from DB for given runNr
643 // note that you may want to clear the list (if it is not empty) before reading
644 AliCDBManager* man = AliCDBManager::Instance();
645 TString storageSTR = Form("%s",storage);
646 if (storageSTR.CompareTo("default")==0) {
647 if(!man->IsDefaultStorageSet()) {
648 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
652 storageSTR = Form("%s",storage);
653 man->SetDefaultStorage(storageSTR.Data());
655 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
658 spdEntry = (TObjArray*)cdbEntry->GetObject();
659 if(!spdEntry) return kFALSE;
662 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB","Calibration for run %d not found in database.",runNr);
665 AliITSCalibrationSPD* calibSPD;
666 for (UInt_t module=0; module<240; module++) {
667 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
668 UInt_t nrDead = calibSPD->GetNrBadSingle();
671 RecursiveInsertDead(calibSPD,module,0,nrDead-1);
675 for (UInt_t index=0; index<nrDead; index++) {
676 UInt_t colM = calibSPD->GetBadColAt(index);
677 UInt_t rowM = calibSPD->GetBadRowAt(index);
678 SetDeadPixelM(module,colM,rowM);
682 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
683 UInt_t eq,hs,chip,col,row;
684 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
685 if (calibSPD->IsChipBad(chipIndex)) {
686 SetDeadChip(eq,hs,chip);
689 SetDeadChip(eq,hs,chip,kFALSE);
693 spdEntry->SetOwner(kTRUE);
697 //____________________________________________________________________________________________
698 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
699 // reads noisy pixels from DB for given runNr
700 // note that you may want to clear the list (if it is not empty) before reading
701 AliCDBManager* man = AliCDBManager::Instance();
702 TString storageSTR = Form("%s",storage);
703 if (storageSTR.CompareTo("default")==0) {
704 if(!man->IsDefaultStorageSet()) {
705 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
709 storageSTR = Form("%s",storage);
710 man->SetDefaultStorage(storageSTR.Data());
712 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
715 spdEntry = (TObjArray*)cdbEntry->GetObject();
716 if(!spdEntry) return kFALSE;
719 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB","Calibration for run %d not found in database.",runNr);
722 AliITSCalibrationSPD* calibSPD;
723 for (UInt_t module=0; module<240; module++) {
724 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
725 UInt_t nrNoisy = calibSPD->GetNrBadSingle();
728 RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
731 for (UInt_t index=0; index<nrNoisy; index++) {
732 UInt_t colM = calibSPD->GetBadColAt(index);
733 UInt_t rowM = calibSPD->GetBadRowAt(index);
734 SetNoisyPixelM(module,colM,rowM);
739 spdEntry->SetOwner(kTRUE);
743 //____________________________________________________________________________________________
744 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDBasNoisy(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
745 // reads dead pixels (put as noisy) from DB for given runNr
746 // note that you may want to clear the list (if it is not empty) before reading
747 AliCDBManager* man = AliCDBManager::Instance();
748 TString storageSTR = Form("%s",storage);
749 if (storageSTR.CompareTo("default")==0) {
750 if(!man->IsDefaultStorageSet()) {
751 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
755 storageSTR = Form("%s",storage);
756 man->SetDefaultStorage(storageSTR.Data());
758 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
761 spdEntry = (TObjArray*)cdbEntry->GetObject();
762 if(!spdEntry) return kFALSE;
765 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromDBasNoisy","Calibration for run %d not found in database.",runNr);
768 AliITSCalibrationSPD* calibSPD;
769 for (UInt_t module=0; module<240; module++) {
770 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
771 UInt_t nrDead = calibSPD->GetNrBadSingle();
774 RecursiveInsertDead(calibSPD,module,0,nrDead-1);
778 for (UInt_t index=0; index<nrDead; index++) {
779 UInt_t colM = calibSPD->GetBadColAt(index);
780 UInt_t rowM = calibSPD->GetBadRowAt(index);
781 SetDeadPixelM(module,colM,rowM);
785 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
786 UInt_t eq,hs,chip,col,row;
787 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
788 if (calibSPD->IsChipBad(chipIndex)) {
789 SetDeadChip(eq,hs,chip);
792 SetDeadChip(eq,hs,chip,kFALSE);
796 spdEntry->SetOwner(kTRUE);
800 //____________________________________________________________________________________________
801 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromCalibObj(TObjArray* calObj) {
802 // reads dead pixels from calib object
803 for (UInt_t module=0; module<240; module++) {
804 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*)calObj->At(module);
805 for (Int_t i=0; i<calibSPD->GetNrBadSingle(); i++) {
806 SetDeadPixelM(module,calibSPD->GetBadColAt(i),calibSPD->GetBadRowAt(i));
808 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
809 UInt_t eq,hs,chip,col,row;
810 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
811 if (calibSPD->IsChipBad(chipIndex)) {
812 SetDeadChip(eq,hs,chip);
815 SetDeadChip(eq,hs,chip,kFALSE);
821 //____________________________________________________________________________________________
822 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromCalibObj(TObjArray* calObj) {
823 // reads noisy pixels from calib object
824 for (UInt_t module=0; module<240; module++) {
825 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*)calObj->At(module);
826 for (Int_t i=0; i<calibSPD->GetNrBadSingle(); i++) {
827 SetNoisyPixelM(module,calibSPD->GetBadColAt(i),calibSPD->GetBadRowAt(i));
832 //____________________________________________________________________________________________
833 Bool_t AliITSOnlineCalibrationSPDhandler::WriteToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
834 // writes dead and noisy pixels to DB for given runNrs
835 // overwrites any previous entries
836 return (WriteNoisyToDB(runNrStart,runNrEnd,storage) && WriteDeadToDB(runNrStart,runNrEnd,storage));
838 //____________________________________________________________________________________________
839 Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
840 // writes dead pixels to DB for given runNrs
841 // overwrites any previous entries
842 AliCDBManager* man = AliCDBManager::Instance();
843 TString storageSTR = Form("%s",storage);
844 if (storageSTR.CompareTo("default")==0) {
845 if(!man->IsDefaultStorageSet()) {
846 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
850 storageSTR = Form("%s",storage);
851 man->SetDefaultStorage(storageSTR.Data());
853 AliCDBMetaData* metaData = new AliCDBMetaData();
854 metaData->SetResponsible("Henrik Tydesjo");
855 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
856 AliCDBId idCalSPD("ITS/Calib/SPDDead",runNrStart,runNrEnd);
857 TObjArray* spdEntry = new TObjArray(240);
858 spdEntry->SetOwner(kTRUE);
859 for(UInt_t module=0; module<240; module++){
860 AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
861 spdEntry->Add(calibSPD);
863 for(UInt_t module=0; module<240; module++){
864 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
865 calibSPD->SetNrBadSingle( GetNrDeadSingle(module) );
866 calibSPD->SetBadList( GetDeadArray(module) );
867 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
868 UInt_t eq,hs,chip,col,row;
869 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
870 if (IsSilentChip(eq,hs,chip)) {
871 calibSPD->SetChipBad(chipIndex);
874 calibSPD->UnSetChipBad(chipIndex);
878 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
885 //____________________________________________________________________________________________
886 Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDBasNoisy(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
887 // writes dead pixels to DB for given runNrs
888 // overwrites any previous entries
889 AliCDBManager* man = AliCDBManager::Instance();
890 TString storageSTR = Form("%s",storage);
891 if (storageSTR.CompareTo("default")==0) {
892 if(!man->IsDefaultStorageSet()) {
893 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
897 storageSTR = Form("%s",storage);
898 man->SetDefaultStorage(storageSTR.Data());
900 AliCDBMetaData* metaData = new AliCDBMetaData();
901 metaData->SetResponsible("Henrik Tydesjo");
902 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
903 AliCDBId idCalSPD("ITS/Calib/SPDNoisy",runNrStart,runNrEnd);
904 TObjArray* spdEntry = new TObjArray(240);
905 spdEntry->SetOwner(kTRUE);
906 for(UInt_t module=0; module<240; module++){
907 AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
908 spdEntry->Add(calibSPD);
910 for(UInt_t module=0; module<240; module++){
911 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
912 calibSPD->SetNrBadSingle( GetNrDeadSingle(module) );
913 calibSPD->SetBadList( GetDeadArray(module) );
914 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
915 UInt_t eq,hs,chip,col,row;
916 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
917 if (IsSilentChip(eq,hs,chip)) {
918 calibSPD->SetChipBad(chipIndex);
921 calibSPD->UnSetChipBad(chipIndex);
925 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
932 //____________________________________________________________________________________________
933 Bool_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
934 // writes noisy pixels to DB for given runNrs
935 // overwrites any previous entries
936 AliCDBManager* man = AliCDBManager::Instance();
937 TString storageSTR = Form("%s",storage);
938 if (storageSTR.CompareTo("default")==0) {
939 if(!man->IsDefaultStorageSet()) {
940 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
944 storageSTR = Form("%s",storage);
945 man->SetDefaultStorage(storageSTR.Data());
947 AliCDBMetaData* metaData = new AliCDBMetaData();
948 metaData->SetResponsible("Henrik Tydesjo");
949 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
950 AliCDBId idCalSPD("ITS/Calib/SPDNoisy",runNrStart,runNrEnd);
951 TObjArray* spdEntry = new TObjArray(240);
952 spdEntry->SetOwner(kTRUE);
953 for(UInt_t module=0; module<240; module++){
954 AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
955 spdEntry->Add(calibSPD);
957 for(UInt_t module=0; module<240; module++){
958 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
959 calibSPD->SetNrBadSingle( GetNrNoisySingle(module) );
960 calibSPD->SetBadList( GetNoisyArray(module) );
962 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
969 //____________________________________________________________________________________________
970 void AliITSOnlineCalibrationSPDhandler::RecursiveInsertDead(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
971 // inserts dead pixels recursively, used when reading from db
972 if (lowInd>highInd) return;
973 Int_t thisInd = lowInd+(highInd-lowInd)/2;
974 SetDeadPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
975 RecursiveInsertDead(calibSPD,module,lowInd,thisInd-1);
976 RecursiveInsertDead(calibSPD,module,thisInd+1,highInd);
978 //____________________________________________________________________________________________
979 void AliITSOnlineCalibrationSPDhandler::RecursiveInsertNoisy(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
980 // inserts noisy pixels recursively, used when reading from db
981 if (lowInd>highInd) return;
982 Int_t thisInd = lowInd+(highInd-lowInd)/2;
983 SetNoisyPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
984 RecursiveInsertNoisy(calibSPD,module,lowInd,thisInd-1);
985 RecursiveInsertNoisy(calibSPD,module,thisInd+1,highInd);
989 //____________________________________________________________________________________________
990 void AliITSOnlineCalibrationSPDhandler::GenerateDCSConfigFile(const Char_t* fileName) {
991 // generates an ascii file in the format as the one produced by online da (but with dummy runNr=0)
993 dcsfile.open(fileName);
994 dcsfile << "[SPD SCAN]\n";
995 dcsfile << "RunNumber=" << "0" << "\n"; // dummy value
996 dcsfile << "Type=" << "4" << "\n";
997 dcsfile << "Router=" << "0" << "\n"; // dummy value
998 dcsfile << "ActualDetConfiguration=" << "0,-1,-1\n"; // dummy values
999 dcsfile << "[NOISY]\n";
1000 for (UInt_t module=0; module<240; module++) {
1001 UInt_t headkey=20*10*6;
1002 for (UInt_t ind=0; ind<GetNrNoisy(module); ind++) {
1003 UInt_t newkey = GetNoisyEqIdAt(module,ind)*10*6 +
1004 GetNoisyHSAt(module,ind)*10 +
1005 GetNoisyChipAt(module,ind);
1006 if (newkey!=headkey) { // print eq,hs,chip header
1008 dcsfile << "-" << newkey/(6*10) << "," << (newkey%(6*10))/10 << "," << (newkey%(6*10))%10 << "\n";
1010 dcsfile << GetNoisyColAt(module,ind) << "," << GetNoisyRowAt(module,ind) << "\n";
1015 //____________________________________________________________________________________________
1016 TArrayS AliITSOnlineCalibrationSPDhandler::GetSilentArray(UInt_t module, Bool_t treeSerial) {
1017 // get a TArrayS of the silent=dead+inactive pixels (format for the AliITSCalibrationSPD object)
1018 // NB! with new implementation of AliITSCalibrationSPD this is not needed anymore
1019 TArrayS returnArray;
1021 UInt_t eq = GetEqIdFromOffline(module);
1022 UInt_t hs = GetHSFromOffline(module);
1024 if ( !( IsActiveEq(eq) && IsActiveHS(eq,hs) ) ) {
1028 for (UInt_t ch=0; ch<5; ch++) {
1029 UInt_t chip = GetChipFromOffline(module,ch*32);
1030 if (!(IsActiveChip(eq,hs,chip))) {
1034 UInt_t gloChip = GetGloChip(eq,hs,chip);
1035 size += fNrDead[gloChip];
1039 returnArray.Set(size*2);
1042 if ( !( IsActiveEq(eq) && IsActiveHS(eq,hs) ) ) {
1043 for (UInt_t colM=0; colM<160; colM++) {
1044 for (UInt_t rowM=0; rowM<256; rowM++) {
1045 returnArray.AddAt(colM,gloIndex*2);
1046 returnArray.AddAt(rowM,gloIndex*2+1);
1052 for (UInt_t ch=0; ch<5; ch++) {
1053 UInt_t chip = GetChipFromOffline(module,ch*32);
1054 if (!(IsActiveChip(eq,hs,chip))) {
1055 for (UInt_t colM=ch*32; colM<ch*32+32; colM++) {
1056 for (UInt_t rowM=0; rowM<256; rowM++) {
1057 returnArray.AddAt(colM,gloIndex*2);
1058 returnArray.AddAt(rowM,gloIndex*2+1);
1064 UInt_t gloChip = GetGloChip(eq,hs,chip);
1065 if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1066 else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
1067 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1068 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1069 Int_t colM = GetColMFromKey(key);
1070 Int_t rowM = GetRowMFromKey(key);
1071 returnArray.AddAt(colM,gloIndex*2);
1072 returnArray.AddAt(rowM,gloIndex*2+1);
1080 //____________________________________________________________________________________________
1081 TArrayS AliITSOnlineCalibrationSPDhandler::GetDeadArray(UInt_t module, Bool_t treeSerial) {
1082 // get a TArrayS of the single dead pixels (format for the AliITSCalibrationSPD object)
1083 TArrayS returnArray;
1085 UInt_t eq = GetEqIdFromOffline(module);
1086 UInt_t hs = GetHSFromOffline(module);
1087 UInt_t size=GetNrDeadSingle(module);
1088 returnArray.Set(size*2);
1090 for (UInt_t ch=0; ch<5; ch++) {
1091 UInt_t chip = GetChipFromOffline(module,ch*32);
1092 UInt_t gloChip = GetGloChip(eq,hs,chip);
1093 if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1094 else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
1095 if (!IsSilentChip(eq,hs,chip)) {
1096 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1097 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1098 Int_t colM = GetColMFromKey(key);
1099 Int_t rowM = GetRowMFromKey(key);
1100 returnArray.AddAt(colM,gloIndex*2);
1101 returnArray.AddAt(rowM,gloIndex*2+1);
1108 //____________________________________________________________________________________________
1109 TArrayS AliITSOnlineCalibrationSPDhandler::GetNoisyArray(UInt_t module, Bool_t treeSerial) {
1110 // get a TArrayS of the single noisy pixels (format for the AliITSCalibrationSPD object)
1111 TArrayS returnArray;
1113 UInt_t eq = GetEqIdFromOffline(module);
1114 UInt_t hs = GetHSFromOffline(module);
1115 UInt_t size=GetNrNoisySingle(module);
1116 returnArray.Set(size*2);
1118 for (UInt_t ch=0; ch<5; ch++) {
1119 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
1120 if (treeSerial) fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1121 else fNoisyPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
1122 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
1123 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1124 Int_t colM = GetColMFromKey(key);
1125 Int_t rowM = GetRowMFromKey(key);
1126 returnArray.AddAt(colM,gloIndex*2);
1127 returnArray.AddAt(rowM,gloIndex*2+1);
1133 //____________________________________________________________________________________________
1134 TArrayI AliITSOnlineCalibrationSPDhandler::GetDeadArrayOnline(UInt_t eq) {
1135 // get a TArrayI of the single dead pixels (format for the AliITSOnlineCalibrationSPD object)
1136 TArrayI returnArray;
1137 // fix size of array
1139 for (UInt_t hs=0; hs<6; hs++) {
1140 for (UInt_t chip=0; chip<10; chip++) {
1141 UInt_t gloChip = GetGloChip(eq,hs,chip);
1142 size+=fNrDead[gloChip];
1145 returnArray.Set(size);
1146 // put keys in array
1148 for (UInt_t hs=0; hs<6; hs++) {
1149 for (UInt_t chip=0; chip<10; chip++) {
1150 UInt_t gloChip = GetGloChip(eq,hs,chip);
1151 fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1152 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1153 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1154 returnArray.AddAt(key,gloIndex);
1161 //____________________________________________________________________________________________
1162 TArrayI AliITSOnlineCalibrationSPDhandler::GetNoisyArrayOnline(UInt_t eq) {
1163 // get a TArrayI of the single noisy pixels (format for the AliITSOnlineCalibrationSPD object)
1164 TArrayI returnArray;
1165 // fix size of array
1167 for (UInt_t hs=0; hs<6; hs++) {
1168 for (UInt_t chip=0; chip<10; chip++) {
1169 UInt_t gloChip = GetGloChip(eq,hs,chip);
1170 size+=fNrNoisy[gloChip];
1173 returnArray.Set(size);
1174 // put keys in array
1176 for (UInt_t hs=0; hs<6; hs++) {
1177 for (UInt_t chip=0; chip<10; chip++) {
1178 UInt_t gloChip = GetGloChip(eq,hs,chip);
1179 fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1180 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
1181 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1182 returnArray.AddAt(key,gloIndex);
1189 //____________________________________________________________________________________________
1190 void AliITSOnlineCalibrationSPDhandler::PrintEqSummary() {
1191 // print summary (nr of dead and noisy) for each equipment
1192 printf("-----------\n");
1193 printf("Eq summary:\n");
1194 printf("-----------\n");
1195 for (UInt_t eq=0; eq<20; eq++) {
1196 printf("Eq %*d: %*d silent(dead+inactive) , %*d dead , %*d noisy\n",2,eq,6,GetNrSilentEq(eq),6,GetNrDeadEq(eq),6,GetNrNoisyEq(eq));
1199 //____________________________________________________________________________________________
1200 void AliITSOnlineCalibrationSPDhandler::PrintSilent() const {
1201 // print the inactive and dead pixels to screen
1202 printf("-----------------------------------------------------------\n");
1203 printf("Inactive or dead Equipments: (eq | module1 .. module12)\n");
1204 printf("-----------------------------------------------------------\n");
1205 for (UInt_t eq=0; eq<20; eq++) {
1206 if (IsSilentEq(eq)) {
1207 printf("%*d | ",2,eq);
1208 for (UInt_t hs=0; hs<6; hs++) {
1209 for (UInt_t chip=0; chip<10; chip+=5) {
1210 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1211 if (hs>0 || chip==5) printf(",");
1212 printf("%*d",3,module);
1219 printf("-----------------------------------------------------------\n");
1220 printf("Inactive or dead Half-staves: (eq,hs | module1,module2)\n");
1221 printf("-----------------------------------------------------------\n");
1222 for (UInt_t eq=0; eq<20; eq++) {
1223 if (!IsSilentEq(eq)) {
1224 for (UInt_t hs=0; hs<6; hs++) {
1225 if (IsSilentHS(eq,hs)) {
1226 printf("%*d,%*d | ",2,eq,1,hs);
1227 for (UInt_t chip=0; chip<10; chip+=5) {
1228 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1229 if (chip==5) printf(",");
1230 printf("%*d",3,module);
1238 printf("-----------------------------------------------------------\n");
1239 printf("Inactive or dead Chips: (eq,hs,chip | module,colM1-colM2)\n");
1240 printf("-----------------------------------------------------------\n");
1241 for (UInt_t eq=0; eq<20; eq++) {
1242 if (!IsSilentEq(eq)) {
1243 for (UInt_t hs=0; hs<6; hs++) {
1244 if (!IsSilentHS(eq,hs)) {
1245 for (UInt_t chip=0; chip<10; chip++) {
1246 if (IsSilentChip(eq,hs,chip)) {
1247 printf("%*d,%*d,%*d | ",2,eq,1,hs,1,chip);
1248 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1249 UInt_t colM1 = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,0);
1250 UInt_t colM2 = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,31);
1251 printf("%*d,%*d-%*d\n",3,module,3,colM1,3,colM2);
1262 //____________________________________________________________________________________________
1263 void AliITSOnlineCalibrationSPDhandler::PrintDead() const {
1264 // print the single dead pixels to screen (disregards inactive eq,hs,chip)
1265 printf("------------------------------------------------------\n");
1266 printf("Dead Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
1267 printf("------------------------------------------------------\n");
1268 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1269 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1270 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1271 UInt_t eq = GetEqIdFromKey(key);
1272 UInt_t hs = GetHSFromKey(key);
1273 UInt_t chip = GetChipFromKey(key);
1274 UInt_t col = GetColFromKey(key);
1275 UInt_t row = GetRowFromKey(key);
1277 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1278 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1279 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1281 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);
1285 //____________________________________________________________________________________________
1286 void AliITSOnlineCalibrationSPDhandler::PrintNoisy() const {
1287 // print the dead pixels to screen
1288 printf("-------------------------------------------------------\n");
1289 printf("Noisy Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
1290 printf("-------------------------------------------------------\n");
1291 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1292 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
1293 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1294 UInt_t eq = GetEqIdFromKey(key);
1295 UInt_t hs = GetHSFromKey(key);
1296 UInt_t chip = GetChipFromKey(key);
1297 UInt_t col = GetColFromKey(key);
1298 UInt_t row = GetRowFromKey(key);
1300 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1301 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1302 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1304 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);
1308 //____________________________________________________________________________________________
1309 Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1310 // set a dead pixel, returns false if pixel is already dead
1311 UInt_t gloChip = GetGloChip(eq,hs,chip);
1312 if (gloChip>=1200) {
1313 Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1316 if (col>=32 && row>=256) {
1317 Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
1320 Int_t key = GetKey(eq,hs,chip,col,row);
1321 // if noisy we dont want to add it...
1322 if (fNoisyPixelMap[gloChip]->Find(key) != NULL) return kFALSE;
1323 if (fDeadPixelMap[gloChip]->Insert(key,gloChip)) {
1329 //____________________________________________________________________________________________
1330 Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1331 // set a noisy pixel, returns false if pixel is already noisy
1332 UInt_t gloChip = GetGloChip(eq,hs,chip);
1333 if (gloChip>=1200) {
1334 Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1337 if (col>=32 && row>=256) {
1338 Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
1341 Int_t key = GetKey(eq,hs,chip,col,row);
1342 // if dead before - remove from the dead list
1343 if (fDeadPixelMap[gloChip]->Remove(key)) {
1346 if (fNoisyPixelMap[gloChip]->Insert(key,gloChip)) {
1347 fNrNoisy[gloChip]++;
1352 //____________________________________________________________________________________________
1353 Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1354 // set a dead pixel, returns false if pixel is already dead
1355 UInt_t eq = GetEqIdFromOffline(module);
1356 UInt_t hs = GetHSFromOffline(module);
1357 UInt_t chip = GetChipFromOffline(module,colM);
1358 UInt_t col = GetColFromOffline(module,colM);
1359 UInt_t row = GetRowFromOffline(module,rowM);
1360 return SetDeadPixel(eq,hs,chip,col,row);
1362 //____________________________________________________________________________________________
1363 Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1364 // set a noisy pixel, returns false if pixel is already noisy
1365 UInt_t eq = GetEqIdFromOffline(module);
1366 UInt_t hs = GetHSFromOffline(module);
1367 UInt_t chip = GetChipFromOffline(module,colM);
1368 UInt_t col = GetColFromOffline(module,colM);
1369 UInt_t row = GetRowFromOffline(module,rowM);
1370 return SetNoisyPixel(eq,hs,chip,col,row);
1372 //____________________________________________________________________________________________
1373 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1374 // unset a dead pixel, returns false if pixel is not dead
1375 UInt_t gloChip = GetGloChip(eq,hs,chip);
1376 if (gloChip>=1200) {
1377 Error("AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1380 Int_t key = GetKey(eq,hs,chip,col,row);
1381 if (fDeadPixelMap[gloChip]->Remove(key)) {
1387 //____________________________________________________________________________________________
1388 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1389 // unset a noisy pixel, returns false if pixel is not noisy
1390 UInt_t gloChip = GetGloChip(eq,hs,chip);
1391 if (gloChip>=1200) {
1392 Error("AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1395 Int_t key = GetKey(eq,hs,chip,col,row);
1396 if (fNoisyPixelMap[gloChip]->Remove(key)) {
1397 fNrNoisy[gloChip]--;
1402 //____________________________________________________________________________________________
1403 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1404 // unset a dead pixel, returns false if pixel is not dead
1405 UInt_t eq = GetEqIdFromOffline(module);
1406 UInt_t hs = GetHSFromOffline(module);
1407 UInt_t chip = GetChipFromOffline(module,colM);
1408 UInt_t col = GetColFromOffline(module,colM);
1409 UInt_t row = GetRowFromOffline(module,rowM);
1410 return UnSetDeadPixel(eq,hs,chip,col,row);
1412 //____________________________________________________________________________________________
1413 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1414 // unset a noisy pixel, returns false if pixel is not noisy
1415 UInt_t eq = GetEqIdFromOffline(module);
1416 UInt_t hs = GetHSFromOffline(module);
1417 UInt_t chip = GetChipFromOffline(module,colM);
1418 UInt_t col = GetColFromOffline(module,colM);
1419 UInt_t row = GetRowFromOffline(module,rowM);
1420 return UnSetNoisyPixel(eq,hs,chip,col,row);
1422 //____________________________________________________________________________________________
1423 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBad(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1424 // is the pixel bad (silent or noisy)
1425 return (IsPixelSilent(eq,hs,chip,col,row) || IsPixelNoisy(eq,hs,chip,col,row));
1427 //____________________________________________________________________________________________
1428 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilent(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1429 // is the pixel silent (dead or inactive)?
1430 UInt_t gloChip = GetGloChip(eq,hs,chip);
1431 if (gloChip>=1200 || col>=32 || row>=256) {
1432 Error("AliITSOnlineCalibrationSPDhandler::IsPixelSilent", "eq,hs,chip,col,row nrs (%d,%d,%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
1435 if (IsSilentChip(eq,hs,chip)) return kTRUE;
1436 else return IsPixelDead(eq,hs,chip,col,row);
1438 //____________________________________________________________________________________________
1439 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDead(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1440 // is the pixel dead?
1441 UInt_t gloChip = GetGloChip(eq,hs,chip);
1442 if (gloChip>=1200 || col>=32 || row>=256) {
1443 Error("AliITSOnlineCalibrationSPDhandler::IsPixelDead", "eq,hs,chip,col,row nrs (%d,%d,%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
1446 UInt_t key = GetKey(eq,hs,chip,col,row);
1447 if (IsDeadEq(eq) || IsDeadHS(eq,hs) || IsDeadChip(eq,hs,chip)) return kTRUE;
1449 if ( fDeadPixelMap[gloChip]->Find(key) != NULL ) return kTRUE;
1453 //____________________________________________________________________________________________
1454 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisy(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1455 // is the pixel noisy?
1456 UInt_t gloChip = GetGloChip(eq,hs,chip);
1457 if (gloChip>=1200 || col>=32 || row>=256) {
1458 Error("AliITSOnlineCalibrationSPDhandler::IsPixelNoisy",Form("eq,hs,chip,col,row nrs (%d,%d,%d,%d,%d) out of bounds.",eq,hs,chip,col,row));
1461 UInt_t key = GetKey(eq,hs,chip,col,row);
1462 if ( fNoisyPixelMap[gloChip]->Find(key) != NULL ) return kTRUE;
1465 //____________________________________________________________________________________________
1466 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBadM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1467 // is the pixel bad (silent or noisy)?
1468 return (IsPixelSilentM(module,colM,rowM) || IsPixelNoisyM(module,colM,rowM));
1470 //____________________________________________________________________________________________
1471 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilentM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1472 // is the pixel silent (dead or inactive)?
1473 UInt_t eq = GetEqIdFromOffline(module);
1474 UInt_t hs = GetHSFromOffline(module);
1475 UInt_t chip = GetChipFromOffline(module,colM);
1476 UInt_t col = GetColFromOffline(module,colM);
1477 UInt_t row = GetRowFromOffline(module,rowM);
1478 return IsPixelSilent(eq,hs,chip,col,row);
1480 //____________________________________________________________________________________________
1481 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1482 // is the pixel dead?
1483 UInt_t eq = GetEqIdFromOffline(module);
1484 UInt_t hs = GetHSFromOffline(module);
1485 UInt_t chip = GetChipFromOffline(module,colM);
1486 UInt_t col = GetColFromOffline(module,colM);
1487 UInt_t row = GetRowFromOffline(module,rowM);
1488 return IsPixelDead(eq,hs,chip,col,row);
1490 //____________________________________________________________________________________________
1491 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1492 // is the pixel noisy?
1493 UInt_t eq = GetEqIdFromOffline(module);
1494 UInt_t hs = GetHSFromOffline(module);
1495 UInt_t chip = GetChipFromOffline(module,colM);
1496 UInt_t col = GetColFromOffline(module,colM);
1497 UInt_t row = GetRowFromOffline(module,rowM);
1498 return IsPixelNoisy(eq,hs,chip,col,row);
1500 //____________________________________________________________________________________________
1501 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBadKey(Int_t key) const {
1502 // is this pixel silent (dead or inactive)?
1503 UInt_t eq = GetEqIdFromKey(key);
1504 UInt_t hs = GetHSFromKey(key);
1505 UInt_t chip = GetChipFromKey(key);
1506 UInt_t col = GetColFromKey(key);
1507 UInt_t row = GetRowFromKey(key);
1508 return IsPixelBad(eq,hs,chip,col,row);
1510 //____________________________________________________________________________________________
1511 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilentKey(Int_t key) const {
1512 // is this pixel silent (dead or inactive)?
1513 UInt_t eq = GetEqIdFromKey(key);
1514 UInt_t hs = GetHSFromKey(key);
1515 UInt_t chip = GetChipFromKey(key);
1516 UInt_t col = GetColFromKey(key);
1517 UInt_t row = GetRowFromKey(key);
1518 return IsPixelSilent(eq,hs,chip,col,row);
1520 //____________________________________________________________________________________________
1521 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadKey(Int_t key) const {
1522 // is this pixel dead?
1523 UInt_t eq = GetEqIdFromKey(key);
1524 UInt_t hs = GetHSFromKey(key);
1525 UInt_t chip = GetChipFromKey(key);
1526 UInt_t col = GetColFromKey(key);
1527 UInt_t row = GetRowFromKey(key);
1528 return IsPixelDead(eq,hs,chip,col,row);
1530 //____________________________________________________________________________________________
1531 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyKey(Int_t key) const {
1532 // is this pixel noisy?
1533 UInt_t eq = GetEqIdFromKey(key);
1534 UInt_t hs = GetHSFromKey(key);
1535 UInt_t chip = GetChipFromKey(key);
1536 UInt_t col = GetColFromKey(key);
1537 UInt_t row = GetRowFromKey(key);
1538 return IsPixelNoisy(eq,hs,chip,col,row);
1540 //____________________________________________________________________________________________
1541 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBad() const {
1542 // returns the total nr of bad pixels (silent or noisy)
1544 nrBad+=GetNrSilent();
1545 UInt_t nrNoisy = GetNrNoisy();
1546 for (UInt_t i=0; i<nrNoisy; i++) {
1547 UInt_t eq = GetNoisyEqIdAt(i);
1548 UInt_t hs = GetNoisyHSAt(i);
1549 UInt_t chip = GetNoisyChipAt(i);
1550 UInt_t col = GetNoisyColAt(i);
1551 UInt_t row = GetNoisyRowAt(i);
1552 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1556 //____________________________________________________________________________________________
1557 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilent() const {
1558 // returns the total nr of silent pixels (dead or inactive)
1560 for (UInt_t eq=0; eq<20; eq++) {
1561 if (IsSilentEq(eq)) {
1565 for (UInt_t hs=0; hs<6; hs++) {
1566 if (IsSilentHS(eq,hs)) {
1570 for (UInt_t chip=0; chip<10; chip++) {
1571 if (IsSilentChip(eq,hs,chip)) {
1576 UInt_t gloChip = GetGloChip(eq,hs,chip);
1577 nrDead+=fNrDead[gloChip];
1584 //____________________________________________________________________________________________
1585 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead() const {
1586 // returns the total nr of dead pixels
1588 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1589 nrDead+=fNrDead[gloChip];
1593 //____________________________________________________________________________________________
1594 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy() const {
1595 // returns the total nr of noisy pixels
1597 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1598 nrNoisy+=fNrNoisy[gloChip];
1602 //____________________________________________________________________________________________
1603 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t index) const {
1604 // get eq for the dead pixel at position index in list of dead
1607 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1608 return GetDeadEqIdAtC2(gloChip,chipIndex);
1610 //____________________________________________________________________________________________
1611 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t index) const {
1612 // get eq for the noisy pixel at position index in list of noisy
1615 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1616 return GetNoisyEqIdAtC2(gloChip,chipIndex);
1618 //____________________________________________________________________________________________
1619 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t index) const {
1620 // get hs for the dead pixel at position index in list of dead
1623 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1624 return GetDeadHSAtC2(gloChip,chipIndex);
1626 //____________________________________________________________________________________________
1627 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t index) const {
1628 // get hs for the noisy pixel at position index in list of noisy
1631 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1632 return GetNoisyHSAtC2(gloChip,chipIndex);
1634 //____________________________________________________________________________________________
1635 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t index) const {
1636 // get chip for the dead pixel at position index in list of dead
1639 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1640 return GetDeadChipAtC2(gloChip,chipIndex);
1642 //____________________________________________________________________________________________
1643 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t index) const {
1644 // get chip for the noisy pixel at position index in list of noisy
1647 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1648 return GetNoisyChipAtC2(gloChip,chipIndex);
1650 //____________________________________________________________________________________________
1651 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t index) const {
1652 // get hs for the dead pixel at position index in list of dead
1655 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1656 return GetDeadColAtC2(gloChip,chipIndex);
1658 //____________________________________________________________________________________________
1659 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t index) const {
1660 // get hs for the noisy pixel at position index in list of noisy
1663 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1664 return GetNoisyColAtC2(gloChip,chipIndex);
1666 //____________________________________________________________________________________________
1667 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t index) const {
1668 // get hs for the dead pixel at position index in list of dead
1671 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1672 return GetDeadRowAtC2(gloChip,chipIndex);
1674 //____________________________________________________________________________________________
1675 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t index) const {
1676 // get hs for the noisy pixel at position index in list of noisy
1679 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1680 return GetNoisyRowAtC2(gloChip,chipIndex);
1682 //____________________________________________________________________________________________
1683 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBad(UInt_t module) const {
1684 // returns the number of bad pixels for a certain module (silent or noisy)
1686 nrBad+=GetNrSilent(module);
1687 UInt_t nrNoisy = GetNrNoisy(module);
1688 for (UInt_t i=0; i<nrNoisy; i++) {
1689 UInt_t eq = GetNoisyEqIdAt(module,i);
1690 UInt_t hs = GetNoisyHSAt(module,i);
1691 UInt_t chip = GetNoisyChipAt(module,i);
1692 UInt_t col = GetNoisyColAt(module,i);
1693 UInt_t row = GetNoisyRowAt(module,i);
1694 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1698 //____________________________________________________________________________________________
1699 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilent(UInt_t module) const {
1700 // returns the number of silent pixels for a certain module (dead or inactive)
1702 Error("AliITSOnlineCalibrationSPDhandler::GetNrSilent", "module nr (%d) out of bounds.",module);
1705 UInt_t nrSilent = 0;
1706 UInt_t eq = GetEqIdFromOffline(module);
1707 if (IsSilentEq(eq)) return 160*256;
1708 UInt_t hs = GetHSFromOffline(module);
1709 if (IsSilentHS(eq,hs)) return 160*256;
1710 for (UInt_t ch=0; ch<5; ch++) {
1711 UInt_t chip = GetChipFromOffline(module,ch*32);
1712 if (IsSilentChip(eq,hs,chip)) {
1716 UInt_t gloChip = GetGloChip(eq,hs,chip);
1717 nrSilent+=fNrDead[gloChip];
1722 //____________________________________________________________________________________________
1723 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadSingle(UInt_t module) const {
1724 // returns the number of single dead pixels (excluding the ones on silent chips) for a certain module
1726 Error("AliITSOnlineCalibrationSPDhandler::GetNrDeadSingle", "module nr (%d) out of bounds.",module);
1730 UInt_t eq = GetEqIdFromOffline(module);
1731 UInt_t hs = GetHSFromOffline(module);
1732 for (UInt_t ch=0; ch<5; ch++) {
1733 UInt_t chip = GetChipFromOffline(module,ch*32);
1734 if (!IsSilentChip(eq,hs,chip)) {
1735 UInt_t gloChip = GetGloChip(eq,hs,chip);
1736 nrDead+=fNrDead[gloChip];
1741 //____________________________________________________________________________________________
1742 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisySingle(UInt_t module) const {
1743 // returns the number of noisy pixels for a certain module
1744 return GetNrNoisy(module);
1746 //____________________________________________________________________________________________
1747 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead(UInt_t module) const {
1748 // returns the number of dead pixels for a certain module
1750 Error("AliITSOnlineCalibrationSPDhandler::GetNrDead", "module nr (%d) out of bounds.",module);
1754 UInt_t eq = GetEqIdFromOffline(module);
1755 UInt_t hs = GetHSFromOffline(module);
1756 for (UInt_t ch=0; ch<5; ch++) {
1757 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
1758 nrDead+=fNrDead[gloChip];
1762 //____________________________________________________________________________________________
1763 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy(UInt_t module) const {
1764 // returns the number of noisy pixels for a certain module
1766 Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisy", "module nr (%d) out of bounds.",module);
1770 UInt_t eq = GetEqIdFromOffline(module);
1771 UInt_t hs = GetHSFromOffline(module);
1772 for (UInt_t ch=0; ch<5; ch++) {
1773 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
1774 nrNoisy+=fNrNoisy[gloChip];
1778 //____________________________________________________________________________________________
1779 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t module, UInt_t index) const {
1780 // get eq for the dead pixel at position index in list of dead
1783 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1784 return GetDeadEqIdAtC2(gloChip,chipIndex);
1786 //____________________________________________________________________________________________
1787 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t module, UInt_t index) const {
1788 // get eq for the noisy pixel at position index in list of noisy
1791 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1792 return GetNoisyEqIdAtC2(gloChip,chipIndex);
1794 //____________________________________________________________________________________________
1795 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t module, UInt_t index) const {
1796 // get hs for the dead pixel at position index in list of dead
1799 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1800 return GetDeadHSAtC2(gloChip,chipIndex);
1802 //____________________________________________________________________________________________
1803 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t module, UInt_t index) const {
1804 // get hs for the noisy pixel at position index in list of noisy
1807 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1808 return GetNoisyHSAtC2(gloChip,chipIndex);
1810 //____________________________________________________________________________________________
1811 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t module, UInt_t index) const {
1812 // get chip for the dead pixel at position index in list of dead
1815 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1816 return GetDeadChipAtC2(gloChip,chipIndex);
1818 //____________________________________________________________________________________________
1819 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t module, UInt_t index) const {
1820 // get chip for the noisy pixel at position index in list of noisy
1823 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1824 return GetNoisyChipAtC2(gloChip,chipIndex);
1826 //____________________________________________________________________________________________
1827 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t module, UInt_t index) const {
1828 // get hs for the dead pixel at position index in list of dead
1831 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1832 return GetDeadColAtC2(gloChip,chipIndex);
1834 //____________________________________________________________________________________________
1835 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t module, UInt_t index) const {
1836 // get hs for the noisy pixel at position index in list of noisy
1839 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1840 return GetNoisyColAtC2(gloChip,chipIndex);
1842 //____________________________________________________________________________________________
1843 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t module, UInt_t index) const {
1844 // get hs for the dead pixel at position index in list of dead
1847 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1848 return GetDeadRowAtC2(gloChip,chipIndex);
1850 //____________________________________________________________________________________________
1851 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t module, UInt_t index) const {
1852 // get hs for the noisy pixel at position index in list of noisy
1855 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1856 return GetNoisyRowAtC2(gloChip,chipIndex);
1858 //____________________________________________________________________________________________
1859 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBadEq(UInt_t eq) const {
1860 // returns nr of bad for eq (silent or noisy)
1862 nrBad+=GetNrSilentEq(eq);
1863 UInt_t nrNoisy = GetNrNoisy(eq);
1864 for (UInt_t i=0; i<nrNoisy; i++) {
1865 UInt_t hs = GetNoisyHSAtEq(eq,i);
1866 UInt_t chip = GetNoisyChipAtEq(eq,i);
1867 UInt_t col = GetNoisyColAtEq(eq,i);
1868 UInt_t row = GetNoisyRowAtEq(eq,i);
1869 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1873 //____________________________________________________________________________________________
1874 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentEq(UInt_t eq) const {
1875 // returns nr of silent for eq (dead or inactive)
1877 if (IsSilentEq(eq)) return 81920*6;
1878 for (UInt_t hs=0; hs<6; hs++) {
1879 if (IsSilentHS(eq,hs)) {
1883 for (UInt_t chip=0; chip<10; chip++) {
1884 if (IsSilentChip(eq,hs,chip)) {
1889 returnval+=GetNrDeadC(eq,hs,chip);
1895 //____________________________________________________________________________________________
1896 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadEq(UInt_t eq) const {
1897 // returns nr of dead for eq
1899 for (UInt_t hs=0; hs<6; hs++) {
1900 for (UInt_t chip=0; chip<10; chip++) {
1901 returnval+=GetNrDeadC(eq,hs,chip);
1906 //____________________________________________________________________________________________
1907 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyEq(UInt_t eq) const {
1908 // returns nr of noisy for eq
1910 for (UInt_t hs=0; hs<6; hs++) {
1911 for (UInt_t chip=0; chip<10; chip++) {
1912 returnval+=GetNrNoisyC(eq,hs,chip);
1917 //____________________________________________________________________________________________
1918 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtEq(UInt_t eq, UInt_t index) const {
1919 // get eq for the dead pixel at position index in list of dead
1920 if (eq<20 && index<GetNrDeadEq(eq)) {
1927 //____________________________________________________________________________________________
1928 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtEq(UInt_t eq, UInt_t index) const {
1929 // get eq for the noisy pixel at position index in list of noisy
1930 if (eq<20 && index<GetNrNoisyEq(eq)) {
1937 //____________________________________________________________________________________________
1938 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtEq(UInt_t eq, UInt_t index) const {
1939 // get hs for the dead pixel at position index in list of dead
1942 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1943 return GetDeadHSAtC2(gloChip,chipIndex);
1945 //____________________________________________________________________________________________
1946 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtEq(UInt_t eq, UInt_t index) const {
1947 // get hs for the noisy pixel at position index in list of noisy
1950 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1951 return GetNoisyHSAtC2(gloChip,chipIndex);
1953 //____________________________________________________________________________________________
1954 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtEq(UInt_t eq, UInt_t index) const {
1955 // get chip for the dead pixel at position index in list of dead
1958 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1959 return GetDeadChipAtC2(gloChip,chipIndex);
1961 //____________________________________________________________________________________________
1962 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtEq(UInt_t eq, UInt_t index) const {
1963 // get chip for the noisy pixel at position index in list of noisy
1966 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1967 return GetNoisyChipAtC2(gloChip,chipIndex);
1969 //____________________________________________________________________________________________
1970 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtEq(UInt_t eq, UInt_t index) const {
1971 // get hs for the dead pixel at position index in list of dead
1974 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1975 return GetDeadColAtC2(gloChip,chipIndex);
1977 //____________________________________________________________________________________________
1978 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtEq(UInt_t eq, UInt_t index) const {
1979 // get hs for the noisy pixel at position index in list of noisy
1982 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1983 return GetNoisyColAtC2(gloChip,chipIndex);
1985 //____________________________________________________________________________________________
1986 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtEq(UInt_t eq, UInt_t index) const {
1987 // get hs for the dead pixel at position index in list of dead
1990 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1991 return GetDeadRowAtC2(gloChip,chipIndex);
1993 //____________________________________________________________________________________________
1994 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtEq(UInt_t eq, UInt_t index) const {
1995 // get hs for the noisy pixel at position index in list of noisy
1998 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1999 return GetNoisyRowAtC2(gloChip,chipIndex);
2001 //____________________________________________________________________________________________
2002 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
2003 // returns nr of bad for chip (silent or noisy)
2005 nrBad+=GetNrSilentC(eq,hs,chip);
2006 UInt_t nrNoisy = GetNrNoisyC(eq,hs,chip);
2007 for (UInt_t i=0; i<nrNoisy; i++) {
2008 UInt_t col = GetNoisyColAtC(eq,hs,chip,i);
2009 UInt_t row = GetNoisyRowAtC(eq,hs,chip,i);
2010 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
2014 //____________________________________________________________________________________________
2015 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentC(UInt_t eq, UInt_t hs, UInt_t chip) const {
2016 // returns nr of silent for chip (dead or inactive)
2017 if (IsSilentChip(eq,hs,chip)) return 8192;
2018 else return GetNrDeadC(eq,hs,chip);
2020 //____________________________________________________________________________________________
2021 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
2022 // returns nr of dead for chip
2023 UInt_t gloChip = GetGloChip(eq,hs,chip);
2024 return GetNrDeadC2(gloChip);
2026 //____________________________________________________________________________________________
2027 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC(UInt_t eq, UInt_t hs, UInt_t chip) const {
2028 // returns nr of noisy for chip
2029 UInt_t gloChip = GetGloChip(eq,hs,chip);
2030 return GetNrNoisyC2(gloChip);
2032 //____________________________________________________________________________________________
2033 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2034 UInt_t gloChip = GetGloChip(eq,hs,chip);
2035 return GetDeadEqIdAtC2(gloChip,index);
2037 //____________________________________________________________________________________________
2038 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2039 UInt_t gloChip = GetGloChip(eq,hs,chip);
2040 return GetNoisyEqIdAtC2(gloChip,index);
2042 //____________________________________________________________________________________________
2043 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2044 UInt_t gloChip = GetGloChip(eq,hs,chip);
2045 return GetDeadHSAtC2(gloChip,index);
2047 //____________________________________________________________________________________________
2048 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2049 UInt_t gloChip = GetGloChip(eq,hs,chip);
2050 return GetNoisyHSAtC2(gloChip,index);
2052 //____________________________________________________________________________________________
2053 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2054 UInt_t gloChip = GetGloChip(eq,hs,chip);
2055 return GetDeadChipAtC2(gloChip,index);
2057 //____________________________________________________________________________________________
2058 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2059 UInt_t gloChip = GetGloChip(eq,hs,chip);
2060 return GetNoisyChipAtC2(gloChip,index);
2062 //____________________________________________________________________________________________
2063 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2064 UInt_t gloChip = GetGloChip(eq,hs,chip);
2065 return GetDeadColAtC2(gloChip,index);
2067 //____________________________________________________________________________________________
2068 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2069 UInt_t gloChip = GetGloChip(eq,hs,chip);
2070 return GetNoisyColAtC2(gloChip,index);
2072 //____________________________________________________________________________________________
2073 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2074 UInt_t gloChip = GetGloChip(eq,hs,chip);
2075 return GetDeadRowAtC2(gloChip,index);
2077 //____________________________________________________________________________________________
2078 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2079 UInt_t gloChip = GetGloChip(eq,hs,chip);
2080 return GetNoisyRowAtC2(gloChip,index);
2082 //____________________________________________________________________________________________
2083 const Char_t* AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2084 // get a string of dead pixel info
2085 TString returnMess = "";
2086 UInt_t gloChip = GetGloChip(eq,hs,chip);
2087 if (gloChip>=1200) {
2088 Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
2089 return returnMess.Data();
2091 if (index<fNrDead[gloChip]) {
2092 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2093 UInt_t col = GetColFromKey(key);
2094 UInt_t row = GetRowFromKey(key);
2095 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
2096 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
2097 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
2098 returnMess = Form("%*d,%*d,%*d,%*d,%*d | %*d,%*d,%*d",2,eq,1,hs,1,chip,2,col,3,row,3,module,3,colM,3,rowM);
2099 return returnMess.Data();
2102 Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "Index %d out of bounds.", index);
2103 return returnMess.Data();
2106 //____________________________________________________________________________________________
2107 const Char_t* AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
2108 // get a string of noisy pixel info
2109 TString returnMess = "";
2110 UInt_t gloChip = GetGloChip(eq,hs,chip);
2111 if (gloChip>=1200) {
2112 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
2113 return returnMess.Data();
2115 if (index<fNrNoisy[gloChip]) {
2116 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2117 UInt_t col = GetColFromKey(key);
2118 UInt_t row = GetRowFromKey(key);
2119 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
2120 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
2121 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
2122 returnMess = Form("%*d,%*d,%*d,%*d,%*d | %*d,%*d,%*d",2,eq,1,hs,1,chip,2,col,3,row,3,module,3,colM,3,rowM);
2123 return returnMess.Data();
2126 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "Index %d out of bounds.", index);
2127 return returnMess.Data();
2130 //____________________________________________________________________________________________
2131 UInt_t AliITSOnlineCalibrationSPDhandler::AddSilentFrom(AliITSOnlineCalibrationSPDhandler* other) {
2132 // returns number of new silent pixels in this' list (dead or inactive)
2133 UInt_t tmpdead = GetNrSilent();
2135 for (UInt_t eq=0; eq<20; eq++) {
2136 if (!(other->IsActiveEq(eq))) ActivateEq(eq,kFALSE);
2137 if (other->IsDeadEq(eq)) SetDeadEq(eq,kTRUE);
2138 for (UInt_t hs=0; hs<6; hs++) {
2139 if (!(other->IsActiveHS(eq,hs))) ActivateHS(eq,hs,kFALSE);
2140 if (other->IsDeadHS(eq,hs)) SetDeadHS(eq,hs,kTRUE);
2141 for (UInt_t chip=0; chip<10; chip++) {
2142 if (!(other->IsActiveChip(eq,hs,chip))) ActivateChip(eq,hs,chip,kFALSE);
2143 if (other->IsDeadChip(eq,hs,chip)) SetDeadChip(eq,hs,chip,kTRUE);
2150 return GetNrSilent() - tmpdead;
2152 //____________________________________________________________________________________________
2153 UInt_t AliITSOnlineCalibrationSPDhandler::AddDeadFrom(AliITSOnlineCalibrationSPDhandler* other) {
2154 // returns number of new dead pixels in this' list
2156 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2157 for (UInt_t ind1=0; ind1<other->fNrDead[gloChip]; ind1++) {
2158 UInt_t eq = other->GetDeadEqIdAtC2(gloChip,ind1);
2159 UInt_t hs = other->GetDeadHSAtC2(gloChip,ind1);
2160 UInt_t chip = other->GetDeadChipAtC2(gloChip,ind1);
2161 UInt_t col = other->GetDeadColAtC2(gloChip,ind1);
2162 UInt_t row = other->GetDeadRowAtC2(gloChip,ind1);
2163 if (SetDeadPixel(eq,hs,chip,col,row)) {
2170 //____________________________________________________________________________________________
2171 UInt_t AliITSOnlineCalibrationSPDhandler::AddNoisyFrom(AliITSOnlineCalibrationSPDhandler* other) {
2172 // returns number of new noisy pixels in this' list
2174 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2175 for (UInt_t ind1=0; ind1<other->fNrNoisy[gloChip]; ind1++) {
2176 UInt_t eq = other->GetNoisyEqIdAtC2(gloChip,ind1);
2177 UInt_t hs = other->GetNoisyHSAtC2(gloChip,ind1);
2178 UInt_t chip = other->GetNoisyChipAtC2(gloChip,ind1);
2179 UInt_t col = other->GetNoisyColAtC2(gloChip,ind1);
2180 UInt_t row = other->GetNoisyRowAtC2(gloChip,ind1);
2181 if (SetNoisyPixel(eq,hs,chip,col,row)) {
2188 //____________________________________________________________________________________________
2189 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2190 // returns nr of dead/noisy in this' lists and not in other's lists (including inactive)
2191 return GetNrSilentDiff(other) + GetNrNoisyDiff(other);
2193 //____________________________________________________________________________________________
2194 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2195 // returns nr of single silent pixels in this' lists and not in other's lists (dead or inactive)
2197 for (UInt_t eq=0; eq<20; eq++) {
2198 for (UInt_t hs=0; hs<6; hs++) {
2199 for (UInt_t chip=0; chip<10; chip++) {
2200 if (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs) || !IsActiveChip(eq,hs,chip) || IsDeadChip(eq,hs,chip)) {
2201 if (other->IsActiveEq(eq) && !other->IsDeadEq(eq) && other->IsActiveHS(eq,hs) && !other->IsDeadHS(eq,hs) && other->IsActiveChip(eq,hs,chip) && !other->IsDeadChip(eq,hs,chip)) {
2202 // if this is inactive and the other is active...
2203 returnval+= 8192 - other->GetNrDeadC(eq,hs,chip);
2207 UInt_t gloChip = GetGloChip(eq,hs,chip);
2208 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2209 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2210 UInt_t col = GetColFromKey(key);
2211 UInt_t row = GetRowFromKey(key);
2212 if (!(other->IsPixelSilent(eq,hs,chip,col,row))) {
2222 //____________________________________________________________________________________________
2223 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2224 // returns nr of dead in this' lists and not in other's lists
2226 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2227 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2228 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2229 UInt_t eq = GetEqIdFromKey(key);
2230 UInt_t hs = GetHSFromKey(key);
2231 UInt_t chip = GetChipFromKey(key);
2232 UInt_t col = GetColFromKey(key);
2233 UInt_t row = GetRowFromKey(key);
2234 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2241 //____________________________________________________________________________________________
2242 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2243 // returns nr of noisy in this' lists and not in other's lists
2245 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2246 for (UInt_t ind1=0; ind1<fNrNoisy[gloChip]; ind1++) {
2247 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind1);
2248 UInt_t eq = GetEqIdFromKey(key);
2249 UInt_t hs = GetHSFromKey(key);
2250 UInt_t chip = GetChipFromKey(key);
2251 UInt_t col = GetColFromKey(key);
2252 UInt_t row = GetRowFromKey(key);
2253 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2260 //____________________________________________________________________________________________
2261 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2262 // returns handler with active/dead/noisy in this' lists, removing those that are in other's lists
2263 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2265 for (UInt_t eq=0; eq<20; eq++) {
2266 if (!(IsActiveEq(eq))) {
2267 newHandler->ActivateEq(eq,kFALSE);
2268 if (!other->IsActiveEq(eq)) newHandler->ActivateEq(eq);
2271 newHandler->SetDeadEq(eq);
2272 if (other->IsDeadEq(eq)) newHandler->SetDeadEq(eq,kFALSE);
2274 for (UInt_t hs=0; hs<6; hs++) {
2275 if (!(IsActiveHS(eq,hs))) {
2276 newHandler->ActivateHS(eq,hs,kFALSE);
2277 if (!other->IsActiveHS(eq,hs)) newHandler->ActivateHS(eq,hs);
2279 if (IsDeadHS(eq,hs)) {
2280 newHandler->SetDeadHS(eq,hs);
2281 if (other->IsDeadHS(eq,hs)) newHandler->SetDeadHS(eq,hs,kFALSE);
2283 for (UInt_t chip=0; chip<10; chip++) {
2284 if (!(IsActiveChip(eq,hs,chip))) {
2285 newHandler->ActivateChip(eq,hs,chip,kFALSE);
2286 if (!other->IsActiveChip(eq,hs,chip)) newHandler->ActivateHS(eq,hs,chip);
2288 if (IsDeadChip(eq,hs,chip)) {
2289 newHandler->SetDeadChip(eq,hs,chip);
2290 if (other->IsDeadChip(eq,hs,chip)) newHandler->SetDeadChip(eq,hs,chip,kFALSE);
2296 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2297 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2298 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2299 UInt_t eq = GetEqIdFromKey(key);
2300 UInt_t hs = GetHSFromKey(key);
2301 UInt_t chip = GetChipFromKey(key);
2302 UInt_t col = GetColFromKey(key);
2303 UInt_t row = GetRowFromKey(key);
2304 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2305 newHandler->SetDeadPixel(eq,hs,chip,col,row);
2310 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2311 for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
2312 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
2313 UInt_t eq = GetEqIdFromKey(key);
2314 UInt_t hs = GetHSFromKey(key);
2315 UInt_t chip = GetChipFromKey(key);
2316 UInt_t col = GetColFromKey(key);
2317 UInt_t row = GetRowFromKey(key);
2318 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2319 newHandler->SetNoisyPixel(eq,hs,chip,col,row);
2326 //____________________________________________________________________________________________
2327 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetSilentDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2328 // returns handler with active/dead in this' lists, removing those that are in other's lists
2329 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2331 for (UInt_t eq=0; eq<20; eq++) {
2332 if (!(IsActiveEq(eq))) {
2333 newHandler->ActivateEq(eq,kFALSE);
2334 if (!other->IsActiveEq(eq)) newHandler->ActivateEq(eq);
2337 newHandler->SetDeadEq(eq);
2338 if (other->IsDeadEq(eq)) newHandler->SetDeadEq(eq,kFALSE);
2340 for (UInt_t hs=0; hs<6; hs++) {
2341 if (!(IsActiveHS(eq,hs))) {
2342 newHandler->ActivateHS(eq,hs,kFALSE);
2343 if (!other->IsActiveHS(eq,hs)) newHandler->ActivateHS(eq,hs);
2345 if (IsDeadHS(eq,hs)) {
2346 newHandler->SetDeadHS(eq,hs);
2347 if (other->IsDeadHS(eq,hs)) newHandler->SetDeadHS(eq,hs,kFALSE);
2349 for (UInt_t chip=0; chip<10; chip++) {
2350 if (!(IsActiveChip(eq,hs,chip))) {
2351 newHandler->ActivateChip(eq,hs,chip,kFALSE);
2352 if (!other->IsActiveChip(eq,hs,chip)) newHandler->ActivateHS(eq,hs,chip);
2354 if (IsDeadChip(eq,hs,chip)) {
2355 newHandler->SetDeadChip(eq,hs,chip);
2356 if (other->IsDeadChip(eq,hs,chip)) newHandler->SetDeadChip(eq,hs,chip,kFALSE);
2362 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2363 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2364 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2365 UInt_t eq = GetEqIdFromKey(key);
2366 UInt_t hs = GetHSFromKey(key);
2367 UInt_t chip = GetChipFromKey(key);
2368 UInt_t col = GetColFromKey(key);
2369 UInt_t row = GetRowFromKey(key);
2370 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2371 newHandler->SetDeadPixel(eq,hs,chip,col,row);
2378 //____________________________________________________________________________________________
2379 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2380 // returns handler with dead in this' lists, except for those in other's lists
2381 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2382 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2383 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2384 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2385 UInt_t eq = GetEqIdFromKey(key);
2386 UInt_t hs = GetHSFromKey(key);
2387 UInt_t chip = GetChipFromKey(key);
2388 UInt_t col = GetColFromKey(key);
2389 UInt_t row = GetRowFromKey(key);
2390 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2391 newHandler->SetDeadPixel(eq,hs,chip,col,row);
2397 //____________________________________________________________________________________________
2398 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2399 // returns handler with noisy in this' lists, except for those in other's lists
2400 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2401 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2402 for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
2403 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
2404 UInt_t eq = GetEqIdFromKey(key);
2405 UInt_t hs = GetHSFromKey(key);
2406 UInt_t chip = GetChipFromKey(key);
2407 UInt_t col = GetColFromKey(key);
2408 UInt_t row = GetRowFromKey(key);
2409 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2410 newHandler->SetNoisyPixel(eq,hs,chip,col,row);
2416 //____________________________________________________________________________________________
2417 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2418 // find gloChip and chipIndex from module and index
2419 if (index<GetNrDead(module)) {
2420 UInt_t eq = GetEqIdFromOffline(module);
2421 UInt_t hs = GetHSFromOffline(module);
2424 for (UInt_t ch=0; ch<5; ch++) {
2425 gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
2426 if (glVal+fNrDead[gloChip]>index) {
2427 chipIndex = index-glVal;
2431 glVal+=fNrDead[gloChip];
2437 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead", "Index %d out of bounds.", index);
2440 //____________________________________________________________________________________________
2441 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2442 // find gloChip and chipIndex from module and index
2443 if (index<GetNrNoisy(module)) {
2444 UInt_t eq = GetEqIdFromOffline(module);
2445 UInt_t hs = GetHSFromOffline(module);
2448 for (UInt_t ch=0; ch<5; ch++) {
2449 gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
2450 if (glVal+fNrNoisy[gloChip]>index) {
2451 chipIndex = index-glVal;
2455 glVal+=fNrNoisy[gloChip];
2461 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy", "Index %d out of bounds.", index);
2464 //____________________________________________________________________________________________
2465 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2466 // find gloChip and chipIndex from module and index
2467 if (index<GetNrDeadEq(eq)) {
2470 for (UInt_t hs=0; hs<6; hs++) {
2471 for (UInt_t chip=0; chip<10; chip++) {
2472 gloChip = GetGloChip(eq,hs,chip);
2473 if (glVal+fNrDead[gloChip]>index) {
2474 chipIndex = index-glVal;
2478 glVal+=fNrDead[gloChip];
2485 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead", "Index %d out of bounds.", index);
2488 //____________________________________________________________________________________________
2489 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2490 // find gloChip and chipIndex from module and index
2491 if (index<GetNrNoisyEq(eq)) {
2494 for (UInt_t hs=0; hs<6; hs++) {
2495 for (UInt_t chip=0; chip<10; chip++) {
2496 gloChip = GetGloChip(eq,hs,chip);
2497 if (glVal+fNrNoisy[gloChip]>index) {
2498 chipIndex = index-glVal;
2502 glVal+=fNrNoisy[gloChip];
2509 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy", "Index %d out of bounds.", index);
2512 //____________________________________________________________________________________________
2513 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2514 // find gloChip and chipIndex from global index
2515 if (index<GetNrDead()) {
2518 for (gloChip=0; gloChip<1200; gloChip++) {
2519 if (glVal+fNrDead[gloChip]>index) {
2520 chipIndex = index-glVal;
2524 glVal+=fNrDead[gloChip];
2530 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead", "Index %d out of bounds.", index);
2533 //____________________________________________________________________________________________
2534 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
2535 // find gloChip and chipIndex from global index
2536 if (index<GetNrNoisy()) {
2539 for (gloChip=0; gloChip<1200; gloChip++) {
2540 if (glVal+fNrNoisy[gloChip]>index) {
2541 chipIndex = index-glVal;
2545 glVal+=fNrNoisy[gloChip];
2551 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy", "Index %d out of bounds.", index);
2554 //____________________________________________________________________________________________
2555 UInt_t AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline(UInt_t module) const {
2556 // module to eq mapping
2558 Error("AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline", "module nr (%d) out of bounds.",module);
2561 return AliITSRawStreamSPD::GetOnlineEqIdFromOffline(module);
2563 //____________________________________________________________________________________________
2564 UInt_t AliITSOnlineCalibrationSPDhandler::GetHSFromOffline(UInt_t module) const {
2565 // module to hs mapping
2567 Error("AliITSOnlineCalibrationSPDhandler::GetHSFromOffline", "module nr (%d) out of bounds.",module);
2570 return AliITSRawStreamSPD::GetOnlineHSFromOffline(module);
2572 //____________________________________________________________________________________________
2573 UInt_t AliITSOnlineCalibrationSPDhandler::GetChipFromOffline(UInt_t module, UInt_t colM) const {
2574 // module,colM to chip mapping
2575 if (module>=240 || colM>=160) {
2576 Error("AliITSOnlineCalibrationSPDhandler::GetChipFromOffline", "module,colM nrs (%d,%d) out of bounds.",module,colM);
2579 return AliITSRawStreamSPD::GetOnlineChipFromOffline(module,colM);
2581 //____________________________________________________________________________________________
2582 UInt_t AliITSOnlineCalibrationSPDhandler::GetColFromOffline(UInt_t module, UInt_t colM) const {
2583 // colM to col mapping
2585 Error("AliITSOnlineCalibrationSPDhandler::GetColFromOffline", "colM nr (%d) out of bounds.",colM);
2588 return AliITSRawStreamSPD::GetOnlineColFromOffline(module,colM);
2590 //____________________________________________________________________________________________
2591 UInt_t AliITSOnlineCalibrationSPDhandler::GetRowFromOffline(UInt_t module, UInt_t rowM) const {
2592 // rowM to row mapping
2594 Error("AliITSOnlineCalibrationSPDhandler::GetRowFromOffline", "rowM nr (%d) out of bounds.",rowM);
2597 return AliITSRawStreamSPD::GetOnlineRowFromOffline(module,rowM);
2599 //____________________________________________________________________________________________
2600 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC2(UInt_t gloChip) const {
2601 // returns nr of dead pixels on this chip
2602 if (gloChip>=1200) {
2603 Error("AliITSOnlineCalibrationSPDhandler::GetNrDeadC2", "global chip nr (%d) out of bounds.",gloChip);
2606 return fNrDead[gloChip];
2608 //____________________________________________________________________________________________
2609 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2(UInt_t gloChip) const {
2610 // returns nr of noisy pixels on this chip
2611 if (gloChip>=1200) {
2612 Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2", "global chip nr (%d) out of bounds.",gloChip);
2615 return fNrNoisy[gloChip];
2617 //____________________________________________________________________________________________
2618 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC2(UInt_t gloChip, UInt_t index) const {
2619 // get eq for the dead pixel at position index in list of dead
2620 if (gloChip>=1200) {
2621 Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
2624 if (index<fNrDead[gloChip]) {
2625 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2626 return GetEqIdFromKey(key);
2629 Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "Index %d out of bounds.", index);
2633 //____________________________________________________________________________________________
2634 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC2(UInt_t gloChip, UInt_t index) const {
2635 // get eq for the noisy pixel at position index in list of noisy
2636 if (gloChip>=1200) {
2637 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
2640 if (index<fNrNoisy[gloChip]) {
2641 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2642 return GetEqIdFromKey(key);
2645 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "Index %d out of bounds.", index);
2649 //____________________________________________________________________________________________
2650 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC2(UInt_t gloChip, UInt_t index) const {
2651 // get hs for the dead pixel at position index in list of dead
2652 if (gloChip>=1200) {
2653 Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "global chip nr (%d) out of bounds.",gloChip);
2656 if (index<fNrDead[gloChip]) {
2657 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2658 return GetHSFromKey(key);
2661 Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "Index %d out of bounds.", index);
2665 //____________________________________________________________________________________________
2666 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC2(UInt_t gloChip, UInt_t index) const {
2667 // get hs for the noisy pixel at position index in list of noisy
2668 if (gloChip>=1200) {
2669 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "global chip nr (%d) out of bounds.",gloChip);
2672 if (index<fNrNoisy[gloChip]) {
2673 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2674 return GetHSFromKey(key);
2677 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "Index %d out of bounds.", index);
2681 //____________________________________________________________________________________________
2682 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC2(UInt_t gloChip, UInt_t index) const {
2683 // get chip for the dead pixel at position index in list of dead
2684 if (gloChip>=1200) {
2685 Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "global chip nr (%d) out of bounds.",gloChip);
2688 if (index<fNrDead[gloChip]) {
2689 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2690 return GetChipFromKey(key);
2693 Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "Index %d out of bounds.", index);
2697 //____________________________________________________________________________________________
2698 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC2(UInt_t gloChip, UInt_t index) const {
2699 // get chip for the noisy pixel at position index in list of noisy
2700 if (gloChip>=1200) {
2701 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "global chip nr (%d) out of bounds.",gloChip);
2704 if (index<fNrNoisy[gloChip]) {
2705 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2706 return GetChipFromKey(key);
2709 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "Index %d out of bounds.", index);
2713 //____________________________________________________________________________________________
2714 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2(UInt_t gloChip, UInt_t index) const {
2715 // get col for the dead pixel at position index in list of dead
2716 if (gloChip>=1200) {
2717 Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "global chip nr (%d) out of bounds.",gloChip);
2720 if (index<fNrDead[gloChip]) {
2721 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2722 return GetColFromKey(key);
2725 Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "Index %d out of bounds.", index);
2729 //____________________________________________________________________________________________
2730 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC2(UInt_t gloChip, UInt_t index) const {
2731 // get col for the noisy pixel at position index in list of noisy
2732 if (gloChip>=1200) {
2733 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "global chip nr (%d) out of bounds.",gloChip);
2736 if (index<fNrNoisy[gloChip]) {
2737 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2738 return GetColFromKey(key);
2741 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "Index %d out of bounds.", index);
2745 //____________________________________________________________________________________________
2746 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC2(UInt_t gloChip, UInt_t index) const {
2747 // get row for the dead pixel at position index in list of dead
2748 if (gloChip>=1200) {
2749 Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "global chip nr (%d) out of bounds.",gloChip);
2752 if (index<fNrDead[gloChip]) {
2753 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2754 return GetRowFromKey(key);
2757 Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "Index %d out of bounds.", index);
2761 //____________________________________________________________________________________________
2762 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC2(UInt_t gloChip, UInt_t index) const {
2763 // get row for the noisy pixel at position index in list of noisy
2764 if (gloChip>=1200) {
2765 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "global chip nr (%d) out of bounds.",gloChip);
2768 if (index<fNrNoisy[gloChip]) {
2769 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2770 return GetRowFromKey(key);
2773 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "Index %d out of bounds.", index);
2777 //____________________________________________________________________________________________
2778 void AliITSOnlineCalibrationSPDhandler::ActivateALL() {
2779 // activate all eq,hs,chips
2780 for (UInt_t eq=0; eq<20; eq++) {
2783 for (UInt_t hs=0; hs<6; hs++) {
2785 for (UInt_t chip=0; chip<10; chip++) {
2786 ActivateChip(eq,hs,chip);
2791 //____________________________________________________________________________________________
2792 void AliITSOnlineCalibrationSPDhandler::ActivateEq(UInt_t eq, Bool_t setval) {
2795 Error("AliITSOnlineCalibrationSPDhandler::ActivateEq", "eq (%d) out of bounds.",eq);
2798 fActiveEq[eq] = setval;
2800 //____________________________________________________________________________________________
2801 void AliITSOnlineCalibrationSPDhandler::ActivateHS(UInt_t eq, UInt_t hs, Bool_t setval) {
2803 if (eq>=20 || hs>=6) {
2804 Error("AliITSOnlineCalibrationSPDhandler::ActivateHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2807 fActiveHS[eq][hs] = setval;
2809 //____________________________________________________________________________________________
2810 void AliITSOnlineCalibrationSPDhandler::ActivateChip(UInt_t eq, UInt_t hs, UInt_t chip, Bool_t setval) {
2812 if (eq>=20 || hs>=6 || chip>=10) {
2813 Error("AliITSOnlineCalibrationSPDhandler::ActivateChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2816 fActiveChip[eq][hs][chip] = setval;
2818 //____________________________________________________________________________________________
2819 Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveEq(UInt_t eq) const {
2822 Error("AliITSOnlineCalibrationSPDhandler::IsActiveEq", "eq (%d) out of bounds.",eq);
2825 return fActiveEq[eq];
2827 //____________________________________________________________________________________________
2828 Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveHS(UInt_t eq, UInt_t hs) const {
2830 if (eq>=20 || hs>=6) {
2831 Error("AliITSOnlineCalibrationSPDhandler::IsActiveHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2834 return fActiveHS[eq][hs];
2836 //____________________________________________________________________________________________
2837 Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
2839 if (eq>=20 || hs>=6 || chip>=10) {
2840 Error("AliITSOnlineCalibrationSPDhandler::IsActiveChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2843 return fActiveChip[eq][hs][chip];
2845 //____________________________________________________________________________________________
2846 void AliITSOnlineCalibrationSPDhandler::UnSetDeadALL() {
2847 // Clear all dead eq,hs,chips
2848 for (UInt_t eq=0; eq<20; eq++) {
2849 SetDeadEq(eq,kFALSE);
2850 for (UInt_t hs=0; hs<6; hs++) {
2851 SetDeadHS(eq,hs,kFALSE);
2852 for (UInt_t chip=0; chip<10; chip++) {
2853 SetDeadChip(eq,hs,chip,kFALSE);
2858 //____________________________________________________________________________________________
2859 void AliITSOnlineCalibrationSPDhandler::SetDeadEq(UInt_t eq, Bool_t setval) {
2862 Error("AliITSOnlineCalibrationSPDhandler::SetDeadEq", "eq (%d) out of bounds.",eq);
2865 fDeadEq[eq] = setval;
2867 //____________________________________________________________________________________________
2868 void AliITSOnlineCalibrationSPDhandler::SetDeadHS(UInt_t eq, UInt_t hs, Bool_t setval) {
2870 if (eq>=20 || hs>=6) {
2871 Error("AliITSOnlineCalibrationSPDhandler::SetDeadHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2874 fDeadHS[eq][hs] = setval;
2876 //____________________________________________________________________________________________
2877 void AliITSOnlineCalibrationSPDhandler::SetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip, Bool_t setval) {
2879 if (eq>=20 || hs>=6 || chip>=10) {
2880 Error("AliITSOnlineCalibrationSPDhandler::SetDeadChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2883 fDeadChip[eq][hs][chip] = setval;
2885 //____________________________________________________________________________________________
2886 Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadEq(UInt_t eq) const {
2889 Error("AliITSOnlineCalibrationSPDhandler::IsDeadEq", "eq (%d) out of bounds.",eq);
2894 //____________________________________________________________________________________________
2895 Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadHS(UInt_t eq, UInt_t hs) const {
2897 if (eq>=20 || hs>=6) {
2898 Error("AliITSOnlineCalibrationSPDhandler::IsDeadHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2901 return fDeadHS[eq][hs];
2903 //____________________________________________________________________________________________
2904 Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
2906 if (eq>=20 || hs>=6 || chip>=10) {
2907 Error("AliITSOnlineCalibrationSPDhandler::IsDeadChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2910 return fDeadChip[eq][hs][chip];
2912 //____________________________________________________________________________________________
2913 Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentEq(UInt_t eq) const {
2916 Error("AliITSOnlineCalibrationSPDhandler::IsSilentEq", "eq (%d) out of bounds.",eq);
2919 return (!IsActiveEq(eq) || IsDeadEq(eq));
2921 //____________________________________________________________________________________________
2922 Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentHS(UInt_t eq, UInt_t hs) const {
2924 if (eq>=20 || hs>=6) {
2925 Error("AliITSOnlineCalibrationSPDhandler::IsSilentHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2928 return (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs));
2930 //____________________________________________________________________________________________
2931 Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
2933 if (eq>=20 || hs>=6 || chip>=10) {
2934 Error("AliITSOnlineCalibrationSPDhandler::IsSilentChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2937 return (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs) || !IsActiveChip(eq,hs,chip) || IsDeadChip(eq,hs,chip));
2939 //____________________________________________________________________________________________
2940 Bool_t AliITSOnlineCalibrationSPDhandler::IsNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
2941 // returns true if there is at least a noisy pixel in the chip
2943 if (eq>=20 || hs>=6 || chip>=10) {
2944 Error("AliITSOnlineCalibrationSPDhandler::IsNoisyChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2947 Bool_t isNoisy = kFALSE;
2949 UInt_t nrNoisy = GetNrNoisy();
2950 for (UInt_t i=0; i<nrNoisy; i++) {
2951 if(eq == GetNoisyEqIdAt(i)){
2952 if(hs == GetNoisyHSAt(i)){
2953 if(chip == GetNoisyChipAt(i)) {
2954 UInt_t col = GetNoisyColAt(i);
2955 UInt_t row = GetNoisyRowAt(i);
2956 if (IsPixelNoisy(eq,hs,chip,col,row)) isNoisy = kTRUE;
2963 //____________________________________________________________________________________________
2964 Bool_t AliITSOnlineCalibrationSPDhandler::WritePITConditionsToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
2965 // writes noisy pixels to DB for given runNrs
2966 // overwrites any previous entries
2967 AliCDBManager* man = AliCDBManager::Instance();
2968 TString storageSTR = Form("%s",storage);
2969 if (storageSTR.CompareTo("default")==0) {
2970 if(!man->IsDefaultStorageSet()) {
2971 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
2975 storageSTR = Form("%s",storage);
2976 man->SetDefaultStorage(storageSTR.Data());
2978 AliCDBMetaData* metaData = new AliCDBMetaData();
2979 metaData->SetResponsible("Annalisa Mastroserio");
2980 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
2981 AliCDBId idCalSPD("TRIGGER/SPD/PITConditions",runNrStart,runNrEnd);
2982 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)fTriggerConditions,idCalSPD,metaData);
2989 //____________________________________________________________________________________________
2990 Bool_t AliITSOnlineCalibrationSPDhandler::SetInactiveChipInPITmask(UInt_t eq, UInt_t hs, UInt_t chip){
2992 fTriggerConditions->SetInActiveChip(eq,hs,chip);
2995 //____________________________________________________________________________________________
2996 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetInactiveChipInPITmask(UInt_t eq, UInt_t hs, UInt_t chip){
2998 fTriggerConditions->SetInActiveChip(eq,hs,chip);
3001 //____________________________________________________________________________________________
3002 void AliITSOnlineCalibrationSPDhandler::PrintDiffInDead(AliITSOnlineCalibrationSPDhandler *other) const {
3004 // Printout of the differences between two ocdb files for SPD Dead channel map
3007 UInt_t nrDeadChipOk=0;
3008 UInt_t nrDeadHsOk=0;
3010 UInt_t nrDeadChip=0;
3011 UInt_t nrDeadHsInOther =0;
3012 UInt_t nrDeadChipInOther=0;
3013 UInt_t nrMismatch =0;
3014 UInt_t nrMismatchInOther =0;
3015 printf("\n\n ****** loop over chips ***** \n");
3016 for(Int_t eq=0; eq<20; eq++){
3017 if(TMath::Abs((Int_t)GetNrBadEq(eq) - (Int_t)other->GetNrBadEq(eq)) >0) printf("-----> dead pixels differ in eq %i! %i - %i in the other \n",eq,GetNrBadEq(eq),other->GetNrBadEq(eq));
3018 for(Int_t hs=0; hs<6; hs++){
3020 Short_t nchipsOther =0;
3022 for(Int_t chip=0; chip<10; chip++){
3023 UInt_t chipkey = AliITSRawStreamSPD::GetOfflineChipKeyFromOnline(eq,hs,chip);
3024 // test if everything is coherent
3025 if(IsDeadChip(eq,hs,chip) && other->IsDeadChip(eq,hs,chip)) {
3030 if(!IsDeadChip(eq,hs,chip) && !other->IsDeadChip(eq,hs,chip)) nrChipOk++;
3031 // now testing if mismatches
3032 if(IsDeadChip(eq,hs,chip)) {
3035 if(!other->IsDeadChip(eq,hs,chip)) {
3037 printf(" mismatch -> eq %i hs %i chip %i is DEAD - ALIVE in the other (chipkey %i)\n",eq,hs,chip,chipkey);
3040 if(other->IsDeadChip(eq,hs,chip)){
3041 nrDeadChipInOther++;
3043 if(!IsDeadChip(eq,hs,chip)) {
3044 nrMismatchInOther++;
3045 printf(" mismatch -> eq %i hs %i chip %i is ALIVE - DEAD in the other (chipkey %i)\n",eq,hs,chip,chipkey);
3049 if(nok==10) nrDeadHsOk++;
3050 if(nchips==10) nrDeadHs++;
3051 if(nchipsOther==10) nrDeadHsInOther++;
3055 printf("\n\n\n*************SUMMARY****************\n");
3056 printf(" BOTH have : %i Dead HS and %i Dead chips with %i coherent chips \n",nrDeadHsOk,nrDeadChipOk,nrChipOk);
3057 printf("\n_________MISMATCH RESULTS___________\n");
3058 printf(" THIS : Nr Dead HS %i - Nr Dead Chip %i \n",nrDeadHs,nrDeadChip);
3059 printf(" OTHER : Nr Dead HS %i - Nr Dead Chip %i \n",nrDeadHsInOther,nrDeadChipInOther);
3060 printf(" N Mismatches in Dead chips (=ALIVE in the other) %i \n",nrMismatch);
3061 printf(" N Mismatches in Alive chips (=DEAD in the other) %i \n",nrMismatchInOther);
3063 //____________________________________________________________________________________________
3064 void AliITSOnlineCalibrationSPDhandler::PrintDiffInPITmask(AliITSOnlineCalibrationSPDhandler *other) const {
3066 // Printout of the differences between two ocdb files for SPD Dead channel map
3071 Int_t nMismatchInOther =0;
3073 printf("\n\n ****** loop over chips in PIT mask***** \n");
3074 for(Int_t eq=0; eq<20; eq++){
3075 for(Int_t hs=0; hs<6; hs++){
3076 for(Int_t chip=0; chip<10; chip++){
3078 UInt_t chipkey = AliITSRawStreamSPD::GetOfflineChipKeyFromOnline(eq,hs,chip);
3080 if(fTriggerConditions->IsChipActive(eq,hs,chip) && (other->GetTriggerConditions())->IsChipActive(eq,hs,chip)) nOk++;
3081 if(fTriggerConditions->IsChipActive(eq,hs,chip) && !(other->GetTriggerConditions())->IsChipActive(eq,hs,chip)) {
3083 printf("Mismatch -> eq %i hs %i chip %i is ACTIVE - INACTIVE in the other (chipkey %i) \n",eq,hs,chip,chipkey);
3085 if(!fTriggerConditions->IsChipActive(eq,hs,chip) && (other->GetTriggerConditions())->IsChipActive(eq,hs,chip)) {
3087 printf("Mismatch -> eq %i hs %i chip %i is INACTIVE - ACTIVE in the other (chipkey %i) \n",eq,hs,chip,chipkey);
3089 if(!fTriggerConditions->IsChipActive(eq,hs,chip) && !(other->GetTriggerConditions())->IsChipActive(eq,hs,chip)) nOk++;
3094 printf("n Chips OK %i : ACTIVE mismatch %i - INACTIVE mismatch in %i \n",nOk,nMismatch,nMismatchInOther);