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