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