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