]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSOnlineCalibrationSPDhandler.cxx
New check for bad SDD modules (F. Prino)
[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). //
b696414b 5// Handling of inactive equipments,HSs,chips have been added. //
6// A pixel that is either dead or inactive is called SILENT here. //
7// The lists of single dead and noisy pixels are separated from the //
8// information about which eq/hs/chip are inactive. //
e03405c9 9// The TArrayS objects that are put in the AliITSCalibrationSPD //
b15de2d2 10// objects can be obtained from the methods GetDeadArray and //
11// GetNoisyArray. //
12//////////////////////////////////////////////////////////////////////
13
14#include "AliITSOnlineCalibrationSPDhandler.h"
15#include "AliITSOnlineCalibrationSPD.h"
53ae21ce 16#include "AliITSIntMap.h"
17#include <TObjArray.h>
60d9faf6 18#include <TArrayI.h>
e03405c9 19#include <TArrayS.h>
b15de2d2 20#include <TFile.h>
53ae21ce 21#include <TError.h>
22#include <fstream>
b15de2d2 23
53ae21ce 24#ifndef SPD_DA_OFF // you may want to exclude cdb classes, if using this class outside aliroot
25#include "AliITSCalibrationSPD.h"
26#include "AliCDBManager.h"
27#include "AliCDBEntry.h"
28#endif
b15de2d2 29
4f88491f 30/* $Id$ */
6727e2db 31//____________________________________________________________________________________________
53ae21ce 32AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler():
6727e2db 33 fFileLocation(".")
53ae21ce 34{
35 // constructor
6727e2db 36 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
37 fNrDead[gloChip]=0;
38 fNrNoisy[gloChip]=0;
39 fDeadPixelMap[gloChip] = new AliITSIntMap();
b696414b 40 fNoisyPixelMap[gloChip] = new AliITSIntMap();
53ae21ce 41 }
b696414b 42 ActivateALL();
478d804c 43 UnSetDeadALL();
53ae21ce 44}
b696414b 45//____________________________________________________________________________________________
b15de2d2 46AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler(const AliITSOnlineCalibrationSPDhandler& handle):
6727e2db 47 fFileLocation(".")
b15de2d2 48{
49 // copy constructor
6727e2db 50 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
51 fNrDead[gloChip] = handle.fNrDead[gloChip];
52 fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
53 fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
54 fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
b15de2d2 55 }
b696414b 56 for (UInt_t eq=0; eq<20; eq++) {
57 fActiveEq[eq] = handle.fActiveEq[eq];
58 for (UInt_t hs=0; hs<6; hs++) {
59 fActiveHS[eq][hs] = handle.fActiveHS[eq][hs];
60 for (UInt_t chip=0; chip<10; chip++) {
61 fActiveChip[eq][hs][chip] = handle.fActiveChip[eq][hs][chip];
62 }
63 }
64 }
53ae21ce 65 fFileLocation = handle.fFileLocation;
b15de2d2 66}
b696414b 67//____________________________________________________________________________________________
b15de2d2 68AliITSOnlineCalibrationSPDhandler::~AliITSOnlineCalibrationSPDhandler() {
6727e2db 69 // ClearMaps();
70 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
71 delete fDeadPixelMap[gloChip];
72 delete fNoisyPixelMap[gloChip];
73 }
b15de2d2 74}
b696414b 75//____________________________________________________________________________________________
b15de2d2 76AliITSOnlineCalibrationSPDhandler& AliITSOnlineCalibrationSPDhandler::operator=(const AliITSOnlineCalibrationSPDhandler& handle) {
77 // assignment operator
78 if (this!=&handle) {
79 this->ClearMaps();
6727e2db 80 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
81 fNrDead[gloChip] = handle.fNrDead[gloChip];
82 fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
83 fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
84 fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
b15de2d2 85 }
b696414b 86 for (UInt_t eq=0; eq<20; eq++) {
87 fActiveEq[eq] = handle.fActiveEq[eq];
88 for (UInt_t hs=0; hs<6; hs++) {
89 fActiveHS[eq][hs] = handle.fActiveHS[eq][hs];
90 for (UInt_t chip=0; chip<10; chip++) {
91 fActiveChip[eq][hs][chip] = handle.fActiveChip[eq][hs][chip];
92 }
93 }
94 }
53ae21ce 95 fFileLocation = handle.fFileLocation;
b15de2d2 96 }
97 return *this;
98}
6727e2db 99//____________________________________________________________________________________________
b15de2d2 100void AliITSOnlineCalibrationSPDhandler::ClearMaps() {
101 // clear the lists of dead and noisy
102 ResetDead();
103 ResetNoisy();
b696414b 104 ActivateALL();
b15de2d2 105}
b696414b 106//____________________________________________________________________________________________
6727e2db 107void AliITSOnlineCalibrationSPDhandler::ResetDead() {
b696414b 108 // reset the dead pixel map and inactive eq,hs,chip
478d804c 109 UnSetDeadALL();
6727e2db 110 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
111 fNrDead[gloChip]=0;
112 fDeadPixelMap[gloChip]->Clear();
53ae21ce 113 }
b15de2d2 114}
b696414b 115//____________________________________________________________________________________________
6727e2db 116void AliITSOnlineCalibrationSPDhandler::ResetNoisy() {
117 // clear the list of noisy pixels
118 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
119 fNrNoisy[gloChip]=0;
120 fNoisyPixelMap[gloChip]->Clear();
121 }
b15de2d2 122}
b696414b 123//____________________________________________________________________________________________
6727e2db 124void AliITSOnlineCalibrationSPDhandler::ResetDeadForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
125 // clear the dead pixels for this chip
478d804c 126 SetDeadChip(eq,hs,chip,kFALSE);
6727e2db 127 UInt_t gloChip = GetGloChip(eq,hs,chip);
128 for (UInt_t col=0; col<32; col++) {
129 for (UInt_t row=0; row<256; row++) {
130 Int_t key = GetKey(eq,hs,chip,col,row);
131 if (fDeadPixelMap[gloChip]->Remove(key)) {
132 fNrDead[gloChip]--;
b15de2d2 133 }
134 }
135 }
136}
b696414b 137//____________________________________________________________________________________________
6727e2db 138void AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
139 // clear the noisy pixels for this chip
140 UInt_t gloChip = GetGloChip(eq,hs,chip);
141 if (gloChip>=1200) {
142 Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip","global chip nr (%d) out of bounds\n",gloChip);
143 return;
144 }
145 for (UInt_t col=0; col<32; col++) {
146 for (UInt_t row=0; row<256; row++) {
147 Int_t key = GetKey(eq,hs,chip,col,row);
148 if (fNoisyPixelMap[gloChip]->Remove(key)) {
149 fNrNoisy[gloChip]--;
150 }
151 }
152 }
153}
b696414b 154//____________________________________________________________________________________________
6727e2db 155void AliITSOnlineCalibrationSPDhandler::ResetDeadForEq(UInt_t eq) {
156 // clear the dead pixels for this eq
157 if (eq>=20) {
158 Error("AliITSOnlineCalibrationSPDhandler::ResetDeadForEq", "eq (%d) out of bounds.",eq);
159 return;
160 }
161 for (UInt_t hs=0; hs<6; hs++) {
162 for (UInt_t chip=0; chip<10; chip++) {
163 ResetDeadForChip(eq, hs, chip);
164 }
165 }
166}
b696414b 167//____________________________________________________________________________________________
6727e2db 168void AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq(UInt_t eq) {
169 // clear the noisy pixels for this eq
170 if (eq>=20) {
171 Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq", "eq (%d) out of bounds.",eq);
172 return;
173 }
174 for (UInt_t hs=0; hs<6; hs++) {
175 for (UInt_t chip=0; chip<10; chip++) {
176 ResetNoisyForChip(eq, hs, chip);
177 }
178 }
179}
b696414b 180
181
6727e2db 182//____________________________________________________________________________________________
183Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromFiles() {
b696414b 184 // read files from file location (active,dead,noisy info). returns true if at least one file found
6727e2db 185 Bool_t b1 = ReadNoisyFromFiles();
b696414b 186 Bool_t b2 = ReadSilentFromFiles();
187 return (b1 || b2);
6727e2db 188}
b696414b 189//____________________________________________________________________________________________
190Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFiles() {
191 // read dead,active files from file location. returns true if at least one file found
53ae21ce 192 Bool_t returnval=kFALSE;
6727e2db 193 for (UInt_t eq=0; eq<20; eq++) {
b696414b 194 if (ReadSilentFromFile(eq)) {
6727e2db 195 returnval=kTRUE;
196 }
197 }
198 return returnval;
199}
b696414b 200//____________________________________________________________________________________________
201Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFiles() {
202 // read dead,active files from file location. returns true if at least one file found
6727e2db 203 Bool_t returnval=kFALSE;
204 for (UInt_t eq=0; eq<20; eq++) {
b696414b 205 if (ReadDeadFromFile(eq)) {
53ae21ce 206 returnval=kTRUE;
207 }
208 }
209 return returnval;
210}
b696414b 211//____________________________________________________________________________________________
212Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFile(UInt_t eq) {
213 // read dead file for eq from file location.
214 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
215 return ReadSilentFromFileName(fileName.Data());
216}
217//____________________________________________________________________________________________
6727e2db 218Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFile(UInt_t eq) {
b696414b 219 // read dead file for eq from file location.
6727e2db 220 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
53ae21ce 221 return ReadDeadFromFileName(fileName.Data());
222}
b696414b 223//____________________________________________________________________________________________
224Bool_t AliITSOnlineCalibrationSPDhandler::ReadSilentFromFileName(const char *fileName) {
225 // read dead from file fileName (including inactive)
226 return ReadDeadFromFileName(fileName, kTRUE);
6727e2db 227}
b696414b 228//____________________________________________________________________________________________
229Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFileName(const char *fileName, Bool_t inactive) {
53ae21ce 230 // read dead from file fileName
b15de2d2 231 AliITSOnlineCalibrationSPD* calib;
232 FILE* fp0 = fopen(fileName, "r");
03fc6773 233 if (fp0 == NULL) {return kFALSE;}
b15de2d2 234 else {
235 fclose(fp0);
236 TFile file(fileName, "READ");
237 if (file.IsOpen()) {
238 file.GetObject("AliITSOnlineCalibrationSPD", calib);
239 file.Close();
240 if (calib!=NULL) {
6727e2db 241 UInt_t nrDead=calib->GetNrBad();
242 for (UInt_t index=0; index<nrDead; index++) {
243 UInt_t key = calib->GetKeyAt(index);
244 UInt_t eq = GetEqIdFromKey(key);
245 UInt_t hs = GetHSFromKey(key);
246 UInt_t chip = GetChipFromKey(key);
247 UInt_t col = GetColFromKey(key);
248 UInt_t row = GetRowFromKey(key);
249 SetDeadPixel(eq,hs,chip,col,row);
b15de2d2 250 }
478d804c 251 UInt_t eq = calib->GetEqNr();
252 if (calib->IsDeadEq()) SetDeadEq(eq);
253 else SetDeadEq(eq,kFALSE);
254 for (UInt_t hs=0; hs<6; hs++) {
255 if (calib->IsDeadHS(hs)) SetDeadHS(eq,hs);
256 else SetDeadHS(eq,hs,kFALSE);
257 for (UInt_t chip=0; chip<10; chip++) {
258 if (calib->IsDeadChip(hs,chip)) SetDeadChip(eq,hs,chip);
259 else SetDeadChip(eq,hs,chip,kFALSE);
260 }
261 }
b696414b 262 if (inactive) {
263 UInt_t eq = calib->GetEqNr();
264 if (calib->IsActiveEq()) ActivateEq(eq);
265 else ActivateEq(eq,kFALSE);
266 for (UInt_t hs=0; hs<6; hs++) {
267 if (calib->IsActiveHS(hs)) ActivateHS(eq,hs);
268 else ActivateHS(eq,hs,kFALSE);
269 for (UInt_t chip=0; chip<10; chip++) {
270 if (calib->IsActiveChip(hs,chip)) ActivateChip(eq,hs,chip);
271 else ActivateChip(eq,hs,chip,kFALSE);
272 }
273 }
274 }
b15de2d2 275 }
276 }
277 }
03fc6773 278 return kTRUE;
b15de2d2 279}
b696414b 280//____________________________________________________________________________________________
281Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFiles() {
282 // read noisy files from file location. returns true if at least one file found
283 Bool_t returnval=kFALSE;
284 for (UInt_t eq=0; eq<20; eq++) {
285 if (ReadNoisyFromFile(eq)) {
286 returnval=kTRUE;
287 }
288 }
289 return returnval;
290}
291//____________________________________________________________________________________________
292Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFile(UInt_t eq) {
293 // read noisy file for eq from file location.
294 TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
295 return ReadNoisyFromFileName(fileName.Data());
296}
297//____________________________________________________________________________________________
53ae21ce 298Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFileName(const char *fileName) {
299 // read noisy from file fileName
b15de2d2 300 AliITSOnlineCalibrationSPD* calib;
301 FILE* fp0 = fopen(fileName, "r");
03fc6773 302 if (fp0 == NULL) {return kFALSE;}
b15de2d2 303 else {
304 fclose(fp0);
305 TFile file(fileName, "READ");
306 if (file.IsOpen()) {
307 file.GetObject("AliITSOnlineCalibrationSPD", calib);
308 file.Close();
309 if (calib!=NULL) {
6727e2db 310 UInt_t nrNoisy=calib->GetNrBad();
311 for (UInt_t index=0; index<nrNoisy; index++) {
312 UInt_t key = calib->GetKeyAt(index);
313 UInt_t eq = GetEqIdFromKey(key);
314 UInt_t hs = GetHSFromKey(key);
315 UInt_t chip = GetChipFromKey(key);
316 UInt_t col = GetColFromKey(key);
317 UInt_t row = GetRowFromKey(key);
318 SetNoisyPixel(eq,hs,chip,col,row);
b15de2d2 319 }
320 }
321 }
322 }
03fc6773 323 return kTRUE;
b15de2d2 324}
b696414b 325//____________________________________________________________________________________________
6727e2db 326UInt_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromText(const char *fileName, UInt_t module) {
327 // read dead from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
328 // insert only those pixels that belong to module (or all if module=240).
53ae21ce 329 UInt_t newNrDead=0;
330 ifstream textFile;
331 textFile.open(fileName, ifstream::in);
332 if (textFile.fail()) {
6727e2db 333 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromText","No dead text file (%s) present.",fileName);
53ae21ce 334 }
335 else {
336 while(1) {
6727e2db 337 UInt_t eq,hs,chip,col,row;
338 textFile >> eq; if (textFile.eof()) break;
53ae21ce 339 textFile >> hs; if (textFile.eof()) break;
340 textFile >> chip; if (textFile.eof()) break;
341 textFile >> col; if (textFile.eof()) break;
342 textFile >> row;
6727e2db 343 if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){
344 if (SetDeadPixel(eq,hs,chip,col,row)) {
345 newNrDead++;
346 }
53ae21ce 347 }
348 if (textFile.eof()) break;
349 }
350 textFile.close();
351 }
352 return newNrDead;
353}
b696414b 354//____________________________________________________________________________________________
6727e2db 355UInt_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText(const char *fileName, UInt_t module) {
356 // read noisy from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
357 // insert only those pixels that belong to module (or all if module=240).
53ae21ce 358 UInt_t newNrNoisy=0;
359 ifstream textFile;
360 textFile.open(fileName, ifstream::in);
361 if (textFile.fail()) {
6727e2db 362 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText","No noisy text file (%s) present.",fileName);
53ae21ce 363 }
364 else {
365 while(1) {
6727e2db 366 UInt_t eq,hs,chip,col,row;
367 textFile >> eq; if (textFile.eof()) break;
53ae21ce 368 textFile >> hs; if (textFile.eof()) break;
369 textFile >> chip; if (textFile.eof()) break;
370 textFile >> col; if (textFile.eof()) break;
371 textFile >> row;
6727e2db 372 if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){
373 if (SetNoisyPixel(eq,hs,chip,col,row)) {
374 newNrNoisy++;
375 }
53ae21ce 376 }
377 if (textFile.eof()) break;
378 }
379 textFile.close();
380 }
381 return newNrNoisy;
382}
6727e2db 383//____________________________________________________________________________________________
384void AliITSOnlineCalibrationSPDhandler::WriteToFilesAlways() {
b696414b 385 // write the lists of active,dead,noisy to files
6727e2db 386 for (UInt_t eq=0; eq<20; eq++) {
b696414b 387 WriteSilentToFile(eq);
6727e2db 388 WriteNoisyToFile(eq);
389 }
390}
b696414b 391//____________________________________________________________________________________________
6727e2db 392UInt_t AliITSOnlineCalibrationSPDhandler::WriteToFiles() {
393 // write the lists of dead and noisy to files (only if there are >0 dead or noisy pixels) , returns nr of files produced
b696414b 394 return (WriteNoisyToFiles() + WriteSilentToFiles());
395}
396//____________________________________________________________________________________________
397void AliITSOnlineCalibrationSPDhandler::WriteSilentToFilesAlways() {
398 // write the lists of silent to files
399 for (UInt_t eq=0; eq<20; eq++) {
400 WriteSilentToFile(eq);
401 }
6727e2db 402}
b696414b 403//____________________________________________________________________________________________
6727e2db 404void AliITSOnlineCalibrationSPDhandler::WriteDeadToFilesAlways() {
405 // write the lists of dead to files
406 for (UInt_t eq=0; eq<20; eq++) {
407 WriteDeadToFile(eq);
408 }
409}
b696414b 410//____________________________________________________________________________________________
6727e2db 411void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFilesAlways() {
412 // write the lists of noisy to files
413 for (UInt_t eq=0; eq<20; eq++) {
414 WriteNoisyToFile(eq);
415 }
416}
b696414b 417//____________________________________________________________________________________________
418UInt_t AliITSOnlineCalibrationSPDhandler::WriteSilentToFiles() {
419 // write the list of silent to file (only if there are >0 silent pixels) , returns nr of files produced
420 UInt_t nrFiles=0;
421 for (UInt_t eq=0; eq<20; eq++) {
422 if (GetNrSilentEq(eq) > 0) {
423 WriteSilentToFile(eq);
424 nrFiles++;
425 }
426 }
427 return nrFiles;
428}
429//____________________________________________________________________________________________
6727e2db 430UInt_t AliITSOnlineCalibrationSPDhandler::WriteDeadToFiles() {
431 // write the list of dead to file (only if there are >0 dead pixels) , returns nr of files produced
432 UInt_t nrFiles=0;
433 for (UInt_t eq=0; eq<20; eq++) {
434 if (GetNrDeadEq(eq) > 0) {
435 WriteDeadToFile(eq);
436 nrFiles++;
437 }
438 }
439 return nrFiles;
440}
b696414b 441//____________________________________________________________________________________________
6727e2db 442UInt_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToFiles() {
443 // write the list of noisy to file (only if there are >0 noisy pixels) , returns nr of files produced
444 UInt_t nrFiles=0;
445 for (UInt_t eq=0; eq<20; eq++) {
446 if (GetNrNoisyEq(eq) > 0) {
447 WriteNoisyToFile(eq);
448 nrFiles++;
449 }
450 }
451 return nrFiles;
452}
b696414b 453//____________________________________________________________________________________________
454void AliITSOnlineCalibrationSPDhandler::WriteSilentToFile(UInt_t eq) {
455 WriteDeadToFile(eq,kTRUE);
456}
457//____________________________________________________________________________________________
458void AliITSOnlineCalibrationSPDhandler::WriteDeadToFile(UInt_t eq, Bool_t inactive) {
459 // write the lists of dead (and inactive if input boolean is true) for eq to file
6727e2db 460 AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
461 calib->SetEqNr(eq);
462 calib->SetBadList(GetDeadArrayOnline(eq));
463 calib->SetNrBad(GetNrDeadEq(eq));
478d804c 464 if (IsDeadEq(eq)) calib->SetDeadEq();
465 else calib->SetDeadEq(kFALSE);
466 for (UInt_t hs=0; hs<6; hs++) {
467 if (IsDeadHS(eq,hs)) calib->SetDeadHS(hs);
468 else calib->SetDeadHS(hs,kFALSE);
469 for (UInt_t chip=0; chip<10; chip++) {
470 if (IsDeadChip(eq,hs,chip)) calib->SetDeadChip(hs,chip);
471 else calib->SetDeadChip(hs,chip,kFALSE);
472 }
473 }
b696414b 474 if (inactive) {
475 if (IsActiveEq(eq)) calib->ActivateEq();
476 else calib->ActivateEq(kFALSE);
477 for (UInt_t hs=0; hs<6; hs++) {
478 if (IsActiveHS(eq,hs)) calib->ActivateHS(hs);
479 else calib->ActivateHS(hs,kFALSE);
480 for (UInt_t chip=0; chip<10; chip++) {
481 if (IsActiveChip(eq,hs,chip)) calib->ActivateChip(hs,chip);
482 else calib->ActivateChip(hs,chip,kFALSE);
483 }
484 }
485 }
6727e2db 486 TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
487 TFile file(fileName.Data(), "RECREATE");
488 file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
489 file.Close();
490 delete calib;
491}
b696414b 492//____________________________________________________________________________________________
6727e2db 493void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFile(UInt_t eq) {
b696414b 494 // write the lists of noisy for eq to file
6727e2db 495 AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
496 calib->SetEqNr(eq);
497 calib->SetBadList(GetNoisyArrayOnline(eq));
498 calib->SetNrBad(GetNrNoisyEq(eq));
499 TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
500 TFile file(fileName.Data(), "RECREATE");
501 file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
502 file.Close();
503 delete calib;
504}
505//____________________________________________________________________________________________
53ae21ce 506#ifndef SPD_DA_OFF
6727e2db 507Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB(UInt_t module, Int_t runNr, Bool_t treeSerial) {
508 // reads dead pixels from DB for given module and runNr
53ae21ce 509 AliCDBManager* man = AliCDBManager::Instance();
510 if(!man->IsDefaultStorageSet()) {
511 man->SetDefaultStorage("local://$ALICE_ROOT");
512 }
6727e2db 513 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
53ae21ce 514 TObjArray* spdEntry;
515 if(cdbEntry) {
516 spdEntry = (TObjArray*)cdbEntry->GetObject();
517 if(!spdEntry) return kFALSE;
518 }
519 else {
6727e2db 520 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB","Calibration for run %d not found in database.",runNr);
53ae21ce 521 return kFALSE;
522 }
523 AliITSCalibrationSPD* calibSPD;
524 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
478d804c 525
526 UInt_t nrDead = calibSPD->GetNrBadSingle();
6727e2db 527 if (nrDead>0) {
528 if (!treeSerial) RecursiveInsertDead(calibSPD,module,0,nrDead-1);
529 else {
530 for (UInt_t index=0; index<nrDead; index++) {
531 UInt_t colM = calibSPD->GetBadColAt(index);
532 UInt_t rowM = calibSPD->GetBadRowAt(index);
533 SetDeadPixelM(module,colM,rowM);
534 }
535 }
53ae21ce 536 }
478d804c 537 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
538 UInt_t eq,hs,chip,col,row;
539 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
540 if (calibSPD->IsChipBad(chipIndex)) {
541 SetDeadChip(eq,hs,chip);
542 }
543 else {
544 SetDeadChip(eq,hs,chip,kFALSE);
545 }
546 }
547
53ae21ce 548 spdEntry->SetOwner(kTRUE);
549 spdEntry->Clear();
550 return kTRUE;
551}
b696414b 552//____________________________________________________________________________________________
6727e2db 553Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB(UInt_t module, Int_t runNr, Bool_t treeSerial) {
554 // reads noisy pixels from DB for given module and runNr
555 AliCDBManager* man = AliCDBManager::Instance();
556 if(!man->IsDefaultStorageSet()) {
557 man->SetDefaultStorage("local://$ALICE_ROOT");
558 }
559 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
560 TObjArray* spdEntry;
561 if(cdbEntry) {
562 spdEntry = (TObjArray*)cdbEntry->GetObject();
563 if(!spdEntry) return kFALSE;
564 }
565 else {
566 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB","Calibration for run %d not found in database.",runNr);
567 return kFALSE;
568 }
569 AliITSCalibrationSPD* calibSPD;
570 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
478d804c 571 UInt_t nrNoisy = calibSPD->GetNrBadSingle();
6727e2db 572 if (nrNoisy>0) {
573 if (!treeSerial) RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
574 else {
575 for (UInt_t index=0; index<nrNoisy; index++) {
576 UInt_t colM = calibSPD->GetBadColAt(index);
577 UInt_t rowM = calibSPD->GetBadRowAt(index);
578 SetNoisyPixelM(module,colM,rowM);
579 }
580 }
581 }
582 spdEntry->SetOwner(kTRUE);
583 spdEntry->Clear();
584 return kTRUE;
585}
b696414b 586//____________________________________________________________________________________________
6727e2db 587Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromDB(Int_t runNr, Bool_t treeSerial) {
53ae21ce 588 // reads dead and noisy pixels from DB for given runNr
589 // note that you may want to clear the lists (if they are not empty) before reading
6727e2db 590 return (ReadNoisyFromDB(runNr,treeSerial) && ReadDeadFromDB(runNr,treeSerial));
591}
b696414b 592//____________________________________________________________________________________________
6727e2db 593Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB(Int_t runNr, Bool_t treeSerial) {
594 // reads dead pixels from DB for given runNr
595 // note that you may want to clear the list (if it is not empty) before reading
53ae21ce 596 AliCDBManager* man = AliCDBManager::Instance();
597 if(!man->IsDefaultStorageSet()) {
598 man->SetDefaultStorage("local://$ALICE_ROOT");
599 }
6727e2db 600 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
53ae21ce 601 TObjArray* spdEntry;
602 if(cdbEntry) {
603 spdEntry = (TObjArray*)cdbEntry->GetObject();
604 if(!spdEntry) return kFALSE;
605 }
606 else {
6727e2db 607 Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB","Calibration for run %d not found in database.",runNr);
53ae21ce 608 return kFALSE;
609 }
610 AliITSCalibrationSPD* calibSPD;
611 for (UInt_t module=0; module<240; module++) {
53ae21ce 612 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
478d804c 613 UInt_t nrDead = calibSPD->GetNrBadSingle();
6727e2db 614 if (nrDead>0) {
615 if (!treeSerial) RecursiveInsertDead(calibSPD,module,0,nrDead-1);
616 else {
617 for (UInt_t index=0; index<nrDead; index++) {
618 UInt_t colM = calibSPD->GetBadColAt(index);
619 UInt_t rowM = calibSPD->GetBadRowAt(index);
620 SetDeadPixelM(module,colM,rowM);
621 }
622 }
53ae21ce 623 }
478d804c 624 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
625 UInt_t eq,hs,chip,col,row;
626 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
627 if (calibSPD->IsChipBad(chipIndex)) {
628 SetDeadChip(eq,hs,chip);
629 }
630 else {
631 SetDeadChip(eq,hs,chip,kFALSE);
632 }
633 }
6727e2db 634 }
635 spdEntry->SetOwner(kTRUE);
636 spdEntry->Clear();
637 return kTRUE;
638}
b696414b 639//____________________________________________________________________________________________
6727e2db 640Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB(Int_t runNr, Bool_t treeSerial) {
641 // reads noisy pixels from DB for given runNr
642 // note that you may want to clear the list (if it is not empty) before reading
643 AliCDBManager* man = AliCDBManager::Instance();
644 if(!man->IsDefaultStorageSet()) {
645 man->SetDefaultStorage("local://$ALICE_ROOT");
646 }
647 AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
648 TObjArray* spdEntry;
649 if(cdbEntry) {
650 spdEntry = (TObjArray*)cdbEntry->GetObject();
651 if(!spdEntry) return kFALSE;
652 }
653 else {
654 Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB","Calibration for run %d not found in database.",runNr);
655 return kFALSE;
656 }
657 AliITSCalibrationSPD* calibSPD;
658 for (UInt_t module=0; module<240; module++) {
659 // printf("Reading module %d\n",module);
660 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
478d804c 661 UInt_t nrNoisy = calibSPD->GetNrBadSingle();
6727e2db 662 if (nrNoisy>0) {
663 if (!treeSerial) {
6727e2db 664 RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
665 }
666 else {
667 for (UInt_t index=0; index<nrNoisy; index++) {
668 UInt_t colM = calibSPD->GetBadColAt(index);
669 UInt_t rowM = calibSPD->GetBadRowAt(index);
670 SetNoisyPixelM(module,colM,rowM);
671 }
672 }
53ae21ce 673 }
674 }
675 spdEntry->SetOwner(kTRUE);
676 spdEntry->Clear();
677 return kTRUE;
678}
b696414b 679//____________________________________________________________________________________________
6727e2db 680Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromCalibObj(TObjArray* calObj) {
681 // reads dead pixels from calib object
682 for (UInt_t module=0; module<240; module++) {
478d804c 683 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*)calObj->At(module);
684 for (Int_t i=0; i<calibSPD->GetNrBadSingle(); i++) {
685 SetDeadPixelM(module,calibSPD->GetBadColAt(i),calibSPD->GetBadRowAt(i));
686 }
687 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
688 UInt_t eq,hs,chip,col,row;
689 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
690 if (calibSPD->IsChipBad(chipIndex)) {
691 SetDeadChip(eq,hs,chip);
692 }
693 else {
694 SetDeadChip(eq,hs,chip,kFALSE);
695 }
6727e2db 696 }
697 }
698 return kTRUE;
699}
b696414b 700//____________________________________________________________________________________________
6727e2db 701Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromCalibObj(TObjArray* calObj) {
702 // reads noisy pixels from calib object
703 for (UInt_t module=0; module<240; module++) {
478d804c 704 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*)calObj->At(module);
705 for (Int_t i=0; i<calibSPD->GetNrBadSingle(); i++) {
706 SetNoisyPixelM(module,calibSPD->GetBadColAt(i),calibSPD->GetBadRowAt(i));
6727e2db 707 }
708 }
709 return kTRUE;
710}
b696414b 711//____________________________________________________________________________________________
53ae21ce 712Bool_t AliITSOnlineCalibrationSPDhandler::WriteToDB(Int_t runNrStart, Int_t runNrEnd) {
6727e2db 713 // writes dead and noisy pixels to DB for given runNrs
714 // overwrites any previous entries
715 return (WriteNoisyToDB(runNrStart,runNrEnd) && WriteDeadToDB(runNrStart,runNrEnd));
716}
b696414b 717//____________________________________________________________________________________________
6727e2db 718Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDB(Int_t runNrStart, Int_t runNrEnd) {
719 // writes dead pixels to DB for given runNrs
53ae21ce 720 // overwrites any previous entries
721 AliCDBManager* man = AliCDBManager::Instance();
722 if(!man->IsDefaultStorageSet()) {
723 man->SetDefaultStorage("local://$ALICE_ROOT");
724 }
725 AliCDBMetaData* metaData = new AliCDBMetaData();
726 metaData->SetResponsible("Henrik Tydesjo");
727 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
6727e2db 728 AliCDBId idCalSPD("ITS/Calib/SPDDead",runNrStart,runNrEnd);
53ae21ce 729 TObjArray* spdEntry = new TObjArray(240);
730 spdEntry->SetOwner(kTRUE);
731 for(UInt_t module=0; module<240; module++){
478d804c 732 AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
3479cee3 733
734 // *** this is temporarily hard coded here ********************
735 // (later these parameters will be separated from the cal.obj.)
478d804c 736 calibSPD->SetThresholds(3000, 250);
737 calibSPD->SetBiasVoltage(18.182);
738 calibSPD->SetNoiseParam(0,0);
739 calibSPD->SetCouplingParam(0.,0.055);
3479cee3 740 // *** remove later...
741 // ************************************************************
742
478d804c 743 spdEntry->Add(calibSPD);
53ae21ce 744 }
745 for(UInt_t module=0; module<240; module++){
478d804c 746 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
747 calibSPD->SetNrBadSingle( GetNrDead(module) );
748 calibSPD->SetBadList( GetDeadArray(module) );
749 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
750 UInt_t eq,hs,chip,col,row;
751 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
752 if (IsSilentChip(eq,hs,chip)) {
753 calibSPD->SetChipBad(chipIndex);
754 }
755 else {
756 calibSPD->UnSetChipBad(chipIndex);
757 }
758 }
53ae21ce 759 }
760 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
761 man->Put(cdbEntry);
762 delete spdEntry;
763 delete cdbEntry;
764 delete metaData;
765 return kTRUE;
766}
b696414b 767//____________________________________________________________________________________________
6727e2db 768Bool_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToDB(Int_t runNrStart, Int_t runNrEnd) {
769 // writes noisy pixels to DB for given runNrs
770 // overwrites any previous entries
771 AliCDBManager* man = AliCDBManager::Instance();
772 if(!man->IsDefaultStorageSet()) {
773 man->SetDefaultStorage("local://$ALICE_ROOT");
774 }
775 AliCDBMetaData* metaData = new AliCDBMetaData();
776 metaData->SetResponsible("Henrik Tydesjo");
777 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
778 AliCDBId idCalSPD("ITS/Calib/SPDNoisy",runNrStart,runNrEnd);
779 TObjArray* spdEntry = new TObjArray(240);
780 spdEntry->SetOwner(kTRUE);
781 for(UInt_t module=0; module<240; module++){
478d804c 782 AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
53ae21ce 783
6727e2db 784 // *** this is temporarily hard coded here ********************
785 // (later these parameters will be separated from the cal.obj.)
478d804c 786 calibSPD->SetThresholds(3000, 250);
787 calibSPD->SetBiasVoltage(18.182);
788 calibSPD->SetNoiseParam(0,0);
789 calibSPD->SetCouplingParam(0.,0.055);
6727e2db 790 // *** remove later...
791 // ************************************************************
792
478d804c 793 spdEntry->Add(calibSPD);
3479cee3 794 }
6727e2db 795 for(UInt_t module=0; module<240; module++){
478d804c 796 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
797 calibSPD->SetNrBadSingle( GetNrNoisy(module) );
798 calibSPD->SetBadList( GetNoisyArray(module) );
53ae21ce 799 }
6727e2db 800 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
801 man->Put(cdbEntry);
802 delete spdEntry;
803 delete cdbEntry;
804 delete metaData;
805 return kTRUE;
53ae21ce 806}
6727e2db 807//____________________________________________________________________________________________
808void AliITSOnlineCalibrationSPDhandler::RecursiveInsertDead(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
809 // inserts dead pixels recursively, used when reading from db
810 if (lowInd>highInd) return;
811 Int_t thisInd = lowInd+(highInd-lowInd)/2;
812 SetDeadPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
813 RecursiveInsertDead(calibSPD,module,lowInd,thisInd-1);
814 RecursiveInsertDead(calibSPD,module,thisInd+1,highInd);
815}
b696414b 816//____________________________________________________________________________________________
6727e2db 817void AliITSOnlineCalibrationSPDhandler::RecursiveInsertNoisy(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
818 // inserts noisy pixels recursively, used when reading from db
6727e2db 819 if (lowInd>highInd) return;
820 Int_t thisInd = lowInd+(highInd-lowInd)/2;
821 SetNoisyPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
822 RecursiveInsertNoisy(calibSPD,module,lowInd,thisInd-1);
823 RecursiveInsertNoisy(calibSPD,module,thisInd+1,highInd);
53ae21ce 824}
6727e2db 825
826#endif
827//____________________________________________________________________________________________
828void AliITSOnlineCalibrationSPDhandler::GenerateDCSConfigFile(const Char_t* fileName) {
829 // generates an ascii file in the format as the one produced by online da (but with dummy runNr=0)
830 ofstream dcsfile;
831 dcsfile.open(fileName);
832 dcsfile << "[SPD SCAN]\n";
833 dcsfile << "RunNumber=" << "0" << "\n"; // dummy value
834 dcsfile << "Type=" << "4" << "\n";
835 dcsfile << "Router=" << "0" << "\n"; // dummy value
4f88491f 836 dcsfile << "ActualDetConfiguration=" << "0,-1,-1\n"; // dummy values
6727e2db 837 dcsfile << "[NOISY]\n";
53ae21ce 838 for (UInt_t module=0; module<240; module++) {
6727e2db 839 UInt_t headkey=20*10*6;
840 for (UInt_t ind=0; ind<GetNrNoisy(module); ind++) {
841 UInt_t newkey = GetNoisyEqIdAt(module,ind)*10*6 +
842 GetNoisyHSAt(module,ind)*10 +
843 GetNoisyChipAt(module,ind);
844 if (newkey!=headkey) { // print eq,hs,chip header
845 headkey = newkey;
846 dcsfile << "-" << newkey/(6*10) << "," << (newkey%(6*10))/10 << "," << (newkey%(6*10))%10 << "\n";
847 }
848 dcsfile << GetNoisyColAt(module,ind) << "," << GetNoisyRowAt(module,ind) << "\n";
53ae21ce 849 }
850 }
6727e2db 851 dcsfile.close();
53ae21ce 852}
6727e2db 853//____________________________________________________________________________________________
b696414b 854TArrayS AliITSOnlineCalibrationSPDhandler::GetSilentArray(UInt_t module, Bool_t treeSerial) {
855 // get a TArrayS of the silent=dead+inactive pixels (format for the AliITSCalibrationSPD object)
478d804c 856 // NB! with new implementation of AliITSCalibrationSPD this is not needed anymore
b696414b 857 TArrayS returnArray;
858
859 UInt_t eq = GetEqIdFromOffline(module);
860 UInt_t hs = GetHSFromOffline(module);
861 UInt_t size=0;
862 if ( !( IsActiveEq(eq) && IsActiveHS(eq,hs) ) ) {
863 size = 8192*5;
864 }
865 else {
866 for (UInt_t ch=0; ch<5; ch++) {
867 UInt_t chip = GetChipFromOffline(module,ch*32);
868 if (!(IsActiveChip(eq,hs,chip))) {
869 size += 8192;
870 }
871 else {
872 UInt_t gloChip = GetGloChip(eq,hs,chip);
873 size += fNrDead[gloChip];
874 }
875 }
876 }
877 returnArray.Set(size*2);
878
879 UInt_t gloIndex=0;
880 if ( !( IsActiveEq(eq) && IsActiveHS(eq,hs) ) ) {
881 for (UInt_t colM=0; colM<160; colM++) {
882 for (UInt_t rowM=0; rowM<256; rowM++) {
883 returnArray.AddAt(colM,gloIndex*2);
884 returnArray.AddAt(rowM,gloIndex*2+1);
885 gloIndex++;
886 }
887 }
888 }
889 else {
890 for (UInt_t ch=0; ch<5; ch++) {
891 UInt_t chip = GetChipFromOffline(module,ch*32);
892 if (!(IsActiveChip(eq,hs,chip))) {
893 for (UInt_t colM=ch*32; colM<ch*32+32; colM++) {
894 for (UInt_t rowM=0; rowM<256; rowM++) {
895 returnArray.AddAt(colM,gloIndex*2);
896 returnArray.AddAt(rowM,gloIndex*2+1);
897 gloIndex++;
898 }
899 }
900 }
901 else {
902 UInt_t gloChip = GetGloChip(eq,hs,chip);
903 if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
904 else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
905 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
906 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
907 Int_t colM = GetColMFromKey(key);
908 Int_t rowM = GetRowMFromKey(key);
909 returnArray.AddAt(colM,gloIndex*2);
910 returnArray.AddAt(rowM,gloIndex*2+1);
911 gloIndex++;
912 }
913 }
914 }
915 }
916 return returnArray;
917}
918//____________________________________________________________________________________________
e03405c9 919TArrayS AliITSOnlineCalibrationSPDhandler::GetDeadArray(UInt_t module, Bool_t treeSerial) {
478d804c 920 // get a TArrayS of the single dead pixels (format for the AliITSCalibrationSPD object)
e03405c9 921 TArrayS returnArray;
6727e2db 922
923 UInt_t eq = GetEqIdFromOffline(module);
924 UInt_t hs = GetHSFromOffline(module);
925 UInt_t size=0;
b696414b 926 for (UInt_t ch=0; ch<5; ch++) {
927 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
6727e2db 928 size += fNrDead[gloChip];
929 }
930 returnArray.Set(size*2);
931 UInt_t gloIndex=0;
b696414b 932 for (UInt_t ch=0; ch<5; ch++) {
478d804c 933 UInt_t chip = GetChipFromOffline(module,ch*32);
934 UInt_t gloChip = GetGloChip(eq,hs,chip);
6727e2db 935 if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
936 else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
478d804c 937 if (!IsSilentChip(eq,hs,chip)) {
938 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
939 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
940 Int_t colM = GetColMFromKey(key);
941 Int_t rowM = GetRowMFromKey(key);
942 returnArray.AddAt(colM,gloIndex*2);
943 returnArray.AddAt(rowM,gloIndex*2+1);
944 gloIndex++;
945 }
53ae21ce 946 }
947 }
6727e2db 948 return returnArray;
53ae21ce 949}
b696414b 950//____________________________________________________________________________________________
e03405c9 951TArrayS AliITSOnlineCalibrationSPDhandler::GetNoisyArray(UInt_t module, Bool_t treeSerial) {
478d804c 952 // get a TArrayS of the single noisy pixels (format for the AliITSCalibrationSPD object)
e03405c9 953 TArrayS returnArray;
6727e2db 954
955 UInt_t eq = GetEqIdFromOffline(module);
956 UInt_t hs = GetHSFromOffline(module);
957 UInt_t size=0;
b696414b 958 for (UInt_t ch=0; ch<5; ch++) {
959 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
6727e2db 960 size += fNrNoisy[gloChip];
961 }
962 returnArray.Set(size*2);
963 UInt_t gloIndex=0;
b696414b 964 for (UInt_t ch=0; ch<5; ch++) {
965 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
6727e2db 966 if (treeSerial) fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
967 else fNoisyPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
968 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
969 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
970 Int_t colM = GetColMFromKey(key);
971 Int_t rowM = GetRowMFromKey(key);
972 returnArray.AddAt(colM,gloIndex*2);
973 returnArray.AddAt(rowM,gloIndex*2+1);
974 gloIndex++;
975 }
b15de2d2 976 }
977 return returnArray;
978}
b696414b 979//____________________________________________________________________________________________
60d9faf6 980TArrayI AliITSOnlineCalibrationSPDhandler::GetDeadArrayOnline(UInt_t eq) {
478d804c 981 // get a TArrayI of the single dead pixels (format for the AliITSOnlineCalibrationSPD object)
60d9faf6 982 TArrayI returnArray;
6727e2db 983 // fix size of array
984 UInt_t size=0;
985 for (UInt_t hs=0; hs<6; hs++) {
986 for (UInt_t chip=0; chip<10; chip++) {
987 UInt_t gloChip = GetGloChip(eq,hs,chip);
988 size+=fNrDead[gloChip];
989 }
990 }
991 returnArray.Set(size);
992 // put keys in array
993 UInt_t gloIndex=0;
994 for (UInt_t hs=0; hs<6; hs++) {
995 for (UInt_t chip=0; chip<10; chip++) {
996 UInt_t gloChip = GetGloChip(eq,hs,chip);
997 fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
998 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
999 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1000 returnArray.AddAt(key,gloIndex);
1001 gloIndex++;
1002 }
1003 }
b15de2d2 1004 }
1005 return returnArray;
1006}
b696414b 1007//____________________________________________________________________________________________
60d9faf6 1008TArrayI AliITSOnlineCalibrationSPDhandler::GetNoisyArrayOnline(UInt_t eq) {
478d804c 1009 // get a TArrayI of the single noisy pixels (format for the AliITSOnlineCalibrationSPD object)
60d9faf6 1010 TArrayI returnArray;
6727e2db 1011 // fix size of array
1012 UInt_t size=0;
1013 for (UInt_t hs=0; hs<6; hs++) {
1014 for (UInt_t chip=0; chip<10; chip++) {
1015 UInt_t gloChip = GetGloChip(eq,hs,chip);
1016 size+=fNrNoisy[gloChip];
1017 }
53ae21ce 1018 }
6727e2db 1019 returnArray.Set(size);
1020 // put keys in array
1021 UInt_t gloIndex=0;
1022 for (UInt_t hs=0; hs<6; hs++) {
1023 for (UInt_t chip=0; chip<10; chip++) {
1024 UInt_t gloChip = GetGloChip(eq,hs,chip);
1025 fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
1026 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
1027 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1028 returnArray.AddAt(key,gloIndex);
1029 gloIndex++;
53ae21ce 1030 }
1031 }
1032 }
6727e2db 1033 return returnArray;
b15de2d2 1034}
6727e2db 1035//____________________________________________________________________________________________
1036void AliITSOnlineCalibrationSPDhandler::PrintEqSummary() {
1037// print summary (nr of dead and noisy) for each equipment
1038 printf("-----------\n");
1039 printf("Eq summary:\n");
1040 printf("-----------\n");
1041 for (UInt_t eq=0; eq<20; eq++) {
478d804c 1042 printf("Eq %*d: %*d silent(dead+inactive) , %*d dead , %*d noisy\n",2,eq,6,GetNrSilentEq(eq),6,GetNrDeadEq(eq),6,GetNrNoisyEq(eq));
b15de2d2 1043 }
b15de2d2 1044}
b696414b 1045//____________________________________________________________________________________________
1046void AliITSOnlineCalibrationSPDhandler::PrintSilent() const {
1047 // print the inactive and dead pixels to screen
478d804c 1048 printf("-----------------------------------------------------------\n");
1049 printf("Inactive or dead Equipments: (eq | module1 .. module12)\n");
1050 printf("-----------------------------------------------------------\n");
b696414b 1051 for (UInt_t eq=0; eq<20; eq++) {
478d804c 1052 if (IsSilentEq(eq)) {
b696414b 1053 printf("%*d | ",2,eq);
1054 for (UInt_t hs=0; hs<6; hs++) {
1055 for (UInt_t chip=0; chip<10; chip+=5) {
1056 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1057 if (hs>0 || chip==5) printf(",");
1058 printf("%*d",3,module);
1059 }
1060 }
1061 printf("\n");
1062 }
1063 }
1064
478d804c 1065 printf("-----------------------------------------------------------\n");
1066 printf("Inactive or dead Half-staves: (eq,hs | module1,module2)\n");
1067 printf("-----------------------------------------------------------\n");
b696414b 1068 for (UInt_t eq=0; eq<20; eq++) {
478d804c 1069 if (!IsSilentEq(eq)) {
b696414b 1070 for (UInt_t hs=0; hs<6; hs++) {
478d804c 1071 if (IsSilentHS(eq,hs)) {
b696414b 1072 printf("%*d,%*d | ",2,eq,1,hs);
1073 for (UInt_t chip=0; chip<10; chip+=5) {
1074 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1075 if (chip==5) printf(",");
1076 printf("%*d",3,module);
1077 }
1078 printf("\n");
1079 }
1080 }
1081 }
1082 }
1083
478d804c 1084 printf("-----------------------------------------------------------\n");
1085 printf("Inactive or dead Chips: (eq,hs,chip | module,colM1-colM2)\n");
1086 printf("-----------------------------------------------------------\n");
b696414b 1087 for (UInt_t eq=0; eq<20; eq++) {
478d804c 1088 if (!IsSilentEq(eq)) {
b696414b 1089 for (UInt_t hs=0; hs<6; hs++) {
478d804c 1090 if (!IsSilentHS(eq,hs)) {
b696414b 1091 for (UInt_t chip=0; chip<10; chip++) {
478d804c 1092 if (IsSilentChip(eq,hs,chip)) {
b696414b 1093 printf("%*d,%*d,%*d | ",2,eq,1,hs,1,chip);
1094 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1095 UInt_t colM1 = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,0);
1096 UInt_t colM2 = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,31);
1097 printf("%*d,%*d-%*d\n",3,module,3,colM1,3,colM2);
1098 }
1099 }
1100 }
1101 }
1102 }
1103 }
1104
1105 PrintDead();
1106
b696414b 1107}
1108//____________________________________________________________________________________________
6727e2db 1109void AliITSOnlineCalibrationSPDhandler::PrintDead() const {
b696414b 1110 // print the single dead pixels to screen (disregards inactive eq,hs,chip)
6727e2db 1111 printf("------------------------------------------------------\n");
1112 printf("Dead Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
1113 printf("------------------------------------------------------\n");
1114 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1115 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1116 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1117 UInt_t eq = GetEqIdFromKey(key);
1118 UInt_t hs = GetHSFromKey(key);
1119 UInt_t chip = GetChipFromKey(key);
1120 UInt_t col = GetColFromKey(key);
1121 UInt_t row = GetRowFromKey(key);
b15de2d2 1122
6727e2db 1123 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1124 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1125 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1126
1127 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);
1128 }
b15de2d2 1129 }
b15de2d2 1130}
b696414b 1131//____________________________________________________________________________________________
6727e2db 1132void AliITSOnlineCalibrationSPDhandler::PrintNoisy() const {
1133 // print the dead pixels to screen
1134 printf("-------------------------------------------------------\n");
1135 printf("Noisy Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
1136 printf("-------------------------------------------------------\n");
1137 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1138 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
1139 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1140 UInt_t eq = GetEqIdFromKey(key);
1141 UInt_t hs = GetHSFromKey(key);
1142 UInt_t chip = GetChipFromKey(key);
1143 UInt_t col = GetColFromKey(key);
1144 UInt_t row = GetRowFromKey(key);
b15de2d2 1145
6727e2db 1146 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1147 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1148 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1149
1150 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);
1151 }
3479cee3 1152 }
3479cee3 1153}
6727e2db 1154//____________________________________________________________________________________________
1155Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1156 // set a dead pixel, returns false if pixel is already dead
1157 UInt_t gloChip = GetGloChip(eq,hs,chip);
1158 if (gloChip>=1200) {
1159 Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1160 return kFALSE;
1161 }
1162 if (col>=32 && row>=256) {
1163 Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
1164 return kFALSE;
1165 }
1166 Int_t key = GetKey(eq,hs,chip,col,row);
1167 // if noisy we dont want to add it...
1168 if (fNoisyPixelMap[gloChip]->Find(key) != NULL) return kFALSE;
1169 if (fDeadPixelMap[gloChip]->Insert(key,gloChip)) {
1170 fNrDead[gloChip]++;
3479cee3 1171 return kTRUE;
1172 }
1173 return kFALSE;
1174}
b696414b 1175//____________________________________________________________________________________________
6727e2db 1176Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1177 // set a noisy pixel, returns false if pixel is already noisy
1178 UInt_t gloChip = GetGloChip(eq,hs,chip);
1179 if (gloChip>=1200) {
1180 Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1181 return kFALSE;
b15de2d2 1182 }
6727e2db 1183 if (col>=32 && row>=256) {
1184 Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
b15de2d2 1185 return kFALSE;
1186 }
6727e2db 1187 Int_t key = GetKey(eq,hs,chip,col,row);
1188 // if dead before - remove from the dead list
1189 if (fDeadPixelMap[gloChip]->Remove(key)) {
1190 fNrDead[gloChip]--;
1191 }
1192 if (fNoisyPixelMap[gloChip]->Insert(key,gloChip)) {
1193 fNrNoisy[gloChip]++;
1194 return kTRUE;
1195 }
1196 return kFALSE;
b15de2d2 1197}
b696414b 1198//____________________________________________________________________________________________
6727e2db 1199Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1200 // set a dead pixel, returns false if pixel is already dead
1201 UInt_t eq = GetEqIdFromOffline(module);
53ae21ce 1202 UInt_t hs = GetHSFromOffline(module);
1203 UInt_t chip = GetChipFromOffline(module,colM);
6727e2db 1204 UInt_t col = GetColFromOffline(module,colM);
1205 UInt_t row = GetRowFromOffline(module,rowM);
1206 return SetDeadPixel(eq,hs,chip,col,row);
53ae21ce 1207}
b696414b 1208//____________________________________________________________________________________________
6727e2db 1209Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1210 // set a noisy pixel, returns false if pixel is already noisy
1211 UInt_t eq = GetEqIdFromOffline(module);
1212 UInt_t hs = GetHSFromOffline(module);
1213 UInt_t chip = GetChipFromOffline(module,colM);
1214 UInt_t col = GetColFromOffline(module,colM);
1215 UInt_t row = GetRowFromOffline(module,rowM);
1216 return SetNoisyPixel(eq,hs,chip,col,row);
53ae21ce 1217}
b696414b 1218//____________________________________________________________________________________________
6727e2db 1219Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1220 // unset a dead pixel, returns false if pixel is not dead
1221 UInt_t gloChip = GetGloChip(eq,hs,chip);
1222 if (gloChip>=1200) {
1223 Error("AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1224 return kFALSE;
53ae21ce 1225 }
6727e2db 1226 Int_t key = GetKey(eq,hs,chip,col,row);
1227 if (fDeadPixelMap[gloChip]->Remove(key)) {
1228 fNrDead[gloChip]--;
1229 return kTRUE;
53ae21ce 1230 }
6727e2db 1231 return kFALSE;
53ae21ce 1232}
b696414b 1233//____________________________________________________________________________________________
6727e2db 1234Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1235 // unset a noisy pixel, returns false if pixel is not noisy
1236 UInt_t gloChip = GetGloChip(eq,hs,chip);
1237 if (gloChip>=1200) {
1238 Error("AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1239 return kFALSE;
53ae21ce 1240 }
6727e2db 1241 Int_t key = GetKey(eq,hs,chip,col,row);
1242 if (fNoisyPixelMap[gloChip]->Remove(key)) {
1243 fNrNoisy[gloChip]--;
1244 return kTRUE;
53ae21ce 1245 }
6727e2db 1246 return kFALSE;
53ae21ce 1247}
b696414b 1248//____________________________________________________________________________________________
6727e2db 1249Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1250 // unset a dead pixel, returns false if pixel is not dead
1251 UInt_t eq = GetEqIdFromOffline(module);
1252 UInt_t hs = GetHSFromOffline(module);
1253 UInt_t chip = GetChipFromOffline(module,colM);
1254 UInt_t col = GetColFromOffline(module,colM);
1255 UInt_t row = GetRowFromOffline(module,rowM);
1256 return UnSetDeadPixel(eq,hs,chip,col,row);
53ae21ce 1257}
b696414b 1258//____________________________________________________________________________________________
6727e2db 1259Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1260 // unset a noisy pixel, returns false if pixel is not noisy
1261 UInt_t eq = GetEqIdFromOffline(module);
1262 UInt_t hs = GetHSFromOffline(module);
1263 UInt_t chip = GetChipFromOffline(module,colM);
1264 UInt_t col = GetColFromOffline(module,colM);
1265 UInt_t row = GetRowFromOffline(module,rowM);
1266 return UnSetNoisyPixel(eq,hs,chip,col,row);
53ae21ce 1267}
b696414b 1268//____________________________________________________________________________________________
478d804c 1269Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBad(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1270 // is the pixel bad (silent or noisy)
1271 return (IsPixelSilent(eq,hs,chip,col,row) || IsPixelNoisy(eq,hs,chip,col,row));
53ae21ce 1272}
6727e2db 1273//____________________________________________________________________________________________
b696414b 1274Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilent(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1275 // is the pixel silent (dead or inactive)?
6727e2db 1276 UInt_t gloChip = GetGloChip(eq,hs,chip);
b696414b 1277 if (gloChip>=1200 || col>=32 || row>=256) {
1278 Error("AliITSOnlineCalibrationSPDhandler::IsPixelSilent", "eq,hs,chip,col,row nrs (%d,%d,%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
6727e2db 1279 return kFALSE;
53ae21ce 1280 }
478d804c 1281 if (IsSilentChip(eq,hs,chip)) return kTRUE;
b696414b 1282 else return IsPixelDead(eq,hs,chip,col,row);
1283}
1284//____________________________________________________________________________________________
1285Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDead(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
478d804c 1286 // is the pixel dead?
b696414b 1287 UInt_t gloChip = GetGloChip(eq,hs,chip);
1288 if (gloChip>=1200 || col>=32 || row>=256) {
1289 Error("AliITSOnlineCalibrationSPDhandler::IsPixelDead", "eq,hs,chip,col,row nrs (%d,%d,%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
6727e2db 1290 return kFALSE;
1291 }
b696414b 1292 UInt_t key = GetKey(eq,hs,chip,col,row);
478d804c 1293 if (IsDeadEq(eq) || IsDeadHS(eq,hs) || IsDeadChip(eq,hs,chip)) return kTRUE;
1294 else {
1295 if ( fDeadPixelMap[gloChip]->Find(key) != NULL ) return kTRUE;
1296 else return kFALSE;
1297 }
b15de2d2 1298}
b696414b 1299//____________________________________________________________________________________________
6727e2db 1300Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisy(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1301 // is the pixel noisy?
1302 UInt_t gloChip = GetGloChip(eq,hs,chip);
b696414b 1303 if (gloChip>=1200 || col>=32 || row>=256) {
1304 Error("AliITSOnlineCalibrationSPDhandler::IsPixelNoisy", "eq,hs,chip,col,row nrs (%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
6727e2db 1305 return kFALSE;
1306 }
1307 UInt_t key = GetKey(eq,hs,chip,col,row);
b696414b 1308 if ( fNoisyPixelMap[gloChip]->Find(key) != NULL ) return kTRUE;
1309 else return kFALSE;
3479cee3 1310}
b696414b 1311//____________________________________________________________________________________________
478d804c 1312Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBadM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1313 // is the pixel bad (silent or noisy)?
1314 return (IsPixelSilentM(module,colM,rowM) || IsPixelNoisyM(module,colM,rowM));
1315}
1316//____________________________________________________________________________________________
b696414b 1317Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilentM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1318 // is the pixel silent (dead or inactive)?
1319 UInt_t eq = GetEqIdFromOffline(module);
1320 UInt_t hs = GetHSFromOffline(module);
1321 UInt_t chip = GetChipFromOffline(module,colM);
1322 UInt_t col = GetColFromOffline(module,colM);
1323 UInt_t row = GetRowFromOffline(module,rowM);
1324 return IsPixelSilent(eq,hs,chip,col,row);
1325}
1326//____________________________________________________________________________________________
6727e2db 1327Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1328 // is the pixel dead?
1329 UInt_t eq = GetEqIdFromOffline(module);
3479cee3 1330 UInt_t hs = GetHSFromOffline(module);
1331 UInt_t chip = GetChipFromOffline(module,colM);
6727e2db 1332 UInt_t col = GetColFromOffline(module,colM);
1333 UInt_t row = GetRowFromOffline(module,rowM);
1334 return IsPixelDead(eq,hs,chip,col,row);
1335}
b696414b 1336//____________________________________________________________________________________________
6727e2db 1337Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1338 // is the pixel noisy?
1339 UInt_t eq = GetEqIdFromOffline(module);
1340 UInt_t hs = GetHSFromOffline(module);
1341 UInt_t chip = GetChipFromOffline(module,colM);
1342 UInt_t col = GetColFromOffline(module,colM);
1343 UInt_t row = GetRowFromOffline(module,rowM);
1344 return IsPixelNoisy(eq,hs,chip,col,row);
1345}
b696414b 1346//____________________________________________________________________________________________
478d804c 1347Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBadKey(Int_t key) const {
1348 // is this pixel silent (dead or inactive)?
1349 UInt_t eq = GetEqIdFromKey(key);
1350 UInt_t hs = GetHSFromKey(key);
1351 UInt_t chip = GetChipFromKey(key);
1352 UInt_t col = GetColFromKey(key);
1353 UInt_t row = GetRowFromKey(key);
1354 return IsPixelBad(eq,hs,chip,col,row);
1355}
1356//____________________________________________________________________________________________
b696414b 1357Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilentKey(Int_t key) const {
1358 // is this pixel silent (dead or inactive)?
1359 UInt_t eq = GetEqIdFromKey(key);
1360 UInt_t hs = GetHSFromKey(key);
1361 UInt_t chip = GetChipFromKey(key);
1362 UInt_t col = GetColFromKey(key);
1363 UInt_t row = GetRowFromKey(key);
1364 return IsPixelSilent(eq,hs,chip,col,row);
1365}
1366//____________________________________________________________________________________________
6727e2db 1367Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadKey(Int_t key) const {
1368 // is this pixel dead?
1369 UInt_t eq = GetEqIdFromKey(key);
1370 UInt_t hs = GetHSFromKey(key);
1371 UInt_t chip = GetChipFromKey(key);
1372 UInt_t col = GetColFromKey(key);
1373 UInt_t row = GetRowFromKey(key);
1374 return IsPixelDead(eq,hs,chip,col,row);
3479cee3 1375}
b696414b 1376//____________________________________________________________________________________________
53ae21ce 1377Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyKey(Int_t key) const {
1378 // is this pixel noisy?
6727e2db 1379 UInt_t eq = GetEqIdFromKey(key);
53ae21ce 1380 UInt_t hs = GetHSFromKey(key);
1381 UInt_t chip = GetChipFromKey(key);
6727e2db 1382 UInt_t col = GetColFromKey(key);
1383 UInt_t row = GetRowFromKey(key);
1384 return IsPixelNoisy(eq,hs,chip,col,row);
b15de2d2 1385}
6727e2db 1386//____________________________________________________________________________________________
478d804c 1387UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBad() const {
1388 // returns the total nr of bad pixels (silent or noisy)
1389 UInt_t nrBad=0;
1390 nrBad+=GetNrSilent();
1391 UInt_t nrNoisy = GetNrNoisy();
1392 for (UInt_t i=0; i<nrNoisy; i++) {
1393 UInt_t eq = GetNoisyEqIdAt(i);
1394 UInt_t hs = GetNoisyHSAt(i);
1395 UInt_t chip = GetNoisyChipAt(i);
1396 UInt_t col = GetNoisyColAt(i);
1397 UInt_t row = GetNoisyRowAt(i);
1398 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1399 }
1400 return nrBad;
1401}
1402//____________________________________________________________________________________________
b696414b 1403UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilent() const {
1404 // returns the total nr of silent pixels (dead or inactive)
1405 UInt_t nrDead = 0;
1406 for (UInt_t eq=0; eq<20; eq++) {
478d804c 1407 if (IsSilentEq(eq)) {
b696414b 1408 nrDead+=81920*6;
1409 continue;
1410 }
1411 for (UInt_t hs=0; hs<6; hs++) {
478d804c 1412 if (IsSilentHS(eq,hs)) {
b696414b 1413 nrDead+=81920;
1414 continue;
1415 }
1416 for (UInt_t chip=0; chip<10; chip++) {
478d804c 1417 if (IsSilentChip(eq,hs,chip)) {
b696414b 1418 nrDead+=8192;
1419 continue;
1420 }
1421 else {
1422 UInt_t gloChip = GetGloChip(eq,hs,chip);
1423 nrDead+=fNrDead[gloChip];
1424 }
1425 }
1426 }
1427 }
1428 return nrDead;
1429}
1430//____________________________________________________________________________________________
6727e2db 1431UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead() const {
1432 // returns the total nr of dead pixels
1433 UInt_t nrDead = 0;
1434 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1435 nrDead+=fNrDead[gloChip];
b15de2d2 1436 }
6727e2db 1437 return nrDead;
b15de2d2 1438}
b696414b 1439//____________________________________________________________________________________________
53ae21ce 1440UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy() const {
1441 // returns the total nr of noisy pixels
1442 UInt_t nrNoisy = 0;
6727e2db 1443 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1444 nrNoisy+=fNrNoisy[gloChip];
53ae21ce 1445 }
1446 return nrNoisy;
1447}
b696414b 1448//____________________________________________________________________________________________
478d804c 1449UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t index) const {
6727e2db 1450 // get eq for the dead pixel at position index in list of dead
1451 UInt_t gloChip;
1452 UInt_t chipIndex;
1453 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1454 return GetDeadEqIdAtC2(gloChip,chipIndex);
1455}
b696414b 1456//____________________________________________________________________________________________
478d804c 1457UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t index) const {
6727e2db 1458 // get eq for the noisy pixel at position index in list of noisy
1459 UInt_t gloChip;
1460 UInt_t chipIndex;
1461 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1462 return GetNoisyEqIdAtC2(gloChip,chipIndex);
1463}
b696414b 1464//____________________________________________________________________________________________
478d804c 1465UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t index) const {
6727e2db 1466 // get hs for the dead pixel at position index in list of dead
1467 UInt_t gloChip;
1468 UInt_t chipIndex;
1469 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1470 return GetDeadHSAtC2(gloChip,chipIndex);
1471}
b696414b 1472//____________________________________________________________________________________________
478d804c 1473UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t index) const {
6727e2db 1474 // get hs for the noisy pixel at position index in list of noisy
1475 UInt_t gloChip;
1476 UInt_t chipIndex;
1477 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1478 return GetNoisyHSAtC2(gloChip,chipIndex);
1479}
b696414b 1480//____________________________________________________________________________________________
478d804c 1481UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t index) const {
6727e2db 1482 // get chip for the dead pixel at position index in list of dead
1483 UInt_t gloChip;
1484 UInt_t chipIndex;
1485 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1486 return GetDeadChipAtC2(gloChip,chipIndex);
1487}
b696414b 1488//____________________________________________________________________________________________
478d804c 1489UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t index) const {
6727e2db 1490 // get chip for the noisy pixel at position index in list of noisy
1491 UInt_t gloChip;
1492 UInt_t chipIndex;
1493 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1494 return GetNoisyChipAtC2(gloChip,chipIndex);
1495}
b696414b 1496//____________________________________________________________________________________________
478d804c 1497UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t index) const {
6727e2db 1498 // get hs for the dead pixel at position index in list of dead
1499 UInt_t gloChip;
1500 UInt_t chipIndex;
1501 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1502 return GetDeadColAtC2(gloChip,chipIndex);
1503}
b696414b 1504//____________________________________________________________________________________________
478d804c 1505UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t index) const {
6727e2db 1506 // get hs for the noisy pixel at position index in list of noisy
1507 UInt_t gloChip;
1508 UInt_t chipIndex;
1509 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1510 return GetNoisyColAtC2(gloChip,chipIndex);
1511}
b696414b 1512//____________________________________________________________________________________________
478d804c 1513UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t index) const {
6727e2db 1514 // get hs for the dead pixel at position index in list of dead
1515 UInt_t gloChip;
1516 UInt_t chipIndex;
1517 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1518 return GetDeadRowAtC2(gloChip,chipIndex);
1519}
b696414b 1520//____________________________________________________________________________________________
478d804c 1521UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t index) const {
6727e2db 1522 // get hs for the noisy pixel at position index in list of noisy
1523 UInt_t gloChip;
1524 UInt_t chipIndex;
1525 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1526 return GetNoisyRowAtC2(gloChip,chipIndex);
1527}
1528//____________________________________________________________________________________________
478d804c 1529UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBad(UInt_t module) const {
1530 // returns the number of bad pixels for a certain module (silent or noisy)
1531 UInt_t nrBad = 0;
1532 nrBad+=GetNrSilent(module);
1533 UInt_t nrNoisy = GetNrNoisy(module);
1534 for (UInt_t i=0; i<nrNoisy; i++) {
1535 UInt_t eq = GetNoisyEqIdAt(module,i);
1536 UInt_t hs = GetNoisyHSAt(module,i);
1537 UInt_t chip = GetNoisyChipAt(module,i);
1538 UInt_t col = GetNoisyColAt(module,i);
1539 UInt_t row = GetNoisyRowAt(module,i);
1540 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1541 }
1542 return nrBad;
1543}
1544//____________________________________________________________________________________________
b696414b 1545UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilent(UInt_t module) const {
1546 // returns the number of silent pixels for a certain module (dead or inactive)
1547 if (module>=240) {
1548 Error("AliITSOnlineCalibrationSPDhandler::GetNrSilent", "module nr (%d) out of bounds.",module);
1549 return 0;
1550 }
1551 UInt_t nrSilent = 0;
1552 UInt_t eq = GetEqIdFromOffline(module);
478d804c 1553 if (IsSilentEq(eq)) return 160*256;
b696414b 1554 UInt_t hs = GetHSFromOffline(module);
478d804c 1555 if (IsSilentHS(eq,hs)) return 160*256;
b696414b 1556 for (UInt_t ch=0; ch<5; ch++) {
1557 UInt_t chip = GetChipFromOffline(module,ch*32);
478d804c 1558 if (IsSilentChip(eq,hs,chip)) {
b696414b 1559 nrSilent+=8192;
1560 }
1561 else {
1562 UInt_t gloChip = GetGloChip(eq,hs,chip);
1563 nrSilent+=fNrDead[gloChip];
1564 }
1565 }
1566 return nrSilent;
1567}
1568//____________________________________________________________________________________________
6727e2db 1569UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead(UInt_t module) const {
1570 // returns the number of dead pixels for a certain module
1571 if (module>=240) {
1572 Error("AliITSOnlineCalibrationSPDhandler::GetNrDead", "module nr (%d) out of bounds.",module);
53ae21ce 1573 return 0;
1574 }
6727e2db 1575 UInt_t nrDead = 0;
1576 UInt_t eq = GetEqIdFromOffline(module);
1577 UInt_t hs = GetHSFromOffline(module);
b696414b 1578 for (UInt_t ch=0; ch<5; ch++) {
1579 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
6727e2db 1580 nrDead+=fNrDead[gloChip];
53ae21ce 1581 }
6727e2db 1582 return nrDead;
1583}
b696414b 1584//____________________________________________________________________________________________
6727e2db 1585UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy(UInt_t module) const {
1586 // returns the number of noisy pixels for a certain module
1587 if (module>=240) {
1588 Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisy", "module nr (%d) out of bounds.",module);
53ae21ce 1589 return 0;
1590 }
6727e2db 1591 UInt_t nrNoisy = 0;
1592 UInt_t eq = GetEqIdFromOffline(module);
1593 UInt_t hs = GetHSFromOffline(module);
b696414b 1594 for (UInt_t ch=0; ch<5; ch++) {
1595 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
6727e2db 1596 nrNoisy+=fNrNoisy[gloChip];
6727e2db 1597 }
1598 return nrNoisy;
1599}
b696414b 1600//____________________________________________________________________________________________
478d804c 1601UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t module, UInt_t index) const {
6727e2db 1602 // get eq for the dead pixel at position index in list of dead
1603 UInt_t gloChip;
1604 UInt_t chipIndex;
1605 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1606 return GetDeadEqIdAtC2(gloChip,chipIndex);
1607}
b696414b 1608//____________________________________________________________________________________________
478d804c 1609UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t module, UInt_t index) const {
6727e2db 1610 // get eq for the noisy pixel at position index in list of noisy
1611 UInt_t gloChip;
1612 UInt_t chipIndex;
1613 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1614 return GetNoisyEqIdAtC2(gloChip,chipIndex);
1615}
b696414b 1616//____________________________________________________________________________________________
478d804c 1617UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t module, UInt_t index) const {
6727e2db 1618 // get hs for the dead pixel at position index in list of dead
1619 UInt_t gloChip;
1620 UInt_t chipIndex;
1621 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1622 return GetDeadHSAtC2(gloChip,chipIndex);
53ae21ce 1623}
b696414b 1624//____________________________________________________________________________________________
478d804c 1625UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t module, UInt_t index) const {
6727e2db 1626 // get hs for the noisy pixel at position index in list of noisy
1627 UInt_t gloChip;
1628 UInt_t chipIndex;
1629 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1630 return GetNoisyHSAtC2(gloChip,chipIndex);
1631}
b696414b 1632//____________________________________________________________________________________________
478d804c 1633UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t module, UInt_t index) const {
6727e2db 1634 // get chip for the dead pixel at position index in list of dead
1635 UInt_t gloChip;
1636 UInt_t chipIndex;
1637 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1638 return GetDeadChipAtC2(gloChip,chipIndex);
1639}
b696414b 1640//____________________________________________________________________________________________
478d804c 1641UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t module, UInt_t index) const {
53ae21ce 1642 // get chip for the noisy pixel at position index in list of noisy
6727e2db 1643 UInt_t gloChip;
1644 UInt_t chipIndex;
1645 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1646 return GetNoisyChipAtC2(gloChip,chipIndex);
1647}
b696414b 1648//____________________________________________________________________________________________
478d804c 1649UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t module, UInt_t index) const {
6727e2db 1650 // get hs for the dead pixel at position index in list of dead
1651 UInt_t gloChip;
1652 UInt_t chipIndex;
1653 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1654 return GetDeadColAtC2(gloChip,chipIndex);
1655}
b696414b 1656//____________________________________________________________________________________________
478d804c 1657UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t module, UInt_t index) const {
6727e2db 1658 // get hs for the noisy pixel at position index in list of noisy
1659 UInt_t gloChip;
1660 UInt_t chipIndex;
1661 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1662 return GetNoisyColAtC2(gloChip,chipIndex);
1663}
b696414b 1664//____________________________________________________________________________________________
478d804c 1665UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t module, UInt_t index) const {
6727e2db 1666 // get hs for the dead pixel at position index in list of dead
1667 UInt_t gloChip;
1668 UInt_t chipIndex;
1669 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1670 return GetDeadRowAtC2(gloChip,chipIndex);
1671}
b696414b 1672//____________________________________________________________________________________________
478d804c 1673UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t module, UInt_t index) const {
6727e2db 1674 // get hs for the noisy pixel at position index in list of noisy
1675 UInt_t gloChip;
1676 UInt_t chipIndex;
1677 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1678 return GetNoisyRowAtC2(gloChip,chipIndex);
1679}
1680//____________________________________________________________________________________________
478d804c 1681UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBadEq(UInt_t eq) const {
1682 // returns nr of bad for eq (silent or noisy)
1683 UInt_t nrBad = 0;
1684 nrBad+=GetNrSilentEq(eq);
1685 UInt_t nrNoisy = GetNrNoisy(eq);
1686 for (UInt_t i=0; i<nrNoisy; i++) {
1687 UInt_t hs = GetNoisyHSAtEq(eq,i);
1688 UInt_t chip = GetNoisyChipAtEq(eq,i);
1689 UInt_t col = GetNoisyColAtEq(eq,i);
1690 UInt_t row = GetNoisyRowAtEq(eq,i);
1691 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1692 }
1693 return nrBad;
1694}
1695//____________________________________________________________________________________________
b696414b 1696UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentEq(UInt_t eq) const {
1697 // returns nr of silent for eq (dead or inactive)
1698 UInt_t returnval=0;
478d804c 1699 if (IsSilentEq(eq)) return 81920*6;
b696414b 1700 for (UInt_t hs=0; hs<6; hs++) {
478d804c 1701 if (IsSilentHS(eq,hs)) {
b696414b 1702 returnval+=81920;
1703 continue;
1704 }
1705 for (UInt_t chip=0; chip<10; chip++) {
478d804c 1706 if (IsSilentChip(eq,hs,chip)) {
b696414b 1707 returnval+=8192;
1708 continue;
1709 }
1710 else {
1711 returnval+=GetNrDeadC(eq,hs,chip);
1712 }
1713 }
1714 }
1715 return returnval;
1716}
1717//____________________________________________________________________________________________
6727e2db 1718UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadEq(UInt_t eq) const {
1719 // returns nr of dead for eq
1720 UInt_t returnval=0;
1721 for (UInt_t hs=0; hs<6; hs++) {
1722 for (UInt_t chip=0; chip<10; chip++) {
1723 returnval+=GetNrDeadC(eq,hs,chip);
1724 }
53ae21ce 1725 }
6727e2db 1726 return returnval;
1727}
b696414b 1728//____________________________________________________________________________________________
6727e2db 1729UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyEq(UInt_t eq) const {
1730 // returns nr of noisy for eq
1731 UInt_t returnval=0;
1732 for (UInt_t hs=0; hs<6; hs++) {
1733 for (UInt_t chip=0; chip<10; chip++) {
1734 returnval+=GetNrNoisyC(eq,hs,chip);
1735 }
53ae21ce 1736 }
6727e2db 1737 return returnval;
53ae21ce 1738}
b696414b 1739//____________________________________________________________________________________________
6727e2db 1740UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtEq(UInt_t eq, UInt_t index) const {
1741 // get eq for the dead pixel at position index in list of dead
1742 if (eq<20 && index<GetNrDeadEq(eq)) {
1743 return eq;
53ae21ce 1744 }
1745 else {
6727e2db 1746 return 20;
53ae21ce 1747 }
1748}
b696414b 1749//____________________________________________________________________________________________
6727e2db 1750UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtEq(UInt_t eq, UInt_t index) const {
1751 // get eq for the noisy pixel at position index in list of noisy
1752 if (eq<20 && index<GetNrNoisyEq(eq)) {
1753 return eq;
53ae21ce 1754 }
1755 else {
6727e2db 1756 return 20;
53ae21ce 1757 }
1758}
b696414b 1759//____________________________________________________________________________________________
478d804c 1760UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtEq(UInt_t eq, UInt_t index) const {
6727e2db 1761 // get hs for the dead pixel at position index in list of dead
1762 UInt_t gloChip;
1763 UInt_t chipIndex;
1764 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1765 return GetDeadHSAtC2(gloChip,chipIndex);
1766}
b696414b 1767//____________________________________________________________________________________________
478d804c 1768UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtEq(UInt_t eq, UInt_t index) const {
6727e2db 1769 // get hs for the noisy pixel at position index in list of noisy
1770 UInt_t gloChip;
1771 UInt_t chipIndex;
1772 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1773 return GetNoisyHSAtC2(gloChip,chipIndex);
1774}
b696414b 1775//____________________________________________________________________________________________
478d804c 1776UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtEq(UInt_t eq, UInt_t index) const {
6727e2db 1777 // get chip for the dead pixel at position index in list of dead
1778 UInt_t gloChip;
1779 UInt_t chipIndex;
1780 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1781 return GetDeadChipAtC2(gloChip,chipIndex);
1782}
b696414b 1783//____________________________________________________________________________________________
478d804c 1784UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtEq(UInt_t eq, UInt_t index) const {
6727e2db 1785 // get chip for the noisy pixel at position index in list of noisy
1786 UInt_t gloChip;
1787 UInt_t chipIndex;
1788 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1789 return GetNoisyChipAtC2(gloChip,chipIndex);
1790}
b696414b 1791//____________________________________________________________________________________________
478d804c 1792UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtEq(UInt_t eq, UInt_t index) const {
6727e2db 1793 // get hs for the dead pixel at position index in list of dead
1794 UInt_t gloChip;
1795 UInt_t chipIndex;
1796 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1797 return GetDeadColAtC2(gloChip,chipIndex);
1798}
b696414b 1799//____________________________________________________________________________________________
478d804c 1800UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtEq(UInt_t eq, UInt_t index) const {
6727e2db 1801 // get hs for the noisy pixel at position index in list of noisy
1802 UInt_t gloChip;
1803 UInt_t chipIndex;
1804 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1805 return GetNoisyColAtC2(gloChip,chipIndex);
1806}
b696414b 1807//____________________________________________________________________________________________
478d804c 1808UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtEq(UInt_t eq, UInt_t index) const {
6727e2db 1809 // get hs for the dead pixel at position index in list of dead
1810 UInt_t gloChip;
1811 UInt_t chipIndex;
1812 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1813 return GetDeadRowAtC2(gloChip,chipIndex);
1814}
b696414b 1815//____________________________________________________________________________________________
478d804c 1816UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtEq(UInt_t eq, UInt_t index) const {
6727e2db 1817 // get hs for the noisy pixel at position index in list of noisy
1818 UInt_t gloChip;
1819 UInt_t chipIndex;
1820 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1821 return GetNoisyRowAtC2(gloChip,chipIndex);
1822}
1823//____________________________________________________________________________________________
478d804c 1824UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
1825 // returns nr of bad for chip (silent or noisy)
1826 UInt_t nrBad = 0;
1827 nrBad+=GetNrSilentC(eq,hs,chip);
1828 UInt_t nrNoisy = GetNrNoisyC(eq,hs,chip);
1829 for (UInt_t i=0; i<nrNoisy; i++) {
1830 UInt_t col = GetNoisyColAtC(eq,hs,chip,i);
1831 UInt_t row = GetNoisyRowAtC(eq,hs,chip,i);
1832 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1833 }
1834 return nrBad;
1835}
1836//____________________________________________________________________________________________
b696414b 1837UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentC(UInt_t eq, UInt_t hs, UInt_t chip) const {
1838 // returns nr of silent for chip (dead or inactive)
478d804c 1839 if (IsSilentChip(eq,hs,chip)) return 8192;
b696414b 1840 else return GetNrDeadC(eq,hs,chip);
1841}
1842//____________________________________________________________________________________________
6727e2db 1843UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
b696414b 1844 // returns nr of dead for chip
6727e2db 1845 UInt_t gloChip = GetGloChip(eq,hs,chip);
1846 return GetNrDeadC2(gloChip);
1847}
b696414b 1848//____________________________________________________________________________________________
6727e2db 1849UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC(UInt_t eq, UInt_t hs, UInt_t chip) const {
b696414b 1850 // returns nr of noisy for chip
6727e2db 1851 UInt_t gloChip = GetGloChip(eq,hs,chip);
1852 return GetNrNoisyC2(gloChip);
1853}
b696414b 1854//____________________________________________________________________________________________
6727e2db 1855UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1856 UInt_t gloChip = GetGloChip(eq,hs,chip);
1857 return GetDeadEqIdAtC2(gloChip,index);
1858}
b696414b 1859//____________________________________________________________________________________________
6727e2db 1860UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1861 UInt_t gloChip = GetGloChip(eq,hs,chip);
1862 return GetNoisyEqIdAtC2(gloChip,index);
1863}
b696414b 1864//____________________________________________________________________________________________
6727e2db 1865UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1866 UInt_t gloChip = GetGloChip(eq,hs,chip);
1867 return GetDeadHSAtC2(gloChip,index);
1868}
b696414b 1869//____________________________________________________________________________________________
6727e2db 1870UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1871 UInt_t gloChip = GetGloChip(eq,hs,chip);
1872 return GetNoisyHSAtC2(gloChip,index);
1873}
b696414b 1874//____________________________________________________________________________________________
6727e2db 1875UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1876 UInt_t gloChip = GetGloChip(eq,hs,chip);
1877 return GetDeadChipAtC2(gloChip,index);
1878}
b696414b 1879//____________________________________________________________________________________________
6727e2db 1880UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1881 UInt_t gloChip = GetGloChip(eq,hs,chip);
1882 return GetNoisyChipAtC2(gloChip,index);
1883}
b696414b 1884//____________________________________________________________________________________________
6727e2db 1885UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1886 UInt_t gloChip = GetGloChip(eq,hs,chip);
1887 return GetDeadColAtC2(gloChip,index);
1888}
b696414b 1889//____________________________________________________________________________________________
6727e2db 1890UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1891 UInt_t gloChip = GetGloChip(eq,hs,chip);
1892 return GetNoisyColAtC2(gloChip,index);
1893}
b696414b 1894//____________________________________________________________________________________________
6727e2db 1895UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1896 UInt_t gloChip = GetGloChip(eq,hs,chip);
1897 return GetDeadRowAtC2(gloChip,index);
1898}
b696414b 1899//____________________________________________________________________________________________
6727e2db 1900UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1901 UInt_t gloChip = GetGloChip(eq,hs,chip);
1902 return GetNoisyRowAtC2(gloChip,index);
1903}
1904//____________________________________________________________________________________________
1905const Char_t* AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1906 // get a string of dead pixel info
1907 TString returnMess = "";
1908 UInt_t gloChip = GetGloChip(eq,hs,chip);
1909 if (gloChip>=1200) {
1910 Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
1911 return returnMess.Data();
1912 }
1913 if (index<fNrDead[gloChip]) {
1914 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
6727e2db 1915 UInt_t col = GetColFromKey(key);
b696414b 1916 UInt_t row = GetRowFromKey(key);
6727e2db 1917 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1918 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1919 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
478d804c 1920 returnMess = Form("%*d,%*d,%*d,%*d,%*d | %*d,%*d,%*d",2,eq,1,hs,1,chip,2,col,3,row,3,module,3,colM,3,rowM);
6727e2db 1921 return returnMess.Data();
53ae21ce 1922 }
1923 else {
6727e2db 1924 Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "Index %d out of bounds.", index);
1925 return returnMess.Data();
1926 }
1927}
b696414b 1928//____________________________________________________________________________________________
6727e2db 1929const Char_t* AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1930 // get a string of noisy pixel info
1931 TString returnMess = "";
1932 UInt_t gloChip = GetGloChip(eq,hs,chip);
1933 if (gloChip>=1200) {
1934 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
1935 return returnMess.Data();
1936 }
1937 if (index<fNrNoisy[gloChip]) {
1938 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
6727e2db 1939 UInt_t col = GetColFromKey(key);
1940 UInt_t row = GetRowFromKey(key);
1941 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1942 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1943 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
478d804c 1944 returnMess = Form("%*d,%*d,%*d,%*d,%*d | %*d,%*d,%*d",2,eq,1,hs,1,chip,2,col,3,row,3,module,3,colM,3,rowM);
6727e2db 1945 return returnMess.Data();
1946 }
1947 else {
1948 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "Index %d out of bounds.", index);
1949 return returnMess.Data();
53ae21ce 1950 }
1951}
6727e2db 1952//____________________________________________________________________________________________
b696414b 1953UInt_t AliITSOnlineCalibrationSPDhandler::AddSilentFrom(AliITSOnlineCalibrationSPDhandler* other) {
1954 // returns number of new silent pixels in this' list (dead or inactive)
1955 UInt_t tmpdead = GetNrSilent();
1956
1957 for (UInt_t eq=0; eq<20; eq++) {
1958 if (!(other->IsActiveEq(eq))) ActivateEq(eq,kFALSE);
478d804c 1959 if (other->IsDeadEq(eq)) SetDeadEq(eq,kTRUE);
b696414b 1960 for (UInt_t hs=0; hs<6; hs++) {
1961 if (!(other->IsActiveHS(eq,hs))) ActivateHS(eq,hs,kFALSE);
478d804c 1962 if (other->IsDeadHS(eq,hs)) SetDeadHS(eq,hs,kTRUE);
b696414b 1963 for (UInt_t chip=0; chip<10; chip++) {
1964 if (!(other->IsActiveChip(eq,hs,chip))) ActivateChip(eq,hs,chip,kFALSE);
478d804c 1965 if (other->IsDeadChip(eq,hs,chip)) SetDeadChip(eq,hs,chip,kTRUE);
b696414b 1966 }
1967 }
1968 }
1969
1970 AddDeadFrom(other);
1971
1972 return GetNrSilent() - tmpdead;
1973}
1974//____________________________________________________________________________________________
6727e2db 1975UInt_t AliITSOnlineCalibrationSPDhandler::AddDeadFrom(AliITSOnlineCalibrationSPDhandler* other) {
1976 // returns number of new dead pixels in this' list
1977 UInt_t returnval=0;
1978 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1979 for (UInt_t ind1=0; ind1<other->fNrDead[gloChip]; ind1++) {
1980 UInt_t eq = other->GetDeadEqIdAtC2(gloChip,ind1);
1981 UInt_t hs = other->GetDeadHSAtC2(gloChip,ind1);
1982 UInt_t chip = other->GetDeadChipAtC2(gloChip,ind1);
1983 UInt_t col = other->GetDeadColAtC2(gloChip,ind1);
1984 UInt_t row = other->GetDeadRowAtC2(gloChip,ind1);
1985 if (SetDeadPixel(eq,hs,chip,col,row)) {
1986 returnval++;
1987 }
53ae21ce 1988 }
b15de2d2 1989 }
6727e2db 1990 return returnval;
b15de2d2 1991}
b696414b 1992//____________________________________________________________________________________________
6727e2db 1993UInt_t AliITSOnlineCalibrationSPDhandler::AddNoisyFrom(AliITSOnlineCalibrationSPDhandler* other) {
1994 // returns number of new noisy pixels in this' list
1995 UInt_t returnval=0;
1996 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1997 for (UInt_t ind1=0; ind1<other->fNrNoisy[gloChip]; ind1++) {
1998 UInt_t eq = other->GetNoisyEqIdAtC2(gloChip,ind1);
1999 UInt_t hs = other->GetNoisyHSAtC2(gloChip,ind1);
2000 UInt_t chip = other->GetNoisyChipAtC2(gloChip,ind1);
2001 UInt_t col = other->GetNoisyColAtC2(gloChip,ind1);
2002 UInt_t row = other->GetNoisyRowAtC2(gloChip,ind1);
2003 if (SetNoisyPixel(eq,hs,chip,col,row)) {
2004 returnval++;
2005 }
53ae21ce 2006 }
2007 }
6727e2db 2008 return returnval;
2009}
2010//____________________________________________________________________________________________
2011UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDiff(AliITSOnlineCalibrationSPDhandler* other) const {
b696414b 2012 // returns nr of dead/noisy in this' lists and not in other's lists (including inactive)
2013 return GetNrSilentDiff(other) + GetNrNoisyDiff(other);
53ae21ce 2014}
b696414b 2015//____________________________________________________________________________________________
2016UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2017 // returns nr of single silent pixels in this' lists and not in other's lists (dead or inactive)
2018 UInt_t returnval=0;
2019 for (UInt_t eq=0; eq<20; eq++) {
2020 for (UInt_t hs=0; hs<6; hs++) {
2021 for (UInt_t chip=0; chip<10; chip++) {
478d804c 2022 if (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs) || !IsActiveChip(eq,hs,chip) || IsDeadChip(eq,hs,chip)) {
2023 if (other->IsActiveEq(eq) && !other->IsDeadEq(eq) && other->IsActiveHS(eq,hs) && !other->IsDeadHS(eq,hs) && other->IsActiveChip(eq,hs,chip) && !other->IsDeadChip(eq,hs,chip)) {
b696414b 2024 // if this is inactive and the other is active...
2025 returnval+= 8192 - other->GetNrDeadC(eq,hs,chip);
2026 }
2027 }
2028 else {
2029 UInt_t gloChip = GetGloChip(eq,hs,chip);
2030 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2031 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2032 UInt_t col = GetColFromKey(key);
2033 UInt_t row = GetRowFromKey(key);
2034 if (!(other->IsPixelSilent(eq,hs,chip,col,row))) {
2035 returnval++;
2036 }
2037 }
2038 }
2039 }
2040 }
2041 }
2042 return returnval;
2043}
2044//____________________________________________________________________________________________
53ae21ce 2045UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2046 // returns nr of dead in this' lists and not in other's lists
2047 UInt_t returnval=0;
6727e2db 2048 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2049 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2050 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2051 UInt_t eq = GetEqIdFromKey(key);
53ae21ce 2052 UInt_t hs = GetHSFromKey(key);
2053 UInt_t chip = GetChipFromKey(key);
2054 UInt_t col = GetColFromKey(key);
2055 UInt_t row = GetRowFromKey(key);
6727e2db 2056 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
53ae21ce 2057 returnval++;
2058 }
2059 }
2060 }
2061 return returnval;
2062}
b696414b 2063//____________________________________________________________________________________________
53ae21ce 2064UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2065 // returns nr of noisy in this' lists and not in other's lists
2066 UInt_t returnval=0;
6727e2db 2067 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2068 for (UInt_t ind1=0; ind1<fNrNoisy[gloChip]; ind1++) {
2069 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind1);
2070 UInt_t eq = GetEqIdFromKey(key);
53ae21ce 2071 UInt_t hs = GetHSFromKey(key);
2072 UInt_t chip = GetChipFromKey(key);
2073 UInt_t col = GetColFromKey(key);
2074 UInt_t row = GetRowFromKey(key);
6727e2db 2075 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
53ae21ce 2076 returnval++;
2077 }
2078 }
b15de2d2 2079 }
53ae21ce 2080 return returnval;
2081}
b696414b 2082//____________________________________________________________________________________________
53ae21ce 2083AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDiff(AliITSOnlineCalibrationSPDhandler* other) const {
b696414b 2084 // returns handler with active/dead/noisy in this' lists, removing those that are in other's lists
53ae21ce 2085 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
b696414b 2086
2087 for (UInt_t eq=0; eq<20; eq++) {
2088 if (!(IsActiveEq(eq))) {
2089 newHandler->ActivateEq(eq,kFALSE);
2090 if (!other->IsActiveEq(eq)) newHandler->ActivateEq(eq);
2091 }
478d804c 2092 if (IsDeadEq(eq)) {
2093 newHandler->SetDeadEq(eq);
2094 if (other->IsDeadEq(eq)) newHandler->SetDeadEq(eq,kFALSE);
2095 }
b696414b 2096 for (UInt_t hs=0; hs<6; hs++) {
2097 if (!(IsActiveHS(eq,hs))) {
2098 newHandler->ActivateHS(eq,hs,kFALSE);
2099 if (!other->IsActiveHS(eq,hs)) newHandler->ActivateHS(eq,hs);
2100 }
478d804c 2101 if (IsDeadHS(eq,hs)) {
2102 newHandler->SetDeadHS(eq,hs);
2103 if (other->IsDeadHS(eq,hs)) newHandler->SetDeadHS(eq,hs,kFALSE);
2104 }
b696414b 2105 for (UInt_t chip=0; chip<10; chip++) {
2106 if (!(IsActiveChip(eq,hs,chip))) {
2107 newHandler->ActivateChip(eq,hs,chip,kFALSE);
2108 if (!other->IsActiveChip(eq,hs,chip)) newHandler->ActivateHS(eq,hs,chip);
2109 }
478d804c 2110 if (IsDeadChip(eq,hs,chip)) {
2111 newHandler->SetDeadChip(eq,hs,chip);
2112 if (other->IsDeadChip(eq,hs,chip)) newHandler->SetDeadChip(eq,hs,chip,kFALSE);
2113 }
b696414b 2114 }
2115 }
2116 }
2117
6727e2db 2118 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2119 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2120 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2121 UInt_t eq = GetEqIdFromKey(key);
53ae21ce 2122 UInt_t hs = GetHSFromKey(key);
2123 UInt_t chip = GetChipFromKey(key);
2124 UInt_t col = GetColFromKey(key);
2125 UInt_t row = GetRowFromKey(key);
6727e2db 2126 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2127 newHandler->SetDeadPixel(eq,hs,chip,col,row);
53ae21ce 2128 }
2129 }
b696414b 2130 }
2131
2132 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
6727e2db 2133 for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
2134 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
2135 UInt_t eq = GetEqIdFromKey(key);
53ae21ce 2136 UInt_t hs = GetHSFromKey(key);
2137 UInt_t chip = GetChipFromKey(key);
2138 UInt_t col = GetColFromKey(key);
2139 UInt_t row = GetRowFromKey(key);
6727e2db 2140 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2141 newHandler->SetNoisyPixel(eq,hs,chip,col,row);
53ae21ce 2142 }
2143 }
2144 }
b696414b 2145
53ae21ce 2146 return newHandler;
2147}
b696414b 2148//____________________________________________________________________________________________
2149AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetSilentDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2150 // returns handler with active/dead in this' lists, removing those that are in other's lists
2151 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2152
2153 for (UInt_t eq=0; eq<20; eq++) {
2154 if (!(IsActiveEq(eq))) {
2155 newHandler->ActivateEq(eq,kFALSE);
2156 if (!other->IsActiveEq(eq)) newHandler->ActivateEq(eq);
2157 }
478d804c 2158 if (IsDeadEq(eq)) {
2159 newHandler->SetDeadEq(eq);
2160 if (other->IsDeadEq(eq)) newHandler->SetDeadEq(eq,kFALSE);
2161 }
b696414b 2162 for (UInt_t hs=0; hs<6; hs++) {
2163 if (!(IsActiveHS(eq,hs))) {
2164 newHandler->ActivateHS(eq,hs,kFALSE);
2165 if (!other->IsActiveHS(eq,hs)) newHandler->ActivateHS(eq,hs);
2166 }
478d804c 2167 if (IsDeadHS(eq,hs)) {
2168 newHandler->SetDeadHS(eq,hs);
2169 if (other->IsDeadHS(eq,hs)) newHandler->SetDeadHS(eq,hs,kFALSE);
2170 }
b696414b 2171 for (UInt_t chip=0; chip<10; chip++) {
2172 if (!(IsActiveChip(eq,hs,chip))) {
2173 newHandler->ActivateChip(eq,hs,chip,kFALSE);
2174 if (!other->IsActiveChip(eq,hs,chip)) newHandler->ActivateHS(eq,hs,chip);
2175 }
478d804c 2176 if (IsDeadChip(eq,hs,chip)) {
2177 newHandler->SetDeadChip(eq,hs,chip);
2178 if (other->IsDeadChip(eq,hs,chip)) newHandler->SetDeadChip(eq,hs,chip,kFALSE);
2179 }
b696414b 2180 }
2181 }
2182 }
2183
2184 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2185 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2186 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2187 UInt_t eq = GetEqIdFromKey(key);
2188 UInt_t hs = GetHSFromKey(key);
2189 UInt_t chip = GetChipFromKey(key);
2190 UInt_t col = GetColFromKey(key);
2191 UInt_t row = GetRowFromKey(key);
2192 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2193 newHandler->SetDeadPixel(eq,hs,chip,col,row);
2194 }
2195 }
2196 }
2197
2198 return newHandler;
2199}
2200//____________________________________________________________________________________________
53ae21ce 2201AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2202 // returns handler with dead in this' lists, except for those in other's lists
2203 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
6727e2db 2204 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2205 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2206 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2207 UInt_t eq = GetEqIdFromKey(key);
53ae21ce 2208 UInt_t hs = GetHSFromKey(key);
2209 UInt_t chip = GetChipFromKey(key);
2210 UInt_t col = GetColFromKey(key);
2211 UInt_t row = GetRowFromKey(key);
6727e2db 2212 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2213 newHandler->SetDeadPixel(eq,hs,chip,col,row);
53ae21ce 2214 }
2215 }
2216 }
2217 return newHandler;
2218}
b696414b 2219//____________________________________________________________________________________________
53ae21ce 2220AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2221 // returns handler with noisy in this' lists, except for those in other's lists
2222 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
6727e2db 2223 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2224 for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
2225 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
2226 UInt_t eq = GetEqIdFromKey(key);
53ae21ce 2227 UInt_t hs = GetHSFromKey(key);
2228 UInt_t chip = GetChipFromKey(key);
2229 UInt_t col = GetColFromKey(key);
2230 UInt_t row = GetRowFromKey(key);
6727e2db 2231 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2232 newHandler->SetNoisyPixel(eq,hs,chip,col,row);
53ae21ce 2233 }
2234 }
2235 }
2236 return newHandler;
2237}
6727e2db 2238//____________________________________________________________________________________________
478d804c 2239void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
6727e2db 2240 // find gloChip and chipIndex from module and index
2241 if (index<GetNrDead(module)) {
2242 UInt_t eq = GetEqIdFromOffline(module);
2243 UInt_t hs = GetHSFromOffline(module);
2244
2245 UInt_t glVal=0;
b696414b 2246 for (UInt_t ch=0; ch<5; ch++) {
2247 gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
6727e2db 2248 if (glVal+fNrDead[gloChip]>index) {
2249 chipIndex = index-glVal;
2250 break;
2251 }
2252 else {
2253 glVal+=fNrDead[gloChip];
2254 }
2255 }
53ae21ce 2256
6727e2db 2257 }
2258 else {
2259 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead", "Index %d out of bounds.", index);
2260 }
2261}
b696414b 2262//____________________________________________________________________________________________
478d804c 2263void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
6727e2db 2264 // find gloChip and chipIndex from module and index
2265 if (index<GetNrNoisy(module)) {
2266 UInt_t eq = GetEqIdFromOffline(module);
2267 UInt_t hs = GetHSFromOffline(module);
2268
2269 UInt_t glVal=0;
b696414b 2270 for (UInt_t ch=0; ch<5; ch++) {
2271 gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
6727e2db 2272 if (glVal+fNrNoisy[gloChip]>index) {
2273 chipIndex = index-glVal;
2274 break;
2275 }
2276 else {
2277 glVal+=fNrNoisy[gloChip];
2278 }
53ae21ce 2279 }
6727e2db 2280
2281 }
2282 else {
2283 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy", "Index %d out of bounds.", index);
53ae21ce 2284 }
2285}
b696414b 2286//____________________________________________________________________________________________
478d804c 2287void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
6727e2db 2288 // find gloChip and chipIndex from module and index
2289 if (index<GetNrDeadEq(eq)) {
53ae21ce 2290
6727e2db 2291 UInt_t glVal=0;
2292 for (UInt_t hs=0; hs<6; hs++) {
2293 for (UInt_t chip=0; chip<10; chip++) {
2294 gloChip = GetGloChip(eq,hs,chip);
2295 if (glVal+fNrDead[gloChip]>index) {
2296 chipIndex = index-glVal;
2297 break;
2298 }
2299 else {
2300 glVal+=fNrDead[gloChip];
2301 }
53ae21ce 2302 }
53ae21ce 2303 }
6727e2db 2304
2305 }
2306 else {
2307 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead", "Index %d out of bounds.", index);
53ae21ce 2308 }
53ae21ce 2309}
b696414b 2310//____________________________________________________________________________________________
478d804c 2311void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
6727e2db 2312 // find gloChip and chipIndex from module and index
2313 if (index<GetNrNoisyEq(eq)) {
2314
2315 UInt_t glVal=0;
2316 for (UInt_t hs=0; hs<6; hs++) {
2317 for (UInt_t chip=0; chip<10; chip++) {
2318 gloChip = GetGloChip(eq,hs,chip);
2319 if (glVal+fNrNoisy[gloChip]>index) {
2320 chipIndex = index-glVal;
2321 break;
2322 }
2323 else {
2324 glVal+=fNrNoisy[gloChip];
2325 }
2326 }
2327 }
2328
2329 }
2330 else {
2331 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy", "Index %d out of bounds.", index);
2332 }
2333}
b696414b 2334//____________________________________________________________________________________________
478d804c 2335void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
6727e2db 2336 // find gloChip and chipIndex from global index
2337 if (index<GetNrDead()) {
2338
2339 UInt_t glVal=0;
2340 for (gloChip=0; gloChip<1200; gloChip++) {
2341 if (glVal+fNrDead[gloChip]>index) {
2342 chipIndex = index-glVal;
2343 break;
2344 }
2345 else {
2346 glVal+=fNrDead[gloChip];
2347 }
2348 }
2349
2350 }
2351 else {
2352 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead", "Index %d out of bounds.", index);
2353 }
2354}
b696414b 2355//____________________________________________________________________________________________
478d804c 2356void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
6727e2db 2357 // find gloChip and chipIndex from global index
2358 if (index<GetNrNoisy()) {
2359
2360 UInt_t glVal=0;
2361 for (gloChip=0; gloChip<1200; gloChip++) {
2362 if (glVal+fNrNoisy[gloChip]>index) {
2363 chipIndex = index-glVal;
2364 break;
2365 }
2366 else {
2367 glVal+=fNrNoisy[gloChip];
2368 }
2369 }
53ae21ce 2370
6727e2db 2371 }
2372 else {
2373 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy", "Index %d out of bounds.", index);
2374 }
2375}
2376//____________________________________________________________________________________________
2377UInt_t AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline(UInt_t module) const {
2378 // module to eq mapping
2379 if (module>=240) {
2380 Error("AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline", "module nr (%d) out of bounds.",module);
2381 return 20;
2382 }
2383 return AliITSRawStreamSPD::GetOnlineEqIdFromOffline(module);
53ae21ce 2384}
b696414b 2385//____________________________________________________________________________________________
6727e2db 2386UInt_t AliITSOnlineCalibrationSPDhandler::GetHSFromOffline(UInt_t module) const {
53ae21ce 2387 // module to hs mapping
6727e2db 2388 if (module>=240) {
2389 Error("AliITSOnlineCalibrationSPDhandler::GetHSFromOffline", "module nr (%d) out of bounds.",module);
2390 return 6;
2391 }
2392 return AliITSRawStreamSPD::GetOnlineHSFromOffline(module);
53ae21ce 2393}
b696414b 2394//____________________________________________________________________________________________
6727e2db 2395UInt_t AliITSOnlineCalibrationSPDhandler::GetChipFromOffline(UInt_t module, UInt_t colM) const {
53ae21ce 2396 // module,colM to chip mapping
6727e2db 2397 if (module>=240 || colM>=160) {
2398 Error("AliITSOnlineCalibrationSPDhandler::GetChipFromOffline", "module,colM nrs (%d,%d) out of bounds.",module,colM);
2399 return 10;
2400 }
2401 return AliITSRawStreamSPD::GetOnlineChipFromOffline(module,colM);
53ae21ce 2402}
b696414b 2403//____________________________________________________________________________________________
6727e2db 2404UInt_t AliITSOnlineCalibrationSPDhandler::GetColFromOffline(UInt_t module, UInt_t colM) const {
53ae21ce 2405 // colM to col mapping
6727e2db 2406 if (colM>=160) {
2407 Error("AliITSOnlineCalibrationSPDhandler::GetColFromOffline", "colM nr (%d) out of bounds.",colM);
2408 return 160;
2409 }
2410 return AliITSRawStreamSPD::GetOnlineColFromOffline(module,colM);
2411}
b696414b 2412//____________________________________________________________________________________________
6727e2db 2413UInt_t AliITSOnlineCalibrationSPDhandler::GetRowFromOffline(UInt_t module, UInt_t rowM) const {
2414 // rowM to row mapping
2415 if (rowM>=256) {
2416 Error("AliITSOnlineCalibrationSPDhandler::GetRowFromOffline", "rowM nr (%d) out of bounds.",rowM);
2417 return 256;
2418 }
2419 return AliITSRawStreamSPD::GetOnlineRowFromOffline(module,rowM);
2420}
2421//____________________________________________________________________________________________
2422UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC2(UInt_t gloChip) const {
2423 // returns nr of dead pixels on this chip
2424 if (gloChip>=1200) {
2425 Error("AliITSOnlineCalibrationSPDhandler::GetNrDeadC2", "global chip nr (%d) out of bounds.",gloChip);
2426 return 0;
2427 }
2428 return fNrDead[gloChip];
2429}
b696414b 2430//____________________________________________________________________________________________
6727e2db 2431UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2(UInt_t gloChip) const {
2432 // returns nr of noisy pixels on this chip
2433 if (gloChip>=1200) {
2434 Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2", "global chip nr (%d) out of bounds.",gloChip);
2435 return 0;
2436 }
2437 return fNrNoisy[gloChip];
2438}
b696414b 2439//____________________________________________________________________________________________
6727e2db 2440UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC2(UInt_t gloChip, UInt_t index) const {
2441 // get eq for the dead pixel at position index in list of dead
2442 if (gloChip>=1200) {
2443 Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
2444 return 20;
2445 }
2446 if (index<fNrDead[gloChip]) {
2447 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2448 return GetEqIdFromKey(key);
2449 }
2450 else {
2451 Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "Index %d out of bounds.", index);
2452 return 0;
2453 }
2454}
b696414b 2455//____________________________________________________________________________________________
6727e2db 2456UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC2(UInt_t gloChip, UInt_t index) const {
2457 // get eq for the noisy pixel at position index in list of noisy
2458 if (gloChip>=1200) {
2459 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
2460 return 20;
2461 }
2462 if (index<fNrNoisy[gloChip]) {
2463 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2464 return GetEqIdFromKey(key);
2465 }
2466 else {
2467 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "Index %d out of bounds.", index);
2468 return 0;
2469 }
2470}
b696414b 2471//____________________________________________________________________________________________
6727e2db 2472UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC2(UInt_t gloChip, UInt_t index) const {
2473 // get hs for the dead pixel at position index in list of dead
2474 if (gloChip>=1200) {
2475 Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "global chip nr (%d) out of bounds.",gloChip);
2476 return 20;
2477 }
2478 if (index<fNrDead[gloChip]) {
2479 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2480 return GetHSFromKey(key);
2481 }
2482 else {
2483 Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "Index %d out of bounds.", index);
2484 return 0;
2485 }
2486}
b696414b 2487//____________________________________________________________________________________________
6727e2db 2488UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC2(UInt_t gloChip, UInt_t index) const {
2489 // get hs for the noisy pixel at position index in list of noisy
2490 if (gloChip>=1200) {
2491 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "global chip nr (%d) out of bounds.",gloChip);
2492 return 20;
2493 }
2494 if (index<fNrNoisy[gloChip]) {
2495 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2496 return GetHSFromKey(key);
2497 }
2498 else {
2499 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "Index %d out of bounds.", index);
2500 return 0;
2501 }
b15de2d2 2502}
b696414b 2503//____________________________________________________________________________________________
6727e2db 2504UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC2(UInt_t gloChip, UInt_t index) const {
2505 // get chip for the dead pixel at position index in list of dead
2506 if (gloChip>=1200) {
2507 Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "global chip nr (%d) out of bounds.",gloChip);
2508 return 20;
2509 }
2510 if (index<fNrDead[gloChip]) {
2511 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2512 return GetChipFromKey(key);
2513 }
2514 else {
2515 Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "Index %d out of bounds.", index);
2516 return 0;
2517 }
2518}
b696414b 2519//____________________________________________________________________________________________
6727e2db 2520UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC2(UInt_t gloChip, UInt_t index) const {
2521 // get chip for the noisy pixel at position index in list of noisy
2522 if (gloChip>=1200) {
2523 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "global chip nr (%d) out of bounds.",gloChip);
2524 return 20;
2525 }
2526 if (index<fNrNoisy[gloChip]) {
2527 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2528 return GetChipFromKey(key);
2529 }
2530 else {
2531 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "Index %d out of bounds.", index);
2532 return 0;
2533 }
2534}
b696414b 2535//____________________________________________________________________________________________
6727e2db 2536UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2(UInt_t gloChip, UInt_t index) const {
2537 // get col for the dead pixel at position index in list of dead
2538 if (gloChip>=1200) {
2539 Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "global chip nr (%d) out of bounds.",gloChip);
2540 return 20;
2541 }
2542 if (index<fNrDead[gloChip]) {
2543 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2544 return GetColFromKey(key);
2545 }
2546 else {
2547 Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "Index %d out of bounds.", index);
2548 return 0;
2549 }
2550}
b696414b 2551//____________________________________________________________________________________________
6727e2db 2552UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC2(UInt_t gloChip, UInt_t index) const {
2553 // get col for the noisy pixel at position index in list of noisy
2554 if (gloChip>=1200) {
2555 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "global chip nr (%d) out of bounds.",gloChip);
2556 return 20;
2557 }
2558 if (index<fNrNoisy[gloChip]) {
2559 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2560 return GetColFromKey(key);
2561 }
2562 else {
2563 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "Index %d out of bounds.", index);
2564 return 0;
2565 }
2566}
b696414b 2567//____________________________________________________________________________________________
6727e2db 2568UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC2(UInt_t gloChip, UInt_t index) const {
2569 // get row for the dead pixel at position index in list of dead
2570 if (gloChip>=1200) {
2571 Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "global chip nr (%d) out of bounds.",gloChip);
2572 return 20;
2573 }
2574 if (index<fNrDead[gloChip]) {
2575 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2576 return GetRowFromKey(key);
2577 }
2578 else {
2579 Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "Index %d out of bounds.", index);
2580 return 0;
2581 }
2582}
b696414b 2583//____________________________________________________________________________________________
6727e2db 2584UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC2(UInt_t gloChip, UInt_t index) const {
2585 // get row for the noisy pixel at position index in list of noisy
2586 if (gloChip>=1200) {
2587 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "global chip nr (%d) out of bounds.",gloChip);
2588 return 20;
2589 }
2590 if (index<fNrNoisy[gloChip]) {
2591 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2592 return GetRowFromKey(key);
2593 }
2594 else {
2595 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "Index %d out of bounds.", index);
2596 return 0;
2597 }
2598}
b696414b 2599//____________________________________________________________________________________________
2600void AliITSOnlineCalibrationSPDhandler::ActivateALL() {
478d804c 2601 // activate all eq,hs,chips
b696414b 2602 for (UInt_t eq=0; eq<20; eq++) {
2603 ActivateEq(eq);
2604 for (UInt_t hs=0; hs<6; hs++) {
2605 ActivateHS(eq,hs);
2606 for (UInt_t chip=0; chip<10; chip++) {
2607 ActivateChip(eq,hs,chip);
2608 }
2609 }
2610 }
2611}
2612//____________________________________________________________________________________________
2613void AliITSOnlineCalibrationSPDhandler::ActivateEq(UInt_t eq, Bool_t setval) {
478d804c 2614 // activate eq
b696414b 2615 if (eq>=20) {
2616 Error("AliITSOnlineCalibrationSPDhandler::ActivateEq", "eq (%d) out of bounds.",eq);
2617 return;
2618 }
2619 fActiveEq[eq] = setval;
2620}
2621//____________________________________________________________________________________________
2622void AliITSOnlineCalibrationSPDhandler::ActivateHS(UInt_t eq, UInt_t hs, Bool_t setval) {
478d804c 2623 // activate hs
b696414b 2624 if (eq>=20 || hs>=6) {
2625 Error("AliITSOnlineCalibrationSPDhandler::ActivateHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2626 return;
2627 }
2628 fActiveHS[eq][hs] = setval;
2629}
2630//____________________________________________________________________________________________
2631void AliITSOnlineCalibrationSPDhandler::ActivateChip(UInt_t eq, UInt_t hs, UInt_t chip, Bool_t setval) {
478d804c 2632 // activate chip
b696414b 2633 if (eq>=20 || hs>=6 || chip>=10) {
2634 Error("AliITSOnlineCalibrationSPDhandler::ActivateChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2635 return;
2636 }
2637 fActiveChip[eq][hs][chip] = setval;
2638}
2639//____________________________________________________________________________________________
2640Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveEq(UInt_t eq) const {
478d804c 2641 // Is eq active?
b696414b 2642 if (eq>=20) {
2643 Error("AliITSOnlineCalibrationSPDhandler::IsActiveEq", "eq (%d) out of bounds.",eq);
2644 return kFALSE;
2645 }
2646 return fActiveEq[eq];
2647}
2648//____________________________________________________________________________________________
2649Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveHS(UInt_t eq, UInt_t hs) const {
478d804c 2650 // Is hs active?
b696414b 2651 if (eq>=20 || hs>=6) {
2652 Error("AliITSOnlineCalibrationSPDhandler::IsActiveHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2653 return kFALSE;
2654 }
2655 return fActiveHS[eq][hs];
2656}
2657//____________________________________________________________________________________________
2658Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
478d804c 2659 // Is chip active?
b696414b 2660 if (eq>=20 || hs>=6 || chip>=10) {
2661 Error("AliITSOnlineCalibrationSPDhandler::IsActiveChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2662 return kFALSE;
2663 }
2664 return fActiveChip[eq][hs][chip];
2665}
478d804c 2666//____________________________________________________________________________________________
2667void AliITSOnlineCalibrationSPDhandler::UnSetDeadALL() {
2668 // Clear all dead eq,hs,chips
2669 for (UInt_t eq=0; eq<20; eq++) {
2670 SetDeadEq(eq,kFALSE);
2671 for (UInt_t hs=0; hs<6; hs++) {
2672 SetDeadHS(eq,hs,kFALSE);
2673 for (UInt_t chip=0; chip<10; chip++) {
2674 SetDeadChip(eq,hs,chip,kFALSE);
2675 }
2676 }
2677 }
2678}
2679//____________________________________________________________________________________________
2680void AliITSOnlineCalibrationSPDhandler::SetDeadEq(UInt_t eq, Bool_t setval) {
2681 // set eq dead
2682 if (eq>=20) {
2683 Error("AliITSOnlineCalibrationSPDhandler::SetDeadEq", "eq (%d) out of bounds.",eq);
2684 return;
2685 }
2686 fDeadEq[eq] = setval;
2687}
2688//____________________________________________________________________________________________
2689void AliITSOnlineCalibrationSPDhandler::SetDeadHS(UInt_t eq, UInt_t hs, Bool_t setval) {
2690 // set hs dead
2691 if (eq>=20 || hs>=6) {
2692 Error("AliITSOnlineCalibrationSPDhandler::SetDeadHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2693 return;
2694 }
2695 fDeadHS[eq][hs] = setval;
2696}
2697//____________________________________________________________________________________________
2698void AliITSOnlineCalibrationSPDhandler::SetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip, Bool_t setval) {
2699 // set chip dead
2700 if (eq>=20 || hs>=6 || chip>=10) {
2701 Error("AliITSOnlineCalibrationSPDhandler::SetDeadChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2702 return;
2703 }
2704 fDeadChip[eq][hs][chip] = setval;
2705}
2706//____________________________________________________________________________________________
2707Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadEq(UInt_t eq) const {
2708 // is eq dead?
2709 if (eq>=20) {
2710 Error("AliITSOnlineCalibrationSPDhandler::IsDeadEq", "eq (%d) out of bounds.",eq);
2711 return kFALSE;
2712 }
2713 return fDeadEq[eq];
2714}
2715//____________________________________________________________________________________________
2716Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadHS(UInt_t eq, UInt_t hs) const {
2717 // is hs dead?
2718 if (eq>=20 || hs>=6) {
2719 Error("AliITSOnlineCalibrationSPDhandler::IsDeadHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2720 return kFALSE;
2721 }
2722 return fDeadHS[eq][hs];
2723}
2724//____________________________________________________________________________________________
2725Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
2726 // is chip dead?
2727 if (eq>=20 || hs>=6 || chip>=10) {
2728 Error("AliITSOnlineCalibrationSPDhandler::IsDeadChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2729 return kFALSE;
2730 }
2731 return fDeadChip[eq][hs][chip];
2732}
2733//____________________________________________________________________________________________
2734Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentEq(UInt_t eq) const {
2735 // is eq silent?
2736 if (eq>=20) {
2737 Error("AliITSOnlineCalibrationSPDhandler::IsSilentEq", "eq (%d) out of bounds.",eq);
2738 return kFALSE;
2739 }
2740 return (!IsActiveEq(eq) || IsDeadEq(eq));
2741}
2742//____________________________________________________________________________________________
2743Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentHS(UInt_t eq, UInt_t hs) const {
2744 // is hs silent?
2745 if (eq>=20 || hs>=6) {
2746 Error("AliITSOnlineCalibrationSPDhandler::IsSilentHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2747 return kFALSE;
2748 }
2749 return (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs));
2750}
2751//____________________________________________________________________________________________
2752Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
2753 // is chip silent?
2754 if (eq>=20 || hs>=6 || chip>=10) {
2755 Error("AliITSOnlineCalibrationSPDhandler::IsSilentChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2756 return kFALSE;
2757 }
2758 return (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs) || !IsActiveChip(eq,hs,chip) || IsDeadChip(eq,hs,chip));
2759}