]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSOnlineCalibrationSPDhandler.cxx
ITSSPDPHYSda: New detector algorithm for finding dead and noisy pixels.
[u/mrichter/AliRoot.git] / ITS / AliITSOnlineCalibrationSPDhandler.cxx
CommitLineData
b15de2d2 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 //
7// GetNoisyArray. //
8//////////////////////////////////////////////////////////////////////
9
10#include "AliITSOnlineCalibrationSPDhandler.h"
11#include "AliITSOnlineCalibrationSPD.h"
53ae21ce 12#include "AliITSIntMap.h"
13#include <TObjArray.h>
b15de2d2 14#include <TArrayI.h>
15#include <TFile.h>
53ae21ce 16#include <TError.h>
17#include <fstream>
b15de2d2 18
53ae21ce 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"
23#endif
b15de2d2 24
6727e2db 25//____________________________________________________________________________________________
53ae21ce 26AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler():
6727e2db 27 fFileLocation(".")
53ae21ce 28{
29 // constructor
6727e2db 30 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
31 fNrDead[gloChip]=0;
32 fNrNoisy[gloChip]=0;
33 fDeadPixelMap[gloChip] = new AliITSIntMap();
34 fNoisyPixelMap[gloChip] = new AliITSIntMap();
53ae21ce 35 }
36}
b15de2d2 37AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler(const AliITSOnlineCalibrationSPDhandler& handle):
6727e2db 38 fFileLocation(".")
b15de2d2 39{
40 // copy constructor
6727e2db 41 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
42 fNrDead[gloChip] = handle.fNrDead[gloChip];
43 fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
44 fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
45 fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
b15de2d2 46 }
53ae21ce 47 fFileLocation = handle.fFileLocation;
b15de2d2 48}
b15de2d2 49AliITSOnlineCalibrationSPDhandler::~AliITSOnlineCalibrationSPDhandler() {
6727e2db 50 // ClearMaps();
51 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
52 delete fDeadPixelMap[gloChip];
53 delete fNoisyPixelMap[gloChip];
54 }
b15de2d2 55}
b15de2d2 56AliITSOnlineCalibrationSPDhandler& AliITSOnlineCalibrationSPDhandler::operator=(const AliITSOnlineCalibrationSPDhandler& handle) {
57 // assignment operator
58 if (this!=&handle) {
59 this->ClearMaps();
6727e2db 60 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
61 fNrDead[gloChip] = handle.fNrDead[gloChip];
62 fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
63 fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
64 fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
b15de2d2 65 }
53ae21ce 66 fFileLocation = handle.fFileLocation;
b15de2d2 67 }
68 return *this;
69}
6727e2db 70//____________________________________________________________________________________________
b15de2d2 71void AliITSOnlineCalibrationSPDhandler::ClearMaps() {
72 // clear the lists of dead and noisy
73 ResetDead();
74 ResetNoisy();
75}
6727e2db 76void AliITSOnlineCalibrationSPDhandler::ResetDead() {
77 // reset the dead pixel map
78 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
79 fNrDead[gloChip]=0;
80 fDeadPixelMap[gloChip]->Clear();
53ae21ce 81 }
b15de2d2 82}
6727e2db 83void AliITSOnlineCalibrationSPDhandler::ResetNoisy() {
84 // clear the list of noisy pixels
85 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
86 fNrNoisy[gloChip]=0;
87 fNoisyPixelMap[gloChip]->Clear();
88 }
b15de2d2 89}
6727e2db 90void AliITSOnlineCalibrationSPDhandler::ResetDeadForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
91 // clear the dead pixels for this chip
92 UInt_t gloChip = GetGloChip(eq,hs,chip);
93 for (UInt_t col=0; col<32; col++) {
94 for (UInt_t row=0; row<256; row++) {
95 Int_t key = GetKey(eq,hs,chip,col,row);
96 if (fDeadPixelMap[gloChip]->Remove(key)) {
97 fNrDead[gloChip]--;
b15de2d2 98 }
99 }
100 }
101}
6727e2db 102void AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
103 // clear the noisy pixels for this chip
104 UInt_t gloChip = GetGloChip(eq,hs,chip);
105 if (gloChip>=1200) {
106 Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip","global chip nr (%d) out of bounds\n",gloChip);
107 return;
108 }
109 for (UInt_t col=0; col<32; col++) {
110 for (UInt_t row=0; row<256; row++) {
111 Int_t key = GetKey(eq,hs,chip,col,row);
112 if (fNoisyPixelMap[gloChip]->Remove(key)) {
113 fNrNoisy[gloChip]--;
114 }
115 }
116 }
117}
118void AliITSOnlineCalibrationSPDhandler::ResetDeadForEq(UInt_t eq) {
119 // clear the dead pixels for this eq
120 if (eq>=20) {
121 Error("AliITSOnlineCalibrationSPDhandler::ResetDeadForEq", "eq (%d) out of bounds.",eq);
122 return;
123 }
124 for (UInt_t hs=0; hs<6; hs++) {
125 for (UInt_t chip=0; chip<10; chip++) {
126 ResetDeadForChip(eq, hs, chip);
127 }
128 }
129}
130void AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq(UInt_t eq) {
131 // clear the noisy pixels for this eq
132 if (eq>=20) {
133 Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq", "eq (%d) out of bounds.",eq);
134 return;
135 }
136 for (UInt_t hs=0; hs<6; hs++) {
137 for (UInt_t chip=0; chip<10; chip++) {
138 ResetNoisyForChip(eq, hs, chip);
139 }
140 }
141}
142//____________________________________________________________________________________________
143Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromFiles() {
144 // read dead and noisy files from file location. returns true if at least one file found
145 Bool_t b1 = ReadNoisyFromFiles();
146 Bool_t b2 = ReadDeadFromFiles();
147 return (b1 && b2);
148}
149
53ae21ce 150Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFiles() {
151 // read dead files from file location. returns true if at least one file found
152 Bool_t returnval=kFALSE;
6727e2db 153 for (UInt_t eq=0; eq<20; eq++) {
154 if (ReadDeadFromFile(eq)) {
155 returnval=kTRUE;
156 }
157 }
158 return returnval;
159}
160Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFiles() {
161 // read noisy files from file location. returns true if at least one file found
162 Bool_t returnval=kFALSE;
163 for (UInt_t eq=0; eq<20; eq++) {
164 if (ReadNoisyFromFile(eq)) {
53ae21ce 165 returnval=kTRUE;
166 }
167 }
168 return returnval;
169}
6727e2db 170Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFile(UInt_t eq) {
171 // read dead file for module from file location.
172 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
53ae21ce 173 return ReadDeadFromFileName(fileName.Data());
174}
6727e2db 175Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFile(UInt_t eq) {
176 // read noisy file for module from file location.
177 TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
178 return ReadNoisyFromFileName(fileName.Data());
179}
53ae21ce 180Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFileName(const char *fileName) {
181 // read dead from file fileName
b15de2d2 182 AliITSOnlineCalibrationSPD* calib;
183 FILE* fp0 = fopen(fileName, "r");
03fc6773 184 if (fp0 == NULL) {return kFALSE;}
b15de2d2 185 else {
186 fclose(fp0);
187 TFile file(fileName, "READ");
188 if (file.IsOpen()) {
189 file.GetObject("AliITSOnlineCalibrationSPD", calib);
190 file.Close();
191 if (calib!=NULL) {
6727e2db 192 UInt_t nrDead=calib->GetNrBad();
193 for (UInt_t index=0; index<nrDead; index++) {
194 UInt_t key = calib->GetKeyAt(index);
195 UInt_t eq = GetEqIdFromKey(key);
196 UInt_t hs = GetHSFromKey(key);
197 UInt_t chip = GetChipFromKey(key);
198 UInt_t col = GetColFromKey(key);
199 UInt_t row = GetRowFromKey(key);
200 SetDeadPixel(eq,hs,chip,col,row);
b15de2d2 201 }
202 }
203 }
204 }
03fc6773 205 return kTRUE;
b15de2d2 206}
53ae21ce 207Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFileName(const char *fileName) {
208 // read noisy from file fileName
b15de2d2 209 AliITSOnlineCalibrationSPD* calib;
210 FILE* fp0 = fopen(fileName, "r");
03fc6773 211 if (fp0 == NULL) {return kFALSE;}
b15de2d2 212 else {
213 fclose(fp0);
214 TFile file(fileName, "READ");
215 if (file.IsOpen()) {
216 file.GetObject("AliITSOnlineCalibrationSPD", calib);
217 file.Close();
218 if (calib!=NULL) {
6727e2db 219 UInt_t nrNoisy=calib->GetNrBad();
220 for (UInt_t index=0; index<nrNoisy; index++) {
221 UInt_t key = calib->GetKeyAt(index);
222 UInt_t eq = GetEqIdFromKey(key);
223 UInt_t hs = GetHSFromKey(key);
224 UInt_t chip = GetChipFromKey(key);
225 UInt_t col = GetColFromKey(key);
226 UInt_t row = GetRowFromKey(key);
227 SetNoisyPixel(eq,hs,chip,col,row);
b15de2d2 228 }
229 }
230 }
231 }
03fc6773 232 return kTRUE;
b15de2d2 233}
6727e2db 234UInt_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromText(const char *fileName, UInt_t module) {
235 // read dead from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
236 // insert only those pixels that belong to module (or all if module=240).
53ae21ce 237 UInt_t newNrDead=0;
238 ifstream textFile;
239 textFile.open(fileName, ifstream::in);
240 if (textFile.fail()) {
6727e2db 241 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromText","No dead text file (%s) present.",fileName);
53ae21ce 242 }
243 else {
244 while(1) {
6727e2db 245 UInt_t eq,hs,chip,col,row;
246 textFile >> eq; if (textFile.eof()) break;
53ae21ce 247 textFile >> hs; if (textFile.eof()) break;
248 textFile >> chip; if (textFile.eof()) break;
249 textFile >> col; if (textFile.eof()) break;
250 textFile >> row;
6727e2db 251 if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){
252 if (SetDeadPixel(eq,hs,chip,col,row)) {
253 newNrDead++;
254 }
53ae21ce 255 }
256 if (textFile.eof()) break;
257 }
258 textFile.close();
259 }
260 return newNrDead;
261}
6727e2db 262UInt_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText(const char *fileName, UInt_t module) {
263 // read noisy from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
264 // insert only those pixels that belong to module (or all if module=240).
53ae21ce 265 UInt_t newNrNoisy=0;
266 ifstream textFile;
267 textFile.open(fileName, ifstream::in);
268 if (textFile.fail()) {
6727e2db 269 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText","No noisy text file (%s) present.",fileName);
53ae21ce 270 }
271 else {
272 while(1) {
6727e2db 273 UInt_t eq,hs,chip,col,row;
274 textFile >> eq; if (textFile.eof()) break;
53ae21ce 275 textFile >> hs; if (textFile.eof()) break;
276 textFile >> chip; if (textFile.eof()) break;
277 textFile >> col; if (textFile.eof()) break;
278 textFile >> row;
6727e2db 279 if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){
280 if (SetNoisyPixel(eq,hs,chip,col,row)) {
281 newNrNoisy++;
282 }
53ae21ce 283 }
284 if (textFile.eof()) break;
285 }
286 textFile.close();
287 }
288 return newNrNoisy;
289}
6727e2db 290//____________________________________________________________________________________________
291void AliITSOnlineCalibrationSPDhandler::WriteToFilesAlways() {
292 // write the lists of dead and noisy to files
293 for (UInt_t eq=0; eq<20; eq++) {
294 WriteDeadToFile(eq);
295 WriteNoisyToFile(eq);
296 }
297}
298UInt_t AliITSOnlineCalibrationSPDhandler::WriteToFiles() {
299 // write the lists of dead and noisy to files (only if there are >0 dead or noisy pixels) , returns nr of files produced
300 return (WriteNoisyToFiles() + WriteDeadToFiles());
301}
302void AliITSOnlineCalibrationSPDhandler::WriteDeadToFilesAlways() {
303 // write the lists of dead to files
304 for (UInt_t eq=0; eq<20; eq++) {
305 WriteDeadToFile(eq);
306 }
307}
308void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFilesAlways() {
309 // write the lists of noisy to files
310 for (UInt_t eq=0; eq<20; eq++) {
311 WriteNoisyToFile(eq);
312 }
313}
314UInt_t AliITSOnlineCalibrationSPDhandler::WriteDeadToFiles() {
315 // write the list of dead to file (only if there are >0 dead pixels) , returns nr of files produced
316 UInt_t nrFiles=0;
317 for (UInt_t eq=0; eq<20; eq++) {
318 if (GetNrDeadEq(eq) > 0) {
319 WriteDeadToFile(eq);
320 nrFiles++;
321 }
322 }
323 return nrFiles;
324}
325UInt_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToFiles() {
326 // write the list of noisy to file (only if there are >0 noisy pixels) , returns nr of files produced
327 UInt_t nrFiles=0;
328 for (UInt_t eq=0; eq<20; eq++) {
329 if (GetNrNoisyEq(eq) > 0) {
330 WriteNoisyToFile(eq);
331 nrFiles++;
332 }
333 }
334 return nrFiles;
335}
336void AliITSOnlineCalibrationSPDhandler::WriteDeadToFile(UInt_t eq) {
337 // write the lists of dead and noisy for module to file
338 AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
339 calib->SetEqNr(eq);
340 calib->SetBadList(GetDeadArrayOnline(eq));
341 calib->SetNrBad(GetNrDeadEq(eq));
342 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
343 TFile file(fileName.Data(), "RECREATE");
344 file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
345 file.Close();
346 delete calib;
347}
348void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFile(UInt_t eq) {
349 // write the lists of noisy and noisy for module to file
350 AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
351 calib->SetEqNr(eq);
352 calib->SetBadList(GetNoisyArrayOnline(eq));
353 calib->SetNrBad(GetNrNoisyEq(eq));
354 TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
355 TFile file(fileName.Data(), "RECREATE");
356 file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
357 file.Close();
358 delete calib;
359}
360//____________________________________________________________________________________________
53ae21ce 361#ifndef SPD_DA_OFF
6727e2db 362Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB(UInt_t module, Int_t runNr, Bool_t treeSerial) {
363 // reads dead pixels from DB for given module and runNr
53ae21ce 364 AliCDBManager* man = AliCDBManager::Instance();
365 if(!man->IsDefaultStorageSet()) {
366 man->SetDefaultStorage("local://$ALICE_ROOT");
367 }
6727e2db 368 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
53ae21ce 369 TObjArray* spdEntry;
370 if(cdbEntry) {
371 spdEntry = (TObjArray*)cdbEntry->GetObject();
372 if(!spdEntry) return kFALSE;
373 }
374 else {
6727e2db 375 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB","Calibration for run %d not found in database.",runNr);
53ae21ce 376 return kFALSE;
377 }
378 AliITSCalibrationSPD* calibSPD;
379 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
6727e2db 380 UInt_t nrDead = calibSPD->GetNrBad();
381 if (nrDead>0) {
382 if (!treeSerial) RecursiveInsertDead(calibSPD,module,0,nrDead-1);
383 else {
384 for (UInt_t index=0; index<nrDead; index++) {
385 UInt_t colM = calibSPD->GetBadColAt(index);
386 UInt_t rowM = calibSPD->GetBadRowAt(index);
387 SetDeadPixelM(module,colM,rowM);
388 }
389 }
53ae21ce 390 }
391 spdEntry->SetOwner(kTRUE);
392 spdEntry->Clear();
393 return kTRUE;
394}
6727e2db 395Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB(UInt_t module, Int_t runNr, Bool_t treeSerial) {
396 // reads noisy pixels from DB for given module and runNr
397 AliCDBManager* man = AliCDBManager::Instance();
398 if(!man->IsDefaultStorageSet()) {
399 man->SetDefaultStorage("local://$ALICE_ROOT");
400 }
401 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
402 TObjArray* spdEntry;
403 if(cdbEntry) {
404 spdEntry = (TObjArray*)cdbEntry->GetObject();
405 if(!spdEntry) return kFALSE;
406 }
407 else {
408 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB","Calibration for run %d not found in database.",runNr);
409 return kFALSE;
410 }
411 AliITSCalibrationSPD* calibSPD;
412 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
413 UInt_t nrNoisy = calibSPD->GetNrBad();
414 if (nrNoisy>0) {
415 if (!treeSerial) RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
416 else {
417 for (UInt_t index=0; index<nrNoisy; index++) {
418 UInt_t colM = calibSPD->GetBadColAt(index);
419 UInt_t rowM = calibSPD->GetBadRowAt(index);
420 SetNoisyPixelM(module,colM,rowM);
421 }
422 }
423 }
424 spdEntry->SetOwner(kTRUE);
425 spdEntry->Clear();
426 return kTRUE;
427}
428Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromDB(Int_t runNr, Bool_t treeSerial) {
53ae21ce 429 // reads dead and noisy pixels from DB for given runNr
430 // note that you may want to clear the lists (if they are not empty) before reading
6727e2db 431 return (ReadNoisyFromDB(runNr,treeSerial) && ReadDeadFromDB(runNr,treeSerial));
432}
433Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB(Int_t runNr, Bool_t treeSerial) {
434 // reads dead pixels from DB for given runNr
435 // note that you may want to clear the list (if it is not empty) before reading
53ae21ce 436 AliCDBManager* man = AliCDBManager::Instance();
437 if(!man->IsDefaultStorageSet()) {
438 man->SetDefaultStorage("local://$ALICE_ROOT");
439 }
6727e2db 440 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
53ae21ce 441 TObjArray* spdEntry;
442 if(cdbEntry) {
443 spdEntry = (TObjArray*)cdbEntry->GetObject();
444 if(!spdEntry) return kFALSE;
445 }
446 else {
6727e2db 447 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB","Calibration for run %d not found in database.",runNr);
53ae21ce 448 return kFALSE;
449 }
450 AliITSCalibrationSPD* calibSPD;
451 for (UInt_t module=0; module<240; module++) {
452 // printf("Reading module %d\n",module);
453 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
6727e2db 454 UInt_t nrDead = calibSPD->GetNrBad();
455 if (nrDead>0) {
456 if (!treeSerial) RecursiveInsertDead(calibSPD,module,0,nrDead-1);
457 else {
458 for (UInt_t index=0; index<nrDead; index++) {
459 UInt_t colM = calibSPD->GetBadColAt(index);
460 UInt_t rowM = calibSPD->GetBadRowAt(index);
461 SetDeadPixelM(module,colM,rowM);
462 }
463 }
53ae21ce 464 }
6727e2db 465 }
466 spdEntry->SetOwner(kTRUE);
467 spdEntry->Clear();
468 return kTRUE;
469}
470Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB(Int_t runNr, Bool_t treeSerial) {
471 // reads noisy pixels from DB for given runNr
472 // note that you may want to clear the list (if it is not empty) before reading
473 AliCDBManager* man = AliCDBManager::Instance();
474 if(!man->IsDefaultStorageSet()) {
475 man->SetDefaultStorage("local://$ALICE_ROOT");
476 }
477 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
478 TObjArray* spdEntry;
479 if(cdbEntry) {
480 spdEntry = (TObjArray*)cdbEntry->GetObject();
481 if(!spdEntry) return kFALSE;
482 }
483 else {
484 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB","Calibration for run %d not found in database.",runNr);
485 return kFALSE;
486 }
487 AliITSCalibrationSPD* calibSPD;
488 for (UInt_t module=0; module<240; module++) {
489 // printf("Reading module %d\n",module);
490 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
491 UInt_t nrNoisy = calibSPD->GetNrBad();
492 if (nrNoisy>0) {
493 if (!treeSerial) {
494 printf("*** mod %d nrnoisy=%d\n",module,nrNoisy);
495 RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
496 }
497 else {
498 for (UInt_t index=0; index<nrNoisy; index++) {
499 UInt_t colM = calibSPD->GetBadColAt(index);
500 UInt_t rowM = calibSPD->GetBadRowAt(index);
501 SetNoisyPixelM(module,colM,rowM);
502 }
503 }
53ae21ce 504 }
505 }
506 spdEntry->SetOwner(kTRUE);
507 spdEntry->Clear();
508 return kTRUE;
509}
6727e2db 510Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromCalibObj(TObjArray* calObj) {
511 // reads dead pixels from calib object
512 for (UInt_t module=0; module<240; module++) {
513 for (Int_t i=0; i<((AliITSCalibrationSPD*)calObj->At(module))->GetNrBad(); i++) {
514 SetDeadPixelM(module,
515 ((AliITSCalibrationSPD*)calObj->At(module))->GetBadColAt(i),
516 ((AliITSCalibrationSPD*)calObj->At(module))->GetBadRowAt(i));
517 }
518 }
519 return kTRUE;
520}
521Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromCalibObj(TObjArray* calObj) {
522 // reads noisy pixels from calib object
523 for (UInt_t module=0; module<240; module++) {
524 for (Int_t i=0; i<((AliITSCalibrationSPD*)calObj->At(module))->GetNrBad(); i++) {
525 SetNoisyPixelM(module,
526 ((AliITSCalibrationSPD*)calObj->At(module))->GetBadColAt(i),
527 ((AliITSCalibrationSPD*)calObj->At(module))->GetBadRowAt(i));
528 }
529 }
530 return kTRUE;
531}
53ae21ce 532Bool_t AliITSOnlineCalibrationSPDhandler::WriteToDB(Int_t runNrStart, Int_t runNrEnd) {
6727e2db 533 // writes dead and noisy pixels to DB for given runNrs
534 // overwrites any previous entries
535 return (WriteNoisyToDB(runNrStart,runNrEnd) && WriteDeadToDB(runNrStart,runNrEnd));
536}
537Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDB(Int_t runNrStart, Int_t runNrEnd) {
538 // writes dead pixels to DB for given runNrs
53ae21ce 539 // overwrites any previous entries
540 AliCDBManager* man = AliCDBManager::Instance();
541 if(!man->IsDefaultStorageSet()) {
542 man->SetDefaultStorage("local://$ALICE_ROOT");
543 }
544 AliCDBMetaData* metaData = new AliCDBMetaData();
545 metaData->SetResponsible("Henrik Tydesjo");
546 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
6727e2db 547 AliCDBId idCalSPD("ITS/Calib/SPDDead",runNrStart,runNrEnd);
53ae21ce 548 TObjArray* spdEntry = new TObjArray(240);
549 spdEntry->SetOwner(kTRUE);
550 for(UInt_t module=0; module<240; module++){
551 AliITSCalibrationSPD* calObj = new AliITSCalibrationSPD();
3479cee3 552
553 // *** this is temporarily hard coded here ********************
554 // (later these parameters will be separated from the cal.obj.)
555 calObj->SetThresholds(3000, 250);
556 calObj->SetBiasVoltage(18.182);
557 calObj->SetNoiseParam(0,0);
3479cee3 558 calObj->SetCouplingParam(0.,0.055);
559 // *** remove later...
560 // ************************************************************
561
53ae21ce 562 spdEntry->Add(calObj);
563 }
564 for(UInt_t module=0; module<240; module++){
6727e2db 565 ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNrBad( GetNrDead(module) );
566 ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetBadList( GetDeadArray(module) );
53ae21ce 567 }
568 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
569 man->Put(cdbEntry);
570 delete spdEntry;
571 delete cdbEntry;
572 delete metaData;
573 return kTRUE;
574}
6727e2db 575Bool_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToDB(Int_t runNrStart, Int_t runNrEnd) {
576 // writes noisy pixels to DB for given runNrs
577 // overwrites any previous entries
578 AliCDBManager* man = AliCDBManager::Instance();
579 if(!man->IsDefaultStorageSet()) {
580 man->SetDefaultStorage("local://$ALICE_ROOT");
581 }
582 AliCDBMetaData* metaData = new AliCDBMetaData();
583 metaData->SetResponsible("Henrik Tydesjo");
584 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
585 AliCDBId idCalSPD("ITS/Calib/SPDNoisy",runNrStart,runNrEnd);
586 TObjArray* spdEntry = new TObjArray(240);
587 spdEntry->SetOwner(kTRUE);
588 for(UInt_t module=0; module<240; module++){
589 AliITSCalibrationSPD* calObj = new AliITSCalibrationSPD();
53ae21ce 590
6727e2db 591 // *** this is temporarily hard coded here ********************
592 // (later these parameters will be separated from the cal.obj.)
593 calObj->SetThresholds(3000, 250);
594 calObj->SetBiasVoltage(18.182);
595 calObj->SetNoiseParam(0,0);
596 calObj->SetCouplingParam(0.,0.055);
597 // *** remove later...
598 // ************************************************************
599
600 spdEntry->Add(calObj);
3479cee3 601 }
6727e2db 602 for(UInt_t module=0; module<240; module++){
603 ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNrBad( GetNrNoisy(module) );
604 ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetBadList( GetNoisyArray(module) );
53ae21ce 605 }
6727e2db 606 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
607 man->Put(cdbEntry);
608 delete spdEntry;
609 delete cdbEntry;
610 delete metaData;
611 return kTRUE;
53ae21ce 612}
6727e2db 613//____________________________________________________________________________________________
614void AliITSOnlineCalibrationSPDhandler::RecursiveInsertDead(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
615 // inserts dead pixels recursively, used when reading from db
616 if (lowInd>highInd) return;
617 Int_t thisInd = lowInd+(highInd-lowInd)/2;
618 SetDeadPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
619 RecursiveInsertDead(calibSPD,module,lowInd,thisInd-1);
620 RecursiveInsertDead(calibSPD,module,thisInd+1,highInd);
621}
622void AliITSOnlineCalibrationSPDhandler::RecursiveInsertNoisy(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
623 // inserts noisy pixels recursively, used when reading from db
624 printf("Rec mod %d : %d,%d\n",module,lowInd,highInd);
625 if (lowInd>highInd) return;
626 Int_t thisInd = lowInd+(highInd-lowInd)/2;
627 SetNoisyPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
628 RecursiveInsertNoisy(calibSPD,module,lowInd,thisInd-1);
629 RecursiveInsertNoisy(calibSPD,module,thisInd+1,highInd);
53ae21ce 630}
6727e2db 631
632#endif
633//____________________________________________________________________________________________
634void AliITSOnlineCalibrationSPDhandler::GenerateDCSConfigFile(const Char_t* fileName) {
635 // generates an ascii file in the format as the one produced by online da (but with dummy runNr=0)
636 ofstream dcsfile;
637 dcsfile.open(fileName);
638 dcsfile << "[SPD SCAN]\n";
639 dcsfile << "RunNumber=" << "0" << "\n"; // dummy value
640 dcsfile << "Type=" << "4" << "\n";
641 dcsfile << "Router=" << "0" << "\n"; // dummy value
642 dcsfile << "ActualDetCoonfiguration=" << "0,-1,-1\n"; // dummy values
643 dcsfile << "[NOISY]\n";
53ae21ce 644 for (UInt_t module=0; module<240; module++) {
6727e2db 645 UInt_t headkey=20*10*6;
646 for (UInt_t ind=0; ind<GetNrNoisy(module); ind++) {
647 UInt_t newkey = GetNoisyEqIdAt(module,ind)*10*6 +
648 GetNoisyHSAt(module,ind)*10 +
649 GetNoisyChipAt(module,ind);
650 if (newkey!=headkey) { // print eq,hs,chip header
651 headkey = newkey;
652 dcsfile << "-" << newkey/(6*10) << "," << (newkey%(6*10))/10 << "," << (newkey%(6*10))%10 << "\n";
653 }
654 dcsfile << GetNoisyColAt(module,ind) << "," << GetNoisyRowAt(module,ind) << "\n";
53ae21ce 655 }
656 }
6727e2db 657 dcsfile.close();
53ae21ce 658}
6727e2db 659//____________________________________________________________________________________________
660TArrayI AliITSOnlineCalibrationSPDhandler::GetDeadArray(UInt_t module, Bool_t treeSerial) {
661 // get a TArrayI of the dead pixels (format for the AliITSCalibrationSPD object)
662 TArrayI returnArray;
663
664 UInt_t eq = GetEqIdFromOffline(module);
665 UInt_t hs = GetHSFromOffline(module);
666 UInt_t size=0;
667 for (UInt_t chip=0; chip<5; chip++) {
668 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
669 size += fNrDead[gloChip];
670 }
671 returnArray.Set(size*2);
672 UInt_t gloIndex=0;
673 for (UInt_t chip=0; chip<5; chip++) {
674 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
675 if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
676 else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
677 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
678 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
679 Int_t colM = GetColMFromKey(key);
680 Int_t rowM = GetRowMFromKey(key);
681 returnArray.AddAt(colM,gloIndex*2);
682 returnArray.AddAt(rowM,gloIndex*2+1);
683 gloIndex++;
53ae21ce 684 }
685 }
6727e2db 686 return returnArray;
53ae21ce 687}
6727e2db 688TArrayI AliITSOnlineCalibrationSPDhandler::GetNoisyArray(UInt_t module, Bool_t treeSerial) {
689 // get a TArrayI of the noisy pixels (format for the AliITSCalibrationSPD object)
b15de2d2 690 TArrayI returnArray;
6727e2db 691
692 UInt_t eq = GetEqIdFromOffline(module);
693 UInt_t hs = GetHSFromOffline(module);
694 UInt_t size=0;
695 for (UInt_t chip=0; chip<5; chip++) {
696 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
697 size += fNrNoisy[gloChip];
698 }
699 returnArray.Set(size*2);
700 UInt_t gloIndex=0;
701 for (UInt_t chip=0; chip<5; chip++) {
702 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
703 if (treeSerial) fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
704 else fNoisyPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
705 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
706 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
707 Int_t colM = GetColMFromKey(key);
708 Int_t rowM = GetRowMFromKey(key);
709 returnArray.AddAt(colM,gloIndex*2);
710 returnArray.AddAt(rowM,gloIndex*2+1);
711 gloIndex++;
712 }
b15de2d2 713 }
714 return returnArray;
715}
6727e2db 716TArrayI AliITSOnlineCalibrationSPDhandler::GetDeadArrayOnline(UInt_t eq) {
717 // get a TArrayI of the dead pixels (format for the AliITSOnlineCalibrationSPD object)
b15de2d2 718 TArrayI returnArray;
6727e2db 719 // fix size of array
720 UInt_t size=0;
721 for (UInt_t hs=0; hs<6; hs++) {
722 for (UInt_t chip=0; chip<10; chip++) {
723 UInt_t gloChip = GetGloChip(eq,hs,chip);
724 size+=fNrDead[gloChip];
725 }
726 }
727 returnArray.Set(size);
728 // put keys in array
729 UInt_t gloIndex=0;
730 for (UInt_t hs=0; hs<6; hs++) {
731 for (UInt_t chip=0; chip<10; chip++) {
732 UInt_t gloChip = GetGloChip(eq,hs,chip);
733 fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
734 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
735 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
736 returnArray.AddAt(key,gloIndex);
737 gloIndex++;
738 }
739 }
b15de2d2 740 }
741 return returnArray;
742}
6727e2db 743TArrayI AliITSOnlineCalibrationSPDhandler::GetNoisyArrayOnline(UInt_t eq) {
744 // get a TArrayI of the noisy pixels (format for the AliITSOnlineCalibrationSPD object)
745 TArrayI returnArray;
746 // fix size of array
747 UInt_t size=0;
748 for (UInt_t hs=0; hs<6; hs++) {
749 for (UInt_t chip=0; chip<10; chip++) {
750 UInt_t gloChip = GetGloChip(eq,hs,chip);
751 size+=fNrNoisy[gloChip];
752 }
53ae21ce 753 }
6727e2db 754 returnArray.Set(size);
755 // put keys in array
756 UInt_t gloIndex=0;
757 for (UInt_t hs=0; hs<6; hs++) {
758 for (UInt_t chip=0; chip<10; chip++) {
759 UInt_t gloChip = GetGloChip(eq,hs,chip);
760 fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
761 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
762 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
763 returnArray.AddAt(key,gloIndex);
764 gloIndex++;
53ae21ce 765 }
766 }
767 }
6727e2db 768 return returnArray;
b15de2d2 769}
6727e2db 770//____________________________________________________________________________________________
771void AliITSOnlineCalibrationSPDhandler::PrintEqSummary() {
772// print summary (nr of dead and noisy) for each equipment
773 printf("-----------\n");
774 printf("Eq summary:\n");
775 printf("-----------\n");
776 for (UInt_t eq=0; eq<20; eq++) {
777 printf("Eq %*d: %*d dead , %*d noisy\n",2,eq,5,GetNrDeadEq(eq),5,GetNrNoisyEq(eq));
b15de2d2 778 }
b15de2d2 779}
6727e2db 780void AliITSOnlineCalibrationSPDhandler::PrintDead() const {
781 // print the dead pixels to screen
782 printf("------------------------------------------------------\n");
783 printf("Dead Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
784 printf("------------------------------------------------------\n");
785 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
786 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
787 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
788 UInt_t eq = GetEqIdFromKey(key);
789 UInt_t hs = GetHSFromKey(key);
790 UInt_t chip = GetChipFromKey(key);
791 UInt_t col = GetColFromKey(key);
792 UInt_t row = GetRowFromKey(key);
b15de2d2 793
6727e2db 794 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
795 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
796 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
797
798 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);
799 }
b15de2d2 800 }
b15de2d2 801}
6727e2db 802void AliITSOnlineCalibrationSPDhandler::PrintNoisy() const {
803 // print the dead pixels to screen
804 printf("-------------------------------------------------------\n");
805 printf("Noisy Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
806 printf("-------------------------------------------------------\n");
807 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
808 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
809 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
810 UInt_t eq = GetEqIdFromKey(key);
811 UInt_t hs = GetHSFromKey(key);
812 UInt_t chip = GetChipFromKey(key);
813 UInt_t col = GetColFromKey(key);
814 UInt_t row = GetRowFromKey(key);
b15de2d2 815
6727e2db 816 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
817 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
818 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
819
820 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);
821 }
3479cee3 822 }
3479cee3 823}
6727e2db 824//____________________________________________________________________________________________
825Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
826 // set a dead pixel, returns false if pixel is already dead
827 UInt_t gloChip = GetGloChip(eq,hs,chip);
828 if (gloChip>=1200) {
829 Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
830 return kFALSE;
831 }
832 if (col>=32 && row>=256) {
833 Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
834 return kFALSE;
835 }
836 Int_t key = GetKey(eq,hs,chip,col,row);
837 // if noisy we dont want to add it...
838 if (fNoisyPixelMap[gloChip]->Find(key) != NULL) return kFALSE;
839 if (fDeadPixelMap[gloChip]->Insert(key,gloChip)) {
840 fNrDead[gloChip]++;
3479cee3 841 return kTRUE;
842 }
843 return kFALSE;
844}
6727e2db 845Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
846 // set a noisy pixel, returns false if pixel is already noisy
847 UInt_t gloChip = GetGloChip(eq,hs,chip);
848 if (gloChip>=1200) {
849 Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
850 return kFALSE;
b15de2d2 851 }
6727e2db 852 if (col>=32 && row>=256) {
853 Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
b15de2d2 854 return kFALSE;
855 }
6727e2db 856 Int_t key = GetKey(eq,hs,chip,col,row);
857 // if dead before - remove from the dead list
858 if (fDeadPixelMap[gloChip]->Remove(key)) {
859 fNrDead[gloChip]--;
860 }
861 if (fNoisyPixelMap[gloChip]->Insert(key,gloChip)) {
862 fNrNoisy[gloChip]++;
863 return kTRUE;
864 }
865 return kFALSE;
b15de2d2 866}
6727e2db 867Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
868 // set a dead pixel, returns false if pixel is already dead
869 UInt_t eq = GetEqIdFromOffline(module);
53ae21ce 870 UInt_t hs = GetHSFromOffline(module);
871 UInt_t chip = GetChipFromOffline(module,colM);
6727e2db 872 UInt_t col = GetColFromOffline(module,colM);
873 UInt_t row = GetRowFromOffline(module,rowM);
874 return SetDeadPixel(eq,hs,chip,col,row);
53ae21ce 875}
6727e2db 876Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
877 // set a noisy pixel, returns false if pixel is already noisy
878 UInt_t eq = GetEqIdFromOffline(module);
879 UInt_t hs = GetHSFromOffline(module);
880 UInt_t chip = GetChipFromOffline(module,colM);
881 UInt_t col = GetColFromOffline(module,colM);
882 UInt_t row = GetRowFromOffline(module,rowM);
883 return SetNoisyPixel(eq,hs,chip,col,row);
53ae21ce 884}
6727e2db 885Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
886 // unset a dead pixel, returns false if pixel is not dead
887 UInt_t gloChip = GetGloChip(eq,hs,chip);
888 if (gloChip>=1200) {
889 Error("AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
890 return kFALSE;
53ae21ce 891 }
6727e2db 892 Int_t key = GetKey(eq,hs,chip,col,row);
893 if (fDeadPixelMap[gloChip]->Remove(key)) {
894 fNrDead[gloChip]--;
895 return kTRUE;
53ae21ce 896 }
6727e2db 897 return kFALSE;
53ae21ce 898}
6727e2db 899Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
900 // unset a noisy pixel, returns false if pixel is not noisy
901 UInt_t gloChip = GetGloChip(eq,hs,chip);
902 if (gloChip>=1200) {
903 Error("AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
904 return kFALSE;
53ae21ce 905 }
6727e2db 906 Int_t key = GetKey(eq,hs,chip,col,row);
907 if (fNoisyPixelMap[gloChip]->Remove(key)) {
908 fNrNoisy[gloChip]--;
909 return kTRUE;
53ae21ce 910 }
6727e2db 911 return kFALSE;
53ae21ce 912}
6727e2db 913Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
914 // unset a dead pixel, returns false if pixel is not dead
915 UInt_t eq = GetEqIdFromOffline(module);
916 UInt_t hs = GetHSFromOffline(module);
917 UInt_t chip = GetChipFromOffline(module,colM);
918 UInt_t col = GetColFromOffline(module,colM);
919 UInt_t row = GetRowFromOffline(module,rowM);
920 return UnSetDeadPixel(eq,hs,chip,col,row);
53ae21ce 921}
6727e2db 922Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
923 // unset a noisy pixel, returns false if pixel is not noisy
924 UInt_t eq = GetEqIdFromOffline(module);
925 UInt_t hs = GetHSFromOffline(module);
926 UInt_t chip = GetChipFromOffline(module,colM);
927 UInt_t col = GetColFromOffline(module,colM);
928 UInt_t row = GetRowFromOffline(module,rowM);
929 return UnSetNoisyPixel(eq,hs,chip,col,row);
53ae21ce 930}
6727e2db 931UInt_t AliITSOnlineCalibrationSPDhandler::SetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip) {
932 // set a full chip dead, returns nr of new dead pixels
933 UInt_t nrNew = 0;
934 for (UInt_t col=0; col<32; col++) {
935 for (UInt_t row=0; row<256; row++) {
936 if (SetDeadPixel(eq,hs,chip,col,row)) {
937 nrNew++;
938 }
939 }
53ae21ce 940 }
6727e2db 941 return nrNew;
53ae21ce 942}
6727e2db 943UInt_t AliITSOnlineCalibrationSPDhandler::SetNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip) {
944 // set a full chip noisy, returns nr of new noisy pixels
945 UInt_t nrNew = 0;
946 for (UInt_t col=0; col<32; col++) {
947 for (UInt_t row=0; row<256; row++) {
948 if (SetNoisyPixel(eq,hs,chip,col,row)) {
949 nrNew++;
950 }
951 }
53ae21ce 952 }
6727e2db 953 return nrNew;
53ae21ce 954}
6727e2db 955Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip) {
956 // unset a full dead chip, returns false if it was not all dead before
957 UInt_t nrUnset = 0;
958 for (UInt_t col=0; col<32; col++) {
959 for (UInt_t row=0; row<256; row++) {
960 if (UnSetDeadPixel(eq,hs,chip,col,row)) {
961 nrUnset++;
962 }
963 }
53ae21ce 964 }
6727e2db 965 if (nrUnset+GetNrNoisyC(eq,hs,chip)<8192) return kFALSE;
966 else return kTRUE;
b15de2d2 967}
6727e2db 968Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip) {
969 // unset a full noisy chip, returns false if it was not all noisy before
970 UInt_t nrUnset = 0;
53ae21ce 971 for (UInt_t col=0; col<32; col++) {
972 for (UInt_t row=0; row<256; row++) {
6727e2db 973 if (UnSetNoisyPixel(eq,hs,chip,col,row)) {
974 nrUnset++;
53ae21ce 975 }
976 }
977 }
6727e2db 978 if (nrUnset<8192) return kFALSE;
979 else return kTRUE;
53ae21ce 980}
6727e2db 981//____________________________________________________________________________________________
982Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDead(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
983 // is the pixel dead?
984 UInt_t gloChip = GetGloChip(eq,hs,chip);
985 if (gloChip>=1200) {
986 Error("AliITSOnlineCalibrationSPDhandler::IsPixelDead", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
987 return kFALSE;
53ae21ce 988 }
6727e2db 989 UInt_t key = GetKey(eq,hs,chip,col,row);
990 if ( fDeadPixelMap[gloChip]->Find(key) != NULL ) {
53ae21ce 991 return kTRUE;
b15de2d2 992 }
6727e2db 993 else {
994 return kFALSE;
995 }
b15de2d2 996}
6727e2db 997Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisy(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
998 // is the pixel noisy?
999 UInt_t gloChip = GetGloChip(eq,hs,chip);
1000 if (gloChip>=1200) {
1001 Error("AliITSOnlineCalibrationSPDhandler::IsPixelNoisy", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1002 return kFALSE;
1003 }
1004 UInt_t key = GetKey(eq,hs,chip,col,row);
1005 if ( fNoisyPixelMap[gloChip]->Find(key) != NULL ) {
3479cee3 1006 return kTRUE;
1007 }
6727e2db 1008 else {
1009 return kFALSE;
1010 }
3479cee3 1011}
6727e2db 1012Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1013 // is the pixel dead?
1014 UInt_t eq = GetEqIdFromOffline(module);
3479cee3 1015 UInt_t hs = GetHSFromOffline(module);
1016 UInt_t chip = GetChipFromOffline(module,colM);
6727e2db 1017 UInt_t col = GetColFromOffline(module,colM);
1018 UInt_t row = GetRowFromOffline(module,rowM);
1019 return IsPixelDead(eq,hs,chip,col,row);
1020}
1021Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1022 // is the pixel noisy?
1023 UInt_t eq = GetEqIdFromOffline(module);
1024 UInt_t hs = GetHSFromOffline(module);
1025 UInt_t chip = GetChipFromOffline(module,colM);
1026 UInt_t col = GetColFromOffline(module,colM);
1027 UInt_t row = GetRowFromOffline(module,rowM);
1028 return IsPixelNoisy(eq,hs,chip,col,row);
1029}
1030Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadKey(Int_t key) const {
1031 // is this pixel dead?
1032 UInt_t eq = GetEqIdFromKey(key);
1033 UInt_t hs = GetHSFromKey(key);
1034 UInt_t chip = GetChipFromKey(key);
1035 UInt_t col = GetColFromKey(key);
1036 UInt_t row = GetRowFromKey(key);
1037 return IsPixelDead(eq,hs,chip,col,row);
3479cee3 1038}
53ae21ce 1039Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyKey(Int_t key) const {
1040 // is this pixel noisy?
6727e2db 1041 UInt_t eq = GetEqIdFromKey(key);
53ae21ce 1042 UInt_t hs = GetHSFromKey(key);
1043 UInt_t chip = GetChipFromKey(key);
6727e2db 1044 UInt_t col = GetColFromKey(key);
1045 UInt_t row = GetRowFromKey(key);
1046 return IsPixelNoisy(eq,hs,chip,col,row);
b15de2d2 1047}
6727e2db 1048//____________________________________________________________________________________________
1049UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead() const {
1050 // returns the total nr of dead pixels
1051 UInt_t nrDead = 0;
1052 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1053 nrDead+=fNrDead[gloChip];
b15de2d2 1054 }
6727e2db 1055 return nrDead;
b15de2d2 1056}
53ae21ce 1057UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy() const {
1058 // returns the total nr of noisy pixels
1059 UInt_t nrNoisy = 0;
6727e2db 1060 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1061 nrNoisy+=fNrNoisy[gloChip];
53ae21ce 1062 }
1063 return nrNoisy;
1064}
6727e2db 1065UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t index) {
1066 // get eq for the dead pixel at position index in list of dead
1067 UInt_t gloChip;
1068 UInt_t chipIndex;
1069 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1070 return GetDeadEqIdAtC2(gloChip,chipIndex);
1071}
1072UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t index) {
1073 // get eq for the noisy pixel at position index in list of noisy
1074 UInt_t gloChip;
1075 UInt_t chipIndex;
1076 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1077 return GetNoisyEqIdAtC2(gloChip,chipIndex);
1078}
1079UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t index) {
1080 // get hs for the dead pixel at position index in list of dead
1081 UInt_t gloChip;
1082 UInt_t chipIndex;
1083 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1084 return GetDeadHSAtC2(gloChip,chipIndex);
1085}
1086UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t index) {
1087 // get hs for the noisy pixel at position index in list of noisy
1088 UInt_t gloChip;
1089 UInt_t chipIndex;
1090 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1091 return GetNoisyHSAtC2(gloChip,chipIndex);
1092}
1093UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t index) {
1094 // get chip for the dead pixel at position index in list of dead
1095 UInt_t gloChip;
1096 UInt_t chipIndex;
1097 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1098 return GetDeadChipAtC2(gloChip,chipIndex);
1099}
1100UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t index) {
1101 // get chip for the noisy pixel at position index in list of noisy
1102 UInt_t gloChip;
1103 UInt_t chipIndex;
1104 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1105 return GetNoisyChipAtC2(gloChip,chipIndex);
1106}
1107UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t index) {
1108 // get hs for the dead pixel at position index in list of dead
1109 UInt_t gloChip;
1110 UInt_t chipIndex;
1111 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1112 return GetDeadColAtC2(gloChip,chipIndex);
1113}
1114UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t index) {
1115 // get hs for the noisy pixel at position index in list of noisy
1116 UInt_t gloChip;
1117 UInt_t chipIndex;
1118 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1119 return GetNoisyColAtC2(gloChip,chipIndex);
1120}
1121UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t index) {
1122 // get hs for the dead pixel at position index in list of dead
1123 UInt_t gloChip;
1124 UInt_t chipIndex;
1125 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1126 return GetDeadRowAtC2(gloChip,chipIndex);
1127}
1128UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t index) {
1129 // get hs for the noisy pixel at position index in list of noisy
1130 UInt_t gloChip;
1131 UInt_t chipIndex;
1132 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1133 return GetNoisyRowAtC2(gloChip,chipIndex);
1134}
1135//____________________________________________________________________________________________
1136UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead(UInt_t module) const {
1137 // returns the number of dead pixels for a certain module
1138 if (module>=240) {
1139 Error("AliITSOnlineCalibrationSPDhandler::GetNrDead", "module nr (%d) out of bounds.",module);
53ae21ce 1140 return 0;
1141 }
6727e2db 1142 UInt_t nrDead = 0;
1143 UInt_t eq = GetEqIdFromOffline(module);
1144 UInt_t hs = GetHSFromOffline(module);
1145 for (UInt_t chip=0; chip<5; chip++) {
1146 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
1147 nrDead+=fNrDead[gloChip];
53ae21ce 1148
53ae21ce 1149 }
6727e2db 1150 return nrDead;
1151}
1152UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy(UInt_t module) const {
1153 // returns the number of noisy pixels for a certain module
1154 if (module>=240) {
1155 Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisy", "module nr (%d) out of bounds.",module);
53ae21ce 1156 return 0;
1157 }
6727e2db 1158 UInt_t nrNoisy = 0;
1159 UInt_t eq = GetEqIdFromOffline(module);
1160 UInt_t hs = GetHSFromOffline(module);
1161 for (UInt_t chip=0; chip<5; chip++) {
1162 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
1163 nrNoisy+=fNrNoisy[gloChip];
1164
1165 }
1166 return nrNoisy;
1167}
1168UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t module, UInt_t index) {
1169 // get eq for the dead pixel at position index in list of dead
1170 UInt_t gloChip;
1171 UInt_t chipIndex;
1172 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1173 return GetDeadEqIdAtC2(gloChip,chipIndex);
1174}
1175UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t module, UInt_t index) {
1176 // get eq for the noisy pixel at position index in list of noisy
1177 UInt_t gloChip;
1178 UInt_t chipIndex;
1179 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1180 return GetNoisyEqIdAtC2(gloChip,chipIndex);
1181}
1182UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t module, UInt_t index) {
1183 // get hs for the dead pixel at position index in list of dead
1184 UInt_t gloChip;
1185 UInt_t chipIndex;
1186 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1187 return GetDeadHSAtC2(gloChip,chipIndex);
53ae21ce 1188}
1189UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t module, UInt_t index) {
6727e2db 1190 // get hs for the noisy pixel at position index in list of noisy
1191 UInt_t gloChip;
1192 UInt_t chipIndex;
1193 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1194 return GetNoisyHSAtC2(gloChip,chipIndex);
1195}
1196UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t module, UInt_t index) {
1197 // get chip for the dead pixel at position index in list of dead
1198 UInt_t gloChip;
1199 UInt_t chipIndex;
1200 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1201 return GetDeadChipAtC2(gloChip,chipIndex);
1202}
1203UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t module, UInt_t index) {
53ae21ce 1204 // get chip for the noisy pixel at position index in list of noisy
6727e2db 1205 UInt_t gloChip;
1206 UInt_t chipIndex;
1207 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1208 return GetNoisyChipAtC2(gloChip,chipIndex);
1209}
1210UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t module, UInt_t index) {
1211 // get hs for the dead pixel at position index in list of dead
1212 UInt_t gloChip;
1213 UInt_t chipIndex;
1214 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1215 return GetDeadColAtC2(gloChip,chipIndex);
1216}
1217UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t module, UInt_t index) {
1218 // get hs for the noisy pixel at position index in list of noisy
1219 UInt_t gloChip;
1220 UInt_t chipIndex;
1221 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1222 return GetNoisyColAtC2(gloChip,chipIndex);
1223}
1224UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t module, UInt_t index) {
1225 // get hs for the dead pixel at position index in list of dead
1226 UInt_t gloChip;
1227 UInt_t chipIndex;
1228 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1229 return GetDeadRowAtC2(gloChip,chipIndex);
1230}
1231UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t module, UInt_t index) {
1232 // get hs for the noisy pixel at position index in list of noisy
1233 UInt_t gloChip;
1234 UInt_t chipIndex;
1235 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1236 return GetNoisyRowAtC2(gloChip,chipIndex);
1237}
1238//____________________________________________________________________________________________
1239UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadEq(UInt_t eq) const {
1240 // returns nr of dead for eq
1241 UInt_t returnval=0;
1242 for (UInt_t hs=0; hs<6; hs++) {
1243 for (UInt_t chip=0; chip<10; chip++) {
1244 returnval+=GetNrDeadC(eq,hs,chip);
1245 }
53ae21ce 1246 }
6727e2db 1247 return returnval;
1248}
1249UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyEq(UInt_t eq) const {
1250 // returns nr of noisy for eq
1251 UInt_t returnval=0;
1252 for (UInt_t hs=0; hs<6; hs++) {
1253 for (UInt_t chip=0; chip<10; chip++) {
1254 returnval+=GetNrNoisyC(eq,hs,chip);
1255 }
53ae21ce 1256 }
6727e2db 1257 return returnval;
53ae21ce 1258}
6727e2db 1259UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtEq(UInt_t eq, UInt_t index) const {
1260 // get eq for the dead pixel at position index in list of dead
1261 if (eq<20 && index<GetNrDeadEq(eq)) {
1262 return eq;
53ae21ce 1263 }
1264 else {
6727e2db 1265 return 20;
53ae21ce 1266 }
1267}
6727e2db 1268UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtEq(UInt_t eq, UInt_t index) const {
1269 // get eq for the noisy pixel at position index in list of noisy
1270 if (eq<20 && index<GetNrNoisyEq(eq)) {
1271 return eq;
53ae21ce 1272 }
1273 else {
6727e2db 1274 return 20;
53ae21ce 1275 }
1276}
6727e2db 1277UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtEq(UInt_t eq, UInt_t index) {
1278 // get hs for the dead pixel at position index in list of dead
1279 UInt_t gloChip;
1280 UInt_t chipIndex;
1281 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1282 return GetDeadHSAtC2(gloChip,chipIndex);
1283}
1284UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtEq(UInt_t eq, UInt_t index) {
1285 // get hs for the noisy pixel at position index in list of noisy
1286 UInt_t gloChip;
1287 UInt_t chipIndex;
1288 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1289 return GetNoisyHSAtC2(gloChip,chipIndex);
1290}
1291UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtEq(UInt_t eq, UInt_t index) {
1292 // get chip for the dead pixel at position index in list of dead
1293 UInt_t gloChip;
1294 UInt_t chipIndex;
1295 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1296 return GetDeadChipAtC2(gloChip,chipIndex);
1297}
1298UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtEq(UInt_t eq, UInt_t index) {
1299 // get chip for the noisy pixel at position index in list of noisy
1300 UInt_t gloChip;
1301 UInt_t chipIndex;
1302 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1303 return GetNoisyChipAtC2(gloChip,chipIndex);
1304}
1305UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtEq(UInt_t eq, UInt_t index) {
1306 // get hs for the dead pixel at position index in list of dead
1307 UInt_t gloChip;
1308 UInt_t chipIndex;
1309 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1310 return GetDeadColAtC2(gloChip,chipIndex);
1311}
1312UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtEq(UInt_t eq, UInt_t index) {
1313 // get hs for the noisy pixel at position index in list of noisy
1314 UInt_t gloChip;
1315 UInt_t chipIndex;
1316 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1317 return GetNoisyColAtC2(gloChip,chipIndex);
1318}
1319UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtEq(UInt_t eq, UInt_t index) {
1320 // get hs for the dead pixel at position index in list of dead
1321 UInt_t gloChip;
1322 UInt_t chipIndex;
1323 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1324 return GetDeadRowAtC2(gloChip,chipIndex);
1325}
1326UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtEq(UInt_t eq, UInt_t index) {
1327 // get hs for the noisy pixel at position index in list of noisy
1328 UInt_t gloChip;
1329 UInt_t chipIndex;
1330 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1331 return GetNoisyRowAtC2(gloChip,chipIndex);
1332}
1333//____________________________________________________________________________________________
1334UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
1335 UInt_t gloChip = GetGloChip(eq,hs,chip);
1336 return GetNrDeadC2(gloChip);
1337}
1338UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC(UInt_t eq, UInt_t hs, UInt_t chip) const {
1339 UInt_t gloChip = GetGloChip(eq,hs,chip);
1340 return GetNrNoisyC2(gloChip);
1341}
1342UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1343 UInt_t gloChip = GetGloChip(eq,hs,chip);
1344 return GetDeadEqIdAtC2(gloChip,index);
1345}
1346UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1347 UInt_t gloChip = GetGloChip(eq,hs,chip);
1348 return GetNoisyEqIdAtC2(gloChip,index);
1349}
1350UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1351 UInt_t gloChip = GetGloChip(eq,hs,chip);
1352 return GetDeadHSAtC2(gloChip,index);
1353}
1354UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1355 UInt_t gloChip = GetGloChip(eq,hs,chip);
1356 return GetNoisyHSAtC2(gloChip,index);
1357}
1358UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1359 UInt_t gloChip = GetGloChip(eq,hs,chip);
1360 return GetDeadChipAtC2(gloChip,index);
1361}
1362UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1363 UInt_t gloChip = GetGloChip(eq,hs,chip);
1364 return GetNoisyChipAtC2(gloChip,index);
1365}
1366UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1367 UInt_t gloChip = GetGloChip(eq,hs,chip);
1368 return GetDeadColAtC2(gloChip,index);
1369}
1370UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1371 UInt_t gloChip = GetGloChip(eq,hs,chip);
1372 return GetNoisyColAtC2(gloChip,index);
1373}
1374UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1375 UInt_t gloChip = GetGloChip(eq,hs,chip);
1376 return GetDeadRowAtC2(gloChip,index);
1377}
1378UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1379 UInt_t gloChip = GetGloChip(eq,hs,chip);
1380 return GetNoisyRowAtC2(gloChip,index);
1381}
1382//____________________________________________________________________________________________
1383const Char_t* AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1384 // get a string of dead pixel info
1385 TString returnMess = "";
1386 UInt_t gloChip = GetGloChip(eq,hs,chip);
1387 if (gloChip>=1200) {
1388 Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
1389 return returnMess.Data();
1390 }
1391 if (index<fNrDead[gloChip]) {
1392 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1393 UInt_t eq = GetEqIdFromKey(key);
1394 UInt_t hs = GetHSFromKey(key);
1395 UInt_t chip = GetChipFromKey(key);
1396 UInt_t col = GetColFromKey(key);
1397 UInt_t row = GetRowFromKey(key);
1398 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1399 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1400 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1401 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);
1402 return returnMess.Data();
53ae21ce 1403 }
1404 else {
6727e2db 1405 Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "Index %d out of bounds.", index);
1406 return returnMess.Data();
1407 }
1408}
1409const Char_t* AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1410 // get a string of noisy pixel info
1411 TString returnMess = "";
1412 UInt_t gloChip = GetGloChip(eq,hs,chip);
1413 if (gloChip>=1200) {
1414 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
1415 return returnMess.Data();
1416 }
1417 if (index<fNrNoisy[gloChip]) {
1418 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1419 UInt_t eq = GetEqIdFromKey(key);
1420 UInt_t hs = GetHSFromKey(key);
1421 UInt_t chip = GetChipFromKey(key);
1422 UInt_t col = GetColFromKey(key);
1423 UInt_t row = GetRowFromKey(key);
1424 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1425 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1426 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1427 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);
1428 return returnMess.Data();
1429 }
1430 else {
1431 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "Index %d out of bounds.", index);
1432 return returnMess.Data();
53ae21ce 1433 }
1434}
6727e2db 1435//____________________________________________________________________________________________
1436UInt_t AliITSOnlineCalibrationSPDhandler::AddDeadFrom(AliITSOnlineCalibrationSPDhandler* other) {
1437 // returns number of new dead pixels in this' list
1438 UInt_t returnval=0;
1439 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1440 for (UInt_t ind1=0; ind1<other->fNrDead[gloChip]; ind1++) {
1441 UInt_t eq = other->GetDeadEqIdAtC2(gloChip,ind1);
1442 UInt_t hs = other->GetDeadHSAtC2(gloChip,ind1);
1443 UInt_t chip = other->GetDeadChipAtC2(gloChip,ind1);
1444 UInt_t col = other->GetDeadColAtC2(gloChip,ind1);
1445 UInt_t row = other->GetDeadRowAtC2(gloChip,ind1);
1446 if (SetDeadPixel(eq,hs,chip,col,row)) {
1447 returnval++;
1448 }
53ae21ce 1449 }
b15de2d2 1450 }
6727e2db 1451 return returnval;
b15de2d2 1452}
6727e2db 1453UInt_t AliITSOnlineCalibrationSPDhandler::AddNoisyFrom(AliITSOnlineCalibrationSPDhandler* other) {
1454 // returns number of new noisy pixels in this' list
1455 UInt_t returnval=0;
1456 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1457 for (UInt_t ind1=0; ind1<other->fNrNoisy[gloChip]; ind1++) {
1458 UInt_t eq = other->GetNoisyEqIdAtC2(gloChip,ind1);
1459 UInt_t hs = other->GetNoisyHSAtC2(gloChip,ind1);
1460 UInt_t chip = other->GetNoisyChipAtC2(gloChip,ind1);
1461 UInt_t col = other->GetNoisyColAtC2(gloChip,ind1);
1462 UInt_t row = other->GetNoisyRowAtC2(gloChip,ind1);
1463 if (SetNoisyPixel(eq,hs,chip,col,row)) {
1464 returnval++;
1465 }
53ae21ce 1466 }
1467 }
6727e2db 1468 return returnval;
1469}
1470//____________________________________________________________________________________________
1471UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDiff(AliITSOnlineCalibrationSPDhandler* other) const {
1472 // returns nr of dead/noisy in this' lists and not in other's lists
1473 return GetNrDeadDiff(other) + GetNrNoisyDiff(other);
53ae21ce 1474}
53ae21ce 1475UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
1476 // returns nr of dead in this' lists and not in other's lists
1477 UInt_t returnval=0;
6727e2db 1478 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1479 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
1480 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
1481 UInt_t eq = GetEqIdFromKey(key);
53ae21ce 1482 UInt_t hs = GetHSFromKey(key);
1483 UInt_t chip = GetChipFromKey(key);
1484 UInt_t col = GetColFromKey(key);
1485 UInt_t row = GetRowFromKey(key);
6727e2db 1486 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
53ae21ce 1487 returnval++;
1488 }
1489 }
1490 }
1491 return returnval;
1492}
53ae21ce 1493UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
1494 // returns nr of noisy in this' lists and not in other's lists
1495 UInt_t returnval=0;
6727e2db 1496 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1497 for (UInt_t ind1=0; ind1<fNrNoisy[gloChip]; ind1++) {
1498 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind1);
1499 UInt_t eq = GetEqIdFromKey(key);
53ae21ce 1500 UInt_t hs = GetHSFromKey(key);
1501 UInt_t chip = GetChipFromKey(key);
1502 UInt_t col = GetColFromKey(key);
1503 UInt_t row = GetRowFromKey(key);
6727e2db 1504 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
53ae21ce 1505 returnval++;
1506 }
1507 }
b15de2d2 1508 }
53ae21ce 1509 return returnval;
1510}
53ae21ce 1511AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDiff(AliITSOnlineCalibrationSPDhandler* other) const {
1512 // returns handler with dead/noisy in this' lists, except for those in other's lists
1513 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
6727e2db 1514 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1515 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
1516 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
1517 UInt_t eq = GetEqIdFromKey(key);
53ae21ce 1518 UInt_t hs = GetHSFromKey(key);
1519 UInt_t chip = GetChipFromKey(key);
1520 UInt_t col = GetColFromKey(key);
1521 UInt_t row = GetRowFromKey(key);
6727e2db 1522 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
1523 newHandler->SetDeadPixel(eq,hs,chip,col,row);
53ae21ce 1524 }
1525 }
6727e2db 1526 for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
1527 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
1528 UInt_t eq = GetEqIdFromKey(key);
53ae21ce 1529 UInt_t hs = GetHSFromKey(key);
1530 UInt_t chip = GetChipFromKey(key);
1531 UInt_t col = GetColFromKey(key);
1532 UInt_t row = GetRowFromKey(key);
6727e2db 1533 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
1534 newHandler->SetNoisyPixel(eq,hs,chip,col,row);
53ae21ce 1535 }
1536 }
1537 }
1538 return newHandler;
1539}
53ae21ce 1540AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
1541 // returns handler with dead in this' lists, except for those in other's lists
1542 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
6727e2db 1543 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1544 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
1545 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
1546 UInt_t eq = GetEqIdFromKey(key);
53ae21ce 1547 UInt_t hs = GetHSFromKey(key);
1548 UInt_t chip = GetChipFromKey(key);
1549 UInt_t col = GetColFromKey(key);
1550 UInt_t row = GetRowFromKey(key);
6727e2db 1551 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
1552 newHandler->SetDeadPixel(eq,hs,chip,col,row);
53ae21ce 1553 }
1554 }
1555 }
1556 return newHandler;
1557}
53ae21ce 1558AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
1559 // returns handler with noisy in this' lists, except for those in other's lists
1560 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
6727e2db 1561 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1562 for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
1563 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
1564 UInt_t eq = GetEqIdFromKey(key);
53ae21ce 1565 UInt_t hs = GetHSFromKey(key);
1566 UInt_t chip = GetChipFromKey(key);
1567 UInt_t col = GetColFromKey(key);
1568 UInt_t row = GetRowFromKey(key);
6727e2db 1569 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
1570 newHandler->SetNoisyPixel(eq,hs,chip,col,row);
53ae21ce 1571 }
1572 }
1573 }
1574 return newHandler;
1575}
6727e2db 1576//____________________________________________________________________________________________
1577void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
1578 // find gloChip and chipIndex from module and index
1579 if (index<GetNrDead(module)) {
1580 UInt_t eq = GetEqIdFromOffline(module);
1581 UInt_t hs = GetHSFromOffline(module);
1582
1583 UInt_t glVal=0;
1584 for (UInt_t chip=0; chip<5; chip++) {
1585 gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
1586 if (glVal+fNrDead[gloChip]>index) {
1587 chipIndex = index-glVal;
1588 break;
1589 }
1590 else {
1591 glVal+=fNrDead[gloChip];
1592 }
1593 }
53ae21ce 1594
6727e2db 1595 }
1596 else {
1597 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead", "Index %d out of bounds.", index);
1598 }
1599}
1600void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
1601 // find gloChip and chipIndex from module and index
1602 if (index<GetNrNoisy(module)) {
1603 UInt_t eq = GetEqIdFromOffline(module);
1604 UInt_t hs = GetHSFromOffline(module);
1605
1606 UInt_t glVal=0;
1607 for (UInt_t chip=0; chip<5; chip++) {
1608 gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
1609 if (glVal+fNrNoisy[gloChip]>index) {
1610 chipIndex = index-glVal;
1611 break;
1612 }
1613 else {
1614 glVal+=fNrNoisy[gloChip];
1615 }
53ae21ce 1616 }
6727e2db 1617
1618 }
1619 else {
1620 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy", "Index %d out of bounds.", index);
53ae21ce 1621 }
1622}
6727e2db 1623void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
1624 // find gloChip and chipIndex from module and index
1625 if (index<GetNrDeadEq(eq)) {
53ae21ce 1626
6727e2db 1627 UInt_t glVal=0;
1628 for (UInt_t hs=0; hs<6; hs++) {
1629 for (UInt_t chip=0; chip<10; chip++) {
1630 gloChip = GetGloChip(eq,hs,chip);
1631 if (glVal+fNrDead[gloChip]>index) {
1632 chipIndex = index-glVal;
1633 break;
1634 }
1635 else {
1636 glVal+=fNrDead[gloChip];
1637 }
53ae21ce 1638 }
53ae21ce 1639 }
6727e2db 1640
1641 }
1642 else {
1643 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead", "Index %d out of bounds.", index);
53ae21ce 1644 }
53ae21ce 1645}
6727e2db 1646void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
1647 // find gloChip and chipIndex from module and index
1648 if (index<GetNrNoisyEq(eq)) {
1649
1650 UInt_t glVal=0;
1651 for (UInt_t hs=0; hs<6; hs++) {
1652 for (UInt_t chip=0; chip<10; chip++) {
1653 gloChip = GetGloChip(eq,hs,chip);
1654 if (glVal+fNrNoisy[gloChip]>index) {
1655 chipIndex = index-glVal;
1656 break;
1657 }
1658 else {
1659 glVal+=fNrNoisy[gloChip];
1660 }
1661 }
1662 }
1663
1664 }
1665 else {
1666 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy", "Index %d out of bounds.", index);
1667 }
1668}
1669void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
1670 // find gloChip and chipIndex from global index
1671 if (index<GetNrDead()) {
1672
1673 UInt_t glVal=0;
1674 for (gloChip=0; gloChip<1200; gloChip++) {
1675 if (glVal+fNrDead[gloChip]>index) {
1676 chipIndex = index-glVal;
1677 break;
1678 }
1679 else {
1680 glVal+=fNrDead[gloChip];
1681 }
1682 }
1683
1684 }
1685 else {
1686 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead", "Index %d out of bounds.", index);
1687 }
1688}
1689void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
1690 // find gloChip and chipIndex from global index
1691 if (index<GetNrNoisy()) {
1692
1693 UInt_t glVal=0;
1694 for (gloChip=0; gloChip<1200; gloChip++) {
1695 if (glVal+fNrNoisy[gloChip]>index) {
1696 chipIndex = index-glVal;
1697 break;
1698 }
1699 else {
1700 glVal+=fNrNoisy[gloChip];
1701 }
1702 }
53ae21ce 1703
6727e2db 1704 }
1705 else {
1706 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy", "Index %d out of bounds.", index);
1707 }
1708}
1709//____________________________________________________________________________________________
1710UInt_t AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline(UInt_t module) const {
1711 // module to eq mapping
1712 if (module>=240) {
1713 Error("AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline", "module nr (%d) out of bounds.",module);
1714 return 20;
1715 }
1716 return AliITSRawStreamSPD::GetOnlineEqIdFromOffline(module);
53ae21ce 1717}
6727e2db 1718UInt_t AliITSOnlineCalibrationSPDhandler::GetHSFromOffline(UInt_t module) const {
53ae21ce 1719 // module to hs mapping
6727e2db 1720 if (module>=240) {
1721 Error("AliITSOnlineCalibrationSPDhandler::GetHSFromOffline", "module nr (%d) out of bounds.",module);
1722 return 6;
1723 }
1724 return AliITSRawStreamSPD::GetOnlineHSFromOffline(module);
53ae21ce 1725}
6727e2db 1726UInt_t AliITSOnlineCalibrationSPDhandler::GetChipFromOffline(UInt_t module, UInt_t colM) const {
53ae21ce 1727 // module,colM to chip mapping
6727e2db 1728 if (module>=240 || colM>=160) {
1729 Error("AliITSOnlineCalibrationSPDhandler::GetChipFromOffline", "module,colM nrs (%d,%d) out of bounds.",module,colM);
1730 return 10;
1731 }
1732 return AliITSRawStreamSPD::GetOnlineChipFromOffline(module,colM);
53ae21ce 1733}
6727e2db 1734UInt_t AliITSOnlineCalibrationSPDhandler::GetColFromOffline(UInt_t module, UInt_t colM) const {
53ae21ce 1735 // colM to col mapping
6727e2db 1736 if (colM>=160) {
1737 Error("AliITSOnlineCalibrationSPDhandler::GetColFromOffline", "colM nr (%d) out of bounds.",colM);
1738 return 160;
1739 }
1740 return AliITSRawStreamSPD::GetOnlineColFromOffline(module,colM);
1741}
1742
1743UInt_t AliITSOnlineCalibrationSPDhandler::GetRowFromOffline(UInt_t module, UInt_t rowM) const {
1744 // rowM to row mapping
1745 if (rowM>=256) {
1746 Error("AliITSOnlineCalibrationSPDhandler::GetRowFromOffline", "rowM nr (%d) out of bounds.",rowM);
1747 return 256;
1748 }
1749 return AliITSRawStreamSPD::GetOnlineRowFromOffline(module,rowM);
1750}
1751//____________________________________________________________________________________________
1752UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC2(UInt_t gloChip) const {
1753 // returns nr of dead pixels on this chip
1754 if (gloChip>=1200) {
1755 Error("AliITSOnlineCalibrationSPDhandler::GetNrDeadC2", "global chip nr (%d) out of bounds.",gloChip);
1756 return 0;
1757 }
1758 return fNrDead[gloChip];
1759}
1760UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2(UInt_t gloChip) const {
1761 // returns nr of noisy pixels on this chip
1762 if (gloChip>=1200) {
1763 Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2", "global chip nr (%d) out of bounds.",gloChip);
1764 return 0;
1765 }
1766 return fNrNoisy[gloChip];
1767}
1768UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC2(UInt_t gloChip, UInt_t index) const {
1769 // get eq for the dead pixel at position index in list of dead
1770 if (gloChip>=1200) {
1771 Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
1772 return 20;
1773 }
1774 if (index<fNrDead[gloChip]) {
1775 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1776 return GetEqIdFromKey(key);
1777 }
1778 else {
1779 Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "Index %d out of bounds.", index);
1780 return 0;
1781 }
1782}
1783UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC2(UInt_t gloChip, UInt_t index) const {
1784 // get eq for the noisy pixel at position index in list of noisy
1785 if (gloChip>=1200) {
1786 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
1787 return 20;
1788 }
1789 if (index<fNrNoisy[gloChip]) {
1790 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1791 return GetEqIdFromKey(key);
1792 }
1793 else {
1794 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "Index %d out of bounds.", index);
1795 return 0;
1796 }
1797}
1798UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC2(UInt_t gloChip, UInt_t index) const {
1799 // get hs for the dead pixel at position index in list of dead
1800 if (gloChip>=1200) {
1801 Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "global chip nr (%d) out of bounds.",gloChip);
1802 return 20;
1803 }
1804 if (index<fNrDead[gloChip]) {
1805 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1806 return GetHSFromKey(key);
1807 }
1808 else {
1809 Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "Index %d out of bounds.", index);
1810 return 0;
1811 }
1812}
1813UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC2(UInt_t gloChip, UInt_t index) const {
1814 // get hs for the noisy pixel at position index in list of noisy
1815 if (gloChip>=1200) {
1816 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "global chip nr (%d) out of bounds.",gloChip);
1817 return 20;
1818 }
1819 if (index<fNrNoisy[gloChip]) {
1820 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1821 return GetHSFromKey(key);
1822 }
1823 else {
1824 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "Index %d out of bounds.", index);
1825 return 0;
1826 }
b15de2d2 1827}
6727e2db 1828UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC2(UInt_t gloChip, UInt_t index) const {
1829 // get chip for the dead pixel at position index in list of dead
1830 if (gloChip>=1200) {
1831 Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "global chip nr (%d) out of bounds.",gloChip);
1832 return 20;
1833 }
1834 if (index<fNrDead[gloChip]) {
1835 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1836 return GetChipFromKey(key);
1837 }
1838 else {
1839 Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "Index %d out of bounds.", index);
1840 return 0;
1841 }
1842}
1843UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC2(UInt_t gloChip, UInt_t index) const {
1844 // get chip for the noisy pixel at position index in list of noisy
1845 if (gloChip>=1200) {
1846 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "global chip nr (%d) out of bounds.",gloChip);
1847 return 20;
1848 }
1849 if (index<fNrNoisy[gloChip]) {
1850 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1851 return GetChipFromKey(key);
1852 }
1853 else {
1854 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "Index %d out of bounds.", index);
1855 return 0;
1856 }
1857}
1858UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2(UInt_t gloChip, UInt_t index) const {
1859 // get col for the dead pixel at position index in list of dead
1860 if (gloChip>=1200) {
1861 Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "global chip nr (%d) out of bounds.",gloChip);
1862 return 20;
1863 }
1864 if (index<fNrDead[gloChip]) {
1865 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1866 return GetColFromKey(key);
1867 }
1868 else {
1869 Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "Index %d out of bounds.", index);
1870 return 0;
1871 }
1872}
1873UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC2(UInt_t gloChip, UInt_t index) const {
1874 // get col for the noisy pixel at position index in list of noisy
1875 if (gloChip>=1200) {
1876 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "global chip nr (%d) out of bounds.",gloChip);
1877 return 20;
1878 }
1879 if (index<fNrNoisy[gloChip]) {
1880 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1881 return GetColFromKey(key);
1882 }
1883 else {
1884 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "Index %d out of bounds.", index);
1885 return 0;
1886 }
1887}
1888UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC2(UInt_t gloChip, UInt_t index) const {
1889 // get row for the dead pixel at position index in list of dead
1890 if (gloChip>=1200) {
1891 Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "global chip nr (%d) out of bounds.",gloChip);
1892 return 20;
1893 }
1894 if (index<fNrDead[gloChip]) {
1895 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1896 return GetRowFromKey(key);
1897 }
1898 else {
1899 Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "Index %d out of bounds.", index);
1900 return 0;
1901 }
1902}
1903UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC2(UInt_t gloChip, UInt_t index) const {
1904 // get row for the noisy pixel at position index in list of noisy
1905 if (gloChip>=1200) {
1906 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "global chip nr (%d) out of bounds.",gloChip);
1907 return 20;
1908 }
1909 if (index<fNrNoisy[gloChip]) {
1910 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1911 return GetRowFromKey(key);
1912 }
1913 else {
1914 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "Index %d out of bounds.", index);
1915 return 0;
1916 }
1917}
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936