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