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