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