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