1 //////////////////////////////////////////////////////////////////////
2 // Author: Henrik Tydesjo //
3 // For easier handling of dead and noisy pixels they are kept in //
4 // container maps (AliITSIntMap). //
5 // The TArrayI objects that are put in the AliITSCalibrationSPD //
6 // objects can be obtained from the methods GetDeadArray and //
8 //////////////////////////////////////////////////////////////////////
10 #include "AliITSOnlineCalibrationSPDhandler.h"
11 #include "AliITSOnlineCalibrationSPD.h"
12 #include "AliITSIntMap.h"
13 #include <TObjArray.h>
19 #ifndef SPD_DA_OFF // you may want to exclude cdb classes, if using this class outside aliroot
20 #include "AliITSCalibrationSPD.h"
21 #include "AliCDBManager.h"
22 #include "AliCDBEntry.h"
26 //____________________________________________________________________________________________
27 AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler():
31 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
34 fDeadPixelMap[gloChip] = new AliITSIntMap();
35 fNoisyPixelMap[gloChip] = new AliITSIntMap();
38 AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler(const AliITSOnlineCalibrationSPDhandler& handle):
42 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
43 fNrDead[gloChip] = handle.fNrDead[gloChip];
44 fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
45 fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
46 fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
48 fFileLocation = handle.fFileLocation;
50 AliITSOnlineCalibrationSPDhandler::~AliITSOnlineCalibrationSPDhandler() {
52 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
53 delete fDeadPixelMap[gloChip];
54 delete fNoisyPixelMap[gloChip];
57 AliITSOnlineCalibrationSPDhandler& AliITSOnlineCalibrationSPDhandler::operator=(const AliITSOnlineCalibrationSPDhandler& handle) {
58 // assignment operator
61 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
62 fNrDead[gloChip] = handle.fNrDead[gloChip];
63 fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
64 fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
65 fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
67 fFileLocation = handle.fFileLocation;
71 //____________________________________________________________________________________________
72 void AliITSOnlineCalibrationSPDhandler::ClearMaps() {
73 // clear the lists of dead and noisy
77 void AliITSOnlineCalibrationSPDhandler::ResetDead() {
78 // reset the dead pixel map
79 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
81 fDeadPixelMap[gloChip]->Clear();
84 void AliITSOnlineCalibrationSPDhandler::ResetNoisy() {
85 // clear the list of noisy pixels
86 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
88 fNoisyPixelMap[gloChip]->Clear();
91 void AliITSOnlineCalibrationSPDhandler::ResetDeadForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
92 // clear the dead pixels for this chip
93 UInt_t gloChip = GetGloChip(eq,hs,chip);
94 for (UInt_t col=0; col<32; col++) {
95 for (UInt_t row=0; row<256; row++) {
96 Int_t key = GetKey(eq,hs,chip,col,row);
97 if (fDeadPixelMap[gloChip]->Remove(key)) {
103 void AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
104 // clear the noisy pixels for this chip
105 UInt_t gloChip = GetGloChip(eq,hs,chip);
107 Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip","global chip nr (%d) out of bounds\n",gloChip);
110 for (UInt_t col=0; col<32; col++) {
111 for (UInt_t row=0; row<256; row++) {
112 Int_t key = GetKey(eq,hs,chip,col,row);
113 if (fNoisyPixelMap[gloChip]->Remove(key)) {
119 void AliITSOnlineCalibrationSPDhandler::ResetDeadForEq(UInt_t eq) {
120 // clear the dead pixels for this eq
122 Error("AliITSOnlineCalibrationSPDhandler::ResetDeadForEq", "eq (%d) out of bounds.",eq);
125 for (UInt_t hs=0; hs<6; hs++) {
126 for (UInt_t chip=0; chip<10; chip++) {
127 ResetDeadForChip(eq, hs, chip);
131 void AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq(UInt_t eq) {
132 // clear the noisy pixels for this eq
134 Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq", "eq (%d) out of bounds.",eq);
137 for (UInt_t hs=0; hs<6; hs++) {
138 for (UInt_t chip=0; chip<10; chip++) {
139 ResetNoisyForChip(eq, hs, chip);
143 //____________________________________________________________________________________________
144 Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromFiles() {
145 // read dead and noisy files from file location. returns true if at least one file found
146 Bool_t b1 = ReadNoisyFromFiles();
147 Bool_t b2 = ReadDeadFromFiles();
151 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFiles() {
152 // read dead files from file location. returns true if at least one file found
153 Bool_t returnval=kFALSE;
154 for (UInt_t eq=0; eq<20; eq++) {
155 if (ReadDeadFromFile(eq)) {
161 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFiles() {
162 // read noisy files from file location. returns true if at least one file found
163 Bool_t returnval=kFALSE;
164 for (UInt_t eq=0; eq<20; eq++) {
165 if (ReadNoisyFromFile(eq)) {
171 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFile(UInt_t eq) {
172 // read dead file for module from file location.
173 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
174 return ReadDeadFromFileName(fileName.Data());
176 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFile(UInt_t eq) {
177 // read noisy file for module from file location.
178 TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
179 return ReadNoisyFromFileName(fileName.Data());
181 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFileName(const char *fileName) {
182 // read dead from file fileName
183 AliITSOnlineCalibrationSPD* calib;
184 FILE* fp0 = fopen(fileName, "r");
185 if (fp0 == NULL) {return kFALSE;}
188 TFile file(fileName, "READ");
190 file.GetObject("AliITSOnlineCalibrationSPD", calib);
193 UInt_t nrDead=calib->GetNrBad();
194 for (UInt_t index=0; index<nrDead; index++) {
195 UInt_t key = calib->GetKeyAt(index);
196 UInt_t eq = GetEqIdFromKey(key);
197 UInt_t hs = GetHSFromKey(key);
198 UInt_t chip = GetChipFromKey(key);
199 UInt_t col = GetColFromKey(key);
200 UInt_t row = GetRowFromKey(key);
201 SetDeadPixel(eq,hs,chip,col,row);
208 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFileName(const char *fileName) {
209 // read noisy from file fileName
210 AliITSOnlineCalibrationSPD* calib;
211 FILE* fp0 = fopen(fileName, "r");
212 if (fp0 == NULL) {return kFALSE;}
215 TFile file(fileName, "READ");
217 file.GetObject("AliITSOnlineCalibrationSPD", calib);
220 UInt_t nrNoisy=calib->GetNrBad();
221 for (UInt_t index=0; index<nrNoisy; index++) {
222 UInt_t key = calib->GetKeyAt(index);
223 UInt_t eq = GetEqIdFromKey(key);
224 UInt_t hs = GetHSFromKey(key);
225 UInt_t chip = GetChipFromKey(key);
226 UInt_t col = GetColFromKey(key);
227 UInt_t row = GetRowFromKey(key);
228 SetNoisyPixel(eq,hs,chip,col,row);
235 UInt_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromText(const char *fileName, UInt_t module) {
236 // read dead from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
237 // insert only those pixels that belong to module (or all if module=240).
240 textFile.open(fileName, ifstream::in);
241 if (textFile.fail()) {
242 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromText","No dead text file (%s) present.",fileName);
246 UInt_t eq,hs,chip,col,row;
247 textFile >> eq; if (textFile.eof()) break;
248 textFile >> hs; if (textFile.eof()) break;
249 textFile >> chip; if (textFile.eof()) break;
250 textFile >> col; if (textFile.eof()) break;
252 if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){
253 if (SetDeadPixel(eq,hs,chip,col,row)) {
257 if (textFile.eof()) break;
263 UInt_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText(const char *fileName, UInt_t module) {
264 // read noisy from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
265 // insert only those pixels that belong to module (or all if module=240).
268 textFile.open(fileName, ifstream::in);
269 if (textFile.fail()) {
270 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText","No noisy text file (%s) present.",fileName);
274 UInt_t eq,hs,chip,col,row;
275 textFile >> eq; if (textFile.eof()) break;
276 textFile >> hs; if (textFile.eof()) break;
277 textFile >> chip; if (textFile.eof()) break;
278 textFile >> col; if (textFile.eof()) break;
280 if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){
281 if (SetNoisyPixel(eq,hs,chip,col,row)) {
285 if (textFile.eof()) break;
291 //____________________________________________________________________________________________
292 void AliITSOnlineCalibrationSPDhandler::WriteToFilesAlways() {
293 // write the lists of dead and noisy to files
294 for (UInt_t eq=0; eq<20; eq++) {
296 WriteNoisyToFile(eq);
299 UInt_t AliITSOnlineCalibrationSPDhandler::WriteToFiles() {
300 // write the lists of dead and noisy to files (only if there are >0 dead or noisy pixels) , returns nr of files produced
301 return (WriteNoisyToFiles() + WriteDeadToFiles());
303 void AliITSOnlineCalibrationSPDhandler::WriteDeadToFilesAlways() {
304 // write the lists of dead to files
305 for (UInt_t eq=0; eq<20; eq++) {
309 void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFilesAlways() {
310 // write the lists of noisy to files
311 for (UInt_t eq=0; eq<20; eq++) {
312 WriteNoisyToFile(eq);
315 UInt_t AliITSOnlineCalibrationSPDhandler::WriteDeadToFiles() {
316 // write the list of dead to file (only if there are >0 dead pixels) , returns nr of files produced
318 for (UInt_t eq=0; eq<20; eq++) {
319 if (GetNrDeadEq(eq) > 0) {
326 UInt_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToFiles() {
327 // write the list of noisy to file (only if there are >0 noisy pixels) , returns nr of files produced
329 for (UInt_t eq=0; eq<20; eq++) {
330 if (GetNrNoisyEq(eq) > 0) {
331 WriteNoisyToFile(eq);
337 void AliITSOnlineCalibrationSPDhandler::WriteDeadToFile(UInt_t eq) {
338 // write the lists of dead and noisy for module to file
339 AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
341 calib->SetBadList(GetDeadArrayOnline(eq));
342 calib->SetNrBad(GetNrDeadEq(eq));
343 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
344 TFile file(fileName.Data(), "RECREATE");
345 file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
349 void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFile(UInt_t eq) {
350 // write the lists of noisy and noisy for module to file
351 AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
353 calib->SetBadList(GetNoisyArrayOnline(eq));
354 calib->SetNrBad(GetNrNoisyEq(eq));
355 TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
356 TFile file(fileName.Data(), "RECREATE");
357 file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
361 //____________________________________________________________________________________________
363 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB(UInt_t module, Int_t runNr, Bool_t treeSerial) {
364 // reads dead pixels from DB for given module and runNr
365 AliCDBManager* man = AliCDBManager::Instance();
366 if(!man->IsDefaultStorageSet()) {
367 man->SetDefaultStorage("local://$ALICE_ROOT");
369 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
372 spdEntry = (TObjArray*)cdbEntry->GetObject();
373 if(!spdEntry) return kFALSE;
376 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB","Calibration for run %d not found in database.",runNr);
379 AliITSCalibrationSPD* calibSPD;
380 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
381 UInt_t nrDead = calibSPD->GetNrBad();
383 if (!treeSerial) RecursiveInsertDead(calibSPD,module,0,nrDead-1);
385 for (UInt_t index=0; index<nrDead; index++) {
386 UInt_t colM = calibSPD->GetBadColAt(index);
387 UInt_t rowM = calibSPD->GetBadRowAt(index);
388 SetDeadPixelM(module,colM,rowM);
392 spdEntry->SetOwner(kTRUE);
396 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB(UInt_t module, Int_t runNr, Bool_t treeSerial) {
397 // reads noisy pixels from DB for given module and runNr
398 AliCDBManager* man = AliCDBManager::Instance();
399 if(!man->IsDefaultStorageSet()) {
400 man->SetDefaultStorage("local://$ALICE_ROOT");
402 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
405 spdEntry = (TObjArray*)cdbEntry->GetObject();
406 if(!spdEntry) return kFALSE;
409 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB","Calibration for run %d not found in database.",runNr);
412 AliITSCalibrationSPD* calibSPD;
413 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
414 UInt_t nrNoisy = calibSPD->GetNrBad();
416 if (!treeSerial) RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
418 for (UInt_t index=0; index<nrNoisy; index++) {
419 UInt_t colM = calibSPD->GetBadColAt(index);
420 UInt_t rowM = calibSPD->GetBadRowAt(index);
421 SetNoisyPixelM(module,colM,rowM);
425 spdEntry->SetOwner(kTRUE);
429 Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromDB(Int_t runNr, Bool_t treeSerial) {
430 // reads dead and noisy pixels from DB for given runNr
431 // note that you may want to clear the lists (if they are not empty) before reading
432 return (ReadNoisyFromDB(runNr,treeSerial) && ReadDeadFromDB(runNr,treeSerial));
434 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB(Int_t runNr, Bool_t treeSerial) {
435 // reads dead pixels from DB for given runNr
436 // note that you may want to clear the list (if it is not empty) before reading
437 AliCDBManager* man = AliCDBManager::Instance();
438 if(!man->IsDefaultStorageSet()) {
439 man->SetDefaultStorage("local://$ALICE_ROOT");
441 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
444 spdEntry = (TObjArray*)cdbEntry->GetObject();
445 if(!spdEntry) return kFALSE;
448 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB","Calibration for run %d not found in database.",runNr);
451 AliITSCalibrationSPD* calibSPD;
452 for (UInt_t module=0; module<240; module++) {
453 // printf("Reading module %d\n",module);
454 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
455 UInt_t nrDead = calibSPD->GetNrBad();
457 if (!treeSerial) RecursiveInsertDead(calibSPD,module,0,nrDead-1);
459 for (UInt_t index=0; index<nrDead; index++) {
460 UInt_t colM = calibSPD->GetBadColAt(index);
461 UInt_t rowM = calibSPD->GetBadRowAt(index);
462 SetDeadPixelM(module,colM,rowM);
467 spdEntry->SetOwner(kTRUE);
471 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB(Int_t runNr, Bool_t treeSerial) {
472 // reads noisy pixels from DB for given runNr
473 // note that you may want to clear the list (if it is not empty) before reading
474 AliCDBManager* man = AliCDBManager::Instance();
475 if(!man->IsDefaultStorageSet()) {
476 man->SetDefaultStorage("local://$ALICE_ROOT");
478 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
481 spdEntry = (TObjArray*)cdbEntry->GetObject();
482 if(!spdEntry) return kFALSE;
485 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB","Calibration for run %d not found in database.",runNr);
488 AliITSCalibrationSPD* calibSPD;
489 for (UInt_t module=0; module<240; module++) {
490 // printf("Reading module %d\n",module);
491 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
492 UInt_t nrNoisy = calibSPD->GetNrBad();
495 printf("*** mod %d nrnoisy=%d\n",module,nrNoisy);
496 RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
499 for (UInt_t index=0; index<nrNoisy; index++) {
500 UInt_t colM = calibSPD->GetBadColAt(index);
501 UInt_t rowM = calibSPD->GetBadRowAt(index);
502 SetNoisyPixelM(module,colM,rowM);
507 spdEntry->SetOwner(kTRUE);
511 Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromCalibObj(TObjArray* calObj) {
512 // reads dead pixels from calib object
513 for (UInt_t module=0; module<240; module++) {
514 for (Int_t i=0; i<((AliITSCalibrationSPD*)calObj->At(module))->GetNrBad(); i++) {
515 SetDeadPixelM(module,
516 ((AliITSCalibrationSPD*)calObj->At(module))->GetBadColAt(i),
517 ((AliITSCalibrationSPD*)calObj->At(module))->GetBadRowAt(i));
522 Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromCalibObj(TObjArray* calObj) {
523 // reads noisy pixels from calib object
524 for (UInt_t module=0; module<240; module++) {
525 for (Int_t i=0; i<((AliITSCalibrationSPD*)calObj->At(module))->GetNrBad(); i++) {
526 SetNoisyPixelM(module,
527 ((AliITSCalibrationSPD*)calObj->At(module))->GetBadColAt(i),
528 ((AliITSCalibrationSPD*)calObj->At(module))->GetBadRowAt(i));
533 Bool_t AliITSOnlineCalibrationSPDhandler::WriteToDB(Int_t runNrStart, Int_t runNrEnd) {
534 // writes dead and noisy pixels to DB for given runNrs
535 // overwrites any previous entries
536 return (WriteNoisyToDB(runNrStart,runNrEnd) && WriteDeadToDB(runNrStart,runNrEnd));
538 Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDB(Int_t runNrStart, Int_t runNrEnd) {
539 // writes dead pixels to DB for given runNrs
540 // overwrites any previous entries
541 AliCDBManager* man = AliCDBManager::Instance();
542 if(!man->IsDefaultStorageSet()) {
543 man->SetDefaultStorage("local://$ALICE_ROOT");
545 AliCDBMetaData* metaData = new AliCDBMetaData();
546 metaData->SetResponsible("Henrik Tydesjo");
547 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
548 AliCDBId idCalSPD("ITS/Calib/SPDDead",runNrStart,runNrEnd);
549 TObjArray* spdEntry = new TObjArray(240);
550 spdEntry->SetOwner(kTRUE);
551 for(UInt_t module=0; module<240; module++){
552 AliITSCalibrationSPD* calObj = new AliITSCalibrationSPD();
554 // *** this is temporarily hard coded here ********************
555 // (later these parameters will be separated from the cal.obj.)
556 calObj->SetThresholds(3000, 250);
557 calObj->SetBiasVoltage(18.182);
558 calObj->SetNoiseParam(0,0);
559 calObj->SetCouplingParam(0.,0.055);
560 // *** remove later...
561 // ************************************************************
563 spdEntry->Add(calObj);
565 for(UInt_t module=0; module<240; module++){
566 ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNrBad( GetNrDead(module) );
567 ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetBadList( GetDeadArray(module) );
569 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
576 Bool_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToDB(Int_t runNrStart, Int_t runNrEnd) {
577 // writes noisy pixels to DB for given runNrs
578 // overwrites any previous entries
579 AliCDBManager* man = AliCDBManager::Instance();
580 if(!man->IsDefaultStorageSet()) {
581 man->SetDefaultStorage("local://$ALICE_ROOT");
583 AliCDBMetaData* metaData = new AliCDBMetaData();
584 metaData->SetResponsible("Henrik Tydesjo");
585 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
586 AliCDBId idCalSPD("ITS/Calib/SPDNoisy",runNrStart,runNrEnd);
587 TObjArray* spdEntry = new TObjArray(240);
588 spdEntry->SetOwner(kTRUE);
589 for(UInt_t module=0; module<240; module++){
590 AliITSCalibrationSPD* calObj = new AliITSCalibrationSPD();
592 // *** this is temporarily hard coded here ********************
593 // (later these parameters will be separated from the cal.obj.)
594 calObj->SetThresholds(3000, 250);
595 calObj->SetBiasVoltage(18.182);
596 calObj->SetNoiseParam(0,0);
597 calObj->SetCouplingParam(0.,0.055);
598 // *** remove later...
599 // ************************************************************
601 spdEntry->Add(calObj);
603 for(UInt_t module=0; module<240; module++){
604 ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNrBad( GetNrNoisy(module) );
605 ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetBadList( GetNoisyArray(module) );
607 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
614 //____________________________________________________________________________________________
615 void AliITSOnlineCalibrationSPDhandler::RecursiveInsertDead(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
616 // inserts dead pixels recursively, used when reading from db
617 if (lowInd>highInd) return;
618 Int_t thisInd = lowInd+(highInd-lowInd)/2;
619 SetDeadPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
620 RecursiveInsertDead(calibSPD,module,lowInd,thisInd-1);
621 RecursiveInsertDead(calibSPD,module,thisInd+1,highInd);
623 void AliITSOnlineCalibrationSPDhandler::RecursiveInsertNoisy(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
624 // inserts noisy pixels recursively, used when reading from db
625 printf("Rec mod %d : %d,%d\n",module,lowInd,highInd);
626 if (lowInd>highInd) return;
627 Int_t thisInd = lowInd+(highInd-lowInd)/2;
628 SetNoisyPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
629 RecursiveInsertNoisy(calibSPD,module,lowInd,thisInd-1);
630 RecursiveInsertNoisy(calibSPD,module,thisInd+1,highInd);
634 //____________________________________________________________________________________________
635 void AliITSOnlineCalibrationSPDhandler::GenerateDCSConfigFile(const Char_t* fileName) {
636 // generates an ascii file in the format as the one produced by online da (but with dummy runNr=0)
638 dcsfile.open(fileName);
639 dcsfile << "[SPD SCAN]\n";
640 dcsfile << "RunNumber=" << "0" << "\n"; // dummy value
641 dcsfile << "Type=" << "4" << "\n";
642 dcsfile << "Router=" << "0" << "\n"; // dummy value
643 dcsfile << "ActualDetConfiguration=" << "0,-1,-1\n"; // dummy values
644 dcsfile << "[NOISY]\n";
645 for (UInt_t module=0; module<240; module++) {
646 UInt_t headkey=20*10*6;
647 for (UInt_t ind=0; ind<GetNrNoisy(module); ind++) {
648 UInt_t newkey = GetNoisyEqIdAt(module,ind)*10*6 +
649 GetNoisyHSAt(module,ind)*10 +
650 GetNoisyChipAt(module,ind);
651 if (newkey!=headkey) { // print eq,hs,chip header
653 dcsfile << "-" << newkey/(6*10) << "," << (newkey%(6*10))/10 << "," << (newkey%(6*10))%10 << "\n";
655 dcsfile << GetNoisyColAt(module,ind) << "," << GetNoisyRowAt(module,ind) << "\n";
660 //____________________________________________________________________________________________
661 TArrayI AliITSOnlineCalibrationSPDhandler::GetDeadArray(UInt_t module, Bool_t treeSerial) {
662 // get a TArrayI of the dead pixels (format for the AliITSCalibrationSPD object)
665 UInt_t eq = GetEqIdFromOffline(module);
666 UInt_t hs = GetHSFromOffline(module);
668 for (UInt_t chip=0; chip<5; chip++) {
669 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
670 size += fNrDead[gloChip];
672 returnArray.Set(size*2);
674 for (UInt_t chip=0; chip<5; chip++) {
675 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
676 if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
677 else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
678 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
679 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
680 Int_t colM = GetColMFromKey(key);
681 Int_t rowM = GetRowMFromKey(key);
682 returnArray.AddAt(colM,gloIndex*2);
683 returnArray.AddAt(rowM,gloIndex*2+1);
689 TArrayI AliITSOnlineCalibrationSPDhandler::GetNoisyArray(UInt_t module, Bool_t treeSerial) {
690 // get a TArrayI of the noisy pixels (format for the AliITSCalibrationSPD object)
693 UInt_t eq = GetEqIdFromOffline(module);
694 UInt_t hs = GetHSFromOffline(module);
696 for (UInt_t chip=0; chip<5; chip++) {
697 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
698 size += fNrNoisy[gloChip];
700 returnArray.Set(size*2);
702 for (UInt_t chip=0; chip<5; chip++) {
703 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
704 if (treeSerial) fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
705 else fNoisyPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
706 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
707 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
708 Int_t colM = GetColMFromKey(key);
709 Int_t rowM = GetRowMFromKey(key);
710 returnArray.AddAt(colM,gloIndex*2);
711 returnArray.AddAt(rowM,gloIndex*2+1);
717 TArrayI AliITSOnlineCalibrationSPDhandler::GetDeadArrayOnline(UInt_t eq) {
718 // get a TArrayI of the dead pixels (format for the AliITSOnlineCalibrationSPD object)
722 for (UInt_t hs=0; hs<6; hs++) {
723 for (UInt_t chip=0; chip<10; chip++) {
724 UInt_t gloChip = GetGloChip(eq,hs,chip);
725 size+=fNrDead[gloChip];
728 returnArray.Set(size);
731 for (UInt_t hs=0; hs<6; hs++) {
732 for (UInt_t chip=0; chip<10; chip++) {
733 UInt_t gloChip = GetGloChip(eq,hs,chip);
734 fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
735 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
736 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
737 returnArray.AddAt(key,gloIndex);
744 TArrayI AliITSOnlineCalibrationSPDhandler::GetNoisyArrayOnline(UInt_t eq) {
745 // get a TArrayI of the noisy pixels (format for the AliITSOnlineCalibrationSPD object)
749 for (UInt_t hs=0; hs<6; hs++) {
750 for (UInt_t chip=0; chip<10; chip++) {
751 UInt_t gloChip = GetGloChip(eq,hs,chip);
752 size+=fNrNoisy[gloChip];
755 returnArray.Set(size);
758 for (UInt_t hs=0; hs<6; hs++) {
759 for (UInt_t chip=0; chip<10; chip++) {
760 UInt_t gloChip = GetGloChip(eq,hs,chip);
761 fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
762 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
763 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
764 returnArray.AddAt(key,gloIndex);
771 //____________________________________________________________________________________________
772 void AliITSOnlineCalibrationSPDhandler::PrintEqSummary() {
773 // print summary (nr of dead and noisy) for each equipment
774 printf("-----------\n");
775 printf("Eq summary:\n");
776 printf("-----------\n");
777 for (UInt_t eq=0; eq<20; eq++) {
778 printf("Eq %*d: %*d dead , %*d noisy\n",2,eq,5,GetNrDeadEq(eq),5,GetNrNoisyEq(eq));
781 void AliITSOnlineCalibrationSPDhandler::PrintDead() const {
782 // print the dead pixels to screen
783 printf("------------------------------------------------------\n");
784 printf("Dead Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
785 printf("------------------------------------------------------\n");
786 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
787 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
788 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
789 UInt_t eq = GetEqIdFromKey(key);
790 UInt_t hs = GetHSFromKey(key);
791 UInt_t chip = GetChipFromKey(key);
792 UInt_t col = GetColFromKey(key);
793 UInt_t row = GetRowFromKey(key);
795 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
796 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
797 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
799 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);
803 void AliITSOnlineCalibrationSPDhandler::PrintNoisy() const {
804 // print the dead pixels to screen
805 printf("-------------------------------------------------------\n");
806 printf("Noisy Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
807 printf("-------------------------------------------------------\n");
808 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
809 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
810 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
811 UInt_t eq = GetEqIdFromKey(key);
812 UInt_t hs = GetHSFromKey(key);
813 UInt_t chip = GetChipFromKey(key);
814 UInt_t col = GetColFromKey(key);
815 UInt_t row = GetRowFromKey(key);
817 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
818 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
819 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
821 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);
825 //____________________________________________________________________________________________
826 Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
827 // set a dead pixel, returns false if pixel is already dead
828 UInt_t gloChip = GetGloChip(eq,hs,chip);
830 Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
833 if (col>=32 && row>=256) {
834 Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
837 Int_t key = GetKey(eq,hs,chip,col,row);
838 // if noisy we dont want to add it...
839 if (fNoisyPixelMap[gloChip]->Find(key) != NULL) return kFALSE;
840 if (fDeadPixelMap[gloChip]->Insert(key,gloChip)) {
846 Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
847 // set a noisy pixel, returns false if pixel is already noisy
848 UInt_t gloChip = GetGloChip(eq,hs,chip);
850 Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
853 if (col>=32 && row>=256) {
854 Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
857 Int_t key = GetKey(eq,hs,chip,col,row);
858 // if dead before - remove from the dead list
859 if (fDeadPixelMap[gloChip]->Remove(key)) {
862 if (fNoisyPixelMap[gloChip]->Insert(key,gloChip)) {
868 Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
869 // set a dead pixel, returns false if pixel is already dead
870 UInt_t eq = GetEqIdFromOffline(module);
871 UInt_t hs = GetHSFromOffline(module);
872 UInt_t chip = GetChipFromOffline(module,colM);
873 UInt_t col = GetColFromOffline(module,colM);
874 UInt_t row = GetRowFromOffline(module,rowM);
875 return SetDeadPixel(eq,hs,chip,col,row);
877 Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
878 // set a noisy pixel, returns false if pixel is already noisy
879 UInt_t eq = GetEqIdFromOffline(module);
880 UInt_t hs = GetHSFromOffline(module);
881 UInt_t chip = GetChipFromOffline(module,colM);
882 UInt_t col = GetColFromOffline(module,colM);
883 UInt_t row = GetRowFromOffline(module,rowM);
884 return SetNoisyPixel(eq,hs,chip,col,row);
886 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
887 // unset a dead pixel, returns false if pixel is not dead
888 UInt_t gloChip = GetGloChip(eq,hs,chip);
890 Error("AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
893 Int_t key = GetKey(eq,hs,chip,col,row);
894 if (fDeadPixelMap[gloChip]->Remove(key)) {
900 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
901 // unset a noisy pixel, returns false if pixel is not noisy
902 UInt_t gloChip = GetGloChip(eq,hs,chip);
904 Error("AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
907 Int_t key = GetKey(eq,hs,chip,col,row);
908 if (fNoisyPixelMap[gloChip]->Remove(key)) {
914 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
915 // unset a dead pixel, returns false if pixel is not dead
916 UInt_t eq = GetEqIdFromOffline(module);
917 UInt_t hs = GetHSFromOffline(module);
918 UInt_t chip = GetChipFromOffline(module,colM);
919 UInt_t col = GetColFromOffline(module,colM);
920 UInt_t row = GetRowFromOffline(module,rowM);
921 return UnSetDeadPixel(eq,hs,chip,col,row);
923 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
924 // unset a noisy pixel, returns false if pixel is not noisy
925 UInt_t eq = GetEqIdFromOffline(module);
926 UInt_t hs = GetHSFromOffline(module);
927 UInt_t chip = GetChipFromOffline(module,colM);
928 UInt_t col = GetColFromOffline(module,colM);
929 UInt_t row = GetRowFromOffline(module,rowM);
930 return UnSetNoisyPixel(eq,hs,chip,col,row);
932 UInt_t AliITSOnlineCalibrationSPDhandler::SetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip) {
933 // set a full chip dead, returns nr of new dead pixels
935 for (UInt_t col=0; col<32; col++) {
936 for (UInt_t row=0; row<256; row++) {
937 if (SetDeadPixel(eq,hs,chip,col,row)) {
944 UInt_t AliITSOnlineCalibrationSPDhandler::SetNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip) {
945 // set a full chip noisy, returns nr of new noisy pixels
947 for (UInt_t col=0; col<32; col++) {
948 for (UInt_t row=0; row<256; row++) {
949 if (SetNoisyPixel(eq,hs,chip,col,row)) {
956 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip) {
957 // unset a full dead chip, returns false if it was not all dead before
959 for (UInt_t col=0; col<32; col++) {
960 for (UInt_t row=0; row<256; row++) {
961 if (UnSetDeadPixel(eq,hs,chip,col,row)) {
966 if (nrUnset+GetNrNoisyC(eq,hs,chip)<8192) return kFALSE;
969 Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip) {
970 // unset a full noisy chip, returns false if it was not all noisy before
972 for (UInt_t col=0; col<32; col++) {
973 for (UInt_t row=0; row<256; row++) {
974 if (UnSetNoisyPixel(eq,hs,chip,col,row)) {
979 if (nrUnset<8192) return kFALSE;
982 //____________________________________________________________________________________________
983 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDead(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
984 // is the pixel dead?
985 UInt_t gloChip = GetGloChip(eq,hs,chip);
987 Error("AliITSOnlineCalibrationSPDhandler::IsPixelDead", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
990 UInt_t key = GetKey(eq,hs,chip,col,row);
991 if ( fDeadPixelMap[gloChip]->Find(key) != NULL ) {
998 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisy(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
999 // is the pixel noisy?
1000 UInt_t gloChip = GetGloChip(eq,hs,chip);
1001 if (gloChip>=1200) {
1002 Error("AliITSOnlineCalibrationSPDhandler::IsPixelNoisy", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1005 UInt_t key = GetKey(eq,hs,chip,col,row);
1006 if ( fNoisyPixelMap[gloChip]->Find(key) != NULL ) {
1013 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1014 // is the pixel dead?
1015 UInt_t eq = GetEqIdFromOffline(module);
1016 UInt_t hs = GetHSFromOffline(module);
1017 UInt_t chip = GetChipFromOffline(module,colM);
1018 UInt_t col = GetColFromOffline(module,colM);
1019 UInt_t row = GetRowFromOffline(module,rowM);
1020 return IsPixelDead(eq,hs,chip,col,row);
1022 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1023 // is the pixel noisy?
1024 UInt_t eq = GetEqIdFromOffline(module);
1025 UInt_t hs = GetHSFromOffline(module);
1026 UInt_t chip = GetChipFromOffline(module,colM);
1027 UInt_t col = GetColFromOffline(module,colM);
1028 UInt_t row = GetRowFromOffline(module,rowM);
1029 return IsPixelNoisy(eq,hs,chip,col,row);
1031 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadKey(Int_t key) const {
1032 // is this pixel dead?
1033 UInt_t eq = GetEqIdFromKey(key);
1034 UInt_t hs = GetHSFromKey(key);
1035 UInt_t chip = GetChipFromKey(key);
1036 UInt_t col = GetColFromKey(key);
1037 UInt_t row = GetRowFromKey(key);
1038 return IsPixelDead(eq,hs,chip,col,row);
1040 Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyKey(Int_t key) const {
1041 // is this pixel noisy?
1042 UInt_t eq = GetEqIdFromKey(key);
1043 UInt_t hs = GetHSFromKey(key);
1044 UInt_t chip = GetChipFromKey(key);
1045 UInt_t col = GetColFromKey(key);
1046 UInt_t row = GetRowFromKey(key);
1047 return IsPixelNoisy(eq,hs,chip,col,row);
1049 //____________________________________________________________________________________________
1050 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead() const {
1051 // returns the total nr of dead pixels
1053 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1054 nrDead+=fNrDead[gloChip];
1058 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy() const {
1059 // returns the total nr of noisy pixels
1061 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1062 nrNoisy+=fNrNoisy[gloChip];
1066 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t index) {
1067 // get eq for the dead pixel at position index in list of dead
1070 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1071 return GetDeadEqIdAtC2(gloChip,chipIndex);
1073 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t index) {
1074 // get eq for the noisy pixel at position index in list of noisy
1077 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1078 return GetNoisyEqIdAtC2(gloChip,chipIndex);
1080 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t index) {
1081 // get hs for the dead pixel at position index in list of dead
1084 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1085 return GetDeadHSAtC2(gloChip,chipIndex);
1087 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t index) {
1088 // get hs for the noisy pixel at position index in list of noisy
1091 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1092 return GetNoisyHSAtC2(gloChip,chipIndex);
1094 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t index) {
1095 // get chip for the dead pixel at position index in list of dead
1098 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1099 return GetDeadChipAtC2(gloChip,chipIndex);
1101 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t index) {
1102 // get chip for the noisy pixel at position index in list of noisy
1105 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1106 return GetNoisyChipAtC2(gloChip,chipIndex);
1108 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t index) {
1109 // get hs for the dead pixel at position index in list of dead
1112 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1113 return GetDeadColAtC2(gloChip,chipIndex);
1115 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t index) {
1116 // get hs for the noisy pixel at position index in list of noisy
1119 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1120 return GetNoisyColAtC2(gloChip,chipIndex);
1122 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t index) {
1123 // get hs for the dead pixel at position index in list of dead
1126 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1127 return GetDeadRowAtC2(gloChip,chipIndex);
1129 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t index) {
1130 // get hs for the noisy pixel at position index in list of noisy
1133 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1134 return GetNoisyRowAtC2(gloChip,chipIndex);
1136 //____________________________________________________________________________________________
1137 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead(UInt_t module) const {
1138 // returns the number of dead pixels for a certain module
1140 Error("AliITSOnlineCalibrationSPDhandler::GetNrDead", "module nr (%d) out of bounds.",module);
1144 UInt_t eq = GetEqIdFromOffline(module);
1145 UInt_t hs = GetHSFromOffline(module);
1146 for (UInt_t chip=0; chip<5; chip++) {
1147 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
1148 nrDead+=fNrDead[gloChip];
1153 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy(UInt_t module) const {
1154 // returns the number of noisy pixels for a certain module
1156 Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisy", "module nr (%d) out of bounds.",module);
1160 UInt_t eq = GetEqIdFromOffline(module);
1161 UInt_t hs = GetHSFromOffline(module);
1162 for (UInt_t chip=0; chip<5; chip++) {
1163 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
1164 nrNoisy+=fNrNoisy[gloChip];
1169 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t module, UInt_t index) {
1170 // get eq for the dead pixel at position index in list of dead
1173 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1174 return GetDeadEqIdAtC2(gloChip,chipIndex);
1176 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t module, UInt_t index) {
1177 // get eq for the noisy pixel at position index in list of noisy
1180 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1181 return GetNoisyEqIdAtC2(gloChip,chipIndex);
1183 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t module, UInt_t index) {
1184 // get hs for the dead pixel at position index in list of dead
1187 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1188 return GetDeadHSAtC2(gloChip,chipIndex);
1190 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t module, UInt_t index) {
1191 // get hs for the noisy pixel at position index in list of noisy
1194 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1195 return GetNoisyHSAtC2(gloChip,chipIndex);
1197 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t module, UInt_t index) {
1198 // get chip for the dead pixel at position index in list of dead
1201 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1202 return GetDeadChipAtC2(gloChip,chipIndex);
1204 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t module, UInt_t index) {
1205 // get chip for the noisy pixel at position index in list of noisy
1208 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1209 return GetNoisyChipAtC2(gloChip,chipIndex);
1211 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t module, UInt_t index) {
1212 // get hs for the dead pixel at position index in list of dead
1215 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1216 return GetDeadColAtC2(gloChip,chipIndex);
1218 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t module, UInt_t index) {
1219 // get hs for the noisy pixel at position index in list of noisy
1222 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1223 return GetNoisyColAtC2(gloChip,chipIndex);
1225 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t module, UInt_t index) {
1226 // get hs for the dead pixel at position index in list of dead
1229 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1230 return GetDeadRowAtC2(gloChip,chipIndex);
1232 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t module, UInt_t index) {
1233 // get hs for the noisy pixel at position index in list of noisy
1236 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1237 return GetNoisyRowAtC2(gloChip,chipIndex);
1239 //____________________________________________________________________________________________
1240 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadEq(UInt_t eq) const {
1241 // returns nr of dead for eq
1243 for (UInt_t hs=0; hs<6; hs++) {
1244 for (UInt_t chip=0; chip<10; chip++) {
1245 returnval+=GetNrDeadC(eq,hs,chip);
1250 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyEq(UInt_t eq) const {
1251 // returns nr of noisy for eq
1253 for (UInt_t hs=0; hs<6; hs++) {
1254 for (UInt_t chip=0; chip<10; chip++) {
1255 returnval+=GetNrNoisyC(eq,hs,chip);
1260 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtEq(UInt_t eq, UInt_t index) const {
1261 // get eq for the dead pixel at position index in list of dead
1262 if (eq<20 && index<GetNrDeadEq(eq)) {
1269 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtEq(UInt_t eq, UInt_t index) const {
1270 // get eq for the noisy pixel at position index in list of noisy
1271 if (eq<20 && index<GetNrNoisyEq(eq)) {
1278 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtEq(UInt_t eq, UInt_t index) {
1279 // get hs for the dead pixel at position index in list of dead
1282 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1283 return GetDeadHSAtC2(gloChip,chipIndex);
1285 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtEq(UInt_t eq, UInt_t index) {
1286 // get hs for the noisy pixel at position index in list of noisy
1289 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1290 return GetNoisyHSAtC2(gloChip,chipIndex);
1292 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtEq(UInt_t eq, UInt_t index) {
1293 // get chip for the dead pixel at position index in list of dead
1296 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1297 return GetDeadChipAtC2(gloChip,chipIndex);
1299 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtEq(UInt_t eq, UInt_t index) {
1300 // get chip for the noisy pixel at position index in list of noisy
1303 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1304 return GetNoisyChipAtC2(gloChip,chipIndex);
1306 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtEq(UInt_t eq, UInt_t index) {
1307 // get hs for the dead pixel at position index in list of dead
1310 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1311 return GetDeadColAtC2(gloChip,chipIndex);
1313 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtEq(UInt_t eq, UInt_t index) {
1314 // get hs for the noisy pixel at position index in list of noisy
1317 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1318 return GetNoisyColAtC2(gloChip,chipIndex);
1320 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtEq(UInt_t eq, UInt_t index) {
1321 // get hs for the dead pixel at position index in list of dead
1324 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1325 return GetDeadRowAtC2(gloChip,chipIndex);
1327 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtEq(UInt_t eq, UInt_t index) {
1328 // get hs for the noisy pixel at position index in list of noisy
1331 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1332 return GetNoisyRowAtC2(gloChip,chipIndex);
1334 //____________________________________________________________________________________________
1335 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
1336 UInt_t gloChip = GetGloChip(eq,hs,chip);
1337 return GetNrDeadC2(gloChip);
1339 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC(UInt_t eq, UInt_t hs, UInt_t chip) const {
1340 UInt_t gloChip = GetGloChip(eq,hs,chip);
1341 return GetNrNoisyC2(gloChip);
1343 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1344 UInt_t gloChip = GetGloChip(eq,hs,chip);
1345 return GetDeadEqIdAtC2(gloChip,index);
1347 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1348 UInt_t gloChip = GetGloChip(eq,hs,chip);
1349 return GetNoisyEqIdAtC2(gloChip,index);
1351 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1352 UInt_t gloChip = GetGloChip(eq,hs,chip);
1353 return GetDeadHSAtC2(gloChip,index);
1355 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1356 UInt_t gloChip = GetGloChip(eq,hs,chip);
1357 return GetNoisyHSAtC2(gloChip,index);
1359 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1360 UInt_t gloChip = GetGloChip(eq,hs,chip);
1361 return GetDeadChipAtC2(gloChip,index);
1363 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1364 UInt_t gloChip = GetGloChip(eq,hs,chip);
1365 return GetNoisyChipAtC2(gloChip,index);
1367 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1368 UInt_t gloChip = GetGloChip(eq,hs,chip);
1369 return GetDeadColAtC2(gloChip,index);
1371 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1372 UInt_t gloChip = GetGloChip(eq,hs,chip);
1373 return GetNoisyColAtC2(gloChip,index);
1375 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1376 UInt_t gloChip = GetGloChip(eq,hs,chip);
1377 return GetDeadRowAtC2(gloChip,index);
1379 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1380 UInt_t gloChip = GetGloChip(eq,hs,chip);
1381 return GetNoisyRowAtC2(gloChip,index);
1383 //____________________________________________________________________________________________
1384 const Char_t* AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1385 // get a string of dead pixel info
1386 TString returnMess = "";
1387 UInt_t gloChip = GetGloChip(eq,hs,chip);
1388 if (gloChip>=1200) {
1389 Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
1390 return returnMess.Data();
1392 if (index<fNrDead[gloChip]) {
1393 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1394 UInt_t eq = GetEqIdFromKey(key);
1395 UInt_t hs = GetHSFromKey(key);
1396 UInt_t chip = GetChipFromKey(key);
1397 UInt_t col = GetColFromKey(key);
1398 UInt_t row = GetRowFromKey(key);
1399 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1400 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1401 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1402 returnMess = Form("%*d,%*d,%*d,%*d,%*d | %*d,%*d,%*d\n",2,eq,1,hs,1,chip,2,col,3,row,3,module,3,colM,3,rowM);
1403 return returnMess.Data();
1406 Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "Index %d out of bounds.", index);
1407 return returnMess.Data();
1410 const Char_t* AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1411 // get a string of noisy pixel info
1412 TString returnMess = "";
1413 UInt_t gloChip = GetGloChip(eq,hs,chip);
1414 if (gloChip>=1200) {
1415 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
1416 return returnMess.Data();
1418 if (index<fNrNoisy[gloChip]) {
1419 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1420 UInt_t eq = GetEqIdFromKey(key);
1421 UInt_t hs = GetHSFromKey(key);
1422 UInt_t chip = GetChipFromKey(key);
1423 UInt_t col = GetColFromKey(key);
1424 UInt_t row = GetRowFromKey(key);
1425 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1426 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1427 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1428 returnMess = Form("%*d,%*d,%*d,%*d,%*d | %*d,%*d,%*d\n",2,eq,1,hs,1,chip,2,col,3,row,3,module,3,colM,3,rowM);
1429 return returnMess.Data();
1432 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "Index %d out of bounds.", index);
1433 return returnMess.Data();
1436 //____________________________________________________________________________________________
1437 UInt_t AliITSOnlineCalibrationSPDhandler::AddDeadFrom(AliITSOnlineCalibrationSPDhandler* other) {
1438 // returns number of new dead pixels in this' list
1440 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1441 for (UInt_t ind1=0; ind1<other->fNrDead[gloChip]; ind1++) {
1442 UInt_t eq = other->GetDeadEqIdAtC2(gloChip,ind1);
1443 UInt_t hs = other->GetDeadHSAtC2(gloChip,ind1);
1444 UInt_t chip = other->GetDeadChipAtC2(gloChip,ind1);
1445 UInt_t col = other->GetDeadColAtC2(gloChip,ind1);
1446 UInt_t row = other->GetDeadRowAtC2(gloChip,ind1);
1447 if (SetDeadPixel(eq,hs,chip,col,row)) {
1454 UInt_t AliITSOnlineCalibrationSPDhandler::AddNoisyFrom(AliITSOnlineCalibrationSPDhandler* other) {
1455 // returns number of new noisy pixels in this' list
1457 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1458 for (UInt_t ind1=0; ind1<other->fNrNoisy[gloChip]; ind1++) {
1459 UInt_t eq = other->GetNoisyEqIdAtC2(gloChip,ind1);
1460 UInt_t hs = other->GetNoisyHSAtC2(gloChip,ind1);
1461 UInt_t chip = other->GetNoisyChipAtC2(gloChip,ind1);
1462 UInt_t col = other->GetNoisyColAtC2(gloChip,ind1);
1463 UInt_t row = other->GetNoisyRowAtC2(gloChip,ind1);
1464 if (SetNoisyPixel(eq,hs,chip,col,row)) {
1471 //____________________________________________________________________________________________
1472 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDiff(AliITSOnlineCalibrationSPDhandler* other) const {
1473 // returns nr of dead/noisy in this' lists and not in other's lists
1474 return GetNrDeadDiff(other) + GetNrNoisyDiff(other);
1476 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
1477 // returns nr of dead in this' lists and not in other's lists
1479 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1480 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
1481 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
1482 UInt_t eq = GetEqIdFromKey(key);
1483 UInt_t hs = GetHSFromKey(key);
1484 UInt_t chip = GetChipFromKey(key);
1485 UInt_t col = GetColFromKey(key);
1486 UInt_t row = GetRowFromKey(key);
1487 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
1494 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
1495 // returns nr of noisy in this' lists and not in other's lists
1497 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1498 for (UInt_t ind1=0; ind1<fNrNoisy[gloChip]; ind1++) {
1499 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind1);
1500 UInt_t eq = GetEqIdFromKey(key);
1501 UInt_t hs = GetHSFromKey(key);
1502 UInt_t chip = GetChipFromKey(key);
1503 UInt_t col = GetColFromKey(key);
1504 UInt_t row = GetRowFromKey(key);
1505 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
1512 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDiff(AliITSOnlineCalibrationSPDhandler* other) const {
1513 // returns handler with dead/noisy in this' lists, except for those in other's lists
1514 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
1515 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1516 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
1517 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
1518 UInt_t eq = GetEqIdFromKey(key);
1519 UInt_t hs = GetHSFromKey(key);
1520 UInt_t chip = GetChipFromKey(key);
1521 UInt_t col = GetColFromKey(key);
1522 UInt_t row = GetRowFromKey(key);
1523 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
1524 newHandler->SetDeadPixel(eq,hs,chip,col,row);
1527 for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
1528 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
1529 UInt_t eq = GetEqIdFromKey(key);
1530 UInt_t hs = GetHSFromKey(key);
1531 UInt_t chip = GetChipFromKey(key);
1532 UInt_t col = GetColFromKey(key);
1533 UInt_t row = GetRowFromKey(key);
1534 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
1535 newHandler->SetNoisyPixel(eq,hs,chip,col,row);
1541 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
1542 // returns handler with dead in this' lists, except for those in other's lists
1543 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
1544 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1545 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
1546 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
1547 UInt_t eq = GetEqIdFromKey(key);
1548 UInt_t hs = GetHSFromKey(key);
1549 UInt_t chip = GetChipFromKey(key);
1550 UInt_t col = GetColFromKey(key);
1551 UInt_t row = GetRowFromKey(key);
1552 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
1553 newHandler->SetDeadPixel(eq,hs,chip,col,row);
1559 AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
1560 // returns handler with noisy in this' lists, except for those in other's lists
1561 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
1562 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1563 for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
1564 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
1565 UInt_t eq = GetEqIdFromKey(key);
1566 UInt_t hs = GetHSFromKey(key);
1567 UInt_t chip = GetChipFromKey(key);
1568 UInt_t col = GetColFromKey(key);
1569 UInt_t row = GetRowFromKey(key);
1570 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
1571 newHandler->SetNoisyPixel(eq,hs,chip,col,row);
1577 //____________________________________________________________________________________________
1578 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
1579 // find gloChip and chipIndex from module and index
1580 if (index<GetNrDead(module)) {
1581 UInt_t eq = GetEqIdFromOffline(module);
1582 UInt_t hs = GetHSFromOffline(module);
1585 for (UInt_t chip=0; chip<5; chip++) {
1586 gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
1587 if (glVal+fNrDead[gloChip]>index) {
1588 chipIndex = index-glVal;
1592 glVal+=fNrDead[gloChip];
1598 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead", "Index %d out of bounds.", index);
1601 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
1602 // find gloChip and chipIndex from module and index
1603 if (index<GetNrNoisy(module)) {
1604 UInt_t eq = GetEqIdFromOffline(module);
1605 UInt_t hs = GetHSFromOffline(module);
1608 for (UInt_t chip=0; chip<5; chip++) {
1609 gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
1610 if (glVal+fNrNoisy[gloChip]>index) {
1611 chipIndex = index-glVal;
1615 glVal+=fNrNoisy[gloChip];
1621 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy", "Index %d out of bounds.", index);
1624 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
1625 // find gloChip and chipIndex from module and index
1626 if (index<GetNrDeadEq(eq)) {
1629 for (UInt_t hs=0; hs<6; hs++) {
1630 for (UInt_t chip=0; chip<10; chip++) {
1631 gloChip = GetGloChip(eq,hs,chip);
1632 if (glVal+fNrDead[gloChip]>index) {
1633 chipIndex = index-glVal;
1637 glVal+=fNrDead[gloChip];
1644 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead", "Index %d out of bounds.", index);
1647 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
1648 // find gloChip and chipIndex from module and index
1649 if (index<GetNrNoisyEq(eq)) {
1652 for (UInt_t hs=0; hs<6; hs++) {
1653 for (UInt_t chip=0; chip<10; chip++) {
1654 gloChip = GetGloChip(eq,hs,chip);
1655 if (glVal+fNrNoisy[gloChip]>index) {
1656 chipIndex = index-glVal;
1660 glVal+=fNrNoisy[gloChip];
1667 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy", "Index %d out of bounds.", index);
1670 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
1671 // find gloChip and chipIndex from global index
1672 if (index<GetNrDead()) {
1675 for (gloChip=0; gloChip<1200; gloChip++) {
1676 if (glVal+fNrDead[gloChip]>index) {
1677 chipIndex = index-glVal;
1681 glVal+=fNrDead[gloChip];
1687 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead", "Index %d out of bounds.", index);
1690 void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
1691 // find gloChip and chipIndex from global index
1692 if (index<GetNrNoisy()) {
1695 for (gloChip=0; gloChip<1200; gloChip++) {
1696 if (glVal+fNrNoisy[gloChip]>index) {
1697 chipIndex = index-glVal;
1701 glVal+=fNrNoisy[gloChip];
1707 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy", "Index %d out of bounds.", index);
1710 //____________________________________________________________________________________________
1711 UInt_t AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline(UInt_t module) const {
1712 // module to eq mapping
1714 Error("AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline", "module nr (%d) out of bounds.",module);
1717 return AliITSRawStreamSPD::GetOnlineEqIdFromOffline(module);
1719 UInt_t AliITSOnlineCalibrationSPDhandler::GetHSFromOffline(UInt_t module) const {
1720 // module to hs mapping
1722 Error("AliITSOnlineCalibrationSPDhandler::GetHSFromOffline", "module nr (%d) out of bounds.",module);
1725 return AliITSRawStreamSPD::GetOnlineHSFromOffline(module);
1727 UInt_t AliITSOnlineCalibrationSPDhandler::GetChipFromOffline(UInt_t module, UInt_t colM) const {
1728 // module,colM to chip mapping
1729 if (module>=240 || colM>=160) {
1730 Error("AliITSOnlineCalibrationSPDhandler::GetChipFromOffline", "module,colM nrs (%d,%d) out of bounds.",module,colM);
1733 return AliITSRawStreamSPD::GetOnlineChipFromOffline(module,colM);
1735 UInt_t AliITSOnlineCalibrationSPDhandler::GetColFromOffline(UInt_t module, UInt_t colM) const {
1736 // colM to col mapping
1738 Error("AliITSOnlineCalibrationSPDhandler::GetColFromOffline", "colM nr (%d) out of bounds.",colM);
1741 return AliITSRawStreamSPD::GetOnlineColFromOffline(module,colM);
1744 UInt_t AliITSOnlineCalibrationSPDhandler::GetRowFromOffline(UInt_t module, UInt_t rowM) const {
1745 // rowM to row mapping
1747 Error("AliITSOnlineCalibrationSPDhandler::GetRowFromOffline", "rowM nr (%d) out of bounds.",rowM);
1750 return AliITSRawStreamSPD::GetOnlineRowFromOffline(module,rowM);
1752 //____________________________________________________________________________________________
1753 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC2(UInt_t gloChip) const {
1754 // returns nr of dead pixels on this chip
1755 if (gloChip>=1200) {
1756 Error("AliITSOnlineCalibrationSPDhandler::GetNrDeadC2", "global chip nr (%d) out of bounds.",gloChip);
1759 return fNrDead[gloChip];
1761 UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2(UInt_t gloChip) const {
1762 // returns nr of noisy pixels on this chip
1763 if (gloChip>=1200) {
1764 Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2", "global chip nr (%d) out of bounds.",gloChip);
1767 return fNrNoisy[gloChip];
1769 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC2(UInt_t gloChip, UInt_t index) const {
1770 // get eq for the dead pixel at position index in list of dead
1771 if (gloChip>=1200) {
1772 Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
1775 if (index<fNrDead[gloChip]) {
1776 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1777 return GetEqIdFromKey(key);
1780 Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "Index %d out of bounds.", index);
1784 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC2(UInt_t gloChip, UInt_t index) const {
1785 // get eq for the noisy pixel at position index in list of noisy
1786 if (gloChip>=1200) {
1787 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
1790 if (index<fNrNoisy[gloChip]) {
1791 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1792 return GetEqIdFromKey(key);
1795 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "Index %d out of bounds.", index);
1799 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC2(UInt_t gloChip, UInt_t index) const {
1800 // get hs for the dead pixel at position index in list of dead
1801 if (gloChip>=1200) {
1802 Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "global chip nr (%d) out of bounds.",gloChip);
1805 if (index<fNrDead[gloChip]) {
1806 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1807 return GetHSFromKey(key);
1810 Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "Index %d out of bounds.", index);
1814 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC2(UInt_t gloChip, UInt_t index) const {
1815 // get hs for the noisy pixel at position index in list of noisy
1816 if (gloChip>=1200) {
1817 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "global chip nr (%d) out of bounds.",gloChip);
1820 if (index<fNrNoisy[gloChip]) {
1821 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1822 return GetHSFromKey(key);
1825 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "Index %d out of bounds.", index);
1829 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC2(UInt_t gloChip, UInt_t index) const {
1830 // get chip for the dead pixel at position index in list of dead
1831 if (gloChip>=1200) {
1832 Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "global chip nr (%d) out of bounds.",gloChip);
1835 if (index<fNrDead[gloChip]) {
1836 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1837 return GetChipFromKey(key);
1840 Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "Index %d out of bounds.", index);
1844 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC2(UInt_t gloChip, UInt_t index) const {
1845 // get chip for the noisy pixel at position index in list of noisy
1846 if (gloChip>=1200) {
1847 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "global chip nr (%d) out of bounds.",gloChip);
1850 if (index<fNrNoisy[gloChip]) {
1851 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1852 return GetChipFromKey(key);
1855 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "Index %d out of bounds.", index);
1859 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2(UInt_t gloChip, UInt_t index) const {
1860 // get col for the dead pixel at position index in list of dead
1861 if (gloChip>=1200) {
1862 Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "global chip nr (%d) out of bounds.",gloChip);
1865 if (index<fNrDead[gloChip]) {
1866 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1867 return GetColFromKey(key);
1870 Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "Index %d out of bounds.", index);
1874 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC2(UInt_t gloChip, UInt_t index) const {
1875 // get col for the noisy pixel at position index in list of noisy
1876 if (gloChip>=1200) {
1877 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "global chip nr (%d) out of bounds.",gloChip);
1880 if (index<fNrNoisy[gloChip]) {
1881 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1882 return GetColFromKey(key);
1885 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "Index %d out of bounds.", index);
1889 UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC2(UInt_t gloChip, UInt_t index) const {
1890 // get row for the dead pixel at position index in list of dead
1891 if (gloChip>=1200) {
1892 Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "global chip nr (%d) out of bounds.",gloChip);
1895 if (index<fNrDead[gloChip]) {
1896 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1897 return GetRowFromKey(key);
1900 Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "Index %d out of bounds.", index);
1904 UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC2(UInt_t gloChip, UInt_t index) const {
1905 // get row for the noisy pixel at position index in list of noisy
1906 if (gloChip>=1200) {
1907 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "global chip nr (%d) out of bounds.",gloChip);
1910 if (index<fNrNoisy[gloChip]) {
1911 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1912 return GetRowFromKey(key);
1915 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "Index %d out of bounds.", index);