]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSOnlineCalibrationSPDhandler.cxx
Do not use tracks when the propagation to the vertex failed
[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();
bb292d31 614 if (nrDead>0) {
6727e2db 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++) {
6727e2db 659 calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
478d804c 660 UInt_t nrNoisy = calibSPD->GetNrBadSingle();
6727e2db 661 if (nrNoisy>0) {
662 if (!treeSerial) {
6727e2db 663 RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
664 }
665 else {
666 for (UInt_t index=0; index<nrNoisy; index++) {
667 UInt_t colM = calibSPD->GetBadColAt(index);
668 UInt_t rowM = calibSPD->GetBadRowAt(index);
669 SetNoisyPixelM(module,colM,rowM);
670 }
671 }
53ae21ce 672 }
673 }
674 spdEntry->SetOwner(kTRUE);
675 spdEntry->Clear();
676 return kTRUE;
677}
b696414b 678//____________________________________________________________________________________________
6727e2db 679Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromCalibObj(TObjArray* calObj) {
680 // reads dead pixels from calib object
681 for (UInt_t module=0; module<240; module++) {
478d804c 682 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*)calObj->At(module);
683 for (Int_t i=0; i<calibSPD->GetNrBadSingle(); i++) {
684 SetDeadPixelM(module,calibSPD->GetBadColAt(i),calibSPD->GetBadRowAt(i));
685 }
686 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
687 UInt_t eq,hs,chip,col,row;
688 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
689 if (calibSPD->IsChipBad(chipIndex)) {
690 SetDeadChip(eq,hs,chip);
691 }
692 else {
693 SetDeadChip(eq,hs,chip,kFALSE);
694 }
6727e2db 695 }
696 }
697 return kTRUE;
698}
b696414b 699//____________________________________________________________________________________________
6727e2db 700Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromCalibObj(TObjArray* calObj) {
701 // reads noisy pixels from calib object
702 for (UInt_t module=0; module<240; module++) {
478d804c 703 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*)calObj->At(module);
704 for (Int_t i=0; i<calibSPD->GetNrBadSingle(); i++) {
705 SetNoisyPixelM(module,calibSPD->GetBadColAt(i),calibSPD->GetBadRowAt(i));
6727e2db 706 }
707 }
708 return kTRUE;
709}
b696414b 710//____________________________________________________________________________________________
53ae21ce 711Bool_t AliITSOnlineCalibrationSPDhandler::WriteToDB(Int_t runNrStart, Int_t runNrEnd) {
6727e2db 712 // writes dead and noisy pixels to DB for given runNrs
713 // overwrites any previous entries
714 return (WriteNoisyToDB(runNrStart,runNrEnd) && WriteDeadToDB(runNrStart,runNrEnd));
715}
b696414b 716//____________________________________________________________________________________________
6727e2db 717Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDB(Int_t runNrStart, Int_t runNrEnd) {
718 // writes dead pixels to DB for given runNrs
53ae21ce 719 // overwrites any previous entries
720 AliCDBManager* man = AliCDBManager::Instance();
721 if(!man->IsDefaultStorageSet()) {
722 man->SetDefaultStorage("local://$ALICE_ROOT");
723 }
724 AliCDBMetaData* metaData = new AliCDBMetaData();
725 metaData->SetResponsible("Henrik Tydesjo");
726 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
6727e2db 727 AliCDBId idCalSPD("ITS/Calib/SPDDead",runNrStart,runNrEnd);
53ae21ce 728 TObjArray* spdEntry = new TObjArray(240);
729 spdEntry->SetOwner(kTRUE);
730 for(UInt_t module=0; module<240; module++){
478d804c 731 AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
478d804c 732 spdEntry->Add(calibSPD);
53ae21ce 733 }
734 for(UInt_t module=0; module<240; module++){
478d804c 735 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
bb292d31 736 calibSPD->SetNrBadSingle( GetNrDeadSingle(module) );
478d804c 737 calibSPD->SetBadList( GetDeadArray(module) );
738 for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
739 UInt_t eq,hs,chip,col,row;
740 AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
741 if (IsSilentChip(eq,hs,chip)) {
742 calibSPD->SetChipBad(chipIndex);
743 }
744 else {
745 calibSPD->UnSetChipBad(chipIndex);
746 }
747 }
53ae21ce 748 }
749 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
750 man->Put(cdbEntry);
751 delete spdEntry;
752 delete cdbEntry;
753 delete metaData;
754 return kTRUE;
755}
b696414b 756//____________________________________________________________________________________________
6727e2db 757Bool_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToDB(Int_t runNrStart, Int_t runNrEnd) {
758 // writes noisy pixels to DB for given runNrs
759 // overwrites any previous entries
760 AliCDBManager* man = AliCDBManager::Instance();
761 if(!man->IsDefaultStorageSet()) {
762 man->SetDefaultStorage("local://$ALICE_ROOT");
763 }
764 AliCDBMetaData* metaData = new AliCDBMetaData();
765 metaData->SetResponsible("Henrik Tydesjo");
766 metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
767 AliCDBId idCalSPD("ITS/Calib/SPDNoisy",runNrStart,runNrEnd);
768 TObjArray* spdEntry = new TObjArray(240);
769 spdEntry->SetOwner(kTRUE);
770 for(UInt_t module=0; module<240; module++){
478d804c 771 AliITSCalibrationSPD* calibSPD = new AliITSCalibrationSPD();
478d804c 772 spdEntry->Add(calibSPD);
3479cee3 773 }
6727e2db 774 for(UInt_t module=0; module<240; module++){
478d804c 775 AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
bb292d31 776 calibSPD->SetNrBadSingle( GetNrNoisySingle(module) );
478d804c 777 calibSPD->SetBadList( GetNoisyArray(module) );
53ae21ce 778 }
6727e2db 779 AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
780 man->Put(cdbEntry);
781 delete spdEntry;
782 delete cdbEntry;
783 delete metaData;
784 return kTRUE;
53ae21ce 785}
6727e2db 786//____________________________________________________________________________________________
787void AliITSOnlineCalibrationSPDhandler::RecursiveInsertDead(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
788 // inserts dead pixels recursively, used when reading from db
789 if (lowInd>highInd) return;
790 Int_t thisInd = lowInd+(highInd-lowInd)/2;
791 SetDeadPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
792 RecursiveInsertDead(calibSPD,module,lowInd,thisInd-1);
793 RecursiveInsertDead(calibSPD,module,thisInd+1,highInd);
794}
b696414b 795//____________________________________________________________________________________________
6727e2db 796void AliITSOnlineCalibrationSPDhandler::RecursiveInsertNoisy(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
797 // inserts noisy pixels recursively, used when reading from db
6727e2db 798 if (lowInd>highInd) return;
799 Int_t thisInd = lowInd+(highInd-lowInd)/2;
800 SetNoisyPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
801 RecursiveInsertNoisy(calibSPD,module,lowInd,thisInd-1);
802 RecursiveInsertNoisy(calibSPD,module,thisInd+1,highInd);
53ae21ce 803}
6727e2db 804
805#endif
806//____________________________________________________________________________________________
807void AliITSOnlineCalibrationSPDhandler::GenerateDCSConfigFile(const Char_t* fileName) {
808 // generates an ascii file in the format as the one produced by online da (but with dummy runNr=0)
809 ofstream dcsfile;
810 dcsfile.open(fileName);
811 dcsfile << "[SPD SCAN]\n";
812 dcsfile << "RunNumber=" << "0" << "\n"; // dummy value
813 dcsfile << "Type=" << "4" << "\n";
814 dcsfile << "Router=" << "0" << "\n"; // dummy value
4f88491f 815 dcsfile << "ActualDetConfiguration=" << "0,-1,-1\n"; // dummy values
6727e2db 816 dcsfile << "[NOISY]\n";
53ae21ce 817 for (UInt_t module=0; module<240; module++) {
6727e2db 818 UInt_t headkey=20*10*6;
819 for (UInt_t ind=0; ind<GetNrNoisy(module); ind++) {
820 UInt_t newkey = GetNoisyEqIdAt(module,ind)*10*6 +
821 GetNoisyHSAt(module,ind)*10 +
822 GetNoisyChipAt(module,ind);
823 if (newkey!=headkey) { // print eq,hs,chip header
824 headkey = newkey;
825 dcsfile << "-" << newkey/(6*10) << "," << (newkey%(6*10))/10 << "," << (newkey%(6*10))%10 << "\n";
826 }
827 dcsfile << GetNoisyColAt(module,ind) << "," << GetNoisyRowAt(module,ind) << "\n";
53ae21ce 828 }
829 }
6727e2db 830 dcsfile.close();
53ae21ce 831}
6727e2db 832//____________________________________________________________________________________________
b696414b 833TArrayS AliITSOnlineCalibrationSPDhandler::GetSilentArray(UInt_t module, Bool_t treeSerial) {
834 // get a TArrayS of the silent=dead+inactive pixels (format for the AliITSCalibrationSPD object)
478d804c 835 // NB! with new implementation of AliITSCalibrationSPD this is not needed anymore
b696414b 836 TArrayS returnArray;
837
838 UInt_t eq = GetEqIdFromOffline(module);
839 UInt_t hs = GetHSFromOffline(module);
840 UInt_t size=0;
841 if ( !( IsActiveEq(eq) && IsActiveHS(eq,hs) ) ) {
842 size = 8192*5;
843 }
844 else {
845 for (UInt_t ch=0; ch<5; ch++) {
846 UInt_t chip = GetChipFromOffline(module,ch*32);
847 if (!(IsActiveChip(eq,hs,chip))) {
848 size += 8192;
849 }
850 else {
851 UInt_t gloChip = GetGloChip(eq,hs,chip);
852 size += fNrDead[gloChip];
853 }
854 }
855 }
856 returnArray.Set(size*2);
857
858 UInt_t gloIndex=0;
859 if ( !( IsActiveEq(eq) && IsActiveHS(eq,hs) ) ) {
860 for (UInt_t colM=0; colM<160; colM++) {
861 for (UInt_t rowM=0; rowM<256; rowM++) {
862 returnArray.AddAt(colM,gloIndex*2);
863 returnArray.AddAt(rowM,gloIndex*2+1);
864 gloIndex++;
865 }
866 }
867 }
868 else {
869 for (UInt_t ch=0; ch<5; ch++) {
870 UInt_t chip = GetChipFromOffline(module,ch*32);
871 if (!(IsActiveChip(eq,hs,chip))) {
872 for (UInt_t colM=ch*32; colM<ch*32+32; colM++) {
873 for (UInt_t rowM=0; rowM<256; rowM++) {
874 returnArray.AddAt(colM,gloIndex*2);
875 returnArray.AddAt(rowM,gloIndex*2+1);
876 gloIndex++;
877 }
878 }
879 }
880 else {
881 UInt_t gloChip = GetGloChip(eq,hs,chip);
882 if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
883 else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
884 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
885 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
886 Int_t colM = GetColMFromKey(key);
887 Int_t rowM = GetRowMFromKey(key);
888 returnArray.AddAt(colM,gloIndex*2);
889 returnArray.AddAt(rowM,gloIndex*2+1);
890 gloIndex++;
891 }
892 }
893 }
894 }
895 return returnArray;
896}
897//____________________________________________________________________________________________
e03405c9 898TArrayS AliITSOnlineCalibrationSPDhandler::GetDeadArray(UInt_t module, Bool_t treeSerial) {
478d804c 899 // get a TArrayS of the single dead pixels (format for the AliITSCalibrationSPD object)
e03405c9 900 TArrayS returnArray;
6727e2db 901
902 UInt_t eq = GetEqIdFromOffline(module);
903 UInt_t hs = GetHSFromOffline(module);
bb292d31 904 UInt_t size=GetNrDeadSingle(module);
6727e2db 905 returnArray.Set(size*2);
906 UInt_t gloIndex=0;
b696414b 907 for (UInt_t ch=0; ch<5; ch++) {
478d804c 908 UInt_t chip = GetChipFromOffline(module,ch*32);
909 UInt_t gloChip = GetGloChip(eq,hs,chip);
6727e2db 910 if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
911 else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
478d804c 912 if (!IsSilentChip(eq,hs,chip)) {
913 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
914 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
915 Int_t colM = GetColMFromKey(key);
916 Int_t rowM = GetRowMFromKey(key);
917 returnArray.AddAt(colM,gloIndex*2);
918 returnArray.AddAt(rowM,gloIndex*2+1);
919 gloIndex++;
920 }
53ae21ce 921 }
922 }
6727e2db 923 return returnArray;
53ae21ce 924}
b696414b 925//____________________________________________________________________________________________
e03405c9 926TArrayS AliITSOnlineCalibrationSPDhandler::GetNoisyArray(UInt_t module, Bool_t treeSerial) {
478d804c 927 // get a TArrayS of the single noisy pixels (format for the AliITSCalibrationSPD object)
e03405c9 928 TArrayS returnArray;
6727e2db 929
930 UInt_t eq = GetEqIdFromOffline(module);
931 UInt_t hs = GetHSFromOffline(module);
bb292d31 932 UInt_t size=GetNrNoisySingle(module);
6727e2db 933 returnArray.Set(size*2);
934 UInt_t gloIndex=0;
b696414b 935 for (UInt_t ch=0; ch<5; ch++) {
936 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
6727e2db 937 if (treeSerial) fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
938 else fNoisyPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
939 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
940 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
941 Int_t colM = GetColMFromKey(key);
942 Int_t rowM = GetRowMFromKey(key);
943 returnArray.AddAt(colM,gloIndex*2);
944 returnArray.AddAt(rowM,gloIndex*2+1);
945 gloIndex++;
946 }
b15de2d2 947 }
948 return returnArray;
949}
b696414b 950//____________________________________________________________________________________________
60d9faf6 951TArrayI AliITSOnlineCalibrationSPDhandler::GetDeadArrayOnline(UInt_t eq) {
478d804c 952 // get a TArrayI of the single dead pixels (format for the AliITSOnlineCalibrationSPD object)
60d9faf6 953 TArrayI returnArray;
6727e2db 954 // fix size of array
955 UInt_t size=0;
956 for (UInt_t hs=0; hs<6; hs++) {
957 for (UInt_t chip=0; chip<10; chip++) {
958 UInt_t gloChip = GetGloChip(eq,hs,chip);
959 size+=fNrDead[gloChip];
960 }
961 }
962 returnArray.Set(size);
963 // put keys in array
964 UInt_t gloIndex=0;
965 for (UInt_t hs=0; hs<6; hs++) {
966 for (UInt_t chip=0; chip<10; chip++) {
967 UInt_t gloChip = GetGloChip(eq,hs,chip);
968 fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
969 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
970 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
971 returnArray.AddAt(key,gloIndex);
972 gloIndex++;
973 }
974 }
b15de2d2 975 }
976 return returnArray;
977}
b696414b 978//____________________________________________________________________________________________
60d9faf6 979TArrayI AliITSOnlineCalibrationSPDhandler::GetNoisyArrayOnline(UInt_t eq) {
478d804c 980 // get a TArrayI of the single noisy pixels (format for the AliITSOnlineCalibrationSPD object)
60d9faf6 981 TArrayI returnArray;
6727e2db 982 // fix size of array
983 UInt_t size=0;
984 for (UInt_t hs=0; hs<6; hs++) {
985 for (UInt_t chip=0; chip<10; chip++) {
986 UInt_t gloChip = GetGloChip(eq,hs,chip);
987 size+=fNrNoisy[gloChip];
988 }
53ae21ce 989 }
6727e2db 990 returnArray.Set(size);
991 // put keys in array
992 UInt_t gloIndex=0;
993 for (UInt_t hs=0; hs<6; hs++) {
994 for (UInt_t chip=0; chip<10; chip++) {
995 UInt_t gloChip = GetGloChip(eq,hs,chip);
996 fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
997 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
998 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
999 returnArray.AddAt(key,gloIndex);
1000 gloIndex++;
53ae21ce 1001 }
1002 }
1003 }
6727e2db 1004 return returnArray;
b15de2d2 1005}
6727e2db 1006//____________________________________________________________________________________________
1007void AliITSOnlineCalibrationSPDhandler::PrintEqSummary() {
1008// print summary (nr of dead and noisy) for each equipment
1009 printf("-----------\n");
1010 printf("Eq summary:\n");
1011 printf("-----------\n");
1012 for (UInt_t eq=0; eq<20; eq++) {
478d804c 1013 printf("Eq %*d: %*d silent(dead+inactive) , %*d dead , %*d noisy\n",2,eq,6,GetNrSilentEq(eq),6,GetNrDeadEq(eq),6,GetNrNoisyEq(eq));
b15de2d2 1014 }
b15de2d2 1015}
b696414b 1016//____________________________________________________________________________________________
1017void AliITSOnlineCalibrationSPDhandler::PrintSilent() const {
1018 // print the inactive and dead pixels to screen
478d804c 1019 printf("-----------------------------------------------------------\n");
1020 printf("Inactive or dead Equipments: (eq | module1 .. module12)\n");
1021 printf("-----------------------------------------------------------\n");
b696414b 1022 for (UInt_t eq=0; eq<20; eq++) {
478d804c 1023 if (IsSilentEq(eq)) {
b696414b 1024 printf("%*d | ",2,eq);
1025 for (UInt_t hs=0; hs<6; hs++) {
1026 for (UInt_t chip=0; chip<10; chip+=5) {
1027 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1028 if (hs>0 || chip==5) printf(",");
1029 printf("%*d",3,module);
1030 }
1031 }
1032 printf("\n");
1033 }
1034 }
1035
478d804c 1036 printf("-----------------------------------------------------------\n");
1037 printf("Inactive or dead Half-staves: (eq,hs | module1,module2)\n");
1038 printf("-----------------------------------------------------------\n");
b696414b 1039 for (UInt_t eq=0; eq<20; eq++) {
478d804c 1040 if (!IsSilentEq(eq)) {
b696414b 1041 for (UInt_t hs=0; hs<6; hs++) {
478d804c 1042 if (IsSilentHS(eq,hs)) {
b696414b 1043 printf("%*d,%*d | ",2,eq,1,hs);
1044 for (UInt_t chip=0; chip<10; chip+=5) {
1045 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1046 if (chip==5) printf(",");
1047 printf("%*d",3,module);
1048 }
1049 printf("\n");
1050 }
1051 }
1052 }
1053 }
1054
478d804c 1055 printf("-----------------------------------------------------------\n");
1056 printf("Inactive or dead Chips: (eq,hs,chip | module,colM1-colM2)\n");
1057 printf("-----------------------------------------------------------\n");
b696414b 1058 for (UInt_t eq=0; eq<20; eq++) {
478d804c 1059 if (!IsSilentEq(eq)) {
b696414b 1060 for (UInt_t hs=0; hs<6; hs++) {
478d804c 1061 if (!IsSilentHS(eq,hs)) {
b696414b 1062 for (UInt_t chip=0; chip<10; chip++) {
478d804c 1063 if (IsSilentChip(eq,hs,chip)) {
b696414b 1064 printf("%*d,%*d,%*d | ",2,eq,1,hs,1,chip);
1065 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1066 UInt_t colM1 = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,0);
1067 UInt_t colM2 = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,31);
1068 printf("%*d,%*d-%*d\n",3,module,3,colM1,3,colM2);
1069 }
1070 }
1071 }
1072 }
1073 }
1074 }
1075
1076 PrintDead();
1077
b696414b 1078}
1079//____________________________________________________________________________________________
6727e2db 1080void AliITSOnlineCalibrationSPDhandler::PrintDead() const {
b696414b 1081 // print the single dead pixels to screen (disregards inactive eq,hs,chip)
6727e2db 1082 printf("------------------------------------------------------\n");
1083 printf("Dead Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
1084 printf("------------------------------------------------------\n");
1085 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1086 for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
1087 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
1088 UInt_t eq = GetEqIdFromKey(key);
1089 UInt_t hs = GetHSFromKey(key);
1090 UInt_t chip = GetChipFromKey(key);
1091 UInt_t col = GetColFromKey(key);
1092 UInt_t row = GetRowFromKey(key);
b15de2d2 1093
6727e2db 1094 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1095 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1096 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1097
1098 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);
1099 }
b15de2d2 1100 }
b15de2d2 1101}
b696414b 1102//____________________________________________________________________________________________
6727e2db 1103void AliITSOnlineCalibrationSPDhandler::PrintNoisy() const {
1104 // print the dead pixels to screen
1105 printf("-------------------------------------------------------\n");
1106 printf("Noisy Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
1107 printf("-------------------------------------------------------\n");
1108 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1109 for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
1110 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
1111 UInt_t eq = GetEqIdFromKey(key);
1112 UInt_t hs = GetHSFromKey(key);
1113 UInt_t chip = GetChipFromKey(key);
1114 UInt_t col = GetColFromKey(key);
1115 UInt_t row = GetRowFromKey(key);
b15de2d2 1116
6727e2db 1117 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1118 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1119 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
1120
1121 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);
1122 }
3479cee3 1123 }
3479cee3 1124}
6727e2db 1125//____________________________________________________________________________________________
1126Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1127 // set a dead pixel, returns false if pixel is already dead
1128 UInt_t gloChip = GetGloChip(eq,hs,chip);
1129 if (gloChip>=1200) {
1130 Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1131 return kFALSE;
1132 }
1133 if (col>=32 && row>=256) {
1134 Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
1135 return kFALSE;
1136 }
1137 Int_t key = GetKey(eq,hs,chip,col,row);
1138 // if noisy we dont want to add it...
1139 if (fNoisyPixelMap[gloChip]->Find(key) != NULL) return kFALSE;
1140 if (fDeadPixelMap[gloChip]->Insert(key,gloChip)) {
1141 fNrDead[gloChip]++;
3479cee3 1142 return kTRUE;
1143 }
1144 return kFALSE;
1145}
b696414b 1146//____________________________________________________________________________________________
6727e2db 1147Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1148 // set a noisy pixel, returns false if pixel is already noisy
1149 UInt_t gloChip = GetGloChip(eq,hs,chip);
1150 if (gloChip>=1200) {
1151 Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1152 return kFALSE;
b15de2d2 1153 }
6727e2db 1154 if (col>=32 && row>=256) {
1155 Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
b15de2d2 1156 return kFALSE;
1157 }
6727e2db 1158 Int_t key = GetKey(eq,hs,chip,col,row);
1159 // if dead before - remove from the dead list
1160 if (fDeadPixelMap[gloChip]->Remove(key)) {
1161 fNrDead[gloChip]--;
1162 }
1163 if (fNoisyPixelMap[gloChip]->Insert(key,gloChip)) {
1164 fNrNoisy[gloChip]++;
1165 return kTRUE;
1166 }
1167 return kFALSE;
b15de2d2 1168}
b696414b 1169//____________________________________________________________________________________________
6727e2db 1170Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1171 // set a dead pixel, returns false if pixel is already dead
1172 UInt_t eq = GetEqIdFromOffline(module);
53ae21ce 1173 UInt_t hs = GetHSFromOffline(module);
1174 UInt_t chip = GetChipFromOffline(module,colM);
6727e2db 1175 UInt_t col = GetColFromOffline(module,colM);
1176 UInt_t row = GetRowFromOffline(module,rowM);
1177 return SetDeadPixel(eq,hs,chip,col,row);
53ae21ce 1178}
b696414b 1179//____________________________________________________________________________________________
6727e2db 1180Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1181 // set a noisy pixel, returns false if pixel is already noisy
1182 UInt_t eq = GetEqIdFromOffline(module);
1183 UInt_t hs = GetHSFromOffline(module);
1184 UInt_t chip = GetChipFromOffline(module,colM);
1185 UInt_t col = GetColFromOffline(module,colM);
1186 UInt_t row = GetRowFromOffline(module,rowM);
1187 return SetNoisyPixel(eq,hs,chip,col,row);
53ae21ce 1188}
b696414b 1189//____________________________________________________________________________________________
6727e2db 1190Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1191 // unset a dead pixel, returns false if pixel is not dead
1192 UInt_t gloChip = GetGloChip(eq,hs,chip);
1193 if (gloChip>=1200) {
1194 Error("AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1195 return kFALSE;
53ae21ce 1196 }
6727e2db 1197 Int_t key = GetKey(eq,hs,chip,col,row);
1198 if (fDeadPixelMap[gloChip]->Remove(key)) {
1199 fNrDead[gloChip]--;
1200 return kTRUE;
53ae21ce 1201 }
6727e2db 1202 return kFALSE;
53ae21ce 1203}
b696414b 1204//____________________________________________________________________________________________
6727e2db 1205Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
1206 // unset a noisy pixel, returns false if pixel is not noisy
1207 UInt_t gloChip = GetGloChip(eq,hs,chip);
1208 if (gloChip>=1200) {
1209 Error("AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
1210 return kFALSE;
53ae21ce 1211 }
6727e2db 1212 Int_t key = GetKey(eq,hs,chip,col,row);
1213 if (fNoisyPixelMap[gloChip]->Remove(key)) {
1214 fNrNoisy[gloChip]--;
1215 return kTRUE;
53ae21ce 1216 }
6727e2db 1217 return kFALSE;
53ae21ce 1218}
b696414b 1219//____________________________________________________________________________________________
6727e2db 1220Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1221 // unset a dead pixel, returns false if pixel is not dead
1222 UInt_t eq = GetEqIdFromOffline(module);
1223 UInt_t hs = GetHSFromOffline(module);
1224 UInt_t chip = GetChipFromOffline(module,colM);
1225 UInt_t col = GetColFromOffline(module,colM);
1226 UInt_t row = GetRowFromOffline(module,rowM);
1227 return UnSetDeadPixel(eq,hs,chip,col,row);
53ae21ce 1228}
b696414b 1229//____________________________________________________________________________________________
6727e2db 1230Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
1231 // unset a noisy pixel, returns false if pixel is not noisy
1232 UInt_t eq = GetEqIdFromOffline(module);
1233 UInt_t hs = GetHSFromOffline(module);
1234 UInt_t chip = GetChipFromOffline(module,colM);
1235 UInt_t col = GetColFromOffline(module,colM);
1236 UInt_t row = GetRowFromOffline(module,rowM);
1237 return UnSetNoisyPixel(eq,hs,chip,col,row);
53ae21ce 1238}
b696414b 1239//____________________________________________________________________________________________
478d804c 1240Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBad(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1241 // is the pixel bad (silent or noisy)
1242 return (IsPixelSilent(eq,hs,chip,col,row) || IsPixelNoisy(eq,hs,chip,col,row));
53ae21ce 1243}
6727e2db 1244//____________________________________________________________________________________________
b696414b 1245Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilent(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1246 // is the pixel silent (dead or inactive)?
6727e2db 1247 UInt_t gloChip = GetGloChip(eq,hs,chip);
b696414b 1248 if (gloChip>=1200 || col>=32 || row>=256) {
1249 Error("AliITSOnlineCalibrationSPDhandler::IsPixelSilent", "eq,hs,chip,col,row nrs (%d,%d,%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
6727e2db 1250 return kFALSE;
53ae21ce 1251 }
478d804c 1252 if (IsSilentChip(eq,hs,chip)) return kTRUE;
b696414b 1253 else return IsPixelDead(eq,hs,chip,col,row);
1254}
1255//____________________________________________________________________________________________
1256Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDead(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
478d804c 1257 // is the pixel dead?
b696414b 1258 UInt_t gloChip = GetGloChip(eq,hs,chip);
1259 if (gloChip>=1200 || col>=32 || row>=256) {
1260 Error("AliITSOnlineCalibrationSPDhandler::IsPixelDead", "eq,hs,chip,col,row nrs (%d,%d,%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
6727e2db 1261 return kFALSE;
1262 }
b696414b 1263 UInt_t key = GetKey(eq,hs,chip,col,row);
478d804c 1264 if (IsDeadEq(eq) || IsDeadHS(eq,hs) || IsDeadChip(eq,hs,chip)) return kTRUE;
1265 else {
1266 if ( fDeadPixelMap[gloChip]->Find(key) != NULL ) return kTRUE;
1267 else return kFALSE;
1268 }
b15de2d2 1269}
b696414b 1270//____________________________________________________________________________________________
6727e2db 1271Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisy(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
1272 // is the pixel noisy?
1273 UInt_t gloChip = GetGloChip(eq,hs,chip);
b696414b 1274 if (gloChip>=1200 || col>=32 || row>=256) {
1275 Error("AliITSOnlineCalibrationSPDhandler::IsPixelNoisy", "eq,hs,chip,col,row nrs (%d,%d,%d) out of bounds.",eq,hs,chip,col,row);
6727e2db 1276 return kFALSE;
1277 }
1278 UInt_t key = GetKey(eq,hs,chip,col,row);
b696414b 1279 if ( fNoisyPixelMap[gloChip]->Find(key) != NULL ) return kTRUE;
1280 else return kFALSE;
3479cee3 1281}
b696414b 1282//____________________________________________________________________________________________
478d804c 1283Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBadM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1284 // is the pixel bad (silent or noisy)?
1285 return (IsPixelSilentM(module,colM,rowM) || IsPixelNoisyM(module,colM,rowM));
1286}
1287//____________________________________________________________________________________________
b696414b 1288Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilentM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1289 // is the pixel silent (dead or inactive)?
1290 UInt_t eq = GetEqIdFromOffline(module);
1291 UInt_t hs = GetHSFromOffline(module);
1292 UInt_t chip = GetChipFromOffline(module,colM);
1293 UInt_t col = GetColFromOffline(module,colM);
1294 UInt_t row = GetRowFromOffline(module,rowM);
1295 return IsPixelSilent(eq,hs,chip,col,row);
1296}
1297//____________________________________________________________________________________________
6727e2db 1298Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1299 // is the pixel dead?
1300 UInt_t eq = GetEqIdFromOffline(module);
3479cee3 1301 UInt_t hs = GetHSFromOffline(module);
1302 UInt_t chip = GetChipFromOffline(module,colM);
6727e2db 1303 UInt_t col = GetColFromOffline(module,colM);
1304 UInt_t row = GetRowFromOffline(module,rowM);
1305 return IsPixelDead(eq,hs,chip,col,row);
1306}
b696414b 1307//____________________________________________________________________________________________
6727e2db 1308Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyM(UInt_t module, UInt_t colM, UInt_t rowM) const {
1309 // is the pixel noisy?
1310 UInt_t eq = GetEqIdFromOffline(module);
1311 UInt_t hs = GetHSFromOffline(module);
1312 UInt_t chip = GetChipFromOffline(module,colM);
1313 UInt_t col = GetColFromOffline(module,colM);
1314 UInt_t row = GetRowFromOffline(module,rowM);
1315 return IsPixelNoisy(eq,hs,chip,col,row);
1316}
b696414b 1317//____________________________________________________________________________________________
478d804c 1318Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelBadKey(Int_t key) const {
1319 // is this pixel silent (dead or inactive)?
1320 UInt_t eq = GetEqIdFromKey(key);
1321 UInt_t hs = GetHSFromKey(key);
1322 UInt_t chip = GetChipFromKey(key);
1323 UInt_t col = GetColFromKey(key);
1324 UInt_t row = GetRowFromKey(key);
1325 return IsPixelBad(eq,hs,chip,col,row);
1326}
1327//____________________________________________________________________________________________
b696414b 1328Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelSilentKey(Int_t key) const {
1329 // is this pixel silent (dead or inactive)?
1330 UInt_t eq = GetEqIdFromKey(key);
1331 UInt_t hs = GetHSFromKey(key);
1332 UInt_t chip = GetChipFromKey(key);
1333 UInt_t col = GetColFromKey(key);
1334 UInt_t row = GetRowFromKey(key);
1335 return IsPixelSilent(eq,hs,chip,col,row);
1336}
1337//____________________________________________________________________________________________
6727e2db 1338Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadKey(Int_t key) const {
1339 // is this pixel dead?
1340 UInt_t eq = GetEqIdFromKey(key);
1341 UInt_t hs = GetHSFromKey(key);
1342 UInt_t chip = GetChipFromKey(key);
1343 UInt_t col = GetColFromKey(key);
1344 UInt_t row = GetRowFromKey(key);
1345 return IsPixelDead(eq,hs,chip,col,row);
3479cee3 1346}
b696414b 1347//____________________________________________________________________________________________
53ae21ce 1348Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyKey(Int_t key) const {
1349 // is this pixel noisy?
6727e2db 1350 UInt_t eq = GetEqIdFromKey(key);
53ae21ce 1351 UInt_t hs = GetHSFromKey(key);
1352 UInt_t chip = GetChipFromKey(key);
6727e2db 1353 UInt_t col = GetColFromKey(key);
1354 UInt_t row = GetRowFromKey(key);
1355 return IsPixelNoisy(eq,hs,chip,col,row);
b15de2d2 1356}
6727e2db 1357//____________________________________________________________________________________________
478d804c 1358UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBad() const {
1359 // returns the total nr of bad pixels (silent or noisy)
1360 UInt_t nrBad=0;
1361 nrBad+=GetNrSilent();
1362 UInt_t nrNoisy = GetNrNoisy();
1363 for (UInt_t i=0; i<nrNoisy; i++) {
1364 UInt_t eq = GetNoisyEqIdAt(i);
1365 UInt_t hs = GetNoisyHSAt(i);
1366 UInt_t chip = GetNoisyChipAt(i);
1367 UInt_t col = GetNoisyColAt(i);
1368 UInt_t row = GetNoisyRowAt(i);
1369 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1370 }
1371 return nrBad;
1372}
1373//____________________________________________________________________________________________
b696414b 1374UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilent() const {
1375 // returns the total nr of silent pixels (dead or inactive)
1376 UInt_t nrDead = 0;
1377 for (UInt_t eq=0; eq<20; eq++) {
478d804c 1378 if (IsSilentEq(eq)) {
b696414b 1379 nrDead+=81920*6;
1380 continue;
1381 }
1382 for (UInt_t hs=0; hs<6; hs++) {
478d804c 1383 if (IsSilentHS(eq,hs)) {
b696414b 1384 nrDead+=81920;
1385 continue;
1386 }
1387 for (UInt_t chip=0; chip<10; chip++) {
478d804c 1388 if (IsSilentChip(eq,hs,chip)) {
b696414b 1389 nrDead+=8192;
1390 continue;
1391 }
1392 else {
1393 UInt_t gloChip = GetGloChip(eq,hs,chip);
1394 nrDead+=fNrDead[gloChip];
1395 }
1396 }
1397 }
1398 }
1399 return nrDead;
1400}
1401//____________________________________________________________________________________________
6727e2db 1402UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead() const {
1403 // returns the total nr of dead pixels
1404 UInt_t nrDead = 0;
1405 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1406 nrDead+=fNrDead[gloChip];
b15de2d2 1407 }
6727e2db 1408 return nrDead;
b15de2d2 1409}
b696414b 1410//____________________________________________________________________________________________
53ae21ce 1411UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy() const {
1412 // returns the total nr of noisy pixels
1413 UInt_t nrNoisy = 0;
6727e2db 1414 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1415 nrNoisy+=fNrNoisy[gloChip];
53ae21ce 1416 }
1417 return nrNoisy;
1418}
b696414b 1419//____________________________________________________________________________________________
478d804c 1420UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t index) const {
6727e2db 1421 // get eq for the dead pixel at position index in list of dead
1422 UInt_t gloChip;
1423 UInt_t chipIndex;
1424 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1425 return GetDeadEqIdAtC2(gloChip,chipIndex);
1426}
b696414b 1427//____________________________________________________________________________________________
478d804c 1428UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t index) const {
6727e2db 1429 // get eq for the noisy pixel at position index in list of noisy
1430 UInt_t gloChip;
1431 UInt_t chipIndex;
1432 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1433 return GetNoisyEqIdAtC2(gloChip,chipIndex);
1434}
b696414b 1435//____________________________________________________________________________________________
478d804c 1436UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t index) const {
6727e2db 1437 // get hs for the dead pixel at position index in list of dead
1438 UInt_t gloChip;
1439 UInt_t chipIndex;
1440 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1441 return GetDeadHSAtC2(gloChip,chipIndex);
1442}
b696414b 1443//____________________________________________________________________________________________
478d804c 1444UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t index) const {
6727e2db 1445 // get hs for the noisy pixel at position index in list of noisy
1446 UInt_t gloChip;
1447 UInt_t chipIndex;
1448 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1449 return GetNoisyHSAtC2(gloChip,chipIndex);
1450}
b696414b 1451//____________________________________________________________________________________________
478d804c 1452UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t index) const {
6727e2db 1453 // get chip for the dead pixel at position index in list of dead
1454 UInt_t gloChip;
1455 UInt_t chipIndex;
1456 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1457 return GetDeadChipAtC2(gloChip,chipIndex);
1458}
b696414b 1459//____________________________________________________________________________________________
478d804c 1460UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t index) const {
6727e2db 1461 // get chip for the noisy pixel at position index in list of noisy
1462 UInt_t gloChip;
1463 UInt_t chipIndex;
1464 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1465 return GetNoisyChipAtC2(gloChip,chipIndex);
1466}
b696414b 1467//____________________________________________________________________________________________
478d804c 1468UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t index) const {
6727e2db 1469 // get hs for the dead pixel at position index in list of dead
1470 UInt_t gloChip;
1471 UInt_t chipIndex;
1472 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1473 return GetDeadColAtC2(gloChip,chipIndex);
1474}
b696414b 1475//____________________________________________________________________________________________
478d804c 1476UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t index) const {
6727e2db 1477 // get hs for the noisy pixel at position index in list of noisy
1478 UInt_t gloChip;
1479 UInt_t chipIndex;
1480 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1481 return GetNoisyColAtC2(gloChip,chipIndex);
1482}
b696414b 1483//____________________________________________________________________________________________
478d804c 1484UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t index) const {
6727e2db 1485 // get hs for the dead pixel at position index in list of dead
1486 UInt_t gloChip;
1487 UInt_t chipIndex;
1488 GetChipAndIndexTotDead(index,gloChip,chipIndex);
1489 return GetDeadRowAtC2(gloChip,chipIndex);
1490}
b696414b 1491//____________________________________________________________________________________________
478d804c 1492UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t index) const {
6727e2db 1493 // get hs for the noisy pixel at position index in list of noisy
1494 UInt_t gloChip;
1495 UInt_t chipIndex;
1496 GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
1497 return GetNoisyRowAtC2(gloChip,chipIndex);
1498}
1499//____________________________________________________________________________________________
478d804c 1500UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBad(UInt_t module) const {
1501 // returns the number of bad pixels for a certain module (silent or noisy)
1502 UInt_t nrBad = 0;
1503 nrBad+=GetNrSilent(module);
1504 UInt_t nrNoisy = GetNrNoisy(module);
1505 for (UInt_t i=0; i<nrNoisy; i++) {
1506 UInt_t eq = GetNoisyEqIdAt(module,i);
1507 UInt_t hs = GetNoisyHSAt(module,i);
1508 UInt_t chip = GetNoisyChipAt(module,i);
1509 UInt_t col = GetNoisyColAt(module,i);
1510 UInt_t row = GetNoisyRowAt(module,i);
1511 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1512 }
1513 return nrBad;
1514}
1515//____________________________________________________________________________________________
b696414b 1516UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilent(UInt_t module) const {
1517 // returns the number of silent pixels for a certain module (dead or inactive)
1518 if (module>=240) {
1519 Error("AliITSOnlineCalibrationSPDhandler::GetNrSilent", "module nr (%d) out of bounds.",module);
1520 return 0;
1521 }
1522 UInt_t nrSilent = 0;
1523 UInt_t eq = GetEqIdFromOffline(module);
478d804c 1524 if (IsSilentEq(eq)) return 160*256;
b696414b 1525 UInt_t hs = GetHSFromOffline(module);
478d804c 1526 if (IsSilentHS(eq,hs)) return 160*256;
b696414b 1527 for (UInt_t ch=0; ch<5; ch++) {
1528 UInt_t chip = GetChipFromOffline(module,ch*32);
478d804c 1529 if (IsSilentChip(eq,hs,chip)) {
b696414b 1530 nrSilent+=8192;
1531 }
1532 else {
1533 UInt_t gloChip = GetGloChip(eq,hs,chip);
1534 nrSilent+=fNrDead[gloChip];
1535 }
1536 }
1537 return nrSilent;
1538}
1539//____________________________________________________________________________________________
bb292d31 1540UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadSingle(UInt_t module) const {
1541 // returns the number of single dead pixels (excluding the ones on silent chips) for a certain module
1542 if (module>=240) {
1543 Error("AliITSOnlineCalibrationSPDhandler::GetNrDeadSingle", "module nr (%d) out of bounds.",module);
1544 return 0;
1545 }
1546 UInt_t nrDead = 0;
1547 UInt_t eq = GetEqIdFromOffline(module);
1548 UInt_t hs = GetHSFromOffline(module);
1549 for (UInt_t ch=0; ch<5; ch++) {
1550 UInt_t chip = GetChipFromOffline(module,ch*32);
1551 if (!IsSilentChip(eq,hs,chip)) {
1552 UInt_t gloChip = GetGloChip(eq,hs,chip);
1553 nrDead+=fNrDead[gloChip];
1554 }
1555 }
1556 return nrDead;
1557}
1558//____________________________________________________________________________________________
1559UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisySingle(UInt_t module) const {
1560 // returns the number of noisy pixels for a certain module
1561 return GetNrNoisy(module);
1562}
1563//____________________________________________________________________________________________
6727e2db 1564UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead(UInt_t module) const {
1565 // returns the number of dead pixels for a certain module
1566 if (module>=240) {
1567 Error("AliITSOnlineCalibrationSPDhandler::GetNrDead", "module nr (%d) out of bounds.",module);
53ae21ce 1568 return 0;
1569 }
6727e2db 1570 UInt_t nrDead = 0;
1571 UInt_t eq = GetEqIdFromOffline(module);
1572 UInt_t hs = GetHSFromOffline(module);
b696414b 1573 for (UInt_t ch=0; ch<5; ch++) {
1574 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
6727e2db 1575 nrDead+=fNrDead[gloChip];
53ae21ce 1576 }
6727e2db 1577 return nrDead;
1578}
b696414b 1579//____________________________________________________________________________________________
6727e2db 1580UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy(UInt_t module) const {
1581 // returns the number of noisy pixels for a certain module
1582 if (module>=240) {
1583 Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisy", "module nr (%d) out of bounds.",module);
53ae21ce 1584 return 0;
1585 }
6727e2db 1586 UInt_t nrNoisy = 0;
1587 UInt_t eq = GetEqIdFromOffline(module);
1588 UInt_t hs = GetHSFromOffline(module);
b696414b 1589 for (UInt_t ch=0; ch<5; ch++) {
1590 UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
6727e2db 1591 nrNoisy+=fNrNoisy[gloChip];
6727e2db 1592 }
1593 return nrNoisy;
1594}
b696414b 1595//____________________________________________________________________________________________
478d804c 1596UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t module, UInt_t index) const {
6727e2db 1597 // get eq for the dead pixel at position index in list of dead
1598 UInt_t gloChip;
1599 UInt_t chipIndex;
1600 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1601 return GetDeadEqIdAtC2(gloChip,chipIndex);
1602}
b696414b 1603//____________________________________________________________________________________________
478d804c 1604UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t module, UInt_t index) const {
6727e2db 1605 // get eq for the noisy pixel at position index in list of noisy
1606 UInt_t gloChip;
1607 UInt_t chipIndex;
1608 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1609 return GetNoisyEqIdAtC2(gloChip,chipIndex);
1610}
b696414b 1611//____________________________________________________________________________________________
478d804c 1612UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t module, UInt_t index) const {
6727e2db 1613 // get hs for the dead pixel at position index in list of dead
1614 UInt_t gloChip;
1615 UInt_t chipIndex;
1616 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1617 return GetDeadHSAtC2(gloChip,chipIndex);
53ae21ce 1618}
b696414b 1619//____________________________________________________________________________________________
478d804c 1620UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t module, UInt_t index) const {
6727e2db 1621 // get hs for the noisy pixel at position index in list of noisy
1622 UInt_t gloChip;
1623 UInt_t chipIndex;
1624 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1625 return GetNoisyHSAtC2(gloChip,chipIndex);
1626}
b696414b 1627//____________________________________________________________________________________________
478d804c 1628UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t module, UInt_t index) const {
6727e2db 1629 // get chip for the dead pixel at position index in list of dead
1630 UInt_t gloChip;
1631 UInt_t chipIndex;
1632 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1633 return GetDeadChipAtC2(gloChip,chipIndex);
1634}
b696414b 1635//____________________________________________________________________________________________
478d804c 1636UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t module, UInt_t index) const {
53ae21ce 1637 // get chip for the noisy pixel at position index in list of noisy
6727e2db 1638 UInt_t gloChip;
1639 UInt_t chipIndex;
1640 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1641 return GetNoisyChipAtC2(gloChip,chipIndex);
1642}
b696414b 1643//____________________________________________________________________________________________
478d804c 1644UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t module, UInt_t index) const {
6727e2db 1645 // get hs for the dead pixel at position index in list of dead
1646 UInt_t gloChip;
1647 UInt_t chipIndex;
1648 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1649 return GetDeadColAtC2(gloChip,chipIndex);
1650}
b696414b 1651//____________________________________________________________________________________________
478d804c 1652UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t module, UInt_t index) const {
6727e2db 1653 // get hs for the noisy pixel at position index in list of noisy
1654 UInt_t gloChip;
1655 UInt_t chipIndex;
1656 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1657 return GetNoisyColAtC2(gloChip,chipIndex);
1658}
b696414b 1659//____________________________________________________________________________________________
478d804c 1660UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t module, UInt_t index) const {
6727e2db 1661 // get hs for the dead pixel at position index in list of dead
1662 UInt_t gloChip;
1663 UInt_t chipIndex;
1664 GetChipAndIndexDead(module,index,gloChip,chipIndex);
1665 return GetDeadRowAtC2(gloChip,chipIndex);
1666}
b696414b 1667//____________________________________________________________________________________________
478d804c 1668UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t module, UInt_t index) const {
6727e2db 1669 // get hs for the noisy pixel at position index in list of noisy
1670 UInt_t gloChip;
1671 UInt_t chipIndex;
1672 GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
1673 return GetNoisyRowAtC2(gloChip,chipIndex);
1674}
1675//____________________________________________________________________________________________
478d804c 1676UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBadEq(UInt_t eq) const {
1677 // returns nr of bad for eq (silent or noisy)
1678 UInt_t nrBad = 0;
1679 nrBad+=GetNrSilentEq(eq);
1680 UInt_t nrNoisy = GetNrNoisy(eq);
1681 for (UInt_t i=0; i<nrNoisy; i++) {
1682 UInt_t hs = GetNoisyHSAtEq(eq,i);
1683 UInt_t chip = GetNoisyChipAtEq(eq,i);
1684 UInt_t col = GetNoisyColAtEq(eq,i);
1685 UInt_t row = GetNoisyRowAtEq(eq,i);
1686 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1687 }
1688 return nrBad;
1689}
1690//____________________________________________________________________________________________
b696414b 1691UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentEq(UInt_t eq) const {
1692 // returns nr of silent for eq (dead or inactive)
1693 UInt_t returnval=0;
478d804c 1694 if (IsSilentEq(eq)) return 81920*6;
b696414b 1695 for (UInt_t hs=0; hs<6; hs++) {
478d804c 1696 if (IsSilentHS(eq,hs)) {
b696414b 1697 returnval+=81920;
1698 continue;
1699 }
1700 for (UInt_t chip=0; chip<10; chip++) {
478d804c 1701 if (IsSilentChip(eq,hs,chip)) {
b696414b 1702 returnval+=8192;
1703 continue;
1704 }
1705 else {
1706 returnval+=GetNrDeadC(eq,hs,chip);
1707 }
1708 }
1709 }
1710 return returnval;
1711}
1712//____________________________________________________________________________________________
6727e2db 1713UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadEq(UInt_t eq) const {
1714 // returns nr of dead for eq
1715 UInt_t returnval=0;
1716 for (UInt_t hs=0; hs<6; hs++) {
1717 for (UInt_t chip=0; chip<10; chip++) {
1718 returnval+=GetNrDeadC(eq,hs,chip);
1719 }
53ae21ce 1720 }
6727e2db 1721 return returnval;
1722}
b696414b 1723//____________________________________________________________________________________________
6727e2db 1724UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyEq(UInt_t eq) const {
1725 // returns nr of noisy for eq
1726 UInt_t returnval=0;
1727 for (UInt_t hs=0; hs<6; hs++) {
1728 for (UInt_t chip=0; chip<10; chip++) {
1729 returnval+=GetNrNoisyC(eq,hs,chip);
1730 }
53ae21ce 1731 }
6727e2db 1732 return returnval;
53ae21ce 1733}
b696414b 1734//____________________________________________________________________________________________
6727e2db 1735UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtEq(UInt_t eq, UInt_t index) const {
1736 // get eq for the dead pixel at position index in list of dead
1737 if (eq<20 && index<GetNrDeadEq(eq)) {
1738 return eq;
53ae21ce 1739 }
1740 else {
6727e2db 1741 return 20;
53ae21ce 1742 }
1743}
b696414b 1744//____________________________________________________________________________________________
6727e2db 1745UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtEq(UInt_t eq, UInt_t index) const {
1746 // get eq for the noisy pixel at position index in list of noisy
1747 if (eq<20 && index<GetNrNoisyEq(eq)) {
1748 return eq;
53ae21ce 1749 }
1750 else {
6727e2db 1751 return 20;
53ae21ce 1752 }
1753}
b696414b 1754//____________________________________________________________________________________________
478d804c 1755UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtEq(UInt_t eq, UInt_t index) const {
6727e2db 1756 // get hs for the dead pixel at position index in list of dead
1757 UInt_t gloChip;
1758 UInt_t chipIndex;
1759 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1760 return GetDeadHSAtC2(gloChip,chipIndex);
1761}
b696414b 1762//____________________________________________________________________________________________
478d804c 1763UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtEq(UInt_t eq, UInt_t index) const {
6727e2db 1764 // get hs for the noisy pixel at position index in list of noisy
1765 UInt_t gloChip;
1766 UInt_t chipIndex;
1767 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1768 return GetNoisyHSAtC2(gloChip,chipIndex);
1769}
b696414b 1770//____________________________________________________________________________________________
478d804c 1771UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtEq(UInt_t eq, UInt_t index) const {
6727e2db 1772 // get chip for the dead pixel at position index in list of dead
1773 UInt_t gloChip;
1774 UInt_t chipIndex;
1775 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1776 return GetDeadChipAtC2(gloChip,chipIndex);
1777}
b696414b 1778//____________________________________________________________________________________________
478d804c 1779UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtEq(UInt_t eq, UInt_t index) const {
6727e2db 1780 // get chip for the noisy pixel at position index in list of noisy
1781 UInt_t gloChip;
1782 UInt_t chipIndex;
1783 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1784 return GetNoisyChipAtC2(gloChip,chipIndex);
1785}
b696414b 1786//____________________________________________________________________________________________
478d804c 1787UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtEq(UInt_t eq, UInt_t index) const {
6727e2db 1788 // get hs for the dead pixel at position index in list of dead
1789 UInt_t gloChip;
1790 UInt_t chipIndex;
1791 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1792 return GetDeadColAtC2(gloChip,chipIndex);
1793}
b696414b 1794//____________________________________________________________________________________________
478d804c 1795UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtEq(UInt_t eq, UInt_t index) const {
6727e2db 1796 // get hs for the noisy pixel at position index in list of noisy
1797 UInt_t gloChip;
1798 UInt_t chipIndex;
1799 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1800 return GetNoisyColAtC2(gloChip,chipIndex);
1801}
b696414b 1802//____________________________________________________________________________________________
478d804c 1803UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtEq(UInt_t eq, UInt_t index) const {
6727e2db 1804 // get hs for the dead pixel at position index in list of dead
1805 UInt_t gloChip;
1806 UInt_t chipIndex;
1807 GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
1808 return GetDeadRowAtC2(gloChip,chipIndex);
1809}
b696414b 1810//____________________________________________________________________________________________
478d804c 1811UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtEq(UInt_t eq, UInt_t index) const {
6727e2db 1812 // get hs for the noisy pixel at position index in list of noisy
1813 UInt_t gloChip;
1814 UInt_t chipIndex;
1815 GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
1816 return GetNoisyRowAtC2(gloChip,chipIndex);
1817}
1818//____________________________________________________________________________________________
478d804c 1819UInt_t AliITSOnlineCalibrationSPDhandler::GetNrBadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
1820 // returns nr of bad for chip (silent or noisy)
1821 UInt_t nrBad = 0;
1822 nrBad+=GetNrSilentC(eq,hs,chip);
1823 UInt_t nrNoisy = GetNrNoisyC(eq,hs,chip);
1824 for (UInt_t i=0; i<nrNoisy; i++) {
1825 UInt_t col = GetNoisyColAtC(eq,hs,chip,i);
1826 UInt_t row = GetNoisyRowAtC(eq,hs,chip,i);
1827 if (!IsPixelSilent(eq,hs,chip,col,row)) nrBad++;
1828 }
1829 return nrBad;
1830}
1831//____________________________________________________________________________________________
b696414b 1832UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentC(UInt_t eq, UInt_t hs, UInt_t chip) const {
1833 // returns nr of silent for chip (dead or inactive)
478d804c 1834 if (IsSilentChip(eq,hs,chip)) return 8192;
b696414b 1835 else return GetNrDeadC(eq,hs,chip);
1836}
1837//____________________________________________________________________________________________
6727e2db 1838UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
b696414b 1839 // returns nr of dead for chip
6727e2db 1840 UInt_t gloChip = GetGloChip(eq,hs,chip);
1841 return GetNrDeadC2(gloChip);
1842}
b696414b 1843//____________________________________________________________________________________________
6727e2db 1844UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC(UInt_t eq, UInt_t hs, UInt_t chip) const {
b696414b 1845 // returns nr of noisy for chip
6727e2db 1846 UInt_t gloChip = GetGloChip(eq,hs,chip);
1847 return GetNrNoisyC2(gloChip);
1848}
b696414b 1849//____________________________________________________________________________________________
6727e2db 1850UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1851 UInt_t gloChip = GetGloChip(eq,hs,chip);
1852 return GetDeadEqIdAtC2(gloChip,index);
1853}
b696414b 1854//____________________________________________________________________________________________
6727e2db 1855UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1856 UInt_t gloChip = GetGloChip(eq,hs,chip);
1857 return GetNoisyEqIdAtC2(gloChip,index);
1858}
b696414b 1859//____________________________________________________________________________________________
6727e2db 1860UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1861 UInt_t gloChip = GetGloChip(eq,hs,chip);
1862 return GetDeadHSAtC2(gloChip,index);
1863}
b696414b 1864//____________________________________________________________________________________________
6727e2db 1865UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1866 UInt_t gloChip = GetGloChip(eq,hs,chip);
1867 return GetNoisyHSAtC2(gloChip,index);
1868}
b696414b 1869//____________________________________________________________________________________________
6727e2db 1870UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1871 UInt_t gloChip = GetGloChip(eq,hs,chip);
1872 return GetDeadChipAtC2(gloChip,index);
1873}
b696414b 1874//____________________________________________________________________________________________
6727e2db 1875UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1876 UInt_t gloChip = GetGloChip(eq,hs,chip);
1877 return GetNoisyChipAtC2(gloChip,index);
1878}
b696414b 1879//____________________________________________________________________________________________
6727e2db 1880UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1881 UInt_t gloChip = GetGloChip(eq,hs,chip);
1882 return GetDeadColAtC2(gloChip,index);
1883}
b696414b 1884//____________________________________________________________________________________________
6727e2db 1885UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1886 UInt_t gloChip = GetGloChip(eq,hs,chip);
1887 return GetNoisyColAtC2(gloChip,index);
1888}
b696414b 1889//____________________________________________________________________________________________
6727e2db 1890UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1891 UInt_t gloChip = GetGloChip(eq,hs,chip);
1892 return GetDeadRowAtC2(gloChip,index);
1893}
b696414b 1894//____________________________________________________________________________________________
6727e2db 1895UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1896 UInt_t gloChip = GetGloChip(eq,hs,chip);
1897 return GetNoisyRowAtC2(gloChip,index);
1898}
1899//____________________________________________________________________________________________
1900const Char_t* AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1901 // get a string of dead pixel info
1902 TString returnMess = "";
1903 UInt_t gloChip = GetGloChip(eq,hs,chip);
1904 if (gloChip>=1200) {
1905 Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
1906 return returnMess.Data();
1907 }
1908 if (index<fNrDead[gloChip]) {
1909 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
6727e2db 1910 UInt_t col = GetColFromKey(key);
b696414b 1911 UInt_t row = GetRowFromKey(key);
6727e2db 1912 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1913 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1914 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
478d804c 1915 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 1916 return returnMess.Data();
53ae21ce 1917 }
1918 else {
6727e2db 1919 Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "Index %d out of bounds.", index);
1920 return returnMess.Data();
1921 }
1922}
b696414b 1923//____________________________________________________________________________________________
6727e2db 1924const Char_t* AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
1925 // get a string of noisy pixel info
1926 TString returnMess = "";
1927 UInt_t gloChip = GetGloChip(eq,hs,chip);
1928 if (gloChip>=1200) {
1929 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
1930 return returnMess.Data();
1931 }
1932 if (index<fNrNoisy[gloChip]) {
1933 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
6727e2db 1934 UInt_t col = GetColFromKey(key);
1935 UInt_t row = GetRowFromKey(key);
1936 UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
1937 UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
1938 UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
478d804c 1939 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 1940 return returnMess.Data();
1941 }
1942 else {
1943 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "Index %d out of bounds.", index);
1944 return returnMess.Data();
53ae21ce 1945 }
1946}
6727e2db 1947//____________________________________________________________________________________________
b696414b 1948UInt_t AliITSOnlineCalibrationSPDhandler::AddSilentFrom(AliITSOnlineCalibrationSPDhandler* other) {
1949 // returns number of new silent pixels in this' list (dead or inactive)
1950 UInt_t tmpdead = GetNrSilent();
1951
1952 for (UInt_t eq=0; eq<20; eq++) {
1953 if (!(other->IsActiveEq(eq))) ActivateEq(eq,kFALSE);
478d804c 1954 if (other->IsDeadEq(eq)) SetDeadEq(eq,kTRUE);
b696414b 1955 for (UInt_t hs=0; hs<6; hs++) {
1956 if (!(other->IsActiveHS(eq,hs))) ActivateHS(eq,hs,kFALSE);
478d804c 1957 if (other->IsDeadHS(eq,hs)) SetDeadHS(eq,hs,kTRUE);
b696414b 1958 for (UInt_t chip=0; chip<10; chip++) {
1959 if (!(other->IsActiveChip(eq,hs,chip))) ActivateChip(eq,hs,chip,kFALSE);
478d804c 1960 if (other->IsDeadChip(eq,hs,chip)) SetDeadChip(eq,hs,chip,kTRUE);
b696414b 1961 }
1962 }
1963 }
1964
1965 AddDeadFrom(other);
1966
1967 return GetNrSilent() - tmpdead;
1968}
1969//____________________________________________________________________________________________
6727e2db 1970UInt_t AliITSOnlineCalibrationSPDhandler::AddDeadFrom(AliITSOnlineCalibrationSPDhandler* other) {
1971 // returns number of new dead pixels in this' list
1972 UInt_t returnval=0;
1973 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1974 for (UInt_t ind1=0; ind1<other->fNrDead[gloChip]; ind1++) {
1975 UInt_t eq = other->GetDeadEqIdAtC2(gloChip,ind1);
1976 UInt_t hs = other->GetDeadHSAtC2(gloChip,ind1);
1977 UInt_t chip = other->GetDeadChipAtC2(gloChip,ind1);
1978 UInt_t col = other->GetDeadColAtC2(gloChip,ind1);
1979 UInt_t row = other->GetDeadRowAtC2(gloChip,ind1);
1980 if (SetDeadPixel(eq,hs,chip,col,row)) {
1981 returnval++;
1982 }
53ae21ce 1983 }
b15de2d2 1984 }
6727e2db 1985 return returnval;
b15de2d2 1986}
b696414b 1987//____________________________________________________________________________________________
6727e2db 1988UInt_t AliITSOnlineCalibrationSPDhandler::AddNoisyFrom(AliITSOnlineCalibrationSPDhandler* other) {
1989 // returns number of new noisy pixels in this' list
1990 UInt_t returnval=0;
1991 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
1992 for (UInt_t ind1=0; ind1<other->fNrNoisy[gloChip]; ind1++) {
1993 UInt_t eq = other->GetNoisyEqIdAtC2(gloChip,ind1);
1994 UInt_t hs = other->GetNoisyHSAtC2(gloChip,ind1);
1995 UInt_t chip = other->GetNoisyChipAtC2(gloChip,ind1);
1996 UInt_t col = other->GetNoisyColAtC2(gloChip,ind1);
1997 UInt_t row = other->GetNoisyRowAtC2(gloChip,ind1);
1998 if (SetNoisyPixel(eq,hs,chip,col,row)) {
1999 returnval++;
2000 }
53ae21ce 2001 }
2002 }
6727e2db 2003 return returnval;
2004}
2005//____________________________________________________________________________________________
2006UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDiff(AliITSOnlineCalibrationSPDhandler* other) const {
b696414b 2007 // returns nr of dead/noisy in this' lists and not in other's lists (including inactive)
2008 return GetNrSilentDiff(other) + GetNrNoisyDiff(other);
53ae21ce 2009}
b696414b 2010//____________________________________________________________________________________________
2011UInt_t AliITSOnlineCalibrationSPDhandler::GetNrSilentDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2012 // returns nr of single silent pixels in this' lists and not in other's lists (dead or inactive)
2013 UInt_t returnval=0;
2014 for (UInt_t eq=0; eq<20; eq++) {
2015 for (UInt_t hs=0; hs<6; hs++) {
2016 for (UInt_t chip=0; chip<10; chip++) {
478d804c 2017 if (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs) || !IsActiveChip(eq,hs,chip) || IsDeadChip(eq,hs,chip)) {
2018 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 2019 // if this is inactive and the other is active...
2020 returnval+= 8192 - other->GetNrDeadC(eq,hs,chip);
2021 }
2022 }
2023 else {
2024 UInt_t gloChip = GetGloChip(eq,hs,chip);
2025 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2026 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2027 UInt_t col = GetColFromKey(key);
2028 UInt_t row = GetRowFromKey(key);
2029 if (!(other->IsPixelSilent(eq,hs,chip,col,row))) {
2030 returnval++;
2031 }
2032 }
2033 }
2034 }
2035 }
2036 }
2037 return returnval;
2038}
2039//____________________________________________________________________________________________
53ae21ce 2040UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2041 // returns nr of dead in this' lists and not in other's lists
2042 UInt_t returnval=0;
6727e2db 2043 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2044 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2045 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2046 UInt_t eq = GetEqIdFromKey(key);
53ae21ce 2047 UInt_t hs = GetHSFromKey(key);
2048 UInt_t chip = GetChipFromKey(key);
2049 UInt_t col = GetColFromKey(key);
2050 UInt_t row = GetRowFromKey(key);
6727e2db 2051 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
53ae21ce 2052 returnval++;
2053 }
2054 }
2055 }
2056 return returnval;
2057}
b696414b 2058//____________________________________________________________________________________________
53ae21ce 2059UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2060 // returns nr of noisy in this' lists and not in other's lists
2061 UInt_t returnval=0;
6727e2db 2062 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2063 for (UInt_t ind1=0; ind1<fNrNoisy[gloChip]; ind1++) {
2064 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind1);
2065 UInt_t eq = GetEqIdFromKey(key);
53ae21ce 2066 UInt_t hs = GetHSFromKey(key);
2067 UInt_t chip = GetChipFromKey(key);
2068 UInt_t col = GetColFromKey(key);
2069 UInt_t row = GetRowFromKey(key);
6727e2db 2070 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
53ae21ce 2071 returnval++;
2072 }
2073 }
b15de2d2 2074 }
53ae21ce 2075 return returnval;
2076}
b696414b 2077//____________________________________________________________________________________________
53ae21ce 2078AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDiff(AliITSOnlineCalibrationSPDhandler* other) const {
b696414b 2079 // returns handler with active/dead/noisy in this' lists, removing those that are in other's lists
53ae21ce 2080 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
b696414b 2081
2082 for (UInt_t eq=0; eq<20; eq++) {
2083 if (!(IsActiveEq(eq))) {
2084 newHandler->ActivateEq(eq,kFALSE);
2085 if (!other->IsActiveEq(eq)) newHandler->ActivateEq(eq);
2086 }
478d804c 2087 if (IsDeadEq(eq)) {
2088 newHandler->SetDeadEq(eq);
2089 if (other->IsDeadEq(eq)) newHandler->SetDeadEq(eq,kFALSE);
2090 }
b696414b 2091 for (UInt_t hs=0; hs<6; hs++) {
2092 if (!(IsActiveHS(eq,hs))) {
2093 newHandler->ActivateHS(eq,hs,kFALSE);
2094 if (!other->IsActiveHS(eq,hs)) newHandler->ActivateHS(eq,hs);
2095 }
478d804c 2096 if (IsDeadHS(eq,hs)) {
2097 newHandler->SetDeadHS(eq,hs);
2098 if (other->IsDeadHS(eq,hs)) newHandler->SetDeadHS(eq,hs,kFALSE);
2099 }
b696414b 2100 for (UInt_t chip=0; chip<10; chip++) {
2101 if (!(IsActiveChip(eq,hs,chip))) {
2102 newHandler->ActivateChip(eq,hs,chip,kFALSE);
2103 if (!other->IsActiveChip(eq,hs,chip)) newHandler->ActivateHS(eq,hs,chip);
2104 }
478d804c 2105 if (IsDeadChip(eq,hs,chip)) {
2106 newHandler->SetDeadChip(eq,hs,chip);
2107 if (other->IsDeadChip(eq,hs,chip)) newHandler->SetDeadChip(eq,hs,chip,kFALSE);
2108 }
b696414b 2109 }
2110 }
2111 }
2112
6727e2db 2113 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2114 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2115 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2116 UInt_t eq = GetEqIdFromKey(key);
53ae21ce 2117 UInt_t hs = GetHSFromKey(key);
2118 UInt_t chip = GetChipFromKey(key);
2119 UInt_t col = GetColFromKey(key);
2120 UInt_t row = GetRowFromKey(key);
6727e2db 2121 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2122 newHandler->SetDeadPixel(eq,hs,chip,col,row);
53ae21ce 2123 }
2124 }
b696414b 2125 }
2126
2127 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
6727e2db 2128 for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
2129 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
2130 UInt_t eq = GetEqIdFromKey(key);
53ae21ce 2131 UInt_t hs = GetHSFromKey(key);
2132 UInt_t chip = GetChipFromKey(key);
2133 UInt_t col = GetColFromKey(key);
2134 UInt_t row = GetRowFromKey(key);
6727e2db 2135 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2136 newHandler->SetNoisyPixel(eq,hs,chip,col,row);
53ae21ce 2137 }
2138 }
2139 }
b696414b 2140
53ae21ce 2141 return newHandler;
2142}
b696414b 2143//____________________________________________________________________________________________
2144AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetSilentDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2145 // returns handler with active/dead in this' lists, removing those that are in other's lists
2146 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
2147
2148 for (UInt_t eq=0; eq<20; eq++) {
2149 if (!(IsActiveEq(eq))) {
2150 newHandler->ActivateEq(eq,kFALSE);
2151 if (!other->IsActiveEq(eq)) newHandler->ActivateEq(eq);
2152 }
478d804c 2153 if (IsDeadEq(eq)) {
2154 newHandler->SetDeadEq(eq);
2155 if (other->IsDeadEq(eq)) newHandler->SetDeadEq(eq,kFALSE);
2156 }
b696414b 2157 for (UInt_t hs=0; hs<6; hs++) {
2158 if (!(IsActiveHS(eq,hs))) {
2159 newHandler->ActivateHS(eq,hs,kFALSE);
2160 if (!other->IsActiveHS(eq,hs)) newHandler->ActivateHS(eq,hs);
2161 }
478d804c 2162 if (IsDeadHS(eq,hs)) {
2163 newHandler->SetDeadHS(eq,hs);
2164 if (other->IsDeadHS(eq,hs)) newHandler->SetDeadHS(eq,hs,kFALSE);
2165 }
b696414b 2166 for (UInt_t chip=0; chip<10; chip++) {
2167 if (!(IsActiveChip(eq,hs,chip))) {
2168 newHandler->ActivateChip(eq,hs,chip,kFALSE);
2169 if (!other->IsActiveChip(eq,hs,chip)) newHandler->ActivateHS(eq,hs,chip);
2170 }
478d804c 2171 if (IsDeadChip(eq,hs,chip)) {
2172 newHandler->SetDeadChip(eq,hs,chip);
2173 if (other->IsDeadChip(eq,hs,chip)) newHandler->SetDeadChip(eq,hs,chip,kFALSE);
2174 }
b696414b 2175 }
2176 }
2177 }
2178
2179 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2180 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2181 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2182 UInt_t eq = GetEqIdFromKey(key);
2183 UInt_t hs = GetHSFromKey(key);
2184 UInt_t chip = GetChipFromKey(key);
2185 UInt_t col = GetColFromKey(key);
2186 UInt_t row = GetRowFromKey(key);
2187 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2188 newHandler->SetDeadPixel(eq,hs,chip,col,row);
2189 }
2190 }
2191 }
2192
2193 return newHandler;
2194}
2195//____________________________________________________________________________________________
53ae21ce 2196AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2197 // returns handler with dead in this' lists, except for those in other's lists
2198 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
6727e2db 2199 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2200 for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
2201 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
2202 UInt_t eq = GetEqIdFromKey(key);
53ae21ce 2203 UInt_t hs = GetHSFromKey(key);
2204 UInt_t chip = GetChipFromKey(key);
2205 UInt_t col = GetColFromKey(key);
2206 UInt_t row = GetRowFromKey(key);
6727e2db 2207 if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
2208 newHandler->SetDeadPixel(eq,hs,chip,col,row);
53ae21ce 2209 }
2210 }
2211 }
2212 return newHandler;
2213}
b696414b 2214//____________________________________________________________________________________________
53ae21ce 2215AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
2216 // returns handler with noisy in this' lists, except for those in other's lists
2217 AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
6727e2db 2218 for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
2219 for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
2220 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
2221 UInt_t eq = GetEqIdFromKey(key);
53ae21ce 2222 UInt_t hs = GetHSFromKey(key);
2223 UInt_t chip = GetChipFromKey(key);
2224 UInt_t col = GetColFromKey(key);
2225 UInt_t row = GetRowFromKey(key);
6727e2db 2226 if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
2227 newHandler->SetNoisyPixel(eq,hs,chip,col,row);
53ae21ce 2228 }
2229 }
2230 }
2231 return newHandler;
2232}
6727e2db 2233//____________________________________________________________________________________________
478d804c 2234void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
6727e2db 2235 // find gloChip and chipIndex from module and index
2236 if (index<GetNrDead(module)) {
2237 UInt_t eq = GetEqIdFromOffline(module);
2238 UInt_t hs = GetHSFromOffline(module);
2239
2240 UInt_t glVal=0;
b696414b 2241 for (UInt_t ch=0; ch<5; ch++) {
2242 gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
6727e2db 2243 if (glVal+fNrDead[gloChip]>index) {
2244 chipIndex = index-glVal;
2245 break;
2246 }
2247 else {
2248 glVal+=fNrDead[gloChip];
2249 }
2250 }
53ae21ce 2251
6727e2db 2252 }
2253 else {
2254 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead", "Index %d out of bounds.", index);
2255 }
2256}
b696414b 2257//____________________________________________________________________________________________
478d804c 2258void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
6727e2db 2259 // find gloChip and chipIndex from module and index
2260 if (index<GetNrNoisy(module)) {
2261 UInt_t eq = GetEqIdFromOffline(module);
2262 UInt_t hs = GetHSFromOffline(module);
2263
2264 UInt_t glVal=0;
b696414b 2265 for (UInt_t ch=0; ch<5; ch++) {
2266 gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,ch*32));
6727e2db 2267 if (glVal+fNrNoisy[gloChip]>index) {
2268 chipIndex = index-glVal;
2269 break;
2270 }
2271 else {
2272 glVal+=fNrNoisy[gloChip];
2273 }
53ae21ce 2274 }
6727e2db 2275
2276 }
2277 else {
2278 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy", "Index %d out of bounds.", index);
53ae21ce 2279 }
2280}
b696414b 2281//____________________________________________________________________________________________
478d804c 2282void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
6727e2db 2283 // find gloChip and chipIndex from module and index
2284 if (index<GetNrDeadEq(eq)) {
53ae21ce 2285
6727e2db 2286 UInt_t glVal=0;
2287 for (UInt_t hs=0; hs<6; hs++) {
2288 for (UInt_t chip=0; chip<10; chip++) {
2289 gloChip = GetGloChip(eq,hs,chip);
2290 if (glVal+fNrDead[gloChip]>index) {
2291 chipIndex = index-glVal;
2292 break;
2293 }
2294 else {
2295 glVal+=fNrDead[gloChip];
2296 }
53ae21ce 2297 }
53ae21ce 2298 }
6727e2db 2299
2300 }
2301 else {
2302 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead", "Index %d out of bounds.", index);
53ae21ce 2303 }
53ae21ce 2304}
b696414b 2305//____________________________________________________________________________________________
478d804c 2306void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
6727e2db 2307 // find gloChip and chipIndex from module and index
2308 if (index<GetNrNoisyEq(eq)) {
2309
2310 UInt_t glVal=0;
2311 for (UInt_t hs=0; hs<6; hs++) {
2312 for (UInt_t chip=0; chip<10; chip++) {
2313 gloChip = GetGloChip(eq,hs,chip);
2314 if (glVal+fNrNoisy[gloChip]>index) {
2315 chipIndex = index-glVal;
2316 break;
2317 }
2318 else {
2319 glVal+=fNrNoisy[gloChip];
2320 }
2321 }
2322 }
2323
2324 }
2325 else {
2326 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy", "Index %d out of bounds.", index);
2327 }
2328}
b696414b 2329//____________________________________________________________________________________________
478d804c 2330void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
6727e2db 2331 // find gloChip and chipIndex from global index
2332 if (index<GetNrDead()) {
2333
2334 UInt_t glVal=0;
2335 for (gloChip=0; gloChip<1200; gloChip++) {
2336 if (glVal+fNrDead[gloChip]>index) {
2337 chipIndex = index-glVal;
2338 break;
2339 }
2340 else {
2341 glVal+=fNrDead[gloChip];
2342 }
2343 }
2344
2345 }
2346 else {
2347 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead", "Index %d out of bounds.", index);
2348 }
2349}
b696414b 2350//____________________________________________________________________________________________
478d804c 2351void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) const {
6727e2db 2352 // find gloChip and chipIndex from global index
2353 if (index<GetNrNoisy()) {
2354
2355 UInt_t glVal=0;
2356 for (gloChip=0; gloChip<1200; gloChip++) {
2357 if (glVal+fNrNoisy[gloChip]>index) {
2358 chipIndex = index-glVal;
2359 break;
2360 }
2361 else {
2362 glVal+=fNrNoisy[gloChip];
2363 }
2364 }
53ae21ce 2365
6727e2db 2366 }
2367 else {
2368 Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy", "Index %d out of bounds.", index);
2369 }
2370}
2371//____________________________________________________________________________________________
2372UInt_t AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline(UInt_t module) const {
2373 // module to eq mapping
2374 if (module>=240) {
2375 Error("AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline", "module nr (%d) out of bounds.",module);
2376 return 20;
2377 }
2378 return AliITSRawStreamSPD::GetOnlineEqIdFromOffline(module);
53ae21ce 2379}
b696414b 2380//____________________________________________________________________________________________
6727e2db 2381UInt_t AliITSOnlineCalibrationSPDhandler::GetHSFromOffline(UInt_t module) const {
53ae21ce 2382 // module to hs mapping
6727e2db 2383 if (module>=240) {
2384 Error("AliITSOnlineCalibrationSPDhandler::GetHSFromOffline", "module nr (%d) out of bounds.",module);
2385 return 6;
2386 }
2387 return AliITSRawStreamSPD::GetOnlineHSFromOffline(module);
53ae21ce 2388}
b696414b 2389//____________________________________________________________________________________________
6727e2db 2390UInt_t AliITSOnlineCalibrationSPDhandler::GetChipFromOffline(UInt_t module, UInt_t colM) const {
53ae21ce 2391 // module,colM to chip mapping
6727e2db 2392 if (module>=240 || colM>=160) {
2393 Error("AliITSOnlineCalibrationSPDhandler::GetChipFromOffline", "module,colM nrs (%d,%d) out of bounds.",module,colM);
2394 return 10;
2395 }
2396 return AliITSRawStreamSPD::GetOnlineChipFromOffline(module,colM);
53ae21ce 2397}
b696414b 2398//____________________________________________________________________________________________
6727e2db 2399UInt_t AliITSOnlineCalibrationSPDhandler::GetColFromOffline(UInt_t module, UInt_t colM) const {
53ae21ce 2400 // colM to col mapping
6727e2db 2401 if (colM>=160) {
2402 Error("AliITSOnlineCalibrationSPDhandler::GetColFromOffline", "colM nr (%d) out of bounds.",colM);
2403 return 160;
2404 }
2405 return AliITSRawStreamSPD::GetOnlineColFromOffline(module,colM);
2406}
b696414b 2407//____________________________________________________________________________________________
6727e2db 2408UInt_t AliITSOnlineCalibrationSPDhandler::GetRowFromOffline(UInt_t module, UInt_t rowM) const {
2409 // rowM to row mapping
2410 if (rowM>=256) {
2411 Error("AliITSOnlineCalibrationSPDhandler::GetRowFromOffline", "rowM nr (%d) out of bounds.",rowM);
2412 return 256;
2413 }
2414 return AliITSRawStreamSPD::GetOnlineRowFromOffline(module,rowM);
2415}
2416//____________________________________________________________________________________________
2417UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC2(UInt_t gloChip) const {
2418 // returns nr of dead pixels on this chip
2419 if (gloChip>=1200) {
2420 Error("AliITSOnlineCalibrationSPDhandler::GetNrDeadC2", "global chip nr (%d) out of bounds.",gloChip);
2421 return 0;
2422 }
2423 return fNrDead[gloChip];
2424}
b696414b 2425//____________________________________________________________________________________________
6727e2db 2426UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2(UInt_t gloChip) const {
2427 // returns nr of noisy pixels on this chip
2428 if (gloChip>=1200) {
2429 Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2", "global chip nr (%d) out of bounds.",gloChip);
2430 return 0;
2431 }
2432 return fNrNoisy[gloChip];
2433}
b696414b 2434//____________________________________________________________________________________________
6727e2db 2435UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC2(UInt_t gloChip, UInt_t index) const {
2436 // get eq for the dead pixel at position index in list of dead
2437 if (gloChip>=1200) {
2438 Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
2439 return 20;
2440 }
2441 if (index<fNrDead[gloChip]) {
2442 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2443 return GetEqIdFromKey(key);
2444 }
2445 else {
2446 Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "Index %d out of bounds.", index);
2447 return 0;
2448 }
2449}
b696414b 2450//____________________________________________________________________________________________
6727e2db 2451UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC2(UInt_t gloChip, UInt_t index) const {
2452 // get eq for the noisy pixel at position index in list of noisy
2453 if (gloChip>=1200) {
2454 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
2455 return 20;
2456 }
2457 if (index<fNrNoisy[gloChip]) {
2458 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2459 return GetEqIdFromKey(key);
2460 }
2461 else {
2462 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "Index %d out of bounds.", index);
2463 return 0;
2464 }
2465}
b696414b 2466//____________________________________________________________________________________________
6727e2db 2467UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC2(UInt_t gloChip, UInt_t index) const {
2468 // get hs for the dead pixel at position index in list of dead
2469 if (gloChip>=1200) {
2470 Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "global chip nr (%d) out of bounds.",gloChip);
2471 return 20;
2472 }
2473 if (index<fNrDead[gloChip]) {
2474 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2475 return GetHSFromKey(key);
2476 }
2477 else {
2478 Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "Index %d out of bounds.", index);
2479 return 0;
2480 }
2481}
b696414b 2482//____________________________________________________________________________________________
6727e2db 2483UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC2(UInt_t gloChip, UInt_t index) const {
2484 // get hs for the noisy pixel at position index in list of noisy
2485 if (gloChip>=1200) {
2486 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "global chip nr (%d) out of bounds.",gloChip);
2487 return 20;
2488 }
2489 if (index<fNrNoisy[gloChip]) {
2490 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2491 return GetHSFromKey(key);
2492 }
2493 else {
2494 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "Index %d out of bounds.", index);
2495 return 0;
2496 }
b15de2d2 2497}
b696414b 2498//____________________________________________________________________________________________
6727e2db 2499UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC2(UInt_t gloChip, UInt_t index) const {
2500 // get chip for the dead pixel at position index in list of dead
2501 if (gloChip>=1200) {
2502 Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "global chip nr (%d) out of bounds.",gloChip);
2503 return 20;
2504 }
2505 if (index<fNrDead[gloChip]) {
2506 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2507 return GetChipFromKey(key);
2508 }
2509 else {
2510 Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "Index %d out of bounds.", index);
2511 return 0;
2512 }
2513}
b696414b 2514//____________________________________________________________________________________________
6727e2db 2515UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC2(UInt_t gloChip, UInt_t index) const {
2516 // get chip for the noisy pixel at position index in list of noisy
2517 if (gloChip>=1200) {
2518 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "global chip nr (%d) out of bounds.",gloChip);
2519 return 20;
2520 }
2521 if (index<fNrNoisy[gloChip]) {
2522 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2523 return GetChipFromKey(key);
2524 }
2525 else {
2526 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "Index %d out of bounds.", index);
2527 return 0;
2528 }
2529}
b696414b 2530//____________________________________________________________________________________________
6727e2db 2531UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2(UInt_t gloChip, UInt_t index) const {
2532 // get col for the dead pixel at position index in list of dead
2533 if (gloChip>=1200) {
2534 Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "global chip nr (%d) out of bounds.",gloChip);
2535 return 20;
2536 }
2537 if (index<fNrDead[gloChip]) {
2538 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2539 return GetColFromKey(key);
2540 }
2541 else {
2542 Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "Index %d out of bounds.", index);
2543 return 0;
2544 }
2545}
b696414b 2546//____________________________________________________________________________________________
6727e2db 2547UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC2(UInt_t gloChip, UInt_t index) const {
2548 // get col for the noisy pixel at position index in list of noisy
2549 if (gloChip>=1200) {
2550 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "global chip nr (%d) out of bounds.",gloChip);
2551 return 20;
2552 }
2553 if (index<fNrNoisy[gloChip]) {
2554 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2555 return GetColFromKey(key);
2556 }
2557 else {
2558 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "Index %d out of bounds.", index);
2559 return 0;
2560 }
2561}
b696414b 2562//____________________________________________________________________________________________
6727e2db 2563UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC2(UInt_t gloChip, UInt_t index) const {
2564 // get row for the dead pixel at position index in list of dead
2565 if (gloChip>=1200) {
2566 Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "global chip nr (%d) out of bounds.",gloChip);
2567 return 20;
2568 }
2569 if (index<fNrDead[gloChip]) {
2570 Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
2571 return GetRowFromKey(key);
2572 }
2573 else {
2574 Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "Index %d out of bounds.", index);
2575 return 0;
2576 }
2577}
b696414b 2578//____________________________________________________________________________________________
6727e2db 2579UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC2(UInt_t gloChip, UInt_t index) const {
2580 // get row for the noisy pixel at position index in list of noisy
2581 if (gloChip>=1200) {
2582 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "global chip nr (%d) out of bounds.",gloChip);
2583 return 20;
2584 }
2585 if (index<fNrNoisy[gloChip]) {
2586 Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
2587 return GetRowFromKey(key);
2588 }
2589 else {
2590 Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "Index %d out of bounds.", index);
2591 return 0;
2592 }
2593}
b696414b 2594//____________________________________________________________________________________________
2595void AliITSOnlineCalibrationSPDhandler::ActivateALL() {
478d804c 2596 // activate all eq,hs,chips
b696414b 2597 for (UInt_t eq=0; eq<20; eq++) {
2598 ActivateEq(eq);
2599 for (UInt_t hs=0; hs<6; hs++) {
2600 ActivateHS(eq,hs);
2601 for (UInt_t chip=0; chip<10; chip++) {
2602 ActivateChip(eq,hs,chip);
2603 }
2604 }
2605 }
2606}
2607//____________________________________________________________________________________________
2608void AliITSOnlineCalibrationSPDhandler::ActivateEq(UInt_t eq, Bool_t setval) {
478d804c 2609 // activate eq
b696414b 2610 if (eq>=20) {
2611 Error("AliITSOnlineCalibrationSPDhandler::ActivateEq", "eq (%d) out of bounds.",eq);
2612 return;
2613 }
2614 fActiveEq[eq] = setval;
2615}
2616//____________________________________________________________________________________________
2617void AliITSOnlineCalibrationSPDhandler::ActivateHS(UInt_t eq, UInt_t hs, Bool_t setval) {
478d804c 2618 // activate hs
b696414b 2619 if (eq>=20 || hs>=6) {
2620 Error("AliITSOnlineCalibrationSPDhandler::ActivateHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2621 return;
2622 }
2623 fActiveHS[eq][hs] = setval;
2624}
2625//____________________________________________________________________________________________
2626void AliITSOnlineCalibrationSPDhandler::ActivateChip(UInt_t eq, UInt_t hs, UInt_t chip, Bool_t setval) {
478d804c 2627 // activate chip
b696414b 2628 if (eq>=20 || hs>=6 || chip>=10) {
2629 Error("AliITSOnlineCalibrationSPDhandler::ActivateChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2630 return;
2631 }
2632 fActiveChip[eq][hs][chip] = setval;
2633}
2634//____________________________________________________________________________________________
2635Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveEq(UInt_t eq) const {
478d804c 2636 // Is eq active?
b696414b 2637 if (eq>=20) {
2638 Error("AliITSOnlineCalibrationSPDhandler::IsActiveEq", "eq (%d) out of bounds.",eq);
2639 return kFALSE;
2640 }
2641 return fActiveEq[eq];
2642}
2643//____________________________________________________________________________________________
2644Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveHS(UInt_t eq, UInt_t hs) const {
478d804c 2645 // Is hs active?
b696414b 2646 if (eq>=20 || hs>=6) {
2647 Error("AliITSOnlineCalibrationSPDhandler::IsActiveHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2648 return kFALSE;
2649 }
2650 return fActiveHS[eq][hs];
2651}
2652//____________________________________________________________________________________________
2653Bool_t AliITSOnlineCalibrationSPDhandler::IsActiveChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
478d804c 2654 // Is chip active?
b696414b 2655 if (eq>=20 || hs>=6 || chip>=10) {
2656 Error("AliITSOnlineCalibrationSPDhandler::IsActiveChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2657 return kFALSE;
2658 }
2659 return fActiveChip[eq][hs][chip];
2660}
478d804c 2661//____________________________________________________________________________________________
2662void AliITSOnlineCalibrationSPDhandler::UnSetDeadALL() {
2663 // Clear all dead eq,hs,chips
2664 for (UInt_t eq=0; eq<20; eq++) {
2665 SetDeadEq(eq,kFALSE);
2666 for (UInt_t hs=0; hs<6; hs++) {
2667 SetDeadHS(eq,hs,kFALSE);
2668 for (UInt_t chip=0; chip<10; chip++) {
2669 SetDeadChip(eq,hs,chip,kFALSE);
2670 }
2671 }
2672 }
2673}
2674//____________________________________________________________________________________________
2675void AliITSOnlineCalibrationSPDhandler::SetDeadEq(UInt_t eq, Bool_t setval) {
2676 // set eq dead
2677 if (eq>=20) {
2678 Error("AliITSOnlineCalibrationSPDhandler::SetDeadEq", "eq (%d) out of bounds.",eq);
2679 return;
2680 }
2681 fDeadEq[eq] = setval;
2682}
2683//____________________________________________________________________________________________
2684void AliITSOnlineCalibrationSPDhandler::SetDeadHS(UInt_t eq, UInt_t hs, Bool_t setval) {
2685 // set hs dead
2686 if (eq>=20 || hs>=6) {
2687 Error("AliITSOnlineCalibrationSPDhandler::SetDeadHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2688 return;
2689 }
2690 fDeadHS[eq][hs] = setval;
2691}
2692//____________________________________________________________________________________________
2693void AliITSOnlineCalibrationSPDhandler::SetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip, Bool_t setval) {
2694 // set chip dead
2695 if (eq>=20 || hs>=6 || chip>=10) {
2696 Error("AliITSOnlineCalibrationSPDhandler::SetDeadChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2697 return;
2698 }
2699 fDeadChip[eq][hs][chip] = setval;
2700}
2701//____________________________________________________________________________________________
2702Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadEq(UInt_t eq) const {
2703 // is eq dead?
2704 if (eq>=20) {
2705 Error("AliITSOnlineCalibrationSPDhandler::IsDeadEq", "eq (%d) out of bounds.",eq);
2706 return kFALSE;
2707 }
2708 return fDeadEq[eq];
2709}
2710//____________________________________________________________________________________________
2711Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadHS(UInt_t eq, UInt_t hs) const {
2712 // is hs dead?
2713 if (eq>=20 || hs>=6) {
2714 Error("AliITSOnlineCalibrationSPDhandler::IsDeadHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2715 return kFALSE;
2716 }
2717 return fDeadHS[eq][hs];
2718}
2719//____________________________________________________________________________________________
2720Bool_t AliITSOnlineCalibrationSPDhandler::IsDeadChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
2721 // is chip dead?
2722 if (eq>=20 || hs>=6 || chip>=10) {
2723 Error("AliITSOnlineCalibrationSPDhandler::IsDeadChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2724 return kFALSE;
2725 }
2726 return fDeadChip[eq][hs][chip];
2727}
2728//____________________________________________________________________________________________
2729Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentEq(UInt_t eq) const {
2730 // is eq silent?
2731 if (eq>=20) {
2732 Error("AliITSOnlineCalibrationSPDhandler::IsSilentEq", "eq (%d) out of bounds.",eq);
2733 return kFALSE;
2734 }
2735 return (!IsActiveEq(eq) || IsDeadEq(eq));
2736}
2737//____________________________________________________________________________________________
2738Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentHS(UInt_t eq, UInt_t hs) const {
2739 // is hs silent?
2740 if (eq>=20 || hs>=6) {
2741 Error("AliITSOnlineCalibrationSPDhandler::IsSilentHS", "eq,hs (%d,%d) out of bounds.",eq,hs);
2742 return kFALSE;
2743 }
2744 return (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs));
2745}
2746//____________________________________________________________________________________________
2747Bool_t AliITSOnlineCalibrationSPDhandler::IsSilentChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
2748 // is chip silent?
2749 if (eq>=20 || hs>=6 || chip>=10) {
2750 Error("AliITSOnlineCalibrationSPDhandler::IsSilentChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
2751 return kFALSE;
2752 }
2753 return (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs) || !IsActiveChip(eq,hs,chip) || IsDeadChip(eq,hs,chip));
2754}