]>
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). // | |
e03405c9 | 5 | // The TArrayS objects that are put in the AliITSCalibrationSPD // |
b15de2d2 | 6 | // objects can be obtained from the methods GetDeadArray and // |
7 | // GetNoisyArray. // | |
8 | ////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #include "AliITSOnlineCalibrationSPDhandler.h" | |
11 | #include "AliITSOnlineCalibrationSPD.h" | |
53ae21ce | 12 | #include "AliITSIntMap.h" |
13 | #include <TObjArray.h> | |
60d9faf6 | 14 | #include <TArrayI.h> |
e03405c9 | 15 | #include <TArrayS.h> |
b15de2d2 | 16 | #include <TFile.h> |
53ae21ce | 17 | #include <TError.h> |
18 | #include <fstream> | |
b15de2d2 | 19 | |
53ae21ce | 20 | #ifndef SPD_DA_OFF // you may want to exclude cdb classes, if using this class outside aliroot |
21 | #include "AliITSCalibrationSPD.h" | |
22 | #include "AliCDBManager.h" | |
23 | #include "AliCDBEntry.h" | |
24 | #endif | |
b15de2d2 | 25 | |
4f88491f | 26 | /* $Id$ */ |
6727e2db | 27 | //____________________________________________________________________________________________ |
53ae21ce | 28 | AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler(): |
6727e2db | 29 | fFileLocation(".") |
53ae21ce | 30 | { |
31 | // constructor | |
6727e2db | 32 | for (UInt_t gloChip=0; gloChip<1200; gloChip++) { |
33 | fNrDead[gloChip]=0; | |
34 | fNrNoisy[gloChip]=0; | |
35 | fDeadPixelMap[gloChip] = new AliITSIntMap(); | |
36 | fNoisyPixelMap[gloChip] = new AliITSIntMap(); | |
53ae21ce | 37 | } |
38 | } | |
b15de2d2 | 39 | AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler(const AliITSOnlineCalibrationSPDhandler& handle): |
6727e2db | 40 | fFileLocation(".") |
b15de2d2 | 41 | { |
42 | // copy constructor | |
6727e2db | 43 | for (UInt_t gloChip=0; gloChip<1200; gloChip++) { |
44 | fNrDead[gloChip] = handle.fNrDead[gloChip]; | |
45 | fNrNoisy[gloChip] = handle.fNrNoisy[gloChip]; | |
46 | fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone(); | |
47 | fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone(); | |
b15de2d2 | 48 | } |
53ae21ce | 49 | fFileLocation = handle.fFileLocation; |
b15de2d2 | 50 | } |
b15de2d2 | 51 | AliITSOnlineCalibrationSPDhandler::~AliITSOnlineCalibrationSPDhandler() { |
6727e2db | 52 | // ClearMaps(); |
53 | for (UInt_t gloChip=0; gloChip<1200; gloChip++) { | |
54 | delete fDeadPixelMap[gloChip]; | |
55 | delete fNoisyPixelMap[gloChip]; | |
56 | } | |
b15de2d2 | 57 | } |
b15de2d2 | 58 | AliITSOnlineCalibrationSPDhandler& AliITSOnlineCalibrationSPDhandler::operator=(const AliITSOnlineCalibrationSPDhandler& handle) { |
59 | // assignment operator | |
60 | if (this!=&handle) { | |
61 | this->ClearMaps(); | |
6727e2db | 62 | for (UInt_t gloChip=0; gloChip<1200; gloChip++) { |
63 | fNrDead[gloChip] = handle.fNrDead[gloChip]; | |
64 | fNrNoisy[gloChip] = handle.fNrNoisy[gloChip]; | |
65 | fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone(); | |
66 | fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone(); | |
b15de2d2 | 67 | } |
53ae21ce | 68 | fFileLocation = handle.fFileLocation; |
b15de2d2 | 69 | } |
70 | return *this; | |
71 | } | |
6727e2db | 72 | //____________________________________________________________________________________________ |
b15de2d2 | 73 | void AliITSOnlineCalibrationSPDhandler::ClearMaps() { |
74 | // clear the lists of dead and noisy | |
75 | ResetDead(); | |
76 | ResetNoisy(); | |
77 | } | |
6727e2db | 78 | void AliITSOnlineCalibrationSPDhandler::ResetDead() { |
79 | // reset the dead pixel map | |
80 | for (UInt_t gloChip=0; gloChip<1200; gloChip++) { | |
81 | fNrDead[gloChip]=0; | |
82 | fDeadPixelMap[gloChip]->Clear(); | |
53ae21ce | 83 | } |
b15de2d2 | 84 | } |
6727e2db | 85 | void AliITSOnlineCalibrationSPDhandler::ResetNoisy() { |
86 | // clear the list of noisy pixels | |
87 | for (UInt_t gloChip=0; gloChip<1200; gloChip++) { | |
88 | fNrNoisy[gloChip]=0; | |
89 | fNoisyPixelMap[gloChip]->Clear(); | |
90 | } | |
b15de2d2 | 91 | } |
6727e2db | 92 | void AliITSOnlineCalibrationSPDhandler::ResetDeadForChip(UInt_t eq, UInt_t hs, UInt_t chip) { |
93 | // clear the dead pixels for this chip | |
94 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
95 | for (UInt_t col=0; col<32; col++) { | |
96 | for (UInt_t row=0; row<256; row++) { | |
97 | Int_t key = GetKey(eq,hs,chip,col,row); | |
98 | if (fDeadPixelMap[gloChip]->Remove(key)) { | |
99 | fNrDead[gloChip]--; | |
b15de2d2 | 100 | } |
101 | } | |
102 | } | |
103 | } | |
6727e2db | 104 | void AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip(UInt_t eq, UInt_t hs, UInt_t chip) { |
105 | // clear the noisy pixels for this chip | |
106 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
107 | if (gloChip>=1200) { | |
108 | Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip","global chip nr (%d) out of bounds\n",gloChip); | |
109 | return; | |
110 | } | |
111 | for (UInt_t col=0; col<32; col++) { | |
112 | for (UInt_t row=0; row<256; row++) { | |
113 | Int_t key = GetKey(eq,hs,chip,col,row); | |
114 | if (fNoisyPixelMap[gloChip]->Remove(key)) { | |
115 | fNrNoisy[gloChip]--; | |
116 | } | |
117 | } | |
118 | } | |
119 | } | |
120 | void AliITSOnlineCalibrationSPDhandler::ResetDeadForEq(UInt_t eq) { | |
121 | // clear the dead pixels for this eq | |
122 | if (eq>=20) { | |
123 | Error("AliITSOnlineCalibrationSPDhandler::ResetDeadForEq", "eq (%d) out of bounds.",eq); | |
124 | return; | |
125 | } | |
126 | for (UInt_t hs=0; hs<6; hs++) { | |
127 | for (UInt_t chip=0; chip<10; chip++) { | |
128 | ResetDeadForChip(eq, hs, chip); | |
129 | } | |
130 | } | |
131 | } | |
132 | void AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq(UInt_t eq) { | |
133 | // clear the noisy pixels for this eq | |
134 | if (eq>=20) { | |
135 | Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq", "eq (%d) out of bounds.",eq); | |
136 | return; | |
137 | } | |
138 | for (UInt_t hs=0; hs<6; hs++) { | |
139 | for (UInt_t chip=0; chip<10; chip++) { | |
140 | ResetNoisyForChip(eq, hs, chip); | |
141 | } | |
142 | } | |
143 | } | |
144 | //____________________________________________________________________________________________ | |
145 | Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromFiles() { | |
146 | // read dead and noisy files from file location. returns true if at least one file found | |
147 | Bool_t b1 = ReadNoisyFromFiles(); | |
148 | Bool_t b2 = ReadDeadFromFiles(); | |
149 | return (b1 && b2); | |
150 | } | |
151 | ||
53ae21ce | 152 | Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFiles() { |
153 | // read dead files from file location. returns true if at least one file found | |
154 | Bool_t returnval=kFALSE; | |
6727e2db | 155 | for (UInt_t eq=0; eq<20; eq++) { |
156 | if (ReadDeadFromFile(eq)) { | |
157 | returnval=kTRUE; | |
158 | } | |
159 | } | |
160 | return returnval; | |
161 | } | |
162 | Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFiles() { | |
163 | // read noisy files from file location. returns true if at least one file found | |
164 | Bool_t returnval=kFALSE; | |
165 | for (UInt_t eq=0; eq<20; eq++) { | |
166 | if (ReadNoisyFromFile(eq)) { | |
53ae21ce | 167 | returnval=kTRUE; |
168 | } | |
169 | } | |
170 | return returnval; | |
171 | } | |
6727e2db | 172 | Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFile(UInt_t eq) { |
173 | // read dead file for module from file location. | |
174 | TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq); | |
53ae21ce | 175 | return ReadDeadFromFileName(fileName.Data()); |
176 | } | |
6727e2db | 177 | Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFile(UInt_t eq) { |
178 | // read noisy file for module from file location. | |
179 | TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq); | |
180 | return ReadNoisyFromFileName(fileName.Data()); | |
181 | } | |
53ae21ce | 182 | Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFileName(const char *fileName) { |
183 | // read dead from file fileName | |
b15de2d2 | 184 | AliITSOnlineCalibrationSPD* calib; |
185 | FILE* fp0 = fopen(fileName, "r"); | |
03fc6773 | 186 | if (fp0 == NULL) {return kFALSE;} |
b15de2d2 | 187 | else { |
188 | fclose(fp0); | |
189 | TFile file(fileName, "READ"); | |
190 | if (file.IsOpen()) { | |
191 | file.GetObject("AliITSOnlineCalibrationSPD", calib); | |
192 | file.Close(); | |
193 | if (calib!=NULL) { | |
6727e2db | 194 | UInt_t nrDead=calib->GetNrBad(); |
195 | for (UInt_t index=0; index<nrDead; index++) { | |
196 | UInt_t key = calib->GetKeyAt(index); | |
197 | UInt_t eq = GetEqIdFromKey(key); | |
198 | UInt_t hs = GetHSFromKey(key); | |
199 | UInt_t chip = GetChipFromKey(key); | |
200 | UInt_t col = GetColFromKey(key); | |
201 | UInt_t row = GetRowFromKey(key); | |
202 | SetDeadPixel(eq,hs,chip,col,row); | |
b15de2d2 | 203 | } |
204 | } | |
205 | } | |
206 | } | |
03fc6773 | 207 | return kTRUE; |
b15de2d2 | 208 | } |
53ae21ce | 209 | Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFileName(const char *fileName) { |
210 | // read noisy from file fileName | |
b15de2d2 | 211 | AliITSOnlineCalibrationSPD* calib; |
212 | FILE* fp0 = fopen(fileName, "r"); | |
03fc6773 | 213 | if (fp0 == NULL) {return kFALSE;} |
b15de2d2 | 214 | else { |
215 | fclose(fp0); | |
216 | TFile file(fileName, "READ"); | |
217 | if (file.IsOpen()) { | |
218 | file.GetObject("AliITSOnlineCalibrationSPD", calib); | |
219 | file.Close(); | |
220 | if (calib!=NULL) { | |
6727e2db | 221 | UInt_t nrNoisy=calib->GetNrBad(); |
222 | for (UInt_t index=0; index<nrNoisy; index++) { | |
223 | UInt_t key = calib->GetKeyAt(index); | |
224 | UInt_t eq = GetEqIdFromKey(key); | |
225 | UInt_t hs = GetHSFromKey(key); | |
226 | UInt_t chip = GetChipFromKey(key); | |
227 | UInt_t col = GetColFromKey(key); | |
228 | UInt_t row = GetRowFromKey(key); | |
229 | SetNoisyPixel(eq,hs,chip,col,row); | |
b15de2d2 | 230 | } |
231 | } | |
232 | } | |
233 | } | |
03fc6773 | 234 | return kTRUE; |
b15de2d2 | 235 | } |
6727e2db | 236 | UInt_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromText(const char *fileName, UInt_t module) { |
237 | // read dead from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here) | |
238 | // insert only those pixels that belong to module (or all if module=240). | |
53ae21ce | 239 | UInt_t newNrDead=0; |
240 | ifstream textFile; | |
241 | textFile.open(fileName, ifstream::in); | |
242 | if (textFile.fail()) { | |
6727e2db | 243 | Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromText","No dead text file (%s) present.",fileName); |
53ae21ce | 244 | } |
245 | else { | |
246 | while(1) { | |
6727e2db | 247 | UInt_t eq,hs,chip,col,row; |
248 | textFile >> eq; if (textFile.eof()) break; | |
53ae21ce | 249 | textFile >> hs; if (textFile.eof()) break; |
250 | textFile >> chip; if (textFile.eof()) break; | |
251 | textFile >> col; if (textFile.eof()) break; | |
252 | textFile >> row; | |
6727e2db | 253 | if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){ |
254 | if (SetDeadPixel(eq,hs,chip,col,row)) { | |
255 | newNrDead++; | |
256 | } | |
53ae21ce | 257 | } |
258 | if (textFile.eof()) break; | |
259 | } | |
260 | textFile.close(); | |
261 | } | |
262 | return newNrDead; | |
263 | } | |
6727e2db | 264 | UInt_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText(const char *fileName, UInt_t module) { |
265 | // read noisy from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here) | |
266 | // insert only those pixels that belong to module (or all if module=240). | |
53ae21ce | 267 | UInt_t newNrNoisy=0; |
268 | ifstream textFile; | |
269 | textFile.open(fileName, ifstream::in); | |
270 | if (textFile.fail()) { | |
6727e2db | 271 | Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText","No noisy text file (%s) present.",fileName); |
53ae21ce | 272 | } |
273 | else { | |
274 | while(1) { | |
6727e2db | 275 | UInt_t eq,hs,chip,col,row; |
276 | textFile >> eq; if (textFile.eof()) break; | |
53ae21ce | 277 | textFile >> hs; if (textFile.eof()) break; |
278 | textFile >> chip; if (textFile.eof()) break; | |
279 | textFile >> col; if (textFile.eof()) break; | |
280 | textFile >> row; | |
6727e2db | 281 | if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){ |
282 | if (SetNoisyPixel(eq,hs,chip,col,row)) { | |
283 | newNrNoisy++; | |
284 | } | |
53ae21ce | 285 | } |
286 | if (textFile.eof()) break; | |
287 | } | |
288 | textFile.close(); | |
289 | } | |
290 | return newNrNoisy; | |
291 | } | |
6727e2db | 292 | //____________________________________________________________________________________________ |
293 | void AliITSOnlineCalibrationSPDhandler::WriteToFilesAlways() { | |
294 | // write the lists of dead and noisy to files | |
295 | for (UInt_t eq=0; eq<20; eq++) { | |
296 | WriteDeadToFile(eq); | |
297 | WriteNoisyToFile(eq); | |
298 | } | |
299 | } | |
300 | UInt_t AliITSOnlineCalibrationSPDhandler::WriteToFiles() { | |
301 | // write the lists of dead and noisy to files (only if there are >0 dead or noisy pixels) , returns nr of files produced | |
302 | return (WriteNoisyToFiles() + WriteDeadToFiles()); | |
303 | } | |
304 | void AliITSOnlineCalibrationSPDhandler::WriteDeadToFilesAlways() { | |
305 | // write the lists of dead to files | |
306 | for (UInt_t eq=0; eq<20; eq++) { | |
307 | WriteDeadToFile(eq); | |
308 | } | |
309 | } | |
310 | void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFilesAlways() { | |
311 | // write the lists of noisy to files | |
312 | for (UInt_t eq=0; eq<20; eq++) { | |
313 | WriteNoisyToFile(eq); | |
314 | } | |
315 | } | |
316 | UInt_t AliITSOnlineCalibrationSPDhandler::WriteDeadToFiles() { | |
317 | // write the list of dead to file (only if there are >0 dead pixels) , returns nr of files produced | |
318 | UInt_t nrFiles=0; | |
319 | for (UInt_t eq=0; eq<20; eq++) { | |
320 | if (GetNrDeadEq(eq) > 0) { | |
321 | WriteDeadToFile(eq); | |
322 | nrFiles++; | |
323 | } | |
324 | } | |
325 | return nrFiles; | |
326 | } | |
327 | UInt_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToFiles() { | |
328 | // write the list of noisy to file (only if there are >0 noisy pixels) , returns nr of files produced | |
329 | UInt_t nrFiles=0; | |
330 | for (UInt_t eq=0; eq<20; eq++) { | |
331 | if (GetNrNoisyEq(eq) > 0) { | |
332 | WriteNoisyToFile(eq); | |
333 | nrFiles++; | |
334 | } | |
335 | } | |
336 | return nrFiles; | |
337 | } | |
338 | void AliITSOnlineCalibrationSPDhandler::WriteDeadToFile(UInt_t eq) { | |
339 | // write the lists of dead and noisy for module to file | |
340 | AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD(); | |
341 | calib->SetEqNr(eq); | |
342 | calib->SetBadList(GetDeadArrayOnline(eq)); | |
343 | calib->SetNrBad(GetNrDeadEq(eq)); | |
344 | TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq); | |
345 | TFile file(fileName.Data(), "RECREATE"); | |
346 | file.WriteTObject(calib, "AliITSOnlineCalibrationSPD"); | |
347 | file.Close(); | |
348 | delete calib; | |
349 | } | |
350 | void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFile(UInt_t eq) { | |
351 | // write the lists of noisy and noisy for module to file | |
352 | AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD(); | |
353 | calib->SetEqNr(eq); | |
354 | calib->SetBadList(GetNoisyArrayOnline(eq)); | |
355 | calib->SetNrBad(GetNrNoisyEq(eq)); | |
356 | TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq); | |
357 | TFile file(fileName.Data(), "RECREATE"); | |
358 | file.WriteTObject(calib, "AliITSOnlineCalibrationSPD"); | |
359 | file.Close(); | |
360 | delete calib; | |
361 | } | |
362 | //____________________________________________________________________________________________ | |
53ae21ce | 363 | #ifndef SPD_DA_OFF |
6727e2db | 364 | Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB(UInt_t module, Int_t runNr, Bool_t treeSerial) { |
365 | // reads dead pixels from DB for given module and runNr | |
53ae21ce | 366 | AliCDBManager* man = AliCDBManager::Instance(); |
367 | if(!man->IsDefaultStorageSet()) { | |
368 | man->SetDefaultStorage("local://$ALICE_ROOT"); | |
369 | } | |
6727e2db | 370 | AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr); |
53ae21ce | 371 | TObjArray* spdEntry; |
372 | if(cdbEntry) { | |
373 | spdEntry = (TObjArray*)cdbEntry->GetObject(); | |
374 | if(!spdEntry) return kFALSE; | |
375 | } | |
376 | else { | |
6727e2db | 377 | Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB","Calibration for run %d not found in database.",runNr); |
53ae21ce | 378 | return kFALSE; |
379 | } | |
380 | AliITSCalibrationSPD* calibSPD; | |
381 | calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module); | |
6727e2db | 382 | UInt_t nrDead = calibSPD->GetNrBad(); |
383 | if (nrDead>0) { | |
384 | if (!treeSerial) RecursiveInsertDead(calibSPD,module,0,nrDead-1); | |
385 | else { | |
386 | for (UInt_t index=0; index<nrDead; index++) { | |
387 | UInt_t colM = calibSPD->GetBadColAt(index); | |
388 | UInt_t rowM = calibSPD->GetBadRowAt(index); | |
389 | SetDeadPixelM(module,colM,rowM); | |
390 | } | |
391 | } | |
53ae21ce | 392 | } |
393 | spdEntry->SetOwner(kTRUE); | |
394 | spdEntry->Clear(); | |
395 | return kTRUE; | |
396 | } | |
6727e2db | 397 | Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB(UInt_t module, Int_t runNr, Bool_t treeSerial) { |
398 | // reads noisy pixels from DB for given module and runNr | |
399 | AliCDBManager* man = AliCDBManager::Instance(); | |
400 | if(!man->IsDefaultStorageSet()) { | |
401 | man->SetDefaultStorage("local://$ALICE_ROOT"); | |
402 | } | |
403 | AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr); | |
404 | TObjArray* spdEntry; | |
405 | if(cdbEntry) { | |
406 | spdEntry = (TObjArray*)cdbEntry->GetObject(); | |
407 | if(!spdEntry) return kFALSE; | |
408 | } | |
409 | else { | |
410 | Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB","Calibration for run %d not found in database.",runNr); | |
411 | return kFALSE; | |
412 | } | |
413 | AliITSCalibrationSPD* calibSPD; | |
414 | calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module); | |
415 | UInt_t nrNoisy = calibSPD->GetNrBad(); | |
416 | if (nrNoisy>0) { | |
417 | if (!treeSerial) RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1); | |
418 | else { | |
419 | for (UInt_t index=0; index<nrNoisy; index++) { | |
420 | UInt_t colM = calibSPD->GetBadColAt(index); | |
421 | UInt_t rowM = calibSPD->GetBadRowAt(index); | |
422 | SetNoisyPixelM(module,colM,rowM); | |
423 | } | |
424 | } | |
425 | } | |
426 | spdEntry->SetOwner(kTRUE); | |
427 | spdEntry->Clear(); | |
428 | return kTRUE; | |
429 | } | |
430 | Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromDB(Int_t runNr, Bool_t treeSerial) { | |
53ae21ce | 431 | // reads dead and noisy pixels from DB for given runNr |
432 | // note that you may want to clear the lists (if they are not empty) before reading | |
6727e2db | 433 | return (ReadNoisyFromDB(runNr,treeSerial) && ReadDeadFromDB(runNr,treeSerial)); |
434 | } | |
435 | Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB(Int_t runNr, Bool_t treeSerial) { | |
436 | // reads dead pixels from DB for given runNr | |
437 | // note that you may want to clear the list (if it is not empty) before reading | |
53ae21ce | 438 | AliCDBManager* man = AliCDBManager::Instance(); |
439 | if(!man->IsDefaultStorageSet()) { | |
440 | man->SetDefaultStorage("local://$ALICE_ROOT"); | |
441 | } | |
6727e2db | 442 | AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr); |
53ae21ce | 443 | TObjArray* spdEntry; |
444 | if(cdbEntry) { | |
445 | spdEntry = (TObjArray*)cdbEntry->GetObject(); | |
446 | if(!spdEntry) return kFALSE; | |
447 | } | |
448 | else { | |
6727e2db | 449 | Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB","Calibration for run %d not found in database.",runNr); |
53ae21ce | 450 | return kFALSE; |
451 | } | |
452 | AliITSCalibrationSPD* calibSPD; | |
453 | for (UInt_t module=0; module<240; module++) { | |
454 | // printf("Reading module %d\n",module); | |
455 | calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module); | |
6727e2db | 456 | UInt_t nrDead = calibSPD->GetNrBad(); |
457 | if (nrDead>0) { | |
458 | if (!treeSerial) RecursiveInsertDead(calibSPD,module,0,nrDead-1); | |
459 | else { | |
460 | for (UInt_t index=0; index<nrDead; index++) { | |
461 | UInt_t colM = calibSPD->GetBadColAt(index); | |
462 | UInt_t rowM = calibSPD->GetBadRowAt(index); | |
463 | SetDeadPixelM(module,colM,rowM); | |
464 | } | |
465 | } | |
53ae21ce | 466 | } |
6727e2db | 467 | } |
468 | spdEntry->SetOwner(kTRUE); | |
469 | spdEntry->Clear(); | |
470 | return kTRUE; | |
471 | } | |
472 | Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB(Int_t runNr, Bool_t treeSerial) { | |
473 | // reads noisy pixels from DB for given runNr | |
474 | // note that you may want to clear the list (if it is not empty) before reading | |
475 | AliCDBManager* man = AliCDBManager::Instance(); | |
476 | if(!man->IsDefaultStorageSet()) { | |
477 | man->SetDefaultStorage("local://$ALICE_ROOT"); | |
478 | } | |
479 | AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr); | |
480 | TObjArray* spdEntry; | |
481 | if(cdbEntry) { | |
482 | spdEntry = (TObjArray*)cdbEntry->GetObject(); | |
483 | if(!spdEntry) return kFALSE; | |
484 | } | |
485 | else { | |
486 | Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB","Calibration for run %d not found in database.",runNr); | |
487 | return kFALSE; | |
488 | } | |
489 | AliITSCalibrationSPD* calibSPD; | |
490 | for (UInt_t module=0; module<240; module++) { | |
491 | // printf("Reading module %d\n",module); | |
492 | calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module); | |
493 | UInt_t nrNoisy = calibSPD->GetNrBad(); | |
494 | if (nrNoisy>0) { | |
495 | if (!treeSerial) { | |
496 | printf("*** mod %d nrnoisy=%d\n",module,nrNoisy); | |
497 | RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1); | |
498 | } | |
499 | else { | |
500 | for (UInt_t index=0; index<nrNoisy; index++) { | |
501 | UInt_t colM = calibSPD->GetBadColAt(index); | |
502 | UInt_t rowM = calibSPD->GetBadRowAt(index); | |
503 | SetNoisyPixelM(module,colM,rowM); | |
504 | } | |
505 | } | |
53ae21ce | 506 | } |
507 | } | |
508 | spdEntry->SetOwner(kTRUE); | |
509 | spdEntry->Clear(); | |
510 | return kTRUE; | |
511 | } | |
6727e2db | 512 | Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromCalibObj(TObjArray* calObj) { |
513 | // reads dead pixels from calib object | |
514 | for (UInt_t module=0; module<240; module++) { | |
515 | for (Int_t i=0; i<((AliITSCalibrationSPD*)calObj->At(module))->GetNrBad(); i++) { | |
516 | SetDeadPixelM(module, | |
517 | ((AliITSCalibrationSPD*)calObj->At(module))->GetBadColAt(i), | |
518 | ((AliITSCalibrationSPD*)calObj->At(module))->GetBadRowAt(i)); | |
519 | } | |
520 | } | |
521 | return kTRUE; | |
522 | } | |
523 | Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromCalibObj(TObjArray* calObj) { | |
524 | // reads noisy pixels from calib object | |
525 | for (UInt_t module=0; module<240; module++) { | |
526 | for (Int_t i=0; i<((AliITSCalibrationSPD*)calObj->At(module))->GetNrBad(); i++) { | |
527 | SetNoisyPixelM(module, | |
528 | ((AliITSCalibrationSPD*)calObj->At(module))->GetBadColAt(i), | |
529 | ((AliITSCalibrationSPD*)calObj->At(module))->GetBadRowAt(i)); | |
530 | } | |
531 | } | |
532 | return kTRUE; | |
533 | } | |
53ae21ce | 534 | Bool_t AliITSOnlineCalibrationSPDhandler::WriteToDB(Int_t runNrStart, Int_t runNrEnd) { |
6727e2db | 535 | // writes dead and noisy pixels to DB for given runNrs |
536 | // overwrites any previous entries | |
537 | return (WriteNoisyToDB(runNrStart,runNrEnd) && WriteDeadToDB(runNrStart,runNrEnd)); | |
538 | } | |
539 | Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDB(Int_t runNrStart, Int_t runNrEnd) { | |
540 | // writes dead pixels to DB for given runNrs | |
53ae21ce | 541 | // overwrites any previous entries |
542 | AliCDBManager* man = AliCDBManager::Instance(); | |
543 | if(!man->IsDefaultStorageSet()) { | |
544 | man->SetDefaultStorage("local://$ALICE_ROOT"); | |
545 | } | |
546 | AliCDBMetaData* metaData = new AliCDBMetaData(); | |
547 | metaData->SetResponsible("Henrik Tydesjo"); | |
548 | metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler."); | |
6727e2db | 549 | AliCDBId idCalSPD("ITS/Calib/SPDDead",runNrStart,runNrEnd); |
53ae21ce | 550 | TObjArray* spdEntry = new TObjArray(240); |
551 | spdEntry->SetOwner(kTRUE); | |
552 | for(UInt_t module=0; module<240; module++){ | |
553 | AliITSCalibrationSPD* calObj = new AliITSCalibrationSPD(); | |
3479cee3 | 554 | |
555 | // *** this is temporarily hard coded here ******************** | |
556 | // (later these parameters will be separated from the cal.obj.) | |
557 | calObj->SetThresholds(3000, 250); | |
558 | calObj->SetBiasVoltage(18.182); | |
559 | calObj->SetNoiseParam(0,0); | |
3479cee3 | 560 | calObj->SetCouplingParam(0.,0.055); |
561 | // *** remove later... | |
562 | // ************************************************************ | |
563 | ||
53ae21ce | 564 | spdEntry->Add(calObj); |
565 | } | |
566 | for(UInt_t module=0; module<240; module++){ | |
6727e2db | 567 | ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNrBad( GetNrDead(module) ); |
568 | ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetBadList( GetDeadArray(module) ); | |
53ae21ce | 569 | } |
570 | AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData); | |
571 | man->Put(cdbEntry); | |
572 | delete spdEntry; | |
573 | delete cdbEntry; | |
574 | delete metaData; | |
575 | return kTRUE; | |
576 | } | |
6727e2db | 577 | Bool_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToDB(Int_t runNrStart, Int_t runNrEnd) { |
578 | // writes noisy pixels to DB for given runNrs | |
579 | // overwrites any previous entries | |
580 | AliCDBManager* man = AliCDBManager::Instance(); | |
581 | if(!man->IsDefaultStorageSet()) { | |
582 | man->SetDefaultStorage("local://$ALICE_ROOT"); | |
583 | } | |
584 | AliCDBMetaData* metaData = new AliCDBMetaData(); | |
585 | metaData->SetResponsible("Henrik Tydesjo"); | |
586 | metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler."); | |
587 | AliCDBId idCalSPD("ITS/Calib/SPDNoisy",runNrStart,runNrEnd); | |
588 | TObjArray* spdEntry = new TObjArray(240); | |
589 | spdEntry->SetOwner(kTRUE); | |
590 | for(UInt_t module=0; module<240; module++){ | |
591 | AliITSCalibrationSPD* calObj = new AliITSCalibrationSPD(); | |
53ae21ce | 592 | |
6727e2db | 593 | // *** this is temporarily hard coded here ******************** |
594 | // (later these parameters will be separated from the cal.obj.) | |
595 | calObj->SetThresholds(3000, 250); | |
596 | calObj->SetBiasVoltage(18.182); | |
597 | calObj->SetNoiseParam(0,0); | |
598 | calObj->SetCouplingParam(0.,0.055); | |
599 | // *** remove later... | |
600 | // ************************************************************ | |
601 | ||
602 | spdEntry->Add(calObj); | |
3479cee3 | 603 | } |
6727e2db | 604 | for(UInt_t module=0; module<240; module++){ |
605 | ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNrBad( GetNrNoisy(module) ); | |
606 | ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetBadList( GetNoisyArray(module) ); | |
53ae21ce | 607 | } |
6727e2db | 608 | AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData); |
609 | man->Put(cdbEntry); | |
610 | delete spdEntry; | |
611 | delete cdbEntry; | |
612 | delete metaData; | |
613 | return kTRUE; | |
53ae21ce | 614 | } |
6727e2db | 615 | //____________________________________________________________________________________________ |
616 | void AliITSOnlineCalibrationSPDhandler::RecursiveInsertDead(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) { | |
617 | // inserts dead pixels recursively, used when reading from db | |
618 | if (lowInd>highInd) return; | |
619 | Int_t thisInd = lowInd+(highInd-lowInd)/2; | |
620 | SetDeadPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd)); | |
621 | RecursiveInsertDead(calibSPD,module,lowInd,thisInd-1); | |
622 | RecursiveInsertDead(calibSPD,module,thisInd+1,highInd); | |
623 | } | |
624 | void AliITSOnlineCalibrationSPDhandler::RecursiveInsertNoisy(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) { | |
625 | // inserts noisy pixels recursively, used when reading from db | |
626 | printf("Rec mod %d : %d,%d\n",module,lowInd,highInd); | |
627 | if (lowInd>highInd) return; | |
628 | Int_t thisInd = lowInd+(highInd-lowInd)/2; | |
629 | SetNoisyPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd)); | |
630 | RecursiveInsertNoisy(calibSPD,module,lowInd,thisInd-1); | |
631 | RecursiveInsertNoisy(calibSPD,module,thisInd+1,highInd); | |
53ae21ce | 632 | } |
6727e2db | 633 | |
634 | #endif | |
635 | //____________________________________________________________________________________________ | |
636 | void AliITSOnlineCalibrationSPDhandler::GenerateDCSConfigFile(const Char_t* fileName) { | |
637 | // generates an ascii file in the format as the one produced by online da (but with dummy runNr=0) | |
638 | ofstream dcsfile; | |
639 | dcsfile.open(fileName); | |
640 | dcsfile << "[SPD SCAN]\n"; | |
641 | dcsfile << "RunNumber=" << "0" << "\n"; // dummy value | |
642 | dcsfile << "Type=" << "4" << "\n"; | |
643 | dcsfile << "Router=" << "0" << "\n"; // dummy value | |
4f88491f | 644 | dcsfile << "ActualDetConfiguration=" << "0,-1,-1\n"; // dummy values |
6727e2db | 645 | dcsfile << "[NOISY]\n"; |
53ae21ce | 646 | for (UInt_t module=0; module<240; module++) { |
6727e2db | 647 | UInt_t headkey=20*10*6; |
648 | for (UInt_t ind=0; ind<GetNrNoisy(module); ind++) { | |
649 | UInt_t newkey = GetNoisyEqIdAt(module,ind)*10*6 + | |
650 | GetNoisyHSAt(module,ind)*10 + | |
651 | GetNoisyChipAt(module,ind); | |
652 | if (newkey!=headkey) { // print eq,hs,chip header | |
653 | headkey = newkey; | |
654 | dcsfile << "-" << newkey/(6*10) << "," << (newkey%(6*10))/10 << "," << (newkey%(6*10))%10 << "\n"; | |
655 | } | |
656 | dcsfile << GetNoisyColAt(module,ind) << "," << GetNoisyRowAt(module,ind) << "\n"; | |
53ae21ce | 657 | } |
658 | } | |
6727e2db | 659 | dcsfile.close(); |
53ae21ce | 660 | } |
6727e2db | 661 | //____________________________________________________________________________________________ |
e03405c9 | 662 | TArrayS AliITSOnlineCalibrationSPDhandler::GetDeadArray(UInt_t module, Bool_t treeSerial) { |
663 | // get a TArrayS of the dead pixels (format for the AliITSCalibrationSPD object) | |
664 | TArrayS returnArray; | |
6727e2db | 665 | |
666 | UInt_t eq = GetEqIdFromOffline(module); | |
667 | UInt_t hs = GetHSFromOffline(module); | |
668 | UInt_t size=0; | |
669 | for (UInt_t chip=0; chip<5; chip++) { | |
670 | UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32)); | |
671 | size += fNrDead[gloChip]; | |
672 | } | |
673 | returnArray.Set(size*2); | |
674 | UInt_t gloIndex=0; | |
675 | for (UInt_t chip=0; chip<5; chip++) { | |
676 | UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32)); | |
677 | if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values | |
678 | else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values | |
679 | for (UInt_t index=0; index<fNrDead[gloChip]; index++) { | |
680 | Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index); | |
681 | Int_t colM = GetColMFromKey(key); | |
682 | Int_t rowM = GetRowMFromKey(key); | |
683 | returnArray.AddAt(colM,gloIndex*2); | |
684 | returnArray.AddAt(rowM,gloIndex*2+1); | |
685 | gloIndex++; | |
53ae21ce | 686 | } |
687 | } | |
6727e2db | 688 | return returnArray; |
53ae21ce | 689 | } |
e03405c9 | 690 | TArrayS AliITSOnlineCalibrationSPDhandler::GetNoisyArray(UInt_t module, Bool_t treeSerial) { |
691 | // get a TArrayS of the noisy pixels (format for the AliITSCalibrationSPD object) | |
692 | TArrayS returnArray; | |
6727e2db | 693 | |
694 | UInt_t eq = GetEqIdFromOffline(module); | |
695 | UInt_t hs = GetHSFromOffline(module); | |
696 | UInt_t size=0; | |
697 | for (UInt_t chip=0; chip<5; chip++) { | |
698 | UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32)); | |
699 | size += fNrNoisy[gloChip]; | |
700 | } | |
701 | returnArray.Set(size*2); | |
702 | UInt_t gloIndex=0; | |
703 | for (UInt_t chip=0; chip<5; chip++) { | |
704 | UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32)); | |
705 | if (treeSerial) fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values | |
706 | else fNoisyPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values | |
707 | for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) { | |
708 | Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index); | |
709 | Int_t colM = GetColMFromKey(key); | |
710 | Int_t rowM = GetRowMFromKey(key); | |
711 | returnArray.AddAt(colM,gloIndex*2); | |
712 | returnArray.AddAt(rowM,gloIndex*2+1); | |
713 | gloIndex++; | |
714 | } | |
b15de2d2 | 715 | } |
716 | return returnArray; | |
717 | } | |
60d9faf6 | 718 | TArrayI AliITSOnlineCalibrationSPDhandler::GetDeadArrayOnline(UInt_t eq) { |
719 | // get a TArrayI of the dead pixels (format for the AliITSOnlineCalibrationSPD object) | |
720 | TArrayI returnArray; | |
6727e2db | 721 | // fix size of array |
722 | UInt_t size=0; | |
723 | for (UInt_t hs=0; hs<6; hs++) { | |
724 | for (UInt_t chip=0; chip<10; chip++) { | |
725 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
726 | size+=fNrDead[gloChip]; | |
727 | } | |
728 | } | |
729 | returnArray.Set(size); | |
730 | // put keys in array | |
731 | UInt_t gloIndex=0; | |
732 | for (UInt_t hs=0; hs<6; hs++) { | |
733 | for (UInt_t chip=0; chip<10; chip++) { | |
734 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
735 | fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values | |
736 | for (UInt_t index=0; index<fNrDead[gloChip]; index++) { | |
737 | Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index); | |
738 | returnArray.AddAt(key,gloIndex); | |
739 | gloIndex++; | |
740 | } | |
741 | } | |
b15de2d2 | 742 | } |
743 | return returnArray; | |
744 | } | |
60d9faf6 | 745 | TArrayI AliITSOnlineCalibrationSPDhandler::GetNoisyArrayOnline(UInt_t eq) { |
746 | // get a TArrayI of the noisy pixels (format for the AliITSOnlineCalibrationSPD object) | |
747 | TArrayI returnArray; | |
6727e2db | 748 | // fix size of array |
749 | UInt_t size=0; | |
750 | for (UInt_t hs=0; hs<6; hs++) { | |
751 | for (UInt_t chip=0; chip<10; chip++) { | |
752 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
753 | size+=fNrNoisy[gloChip]; | |
754 | } | |
53ae21ce | 755 | } |
6727e2db | 756 | returnArray.Set(size); |
757 | // put keys in array | |
758 | UInt_t gloIndex=0; | |
759 | for (UInt_t hs=0; hs<6; hs++) { | |
760 | for (UInt_t chip=0; chip<10; chip++) { | |
761 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
762 | fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values | |
763 | for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) { | |
764 | Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index); | |
765 | returnArray.AddAt(key,gloIndex); | |
766 | gloIndex++; | |
53ae21ce | 767 | } |
768 | } | |
769 | } | |
6727e2db | 770 | return returnArray; |
b15de2d2 | 771 | } |
6727e2db | 772 | //____________________________________________________________________________________________ |
773 | void AliITSOnlineCalibrationSPDhandler::PrintEqSummary() { | |
774 | // print summary (nr of dead and noisy) for each equipment | |
775 | printf("-----------\n"); | |
776 | printf("Eq summary:\n"); | |
777 | printf("-----------\n"); | |
778 | for (UInt_t eq=0; eq<20; eq++) { | |
779 | printf("Eq %*d: %*d dead , %*d noisy\n",2,eq,5,GetNrDeadEq(eq),5,GetNrNoisyEq(eq)); | |
b15de2d2 | 780 | } |
b15de2d2 | 781 | } |
6727e2db | 782 | void AliITSOnlineCalibrationSPDhandler::PrintDead() const { |
783 | // print the dead pixels to screen | |
784 | printf("------------------------------------------------------\n"); | |
785 | printf("Dead Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n"); | |
786 | printf("------------------------------------------------------\n"); | |
787 | for (UInt_t gloChip=0; gloChip<1200; gloChip++) { | |
788 | for (UInt_t index=0; index<fNrDead[gloChip]; index++) { | |
789 | Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index); | |
790 | UInt_t eq = GetEqIdFromKey(key); | |
791 | UInt_t hs = GetHSFromKey(key); | |
792 | UInt_t chip = GetChipFromKey(key); | |
793 | UInt_t col = GetColFromKey(key); | |
794 | UInt_t row = GetRowFromKey(key); | |
b15de2d2 | 795 | |
6727e2db | 796 | UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip); |
797 | UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col); | |
798 | UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row); | |
799 | ||
800 | 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); | |
801 | } | |
b15de2d2 | 802 | } |
b15de2d2 | 803 | } |
6727e2db | 804 | void AliITSOnlineCalibrationSPDhandler::PrintNoisy() const { |
805 | // print the dead pixels to screen | |
806 | printf("-------------------------------------------------------\n"); | |
807 | printf("Noisy Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n"); | |
808 | printf("-------------------------------------------------------\n"); | |
809 | for (UInt_t gloChip=0; gloChip<1200; gloChip++) { | |
810 | for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) { | |
811 | Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index); | |
812 | UInt_t eq = GetEqIdFromKey(key); | |
813 | UInt_t hs = GetHSFromKey(key); | |
814 | UInt_t chip = GetChipFromKey(key); | |
815 | UInt_t col = GetColFromKey(key); | |
816 | UInt_t row = GetRowFromKey(key); | |
b15de2d2 | 817 | |
6727e2db | 818 | UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip); |
819 | UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col); | |
820 | UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row); | |
821 | ||
822 | 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); | |
823 | } | |
3479cee3 | 824 | } |
3479cee3 | 825 | } |
6727e2db | 826 | //____________________________________________________________________________________________ |
827 | Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) { | |
828 | // set a dead pixel, returns false if pixel is already dead | |
829 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
830 | if (gloChip>=1200) { | |
831 | Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip); | |
832 | return kFALSE; | |
833 | } | |
834 | if (col>=32 && row>=256) { | |
835 | Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "col,row nrs (%d,%d) out of bounds.",col,row); | |
836 | return kFALSE; | |
837 | } | |
838 | Int_t key = GetKey(eq,hs,chip,col,row); | |
839 | // if noisy we dont want to add it... | |
840 | if (fNoisyPixelMap[gloChip]->Find(key) != NULL) return kFALSE; | |
841 | if (fDeadPixelMap[gloChip]->Insert(key,gloChip)) { | |
842 | fNrDead[gloChip]++; | |
3479cee3 | 843 | return kTRUE; |
844 | } | |
845 | return kFALSE; | |
846 | } | |
6727e2db | 847 | Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) { |
848 | // set a noisy pixel, returns false if pixel is already noisy | |
849 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
850 | if (gloChip>=1200) { | |
851 | Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip); | |
852 | return kFALSE; | |
b15de2d2 | 853 | } |
6727e2db | 854 | if (col>=32 && row>=256) { |
855 | Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "col,row nrs (%d,%d) out of bounds.",col,row); | |
b15de2d2 | 856 | return kFALSE; |
857 | } | |
6727e2db | 858 | Int_t key = GetKey(eq,hs,chip,col,row); |
859 | // if dead before - remove from the dead list | |
860 | if (fDeadPixelMap[gloChip]->Remove(key)) { | |
861 | fNrDead[gloChip]--; | |
862 | } | |
863 | if (fNoisyPixelMap[gloChip]->Insert(key,gloChip)) { | |
864 | fNrNoisy[gloChip]++; | |
865 | return kTRUE; | |
866 | } | |
867 | return kFALSE; | |
b15de2d2 | 868 | } |
6727e2db | 869 | Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) { |
870 | // set a dead pixel, returns false if pixel is already dead | |
871 | UInt_t eq = GetEqIdFromOffline(module); | |
53ae21ce | 872 | UInt_t hs = GetHSFromOffline(module); |
873 | UInt_t chip = GetChipFromOffline(module,colM); | |
6727e2db | 874 | UInt_t col = GetColFromOffline(module,colM); |
875 | UInt_t row = GetRowFromOffline(module,rowM); | |
876 | return SetDeadPixel(eq,hs,chip,col,row); | |
53ae21ce | 877 | } |
6727e2db | 878 | Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) { |
879 | // set a noisy pixel, returns false if pixel is already noisy | |
880 | UInt_t eq = GetEqIdFromOffline(module); | |
881 | UInt_t hs = GetHSFromOffline(module); | |
882 | UInt_t chip = GetChipFromOffline(module,colM); | |
883 | UInt_t col = GetColFromOffline(module,colM); | |
884 | UInt_t row = GetRowFromOffline(module,rowM); | |
885 | return SetNoisyPixel(eq,hs,chip,col,row); | |
53ae21ce | 886 | } |
6727e2db | 887 | Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) { |
888 | // unset a dead pixel, returns false if pixel is not dead | |
889 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
890 | if (gloChip>=1200) { | |
891 | Error("AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip); | |
892 | return kFALSE; | |
53ae21ce | 893 | } |
6727e2db | 894 | Int_t key = GetKey(eq,hs,chip,col,row); |
895 | if (fDeadPixelMap[gloChip]->Remove(key)) { | |
896 | fNrDead[gloChip]--; | |
897 | return kTRUE; | |
53ae21ce | 898 | } |
6727e2db | 899 | return kFALSE; |
53ae21ce | 900 | } |
6727e2db | 901 | Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) { |
902 | // unset a noisy pixel, returns false if pixel is not noisy | |
903 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
904 | if (gloChip>=1200) { | |
905 | Error("AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip); | |
906 | return kFALSE; | |
53ae21ce | 907 | } |
6727e2db | 908 | Int_t key = GetKey(eq,hs,chip,col,row); |
909 | if (fNoisyPixelMap[gloChip]->Remove(key)) { | |
910 | fNrNoisy[gloChip]--; | |
911 | return kTRUE; | |
53ae21ce | 912 | } |
6727e2db | 913 | return kFALSE; |
53ae21ce | 914 | } |
6727e2db | 915 | Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) { |
916 | // unset a dead pixel, returns false if pixel is not dead | |
917 | UInt_t eq = GetEqIdFromOffline(module); | |
918 | UInt_t hs = GetHSFromOffline(module); | |
919 | UInt_t chip = GetChipFromOffline(module,colM); | |
920 | UInt_t col = GetColFromOffline(module,colM); | |
921 | UInt_t row = GetRowFromOffline(module,rowM); | |
922 | return UnSetDeadPixel(eq,hs,chip,col,row); | |
53ae21ce | 923 | } |
6727e2db | 924 | Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) { |
925 | // unset a noisy pixel, returns false if pixel is not noisy | |
926 | UInt_t eq = GetEqIdFromOffline(module); | |
927 | UInt_t hs = GetHSFromOffline(module); | |
928 | UInt_t chip = GetChipFromOffline(module,colM); | |
929 | UInt_t col = GetColFromOffline(module,colM); | |
930 | UInt_t row = GetRowFromOffline(module,rowM); | |
931 | return UnSetNoisyPixel(eq,hs,chip,col,row); | |
53ae21ce | 932 | } |
6727e2db | 933 | UInt_t AliITSOnlineCalibrationSPDhandler::SetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip) { |
934 | // set a full chip dead, returns nr of new dead pixels | |
935 | UInt_t nrNew = 0; | |
936 | for (UInt_t col=0; col<32; col++) { | |
937 | for (UInt_t row=0; row<256; row++) { | |
938 | if (SetDeadPixel(eq,hs,chip,col,row)) { | |
939 | nrNew++; | |
940 | } | |
941 | } | |
53ae21ce | 942 | } |
6727e2db | 943 | return nrNew; |
53ae21ce | 944 | } |
6727e2db | 945 | UInt_t AliITSOnlineCalibrationSPDhandler::SetNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip) { |
946 | // set a full chip noisy, returns nr of new noisy pixels | |
947 | UInt_t nrNew = 0; | |
948 | for (UInt_t col=0; col<32; col++) { | |
949 | for (UInt_t row=0; row<256; row++) { | |
950 | if (SetNoisyPixel(eq,hs,chip,col,row)) { | |
951 | nrNew++; | |
952 | } | |
953 | } | |
53ae21ce | 954 | } |
6727e2db | 955 | return nrNew; |
53ae21ce | 956 | } |
6727e2db | 957 | Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip) { |
958 | // unset a full dead chip, returns false if it was not all dead before | |
959 | UInt_t nrUnset = 0; | |
960 | for (UInt_t col=0; col<32; col++) { | |
961 | for (UInt_t row=0; row<256; row++) { | |
962 | if (UnSetDeadPixel(eq,hs,chip,col,row)) { | |
963 | nrUnset++; | |
964 | } | |
965 | } | |
53ae21ce | 966 | } |
6727e2db | 967 | if (nrUnset+GetNrNoisyC(eq,hs,chip)<8192) return kFALSE; |
968 | else return kTRUE; | |
b15de2d2 | 969 | } |
6727e2db | 970 | Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip) { |
971 | // unset a full noisy chip, returns false if it was not all noisy before | |
972 | UInt_t nrUnset = 0; | |
53ae21ce | 973 | for (UInt_t col=0; col<32; col++) { |
974 | for (UInt_t row=0; row<256; row++) { | |
6727e2db | 975 | if (UnSetNoisyPixel(eq,hs,chip,col,row)) { |
976 | nrUnset++; | |
53ae21ce | 977 | } |
978 | } | |
979 | } | |
6727e2db | 980 | if (nrUnset<8192) return kFALSE; |
981 | else return kTRUE; | |
53ae21ce | 982 | } |
6727e2db | 983 | //____________________________________________________________________________________________ |
984 | Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDead(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const { | |
985 | // is the pixel dead? | |
986 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
987 | if (gloChip>=1200) { | |
988 | Error("AliITSOnlineCalibrationSPDhandler::IsPixelDead", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip); | |
989 | return kFALSE; | |
53ae21ce | 990 | } |
6727e2db | 991 | UInt_t key = GetKey(eq,hs,chip,col,row); |
992 | if ( fDeadPixelMap[gloChip]->Find(key) != NULL ) { | |
53ae21ce | 993 | return kTRUE; |
b15de2d2 | 994 | } |
6727e2db | 995 | else { |
996 | return kFALSE; | |
997 | } | |
b15de2d2 | 998 | } |
6727e2db | 999 | Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisy(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const { |
1000 | // is the pixel noisy? | |
1001 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
1002 | if (gloChip>=1200) { | |
1003 | Error("AliITSOnlineCalibrationSPDhandler::IsPixelNoisy", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip); | |
1004 | return kFALSE; | |
1005 | } | |
1006 | UInt_t key = GetKey(eq,hs,chip,col,row); | |
1007 | if ( fNoisyPixelMap[gloChip]->Find(key) != NULL ) { | |
3479cee3 | 1008 | return kTRUE; |
1009 | } | |
6727e2db | 1010 | else { |
1011 | return kFALSE; | |
1012 | } | |
3479cee3 | 1013 | } |
6727e2db | 1014 | Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadM(UInt_t module, UInt_t colM, UInt_t rowM) const { |
1015 | // is the pixel dead? | |
1016 | UInt_t eq = GetEqIdFromOffline(module); | |
3479cee3 | 1017 | UInt_t hs = GetHSFromOffline(module); |
1018 | UInt_t chip = GetChipFromOffline(module,colM); | |
6727e2db | 1019 | UInt_t col = GetColFromOffline(module,colM); |
1020 | UInt_t row = GetRowFromOffline(module,rowM); | |
1021 | return IsPixelDead(eq,hs,chip,col,row); | |
1022 | } | |
1023 | Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyM(UInt_t module, UInt_t colM, UInt_t rowM) const { | |
1024 | // is the pixel noisy? | |
1025 | UInt_t eq = GetEqIdFromOffline(module); | |
1026 | UInt_t hs = GetHSFromOffline(module); | |
1027 | UInt_t chip = GetChipFromOffline(module,colM); | |
1028 | UInt_t col = GetColFromOffline(module,colM); | |
1029 | UInt_t row = GetRowFromOffline(module,rowM); | |
1030 | return IsPixelNoisy(eq,hs,chip,col,row); | |
1031 | } | |
1032 | Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadKey(Int_t key) const { | |
1033 | // is this pixel dead? | |
1034 | UInt_t eq = GetEqIdFromKey(key); | |
1035 | UInt_t hs = GetHSFromKey(key); | |
1036 | UInt_t chip = GetChipFromKey(key); | |
1037 | UInt_t col = GetColFromKey(key); | |
1038 | UInt_t row = GetRowFromKey(key); | |
1039 | return IsPixelDead(eq,hs,chip,col,row); | |
3479cee3 | 1040 | } |
53ae21ce | 1041 | Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyKey(Int_t key) const { |
1042 | // is this pixel noisy? | |
6727e2db | 1043 | UInt_t eq = GetEqIdFromKey(key); |
53ae21ce | 1044 | UInt_t hs = GetHSFromKey(key); |
1045 | UInt_t chip = GetChipFromKey(key); | |
6727e2db | 1046 | UInt_t col = GetColFromKey(key); |
1047 | UInt_t row = GetRowFromKey(key); | |
1048 | return IsPixelNoisy(eq,hs,chip,col,row); | |
b15de2d2 | 1049 | } |
6727e2db | 1050 | //____________________________________________________________________________________________ |
1051 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead() const { | |
1052 | // returns the total nr of dead pixels | |
1053 | UInt_t nrDead = 0; | |
1054 | for (UInt_t gloChip=0; gloChip<1200; gloChip++) { | |
1055 | nrDead+=fNrDead[gloChip]; | |
b15de2d2 | 1056 | } |
6727e2db | 1057 | return nrDead; |
b15de2d2 | 1058 | } |
53ae21ce | 1059 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy() const { |
1060 | // returns the total nr of noisy pixels | |
1061 | UInt_t nrNoisy = 0; | |
6727e2db | 1062 | for (UInt_t gloChip=0; gloChip<1200; gloChip++) { |
1063 | nrNoisy+=fNrNoisy[gloChip]; | |
53ae21ce | 1064 | } |
1065 | return nrNoisy; | |
1066 | } | |
6727e2db | 1067 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t index) { |
1068 | // get eq for the dead pixel at position index in list of dead | |
1069 | UInt_t gloChip; | |
1070 | UInt_t chipIndex; | |
1071 | GetChipAndIndexTotDead(index,gloChip,chipIndex); | |
1072 | return GetDeadEqIdAtC2(gloChip,chipIndex); | |
1073 | } | |
1074 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t index) { | |
1075 | // get eq for the noisy pixel at position index in list of noisy | |
1076 | UInt_t gloChip; | |
1077 | UInt_t chipIndex; | |
1078 | GetChipAndIndexTotNoisy(index,gloChip,chipIndex); | |
1079 | return GetNoisyEqIdAtC2(gloChip,chipIndex); | |
1080 | } | |
1081 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t index) { | |
1082 | // get hs for the dead pixel at position index in list of dead | |
1083 | UInt_t gloChip; | |
1084 | UInt_t chipIndex; | |
1085 | GetChipAndIndexTotDead(index,gloChip,chipIndex); | |
1086 | return GetDeadHSAtC2(gloChip,chipIndex); | |
1087 | } | |
1088 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t index) { | |
1089 | // get hs for the noisy pixel at position index in list of noisy | |
1090 | UInt_t gloChip; | |
1091 | UInt_t chipIndex; | |
1092 | GetChipAndIndexTotNoisy(index,gloChip,chipIndex); | |
1093 | return GetNoisyHSAtC2(gloChip,chipIndex); | |
1094 | } | |
1095 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t index) { | |
1096 | // get chip for the dead pixel at position index in list of dead | |
1097 | UInt_t gloChip; | |
1098 | UInt_t chipIndex; | |
1099 | GetChipAndIndexTotDead(index,gloChip,chipIndex); | |
1100 | return GetDeadChipAtC2(gloChip,chipIndex); | |
1101 | } | |
1102 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t index) { | |
1103 | // get chip for the noisy pixel at position index in list of noisy | |
1104 | UInt_t gloChip; | |
1105 | UInt_t chipIndex; | |
1106 | GetChipAndIndexTotNoisy(index,gloChip,chipIndex); | |
1107 | return GetNoisyChipAtC2(gloChip,chipIndex); | |
1108 | } | |
1109 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t index) { | |
1110 | // get hs for the dead pixel at position index in list of dead | |
1111 | UInt_t gloChip; | |
1112 | UInt_t chipIndex; | |
1113 | GetChipAndIndexTotDead(index,gloChip,chipIndex); | |
1114 | return GetDeadColAtC2(gloChip,chipIndex); | |
1115 | } | |
1116 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t index) { | |
1117 | // get hs for the noisy pixel at position index in list of noisy | |
1118 | UInt_t gloChip; | |
1119 | UInt_t chipIndex; | |
1120 | GetChipAndIndexTotNoisy(index,gloChip,chipIndex); | |
1121 | return GetNoisyColAtC2(gloChip,chipIndex); | |
1122 | } | |
1123 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t index) { | |
1124 | // get hs for the dead pixel at position index in list of dead | |
1125 | UInt_t gloChip; | |
1126 | UInt_t chipIndex; | |
1127 | GetChipAndIndexTotDead(index,gloChip,chipIndex); | |
1128 | return GetDeadRowAtC2(gloChip,chipIndex); | |
1129 | } | |
1130 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t index) { | |
1131 | // get hs for the noisy pixel at position index in list of noisy | |
1132 | UInt_t gloChip; | |
1133 | UInt_t chipIndex; | |
1134 | GetChipAndIndexTotNoisy(index,gloChip,chipIndex); | |
1135 | return GetNoisyRowAtC2(gloChip,chipIndex); | |
1136 | } | |
1137 | //____________________________________________________________________________________________ | |
1138 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead(UInt_t module) const { | |
1139 | // returns the number of dead pixels for a certain module | |
1140 | if (module>=240) { | |
1141 | Error("AliITSOnlineCalibrationSPDhandler::GetNrDead", "module nr (%d) out of bounds.",module); | |
53ae21ce | 1142 | return 0; |
1143 | } | |
6727e2db | 1144 | UInt_t nrDead = 0; |
1145 | UInt_t eq = GetEqIdFromOffline(module); | |
1146 | UInt_t hs = GetHSFromOffline(module); | |
1147 | for (UInt_t chip=0; chip<5; chip++) { | |
1148 | UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32)); | |
1149 | nrDead+=fNrDead[gloChip]; | |
53ae21ce | 1150 | |
53ae21ce | 1151 | } |
6727e2db | 1152 | return nrDead; |
1153 | } | |
1154 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy(UInt_t module) const { | |
1155 | // returns the number of noisy pixels for a certain module | |
1156 | if (module>=240) { | |
1157 | Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisy", "module nr (%d) out of bounds.",module); | |
53ae21ce | 1158 | return 0; |
1159 | } | |
6727e2db | 1160 | UInt_t nrNoisy = 0; |
1161 | UInt_t eq = GetEqIdFromOffline(module); | |
1162 | UInt_t hs = GetHSFromOffline(module); | |
1163 | for (UInt_t chip=0; chip<5; chip++) { | |
1164 | UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32)); | |
1165 | nrNoisy+=fNrNoisy[gloChip]; | |
1166 | ||
1167 | } | |
1168 | return nrNoisy; | |
1169 | } | |
1170 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t module, UInt_t index) { | |
1171 | // get eq for the dead pixel at position index in list of dead | |
1172 | UInt_t gloChip; | |
1173 | UInt_t chipIndex; | |
1174 | GetChipAndIndexDead(module,index,gloChip,chipIndex); | |
1175 | return GetDeadEqIdAtC2(gloChip,chipIndex); | |
1176 | } | |
1177 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t module, UInt_t index) { | |
1178 | // get eq for the noisy pixel at position index in list of noisy | |
1179 | UInt_t gloChip; | |
1180 | UInt_t chipIndex; | |
1181 | GetChipAndIndexNoisy(module,index,gloChip,chipIndex); | |
1182 | return GetNoisyEqIdAtC2(gloChip,chipIndex); | |
1183 | } | |
1184 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t module, UInt_t index) { | |
1185 | // get hs for the dead pixel at position index in list of dead | |
1186 | UInt_t gloChip; | |
1187 | UInt_t chipIndex; | |
1188 | GetChipAndIndexDead(module,index,gloChip,chipIndex); | |
1189 | return GetDeadHSAtC2(gloChip,chipIndex); | |
53ae21ce | 1190 | } |
1191 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t module, UInt_t index) { | |
6727e2db | 1192 | // get hs for the noisy pixel at position index in list of noisy |
1193 | UInt_t gloChip; | |
1194 | UInt_t chipIndex; | |
1195 | GetChipAndIndexNoisy(module,index,gloChip,chipIndex); | |
1196 | return GetNoisyHSAtC2(gloChip,chipIndex); | |
1197 | } | |
1198 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t module, UInt_t index) { | |
1199 | // get chip for the dead pixel at position index in list of dead | |
1200 | UInt_t gloChip; | |
1201 | UInt_t chipIndex; | |
1202 | GetChipAndIndexDead(module,index,gloChip,chipIndex); | |
1203 | return GetDeadChipAtC2(gloChip,chipIndex); | |
1204 | } | |
1205 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t module, UInt_t index) { | |
53ae21ce | 1206 | // get chip for the noisy pixel at position index in list of noisy |
6727e2db | 1207 | UInt_t gloChip; |
1208 | UInt_t chipIndex; | |
1209 | GetChipAndIndexNoisy(module,index,gloChip,chipIndex); | |
1210 | return GetNoisyChipAtC2(gloChip,chipIndex); | |
1211 | } | |
1212 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t module, UInt_t index) { | |
1213 | // get hs for the dead pixel at position index in list of dead | |
1214 | UInt_t gloChip; | |
1215 | UInt_t chipIndex; | |
1216 | GetChipAndIndexDead(module,index,gloChip,chipIndex); | |
1217 | return GetDeadColAtC2(gloChip,chipIndex); | |
1218 | } | |
1219 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t module, UInt_t index) { | |
1220 | // get hs for the noisy pixel at position index in list of noisy | |
1221 | UInt_t gloChip; | |
1222 | UInt_t chipIndex; | |
1223 | GetChipAndIndexNoisy(module,index,gloChip,chipIndex); | |
1224 | return GetNoisyColAtC2(gloChip,chipIndex); | |
1225 | } | |
1226 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t module, UInt_t index) { | |
1227 | // get hs for the dead pixel at position index in list of dead | |
1228 | UInt_t gloChip; | |
1229 | UInt_t chipIndex; | |
1230 | GetChipAndIndexDead(module,index,gloChip,chipIndex); | |
1231 | return GetDeadRowAtC2(gloChip,chipIndex); | |
1232 | } | |
1233 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t module, UInt_t index) { | |
1234 | // get hs for the noisy pixel at position index in list of noisy | |
1235 | UInt_t gloChip; | |
1236 | UInt_t chipIndex; | |
1237 | GetChipAndIndexNoisy(module,index,gloChip,chipIndex); | |
1238 | return GetNoisyRowAtC2(gloChip,chipIndex); | |
1239 | } | |
1240 | //____________________________________________________________________________________________ | |
1241 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadEq(UInt_t eq) const { | |
1242 | // returns nr of dead for eq | |
1243 | UInt_t returnval=0; | |
1244 | for (UInt_t hs=0; hs<6; hs++) { | |
1245 | for (UInt_t chip=0; chip<10; chip++) { | |
1246 | returnval+=GetNrDeadC(eq,hs,chip); | |
1247 | } | |
53ae21ce | 1248 | } |
6727e2db | 1249 | return returnval; |
1250 | } | |
1251 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyEq(UInt_t eq) const { | |
1252 | // returns nr of noisy for eq | |
1253 | UInt_t returnval=0; | |
1254 | for (UInt_t hs=0; hs<6; hs++) { | |
1255 | for (UInt_t chip=0; chip<10; chip++) { | |
1256 | returnval+=GetNrNoisyC(eq,hs,chip); | |
1257 | } | |
53ae21ce | 1258 | } |
6727e2db | 1259 | return returnval; |
53ae21ce | 1260 | } |
6727e2db | 1261 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtEq(UInt_t eq, UInt_t index) const { |
1262 | // get eq for the dead pixel at position index in list of dead | |
1263 | if (eq<20 && index<GetNrDeadEq(eq)) { | |
1264 | return eq; | |
53ae21ce | 1265 | } |
1266 | else { | |
6727e2db | 1267 | return 20; |
53ae21ce | 1268 | } |
1269 | } | |
6727e2db | 1270 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtEq(UInt_t eq, UInt_t index) const { |
1271 | // get eq for the noisy pixel at position index in list of noisy | |
1272 | if (eq<20 && index<GetNrNoisyEq(eq)) { | |
1273 | return eq; | |
53ae21ce | 1274 | } |
1275 | else { | |
6727e2db | 1276 | return 20; |
53ae21ce | 1277 | } |
1278 | } | |
6727e2db | 1279 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtEq(UInt_t eq, UInt_t index) { |
1280 | // get hs for the dead pixel at position index in list of dead | |
1281 | UInt_t gloChip; | |
1282 | UInt_t chipIndex; | |
1283 | GetChipAndIndexEqDead(eq,index,gloChip,chipIndex); | |
1284 | return GetDeadHSAtC2(gloChip,chipIndex); | |
1285 | } | |
1286 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtEq(UInt_t eq, UInt_t index) { | |
1287 | // get hs for the noisy pixel at position index in list of noisy | |
1288 | UInt_t gloChip; | |
1289 | UInt_t chipIndex; | |
1290 | GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex); | |
1291 | return GetNoisyHSAtC2(gloChip,chipIndex); | |
1292 | } | |
1293 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtEq(UInt_t eq, UInt_t index) { | |
1294 | // get chip for the dead pixel at position index in list of dead | |
1295 | UInt_t gloChip; | |
1296 | UInt_t chipIndex; | |
1297 | GetChipAndIndexEqDead(eq,index,gloChip,chipIndex); | |
1298 | return GetDeadChipAtC2(gloChip,chipIndex); | |
1299 | } | |
1300 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtEq(UInt_t eq, UInt_t index) { | |
1301 | // get chip for the noisy pixel at position index in list of noisy | |
1302 | UInt_t gloChip; | |
1303 | UInt_t chipIndex; | |
1304 | GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex); | |
1305 | return GetNoisyChipAtC2(gloChip,chipIndex); | |
1306 | } | |
1307 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtEq(UInt_t eq, UInt_t index) { | |
1308 | // get hs for the dead pixel at position index in list of dead | |
1309 | UInt_t gloChip; | |
1310 | UInt_t chipIndex; | |
1311 | GetChipAndIndexEqDead(eq,index,gloChip,chipIndex); | |
1312 | return GetDeadColAtC2(gloChip,chipIndex); | |
1313 | } | |
1314 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtEq(UInt_t eq, UInt_t index) { | |
1315 | // get hs for the noisy pixel at position index in list of noisy | |
1316 | UInt_t gloChip; | |
1317 | UInt_t chipIndex; | |
1318 | GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex); | |
1319 | return GetNoisyColAtC2(gloChip,chipIndex); | |
1320 | } | |
1321 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtEq(UInt_t eq, UInt_t index) { | |
1322 | // get hs for the dead pixel at position index in list of dead | |
1323 | UInt_t gloChip; | |
1324 | UInt_t chipIndex; | |
1325 | GetChipAndIndexEqDead(eq,index,gloChip,chipIndex); | |
1326 | return GetDeadRowAtC2(gloChip,chipIndex); | |
1327 | } | |
1328 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtEq(UInt_t eq, UInt_t index) { | |
1329 | // get hs for the noisy pixel at position index in list of noisy | |
1330 | UInt_t gloChip; | |
1331 | UInt_t chipIndex; | |
1332 | GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex); | |
1333 | return GetNoisyRowAtC2(gloChip,chipIndex); | |
1334 | } | |
1335 | //____________________________________________________________________________________________ | |
1336 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC(UInt_t eq, UInt_t hs, UInt_t chip) const { | |
1337 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
1338 | return GetNrDeadC2(gloChip); | |
1339 | } | |
1340 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC(UInt_t eq, UInt_t hs, UInt_t chip) const { | |
1341 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
1342 | return GetNrNoisyC2(gloChip); | |
1343 | } | |
1344 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const { | |
1345 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
1346 | return GetDeadEqIdAtC2(gloChip,index); | |
1347 | } | |
1348 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const { | |
1349 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
1350 | return GetNoisyEqIdAtC2(gloChip,index); | |
1351 | } | |
1352 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const { | |
1353 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
1354 | return GetDeadHSAtC2(gloChip,index); | |
1355 | } | |
1356 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const { | |
1357 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
1358 | return GetNoisyHSAtC2(gloChip,index); | |
1359 | } | |
1360 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const { | |
1361 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
1362 | return GetDeadChipAtC2(gloChip,index); | |
1363 | } | |
1364 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const { | |
1365 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
1366 | return GetNoisyChipAtC2(gloChip,index); | |
1367 | } | |
1368 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const { | |
1369 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
1370 | return GetDeadColAtC2(gloChip,index); | |
1371 | } | |
1372 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const { | |
1373 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
1374 | return GetNoisyColAtC2(gloChip,index); | |
1375 | } | |
1376 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const { | |
1377 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
1378 | return GetDeadRowAtC2(gloChip,index); | |
1379 | } | |
1380 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const { | |
1381 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
1382 | return GetNoisyRowAtC2(gloChip,index); | |
1383 | } | |
1384 | //____________________________________________________________________________________________ | |
1385 | const Char_t* AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const { | |
1386 | // get a string of dead pixel info | |
1387 | TString returnMess = ""; | |
1388 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
1389 | if (gloChip>=1200) { | |
1390 | Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip); | |
1391 | return returnMess.Data(); | |
1392 | } | |
1393 | if (index<fNrDead[gloChip]) { | |
1394 | Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index); | |
6727e2db | 1395 | UInt_t col = GetColFromKey(key); |
1396 | UInt_t row = GetRowFromKey(key); | |
1397 | UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip); | |
1398 | UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col); | |
1399 | UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row); | |
1400 | returnMess = Form("%*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); | |
1401 | return returnMess.Data(); | |
53ae21ce | 1402 | } |
1403 | else { | |
6727e2db | 1404 | Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "Index %d out of bounds.", index); |
1405 | return returnMess.Data(); | |
1406 | } | |
1407 | } | |
1408 | const Char_t* AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const { | |
1409 | // get a string of noisy pixel info | |
1410 | TString returnMess = ""; | |
1411 | UInt_t gloChip = GetGloChip(eq,hs,chip); | |
1412 | if (gloChip>=1200) { | |
1413 | Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip); | |
1414 | return returnMess.Data(); | |
1415 | } | |
1416 | if (index<fNrNoisy[gloChip]) { | |
1417 | Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index); | |
6727e2db | 1418 | UInt_t col = GetColFromKey(key); |
1419 | UInt_t row = GetRowFromKey(key); | |
1420 | UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip); | |
1421 | UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col); | |
1422 | UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row); | |
1423 | returnMess = Form("%*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); | |
1424 | return returnMess.Data(); | |
1425 | } | |
1426 | else { | |
1427 | Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "Index %d out of bounds.", index); | |
1428 | return returnMess.Data(); | |
53ae21ce | 1429 | } |
1430 | } | |
6727e2db | 1431 | //____________________________________________________________________________________________ |
1432 | UInt_t AliITSOnlineCalibrationSPDhandler::AddDeadFrom(AliITSOnlineCalibrationSPDhandler* other) { | |
1433 | // returns number of new dead pixels in this' list | |
1434 | UInt_t returnval=0; | |
1435 | for (UInt_t gloChip=0; gloChip<1200; gloChip++) { | |
1436 | for (UInt_t ind1=0; ind1<other->fNrDead[gloChip]; ind1++) { | |
1437 | UInt_t eq = other->GetDeadEqIdAtC2(gloChip,ind1); | |
1438 | UInt_t hs = other->GetDeadHSAtC2(gloChip,ind1); | |
1439 | UInt_t chip = other->GetDeadChipAtC2(gloChip,ind1); | |
1440 | UInt_t col = other->GetDeadColAtC2(gloChip,ind1); | |
1441 | UInt_t row = other->GetDeadRowAtC2(gloChip,ind1); | |
1442 | if (SetDeadPixel(eq,hs,chip,col,row)) { | |
1443 | returnval++; | |
1444 | } | |
53ae21ce | 1445 | } |
b15de2d2 | 1446 | } |
6727e2db | 1447 | return returnval; |
b15de2d2 | 1448 | } |
6727e2db | 1449 | UInt_t AliITSOnlineCalibrationSPDhandler::AddNoisyFrom(AliITSOnlineCalibrationSPDhandler* other) { |
1450 | // returns number of new noisy pixels in this' list | |
1451 | UInt_t returnval=0; | |
1452 | for (UInt_t gloChip=0; gloChip<1200; gloChip++) { | |
1453 | for (UInt_t ind1=0; ind1<other->fNrNoisy[gloChip]; ind1++) { | |
1454 | UInt_t eq = other->GetNoisyEqIdAtC2(gloChip,ind1); | |
1455 | UInt_t hs = other->GetNoisyHSAtC2(gloChip,ind1); | |
1456 | UInt_t chip = other->GetNoisyChipAtC2(gloChip,ind1); | |
1457 | UInt_t col = other->GetNoisyColAtC2(gloChip,ind1); | |
1458 | UInt_t row = other->GetNoisyRowAtC2(gloChip,ind1); | |
1459 | if (SetNoisyPixel(eq,hs,chip,col,row)) { | |
1460 | returnval++; | |
1461 | } | |
53ae21ce | 1462 | } |
1463 | } | |
6727e2db | 1464 | return returnval; |
1465 | } | |
1466 | //____________________________________________________________________________________________ | |
1467 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDiff(AliITSOnlineCalibrationSPDhandler* other) const { | |
1468 | // returns nr of dead/noisy in this' lists and not in other's lists | |
1469 | return GetNrDeadDiff(other) + GetNrNoisyDiff(other); | |
53ae21ce | 1470 | } |
53ae21ce | 1471 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const { |
1472 | // returns nr of dead in this' lists and not in other's lists | |
1473 | UInt_t returnval=0; | |
6727e2db | 1474 | for (UInt_t gloChip=0; gloChip<1200; gloChip++) { |
1475 | for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) { | |
1476 | Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1); | |
1477 | UInt_t eq = GetEqIdFromKey(key); | |
53ae21ce | 1478 | UInt_t hs = GetHSFromKey(key); |
1479 | UInt_t chip = GetChipFromKey(key); | |
1480 | UInt_t col = GetColFromKey(key); | |
1481 | UInt_t row = GetRowFromKey(key); | |
6727e2db | 1482 | if (!(other->IsPixelDead(eq,hs,chip,col,row))) { |
53ae21ce | 1483 | returnval++; |
1484 | } | |
1485 | } | |
1486 | } | |
1487 | return returnval; | |
1488 | } | |
53ae21ce | 1489 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const { |
1490 | // returns nr of noisy in this' lists and not in other's lists | |
1491 | UInt_t returnval=0; | |
6727e2db | 1492 | for (UInt_t gloChip=0; gloChip<1200; gloChip++) { |
1493 | for (UInt_t ind1=0; ind1<fNrNoisy[gloChip]; ind1++) { | |
1494 | Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind1); | |
1495 | UInt_t eq = GetEqIdFromKey(key); | |
53ae21ce | 1496 | UInt_t hs = GetHSFromKey(key); |
1497 | UInt_t chip = GetChipFromKey(key); | |
1498 | UInt_t col = GetColFromKey(key); | |
1499 | UInt_t row = GetRowFromKey(key); | |
6727e2db | 1500 | if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) { |
53ae21ce | 1501 | returnval++; |
1502 | } | |
1503 | } | |
b15de2d2 | 1504 | } |
53ae21ce | 1505 | return returnval; |
1506 | } | |
53ae21ce | 1507 | AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDiff(AliITSOnlineCalibrationSPDhandler* other) const { |
1508 | // returns handler with dead/noisy in this' lists, except for those in other's lists | |
1509 | AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler(); | |
6727e2db | 1510 | for (UInt_t gloChip=0; gloChip<1200; gloChip++) { |
1511 | for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) { | |
1512 | Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1); | |
1513 | UInt_t eq = GetEqIdFromKey(key); | |
53ae21ce | 1514 | UInt_t hs = GetHSFromKey(key); |
1515 | UInt_t chip = GetChipFromKey(key); | |
1516 | UInt_t col = GetColFromKey(key); | |
1517 | UInt_t row = GetRowFromKey(key); | |
6727e2db | 1518 | if (!(other->IsPixelDead(eq,hs,chip,col,row))) { |
1519 | newHandler->SetDeadPixel(eq,hs,chip,col,row); | |
53ae21ce | 1520 | } |
1521 | } | |
6727e2db | 1522 | for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) { |
1523 | Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2); | |
1524 | UInt_t eq = GetEqIdFromKey(key); | |
53ae21ce | 1525 | UInt_t hs = GetHSFromKey(key); |
1526 | UInt_t chip = GetChipFromKey(key); | |
1527 | UInt_t col = GetColFromKey(key); | |
1528 | UInt_t row = GetRowFromKey(key); | |
6727e2db | 1529 | if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) { |
1530 | newHandler->SetNoisyPixel(eq,hs,chip,col,row); | |
53ae21ce | 1531 | } |
1532 | } | |
1533 | } | |
1534 | return newHandler; | |
1535 | } | |
53ae21ce | 1536 | AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const { |
1537 | // returns handler with dead in this' lists, except for those in other's lists | |
1538 | AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler(); | |
6727e2db | 1539 | for (UInt_t gloChip=0; gloChip<1200; gloChip++) { |
1540 | for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) { | |
1541 | Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1); | |
1542 | UInt_t eq = GetEqIdFromKey(key); | |
53ae21ce | 1543 | UInt_t hs = GetHSFromKey(key); |
1544 | UInt_t chip = GetChipFromKey(key); | |
1545 | UInt_t col = GetColFromKey(key); | |
1546 | UInt_t row = GetRowFromKey(key); | |
6727e2db | 1547 | if (!(other->IsPixelDead(eq,hs,chip,col,row))) { |
1548 | newHandler->SetDeadPixel(eq,hs,chip,col,row); | |
53ae21ce | 1549 | } |
1550 | } | |
1551 | } | |
1552 | return newHandler; | |
1553 | } | |
53ae21ce | 1554 | AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const { |
1555 | // returns handler with noisy in this' lists, except for those in other's lists | |
1556 | AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler(); | |
6727e2db | 1557 | for (UInt_t gloChip=0; gloChip<1200; gloChip++) { |
1558 | for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) { | |
1559 | Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2); | |
1560 | UInt_t eq = GetEqIdFromKey(key); | |
53ae21ce | 1561 | UInt_t hs = GetHSFromKey(key); |
1562 | UInt_t chip = GetChipFromKey(key); | |
1563 | UInt_t col = GetColFromKey(key); | |
1564 | UInt_t row = GetRowFromKey(key); | |
6727e2db | 1565 | if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) { |
1566 | newHandler->SetNoisyPixel(eq,hs,chip,col,row); | |
53ae21ce | 1567 | } |
1568 | } | |
1569 | } | |
1570 | return newHandler; | |
1571 | } | |
6727e2db | 1572 | //____________________________________________________________________________________________ |
1573 | void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) { | |
1574 | // find gloChip and chipIndex from module and index | |
1575 | if (index<GetNrDead(module)) { | |
1576 | UInt_t eq = GetEqIdFromOffline(module); | |
1577 | UInt_t hs = GetHSFromOffline(module); | |
1578 | ||
1579 | UInt_t glVal=0; | |
1580 | for (UInt_t chip=0; chip<5; chip++) { | |
1581 | gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32)); | |
1582 | if (glVal+fNrDead[gloChip]>index) { | |
1583 | chipIndex = index-glVal; | |
1584 | break; | |
1585 | } | |
1586 | else { | |
1587 | glVal+=fNrDead[gloChip]; | |
1588 | } | |
1589 | } | |
53ae21ce | 1590 | |
6727e2db | 1591 | } |
1592 | else { | |
1593 | Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead", "Index %d out of bounds.", index); | |
1594 | } | |
1595 | } | |
1596 | void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) { | |
1597 | // find gloChip and chipIndex from module and index | |
1598 | if (index<GetNrNoisy(module)) { | |
1599 | UInt_t eq = GetEqIdFromOffline(module); | |
1600 | UInt_t hs = GetHSFromOffline(module); | |
1601 | ||
1602 | UInt_t glVal=0; | |
1603 | for (UInt_t chip=0; chip<5; chip++) { | |
1604 | gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32)); | |
1605 | if (glVal+fNrNoisy[gloChip]>index) { | |
1606 | chipIndex = index-glVal; | |
1607 | break; | |
1608 | } | |
1609 | else { | |
1610 | glVal+=fNrNoisy[gloChip]; | |
1611 | } | |
53ae21ce | 1612 | } |
6727e2db | 1613 | |
1614 | } | |
1615 | else { | |
1616 | Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy", "Index %d out of bounds.", index); | |
53ae21ce | 1617 | } |
1618 | } | |
6727e2db | 1619 | void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) { |
1620 | // find gloChip and chipIndex from module and index | |
1621 | if (index<GetNrDeadEq(eq)) { | |
53ae21ce | 1622 | |
6727e2db | 1623 | UInt_t glVal=0; |
1624 | for (UInt_t hs=0; hs<6; hs++) { | |
1625 | for (UInt_t chip=0; chip<10; chip++) { | |
1626 | gloChip = GetGloChip(eq,hs,chip); | |
1627 | if (glVal+fNrDead[gloChip]>index) { | |
1628 | chipIndex = index-glVal; | |
1629 | break; | |
1630 | } | |
1631 | else { | |
1632 | glVal+=fNrDead[gloChip]; | |
1633 | } | |
53ae21ce | 1634 | } |
53ae21ce | 1635 | } |
6727e2db | 1636 | |
1637 | } | |
1638 | else { | |
1639 | Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead", "Index %d out of bounds.", index); | |
53ae21ce | 1640 | } |
53ae21ce | 1641 | } |
6727e2db | 1642 | void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) { |
1643 | // find gloChip and chipIndex from module and index | |
1644 | if (index<GetNrNoisyEq(eq)) { | |
1645 | ||
1646 | UInt_t glVal=0; | |
1647 | for (UInt_t hs=0; hs<6; hs++) { | |
1648 | for (UInt_t chip=0; chip<10; chip++) { | |
1649 | gloChip = GetGloChip(eq,hs,chip); | |
1650 | if (glVal+fNrNoisy[gloChip]>index) { | |
1651 | chipIndex = index-glVal; | |
1652 | break; | |
1653 | } | |
1654 | else { | |
1655 | glVal+=fNrNoisy[gloChip]; | |
1656 | } | |
1657 | } | |
1658 | } | |
1659 | ||
1660 | } | |
1661 | else { | |
1662 | Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy", "Index %d out of bounds.", index); | |
1663 | } | |
1664 | } | |
1665 | void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) { | |
1666 | // find gloChip and chipIndex from global index | |
1667 | if (index<GetNrDead()) { | |
1668 | ||
1669 | UInt_t glVal=0; | |
1670 | for (gloChip=0; gloChip<1200; gloChip++) { | |
1671 | if (glVal+fNrDead[gloChip]>index) { | |
1672 | chipIndex = index-glVal; | |
1673 | break; | |
1674 | } | |
1675 | else { | |
1676 | glVal+=fNrDead[gloChip]; | |
1677 | } | |
1678 | } | |
1679 | ||
1680 | } | |
1681 | else { | |
1682 | Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead", "Index %d out of bounds.", index); | |
1683 | } | |
1684 | } | |
1685 | void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) { | |
1686 | // find gloChip and chipIndex from global index | |
1687 | if (index<GetNrNoisy()) { | |
1688 | ||
1689 | UInt_t glVal=0; | |
1690 | for (gloChip=0; gloChip<1200; gloChip++) { | |
1691 | if (glVal+fNrNoisy[gloChip]>index) { | |
1692 | chipIndex = index-glVal; | |
1693 | break; | |
1694 | } | |
1695 | else { | |
1696 | glVal+=fNrNoisy[gloChip]; | |
1697 | } | |
1698 | } | |
53ae21ce | 1699 | |
6727e2db | 1700 | } |
1701 | else { | |
1702 | Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy", "Index %d out of bounds.", index); | |
1703 | } | |
1704 | } | |
1705 | //____________________________________________________________________________________________ | |
1706 | UInt_t AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline(UInt_t module) const { | |
1707 | // module to eq mapping | |
1708 | if (module>=240) { | |
1709 | Error("AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline", "module nr (%d) out of bounds.",module); | |
1710 | return 20; | |
1711 | } | |
1712 | return AliITSRawStreamSPD::GetOnlineEqIdFromOffline(module); | |
53ae21ce | 1713 | } |
6727e2db | 1714 | UInt_t AliITSOnlineCalibrationSPDhandler::GetHSFromOffline(UInt_t module) const { |
53ae21ce | 1715 | // module to hs mapping |
6727e2db | 1716 | if (module>=240) { |
1717 | Error("AliITSOnlineCalibrationSPDhandler::GetHSFromOffline", "module nr (%d) out of bounds.",module); | |
1718 | return 6; | |
1719 | } | |
1720 | return AliITSRawStreamSPD::GetOnlineHSFromOffline(module); | |
53ae21ce | 1721 | } |
6727e2db | 1722 | UInt_t AliITSOnlineCalibrationSPDhandler::GetChipFromOffline(UInt_t module, UInt_t colM) const { |
53ae21ce | 1723 | // module,colM to chip mapping |
6727e2db | 1724 | if (module>=240 || colM>=160) { |
1725 | Error("AliITSOnlineCalibrationSPDhandler::GetChipFromOffline", "module,colM nrs (%d,%d) out of bounds.",module,colM); | |
1726 | return 10; | |
1727 | } | |
1728 | return AliITSRawStreamSPD::GetOnlineChipFromOffline(module,colM); | |
53ae21ce | 1729 | } |
6727e2db | 1730 | UInt_t AliITSOnlineCalibrationSPDhandler::GetColFromOffline(UInt_t module, UInt_t colM) const { |
53ae21ce | 1731 | // colM to col mapping |
6727e2db | 1732 | if (colM>=160) { |
1733 | Error("AliITSOnlineCalibrationSPDhandler::GetColFromOffline", "colM nr (%d) out of bounds.",colM); | |
1734 | return 160; | |
1735 | } | |
1736 | return AliITSRawStreamSPD::GetOnlineColFromOffline(module,colM); | |
1737 | } | |
1738 | ||
1739 | UInt_t AliITSOnlineCalibrationSPDhandler::GetRowFromOffline(UInt_t module, UInt_t rowM) const { | |
1740 | // rowM to row mapping | |
1741 | if (rowM>=256) { | |
1742 | Error("AliITSOnlineCalibrationSPDhandler::GetRowFromOffline", "rowM nr (%d) out of bounds.",rowM); | |
1743 | return 256; | |
1744 | } | |
1745 | return AliITSRawStreamSPD::GetOnlineRowFromOffline(module,rowM); | |
1746 | } | |
1747 | //____________________________________________________________________________________________ | |
1748 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC2(UInt_t gloChip) const { | |
1749 | // returns nr of dead pixels on this chip | |
1750 | if (gloChip>=1200) { | |
1751 | Error("AliITSOnlineCalibrationSPDhandler::GetNrDeadC2", "global chip nr (%d) out of bounds.",gloChip); | |
1752 | return 0; | |
1753 | } | |
1754 | return fNrDead[gloChip]; | |
1755 | } | |
1756 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2(UInt_t gloChip) const { | |
1757 | // returns nr of noisy pixels on this chip | |
1758 | if (gloChip>=1200) { | |
1759 | Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2", "global chip nr (%d) out of bounds.",gloChip); | |
1760 | return 0; | |
1761 | } | |
1762 | return fNrNoisy[gloChip]; | |
1763 | } | |
1764 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC2(UInt_t gloChip, UInt_t index) const { | |
1765 | // get eq for the dead pixel at position index in list of dead | |
1766 | if (gloChip>=1200) { | |
1767 | Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "global chip nr (%d) out of bounds.",gloChip); | |
1768 | return 20; | |
1769 | } | |
1770 | if (index<fNrDead[gloChip]) { | |
1771 | Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index); | |
1772 | return GetEqIdFromKey(key); | |
1773 | } | |
1774 | else { | |
1775 | Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "Index %d out of bounds.", index); | |
1776 | return 0; | |
1777 | } | |
1778 | } | |
1779 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC2(UInt_t gloChip, UInt_t index) const { | |
1780 | // get eq for the noisy pixel at position index in list of noisy | |
1781 | if (gloChip>=1200) { | |
1782 | Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "global chip nr (%d) out of bounds.",gloChip); | |
1783 | return 20; | |
1784 | } | |
1785 | if (index<fNrNoisy[gloChip]) { | |
1786 | Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index); | |
1787 | return GetEqIdFromKey(key); | |
1788 | } | |
1789 | else { | |
1790 | Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "Index %d out of bounds.", index); | |
1791 | return 0; | |
1792 | } | |
1793 | } | |
1794 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC2(UInt_t gloChip, UInt_t index) const { | |
1795 | // get hs for the dead pixel at position index in list of dead | |
1796 | if (gloChip>=1200) { | |
1797 | Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "global chip nr (%d) out of bounds.",gloChip); | |
1798 | return 20; | |
1799 | } | |
1800 | if (index<fNrDead[gloChip]) { | |
1801 | Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index); | |
1802 | return GetHSFromKey(key); | |
1803 | } | |
1804 | else { | |
1805 | Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "Index %d out of bounds.", index); | |
1806 | return 0; | |
1807 | } | |
1808 | } | |
1809 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC2(UInt_t gloChip, UInt_t index) const { | |
1810 | // get hs for the noisy pixel at position index in list of noisy | |
1811 | if (gloChip>=1200) { | |
1812 | Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "global chip nr (%d) out of bounds.",gloChip); | |
1813 | return 20; | |
1814 | } | |
1815 | if (index<fNrNoisy[gloChip]) { | |
1816 | Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index); | |
1817 | return GetHSFromKey(key); | |
1818 | } | |
1819 | else { | |
1820 | Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "Index %d out of bounds.", index); | |
1821 | return 0; | |
1822 | } | |
b15de2d2 | 1823 | } |
6727e2db | 1824 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC2(UInt_t gloChip, UInt_t index) const { |
1825 | // get chip for the dead pixel at position index in list of dead | |
1826 | if (gloChip>=1200) { | |
1827 | Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "global chip nr (%d) out of bounds.",gloChip); | |
1828 | return 20; | |
1829 | } | |
1830 | if (index<fNrDead[gloChip]) { | |
1831 | Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index); | |
1832 | return GetChipFromKey(key); | |
1833 | } | |
1834 | else { | |
1835 | Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "Index %d out of bounds.", index); | |
1836 | return 0; | |
1837 | } | |
1838 | } | |
1839 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC2(UInt_t gloChip, UInt_t index) const { | |
1840 | // get chip for the noisy pixel at position index in list of noisy | |
1841 | if (gloChip>=1200) { | |
1842 | Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "global chip nr (%d) out of bounds.",gloChip); | |
1843 | return 20; | |
1844 | } | |
1845 | if (index<fNrNoisy[gloChip]) { | |
1846 | Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index); | |
1847 | return GetChipFromKey(key); | |
1848 | } | |
1849 | else { | |
1850 | Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "Index %d out of bounds.", index); | |
1851 | return 0; | |
1852 | } | |
1853 | } | |
1854 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2(UInt_t gloChip, UInt_t index) const { | |
1855 | // get col for the dead pixel at position index in list of dead | |
1856 | if (gloChip>=1200) { | |
1857 | Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "global chip nr (%d) out of bounds.",gloChip); | |
1858 | return 20; | |
1859 | } | |
1860 | if (index<fNrDead[gloChip]) { | |
1861 | Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index); | |
1862 | return GetColFromKey(key); | |
1863 | } | |
1864 | else { | |
1865 | Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "Index %d out of bounds.", index); | |
1866 | return 0; | |
1867 | } | |
1868 | } | |
1869 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC2(UInt_t gloChip, UInt_t index) const { | |
1870 | // get col for the noisy pixel at position index in list of noisy | |
1871 | if (gloChip>=1200) { | |
1872 | Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "global chip nr (%d) out of bounds.",gloChip); | |
1873 | return 20; | |
1874 | } | |
1875 | if (index<fNrNoisy[gloChip]) { | |
1876 | Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index); | |
1877 | return GetColFromKey(key); | |
1878 | } | |
1879 | else { | |
1880 | Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "Index %d out of bounds.", index); | |
1881 | return 0; | |
1882 | } | |
1883 | } | |
1884 | UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC2(UInt_t gloChip, UInt_t index) const { | |
1885 | // get row for the dead pixel at position index in list of dead | |
1886 | if (gloChip>=1200) { | |
1887 | Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "global chip nr (%d) out of bounds.",gloChip); | |
1888 | return 20; | |
1889 | } | |
1890 | if (index<fNrDead[gloChip]) { | |
1891 | Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index); | |
1892 | return GetRowFromKey(key); | |
1893 | } | |
1894 | else { | |
1895 | Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "Index %d out of bounds.", index); | |
1896 | return 0; | |
1897 | } | |
1898 | } | |
1899 | UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC2(UInt_t gloChip, UInt_t index) const { | |
1900 | // get row for the noisy pixel at position index in list of noisy | |
1901 | if (gloChip>=1200) { | |
1902 | Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "global chip nr (%d) out of bounds.",gloChip); | |
1903 | return 20; | |
1904 | } | |
1905 | if (index<fNrNoisy[gloChip]) { | |
1906 | Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index); | |
1907 | return GetRowFromKey(key); | |
1908 | } | |
1909 | else { | |
1910 | Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "Index %d out of bounds.", index); | |
1911 | return 0; | |
1912 | } | |
1913 | } | |
1914 | ||
1915 | ||
1916 | ||
1917 | ||
1918 | ||
1919 | ||
1920 | ||
1921 | ||
1922 | ||
1923 | ||
1924 | ||
1925 | ||
1926 | ||
1927 | ||
1928 | ||
1929 | ||
1930 | ||
1931 |