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