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