]>
Commit | Line | Data |
---|---|---|
4a60ccc4 | 1 | /************************************************************************** |
2 | * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
6a0fdcbd | 16 | /* $Id$ */ |
4a60ccc4 | 17 | |
18 | ////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // Implementation of the class for bad channel treatment in the tracker // | |
21 | // Stores 1 status bit for each SPD pixel and SDD anode: // | |
22 | // 0 = bad channel // | |
23 | // 1 = good channel // | |
23197852 | 24 | // Dead and noisy channels are read from AliITSCalibration objects // |
4a60ccc4 | 25 | // Origin: F.Prino, Torino, prino@to.infn.it // |
26 | // // | |
27 | ////////////////////////////////////////////////////////////////////////// | |
28 | ||
27199d86 | 29 | #include <TString.h> |
4a60ccc4 | 30 | #include "AliITSChannelStatus.h" |
31 | #include "AliITSCalibrationSPD.h" | |
32 | #include "AliITSCalibrationSDD.h" | |
6a0fdcbd | 33 | #include "AliITSCalibrationSSD.h" |
b0702f40 | 34 | #include "AliITSsegmentationSPD.h" |
35 | #include "AliITSsegmentationSDD.h" | |
6a0fdcbd | 36 | #include "AliITSsegmentationSSD.h" |
4a60ccc4 | 37 | #include "AliCDBEntry.h" |
b0702f40 | 38 | #include "TMath.h" |
4a60ccc4 | 39 | #include "AliLog.h" |
40 | ||
41 | ClassImp(AliITSChannelStatus) | |
42 | ||
43 | ||
44 | //______________________________________________________________________ | |
45 | AliITSChannelStatus::AliITSChannelStatus(): | |
46 | TObject(), | |
47 | fSPDChannelStatus(0), | |
6a0fdcbd | 48 | fSDDChannelStatus(0), |
49 | fSSDChannelStatus(0) | |
4a60ccc4 | 50 | { |
51 | // default constructor | |
27199d86 | 52 | } |
53 | //______________________________________________________________________ | |
54 | AliITSChannelStatus::AliITSChannelStatus(TString config): | |
55 | TObject(), | |
56 | fSPDChannelStatus(0), | |
57 | fSDDChannelStatus(0), | |
58 | fSSDChannelStatus(0) | |
59 | { | |
60 | // construt starting from an option passed via a TString | |
61 | CreateArrays(); | |
62 | if(config.Contains("Ideal") || config.Contains("Default")){ | |
63 | InitDefaults(); | |
64 | } | |
4a60ccc4 | 65 | } |
66 | //______________________________________________________________________ | |
67 | AliITSChannelStatus::AliITSChannelStatus(AliCDBManager *cdb): | |
68 | TObject(), | |
69 | fSPDChannelStatus(0), | |
6a0fdcbd | 70 | fSDDChannelStatus(0), |
71 | fSSDChannelStatus(0) | |
4a60ccc4 | 72 | { |
b34fed4e | 73 | // contruct starting from CDB |
4a60ccc4 | 74 | AliCDBEntry* spdEntryD = cdb->Get("ITS/Calib/SPDDead"); |
75 | if (!spdEntryD) AliFatal("Cannot get CDB entry for SPDDead"); | |
76 | TObjArray* deadArrSPD = (TObjArray*)spdEntryD->GetObject(); | |
77 | if (!deadArrSPD) AliFatal("No object found in SPDDead file"); | |
78 | ||
9806b6f8 | 79 | AliCDBEntry* spdEntrySparseD = cdb->Get("ITS/Calib/SPDSparseDead"); |
80 | if (!spdEntrySparseD) AliFatal("Cannot get CDB entry for SPDSparseDead"); | |
81 | TObjArray* deadSparseArrSPD = (TObjArray*)spdEntrySparseD->GetObject(); | |
82 | if (!deadSparseArrSPD) AliFatal("No object found in SPDSparseDead file"); | |
83 | ||
4a60ccc4 | 84 | AliCDBEntry* spdEntryN = cdb->Get("ITS/Calib/SPDNoisy"); |
85 | if (!spdEntryN) AliFatal("Cannot get CDB entry for SPDNoisy"); | |
86 | TObjArray* noisArrSPD = (TObjArray*)spdEntryN->GetObject(); | |
87 | if (!noisArrSPD) AliFatal("No object found in SPDNoisy file"); | |
88 | ||
89 | AliCDBEntry* sddEntry = cdb->Get("ITS/Calib/CalibSDD"); | |
90 | if (!sddEntry) AliFatal("Cannot get CDB entry for CalibSDD"); | |
91 | TObjArray* calArrSDD = (TObjArray*)sddEntry->GetObject(); | |
92 | if (!calArrSDD) AliFatal("No object found in CalibSDD file"); | |
93 | ||
6a0fdcbd | 94 | AliCDBEntry* ssdEntry = cdb->Get("ITS/Calib/CalibSSD"); |
95 | if (!ssdEntry) AliFatal("Cannot get CDB entry for CalibSSD"); | |
96 | TObjArray* calArrSSD = (TObjArray*)ssdEntry->GetObject(); | |
97 | if (!calArrSSD) AliFatal("No object found in CalibSSD file"); | |
98 | ||
27199d86 | 99 | CreateArrays(); |
9806b6f8 | 100 | InitFromOCDB(deadArrSPD,deadSparseArrSPD,noisArrSPD,calArrSDD,calArrSSD); |
4a60ccc4 | 101 | } |
102 | //______________________________________________________________________ | |
04c81913 | 103 | AliITSChannelStatus::AliITSChannelStatus(const AliITSDetTypeRec *dtrec): |
23197852 | 104 | TObject(), |
105 | fSPDChannelStatus(0), | |
6a0fdcbd | 106 | fSDDChannelStatus(0), |
107 | fSSDChannelStatus(0) | |
23197852 | 108 | { |
b34fed4e | 109 | // contruct starting from det type rec |
27199d86 | 110 | CreateArrays(); |
23197852 | 111 | |
112 | // SPD modules | |
113 | for(Int_t imod=0; imod<kSPDModules; imod++){ | |
114 | for(Int_t ix=0; ix<kSPDNpxPerModule; ix++){ | |
115 | for(Int_t iz=0; iz<kSPDNpzPerModule; iz++){ | |
116 | Int_t index=imod*kSPDNpxPerModule*kSPDNpzPerModule+ix*kSPDNpzPerModule+iz; | |
117 | fSPDChannelStatus->SetBitNumber(index,kTRUE); | |
118 | } | |
119 | } | |
120 | Int_t ix,iz; | |
121 | ||
122 | // Mask SPD dead pixels | |
123 | AliITSCalibrationSPD* deadspd=(AliITSCalibrationSPD*)dtrec->GetSPDDeadModel(imod); | |
124 | for(Int_t ipix=0; ipix<deadspd->GetNrBad();ipix++){ | |
125 | deadspd->GetBadPixel(ipix,ix,iz); | |
126 | Int_t index=imod*kSPDNpxPerModule*kSPDNpzPerModule+ix*kSPDNpzPerModule+iz; | |
127 | fSPDChannelStatus->SetBitNumber(index,kFALSE); | |
128 | } | |
9806b6f8 | 129 | |
130 | // Mask SPD sparse dead pixels | |
131 | AliITSCalibrationSPD* deadSparseSpd=(AliITSCalibrationSPD*)dtrec->GetSPDSparseDeadModel(imod); | |
132 | for(Int_t ipix=0; ipix<deadSparseSpd->GetNrBad();ipix++){ | |
133 | deadSparseSpd->GetBadPixel(ipix,ix,iz); | |
134 | Int_t index=imod*kSPDNpxPerModule*kSPDNpzPerModule+ix*kSPDNpzPerModule+iz; | |
135 | fSPDChannelStatus->SetBitNumber(index,kFALSE); | |
136 | } | |
137 | ||
23197852 | 138 | // Mask SPD noisy pixels |
139 | AliITSCalibrationSPD* noisspd=(AliITSCalibrationSPD*)dtrec->GetCalibrationModel(imod); | |
140 | for(Int_t ipix=0; ipix<noisspd->GetNrBad();ipix++){ | |
141 | noisspd->GetBadPixel(ipix,ix,iz); | |
142 | Int_t index=imod*kSPDNpxPerModule*kSPDNpzPerModule+ix*kSPDNpzPerModule+iz; | |
143 | fSPDChannelStatus->SetBitNumber(index,kFALSE); | |
144 | } | |
145 | } | |
146 | ||
147 | // SDD modules | |
148 | for(Int_t imod=0; imod<kSDDModules; imod++){ | |
149 | AliITSCalibrationSDD* calsdd=(AliITSCalibrationSDD*)dtrec->GetCalibrationModel(imod+kSPDModules); | |
150 | for(Int_t ian=0; ian<kSDDAnodesPerModule; ian++){ | |
151 | Bool_t cstatus=kTRUE; | |
152 | if(calsdd->IsBadChannel(ian)) cstatus=kFALSE; | |
153 | Int_t index=imod*kSDDAnodesPerModule+ian; | |
154 | fSDDChannelStatus->SetBitNumber(index,cstatus); | |
155 | } | |
156 | } | |
6a0fdcbd | 157 | |
158 | // SSD modules | |
159 | for (Int_t imod = 0; imod < kSSDModules; imod++) { | |
160 | AliITSCalibrationSSD* calssd=(AliITSCalibrationSSD*)dtrec->GetCalibrationModel(kSSDFirstModule+imod); | |
161 | for(Int_t ip=0; ip<kSSDStripsPerModule; ip++) { | |
162 | Int_t index=imod*kSSDStripsPerModule+ip; | |
163 | Bool_t cstatus = kTRUE; | |
164 | if (ip < 768 && calssd->IsPChannelBad(ip)) | |
165 | cstatus = kFALSE; | |
166 | if (ip >= 768 && calssd->IsNChannelBad(ip-768)) | |
167 | cstatus = kFALSE; | |
168 | ||
169 | fSSDChannelStatus->SetBitNumber(index,cstatus); | |
170 | } | |
171 | } | |
23197852 | 172 | } |
173 | //______________________________________________________________________ | |
27199d86 | 174 | void AliITSChannelStatus::CreateArrays(){ |
175 | // creates the TBit arrays | |
176 | ||
177 | UInt_t nSPDchan=kSPDModules*kSPDNpxPerModule*kSPDNpzPerModule; | |
178 | fSPDChannelStatus=new TBits(nSPDchan); | |
179 | ||
180 | UInt_t nSDDchan=kSDDModules*kSDDAnodesPerModule; | |
181 | fSDDChannelStatus=new TBits(nSDDchan); | |
182 | ||
183 | UInt_t nSSDchan=kSSDModules*kSSDStripsPerModule; | |
184 | fSSDChannelStatus=new TBits(nSSDchan); | |
185 | ||
186 | } | |
187 | //______________________________________________________________________ | |
4a60ccc4 | 188 | void AliITSChannelStatus::InitDefaults(){ |
189 | // fill bitmaps setting all channels as good | |
190 | for(Int_t imod=0; imod<kSPDModules; imod++){ | |
191 | for(Int_t ix=0; ix<kSPDNpxPerModule; ix++){ | |
192 | for(Int_t iz=0; iz<kSPDNpzPerModule; iz++){ | |
193 | Int_t index=imod*kSPDNpxPerModule*kSPDNpzPerModule+ix*kSPDNpzPerModule+iz; | |
194 | fSPDChannelStatus->SetBitNumber(index,kTRUE); | |
195 | } | |
196 | } | |
197 | } | |
198 | for(Int_t imod=0; imod<kSDDModules; imod++){ | |
199 | for(Int_t ian=0; ian<kSDDAnodesPerModule; ian++){ | |
200 | Int_t index=imod*kSDDAnodesPerModule+ian; | |
201 | fSDDChannelStatus->SetBitNumber(index,kTRUE); | |
202 | } | |
203 | } | |
6a0fdcbd | 204 | for(Int_t imod=0; imod<kSSDModules; imod++){ |
205 | for(Int_t is=0; is<kSSDStripsPerModule; is++){ | |
206 | Int_t index=imod*kSSDStripsPerModule+is; | |
207 | fSSDChannelStatus->SetBitNumber(index,kTRUE); | |
208 | } | |
209 | } | |
4a60ccc4 | 210 | } |
211 | //______________________________________________________________________ | |
27199d86 | 212 | void AliITSChannelStatus::InitFromOCDB(const TObjArray* deadArrSPD, const TObjArray* /* deadSparseArrSPD */, const TObjArray* noisArrSPD, const TObjArray* calArrSDD, const TObjArray *calArrSSD){ |
4a60ccc4 | 213 | // fills bitmaps from arrays of AliITSCalibrationSXD objects |
214 | ||
215 | // SPD modules | |
216 | for(Int_t imod=0; imod<kSPDModules; imod++){ | |
217 | for(Int_t ix=0; ix<kSPDNpxPerModule; ix++){ | |
218 | for(Int_t iz=0; iz<kSPDNpzPerModule; iz++){ | |
219 | Int_t index=imod*kSPDNpxPerModule*kSPDNpzPerModule+ix*kSPDNpzPerModule+iz; | |
220 | fSPDChannelStatus->SetBitNumber(index,kTRUE); | |
221 | } | |
222 | } | |
223 | Int_t ix,iz; | |
224 | ||
225 | // Mask SPD dead pixels | |
226 | AliITSCalibrationSPD* deadspd=(AliITSCalibrationSPD*)deadArrSPD->At(imod); | |
227 | for(Int_t ipix=0; ipix<deadspd->GetNrBad();ipix++){ | |
228 | deadspd->GetBadPixel(ipix,ix,iz); | |
229 | Int_t index=imod*kSPDNpxPerModule*kSPDNpzPerModule+ix*kSPDNpzPerModule+iz; | |
230 | fSPDChannelStatus->SetBitNumber(index,kFALSE); | |
231 | } | |
9806b6f8 | 232 | |
233 | // Mask SPD sparse dead pixels | |
234 | AliITSCalibrationSPD* deadSparseSpd=(AliITSCalibrationSPD*)deadArrSPD->At(imod); | |
235 | for(Int_t ipix=0; ipix<deadSparseSpd->GetNrBad();ipix++){ | |
236 | deadSparseSpd->GetBadPixel(ipix,ix,iz); | |
237 | Int_t index=imod*kSPDNpxPerModule*kSPDNpzPerModule+ix*kSPDNpzPerModule+iz; | |
238 | fSPDChannelStatus->SetBitNumber(index,kFALSE); | |
239 | } | |
4a60ccc4 | 240 | |
241 | // Mask SPD noisy pixels | |
242 | AliITSCalibrationSPD* noisspd=(AliITSCalibrationSPD*)noisArrSPD->At(imod); | |
243 | for(Int_t ipix=0; ipix<noisspd->GetNrBad();ipix++){ | |
244 | noisspd->GetBadPixel(ipix,ix,iz); | |
245 | Int_t index=imod*kSPDNpxPerModule*kSPDNpzPerModule+ix*kSPDNpzPerModule+iz; | |
246 | fSPDChannelStatus->SetBitNumber(index,kFALSE); | |
247 | } | |
248 | } | |
249 | ||
250 | // SDD modules | |
251 | for(Int_t imod=0; imod<kSDDModules; imod++){ | |
252 | AliITSCalibrationSDD* calsdd=(AliITSCalibrationSDD*)calArrSDD->At(imod); | |
253 | for(Int_t ian=0; ian<kSDDAnodesPerModule; ian++){ | |
254 | Bool_t cstatus=kTRUE; | |
255 | if(calsdd->IsBadChannel(ian)) cstatus=kFALSE; | |
256 | Int_t index=imod*kSDDAnodesPerModule+ian; | |
257 | fSDDChannelStatus->SetBitNumber(index,cstatus); | |
258 | } | |
259 | } | |
6a0fdcbd | 260 | |
261 | // SSD modules | |
262 | for (Int_t imod = 0; imod < kSSDModules; imod++) { | |
263 | AliITSCalibrationSSD* calssd=(AliITSCalibrationSSD*)calArrSSD->At(imod); | |
264 | for(Int_t ip=0; ip<kSSDStripsPerModule; ip++) { | |
265 | Int_t index=imod*kSSDStripsPerModule+ip; | |
266 | Bool_t cstatus = kTRUE; | |
267 | if (ip < 768 && calssd->IsPChannelBad(ip)) | |
268 | cstatus = kFALSE; | |
269 | if (ip >= 768 && calssd->IsNChannelBad(ip-768)) | |
270 | cstatus = kFALSE; | |
271 | ||
272 | fSSDChannelStatus->SetBitNumber(index,cstatus); | |
273 | } | |
274 | } | |
4a60ccc4 | 275 | } |
276 | //______________________________________________________________________ | |
277 | AliITSChannelStatus::AliITSChannelStatus(const AliITSChannelStatus& cstatus): | |
278 | TObject(), | |
279 | fSPDChannelStatus(cstatus.fSPDChannelStatus), | |
6a0fdcbd | 280 | fSDDChannelStatus(cstatus.fSDDChannelStatus), |
281 | fSSDChannelStatus(cstatus.fSSDChannelStatus) | |
4a60ccc4 | 282 | { |
283 | // copy constructor | |
284 | } | |
285 | //______________________________________________________________________ | |
286 | AliITSChannelStatus& AliITSChannelStatus::operator=(const AliITSChannelStatus& cstatus) | |
287 | { | |
288 | // assignment operator | |
289 | this->~AliITSChannelStatus(); | |
290 | new(this) AliITSChannelStatus(cstatus); | |
291 | return *this; | |
292 | } | |
293 | ||
294 | //______________________________________________________________________ | |
295 | AliITSChannelStatus::~AliITSChannelStatus(){ | |
296 | // destructor | |
297 | if(fSPDChannelStatus) delete fSPDChannelStatus; | |
298 | if(fSDDChannelStatus) delete fSDDChannelStatus; | |
6a0fdcbd | 299 | if(fSSDChannelStatus) delete fSSDChannelStatus; |
4a60ccc4 | 300 | } |
301 | ||
302 | //______________________________________________________________________ | |
303 | Bool_t AliITSChannelStatus::CheckBounds(Int_t imod, Int_t iz, Int_t ix) const { | |
304 | // check for out of bounds | |
6a0fdcbd | 305 | if(imod<0 || imod>=kSPDModules+kSDDModules+kSSDModules){ |
4a60ccc4 | 306 | AliError(Form("Module number out of range 0-%d",kSPDModules+kSDDModules)); |
307 | return kFALSE; | |
308 | } | |
309 | if(imod<kSPDModules){ | |
310 | if(ix<0 || ix>=kSPDNpxPerModule || iz<0 || iz>=kSPDNpzPerModule){ | |
311 | AliError("SPD: Pixel number out of range"); | |
312 | return kFALSE; | |
313 | } | |
6a0fdcbd | 314 | }else if (imod<kSSDFirstModule){ |
4a60ccc4 | 315 | if(iz<0 || iz>=kSDDAnodesPerModule){ |
316 | AliError("SDD: anode number out of range"); | |
317 | return kFALSE; | |
318 | } | |
319 | } | |
6a0fdcbd | 320 | else { |
321 | if(iz<0 || iz>=kSSDStripsPerModule){ | |
322 | AliError("SSD: strip number out of range"); | |
323 | return kFALSE; | |
324 | } | |
325 | } | |
4a60ccc4 | 326 | return kTRUE; |
327 | } | |
328 | //______________________________________________________________________ | |
329 | Bool_t AliITSChannelStatus::GetChannelStatus(Int_t imod, Int_t iz, Int_t ix) const { | |
330 | // return status of inquired channel | |
331 | if(CheckBounds(imod,iz,ix)==kFALSE) return kFALSE; | |
332 | if(imod<kSPDModules){ | |
333 | Int_t index=imod*kSPDNpxPerModule*kSPDNpzPerModule+ix*kSPDNpzPerModule+iz; | |
334 | return fSPDChannelStatus->TestBitNumber(index); | |
6a0fdcbd | 335 | } else if (imod < kSSDFirstModule) { |
4a60ccc4 | 336 | imod-=kSPDModules; |
337 | Int_t index=imod*kSDDAnodesPerModule+iz; | |
338 | return fSDDChannelStatus->TestBitNumber(index); | |
339 | } | |
6a0fdcbd | 340 | else { // SSD: iz is strip number 0-767 P-side, 768 - 1535 N-side |
341 | imod-=kSSDFirstModule; | |
342 | Int_t index=imod*kSSDStripsPerModule+iz; | |
343 | return fSSDChannelStatus->TestBitNumber(index); | |
344 | } | |
4a60ccc4 | 345 | } |
346 | //______________________________________________________________________ | |
347 | void AliITSChannelStatus::SetChannelStatus(Bool_t cstatus, Int_t imod, Int_t iz, Int_t ix){ | |
348 | // set status for given channel | |
349 | if(CheckBounds(imod,iz,ix)==kFALSE) return; | |
350 | if(imod<kSPDModules){ | |
351 | Int_t index=imod*kSPDNpxPerModule*kSPDNpzPerModule+ix*kSPDNpzPerModule+iz; | |
352 | fSPDChannelStatus->SetBitNumber(index,cstatus); | |
6a0fdcbd | 353 | }else if (imod < kSSDFirstModule) { |
4a60ccc4 | 354 | imod-=kSPDModules; |
355 | Int_t index=imod*kSDDAnodesPerModule+iz; | |
356 | fSDDChannelStatus->SetBitNumber(index,cstatus); | |
357 | } | |
6a0fdcbd | 358 | else { // SSD: iz is strip number 0-767 P-side, 768 - 1535 N-side |
359 | imod-=kSSDFirstModule; | |
360 | Int_t index=imod*kSSDStripsPerModule+iz; | |
361 | return fSSDChannelStatus->SetBitNumber(index,cstatus); | |
362 | } | |
4a60ccc4 | 363 | } |
b0702f40 | 364 | //______________________________________________________________________ |
365 | Bool_t AliITSChannelStatus::GetSDDLimits(Float_t zlocmin, Float_t zlocmax, Float_t xlocmin, Float_t xlocmax, Int_t& izmin, Int_t& izmax, Int_t& izmin2, Int_t& izmax2) const { | |
366 | // Returns min. and max. anode numbers from local coordindate | |
367 | AliITSsegmentationSDD *seg=new AliITSsegmentationSDD(); | |
368 | Float_t dummySpeed=6.5; // to avoid warnings in SDD segmentation | |
369 | Float_t tolerance=0.9999; | |
370 | seg->SetDriftSpeed(dummySpeed); | |
371 | Float_t zHalfSize=0.5*seg->Dz()/10000.; | |
372 | zHalfSize*=tolerance; | |
373 | if(zlocmin<-zHalfSize) zlocmin=-zHalfSize; | |
374 | if(zlocmax>zHalfSize) zlocmax=zHalfSize; | |
375 | if(zlocmax<-zHalfSize || zlocmin>zHalfSize){ | |
376 | AliWarning("Search region completely outside module"); | |
377 | return kFALSE; | |
378 | } | |
379 | Float_t xHalfSize=seg->Dx()/10000.; | |
380 | xHalfSize*=tolerance; | |
381 | if(xlocmin<-xHalfSize) xlocmin=-xHalfSize; | |
382 | if(xlocmax>xHalfSize) xlocmax=xHalfSize; | |
383 | if(xlocmax<-xHalfSize || xlocmin>xHalfSize){ | |
384 | AliWarning("Search region completely outside module"); | |
385 | return kFALSE; | |
386 | } | |
387 | ||
388 | Int_t iSid1=seg->GetSideFromLocalX(xlocmin); | |
389 | Int_t iSid2=seg->GetSideFromLocalX(xlocmax); | |
390 | Int_t iz1,iz2,ixdummy; | |
391 | seg->LocalToDet(xlocmin,zlocmin,ixdummy,iz1); | |
392 | seg->LocalToDet(xlocmin,zlocmax,ixdummy,iz2); | |
393 | izmin=TMath::Min(iz1,iz2); | |
394 | izmax=TMath::Max(iz1,iz2); | |
395 | if(iSid1==iSid2){ | |
396 | izmax2=izmin2=-1; | |
397 | }else{ | |
398 | seg->LocalToDet(xlocmax,zlocmin,ixdummy,iz1); | |
399 | seg->LocalToDet(xlocmax,zlocmax,ixdummy,iz2); | |
400 | izmin2=TMath::Min(iz1,iz2); | |
401 | izmax2=TMath::Max(iz1,iz2); | |
402 | } | |
403 | delete seg; | |
404 | return kTRUE; | |
405 | } | |
406 | //______________________________________________________________________ | |
407 | Bool_t AliITSChannelStatus::GetSPDLimits(Float_t zlocmin, Float_t zlocmax, Float_t xlocmin, Float_t xlocmax, Int_t& izmin, Int_t& izmax, Int_t& ixmin, Int_t& ixmax) const { | |
408 | // Returns min. and max. pixel numbers from local coordindate | |
409 | Float_t tolerance=0.9999; | |
410 | AliITSsegmentationSPD *seg=new AliITSsegmentationSPD(); | |
411 | Float_t zHalfSize=0.5*seg->Dz()/10000.; | |
412 | zHalfSize*=tolerance; | |
413 | if(zlocmin<-zHalfSize) zlocmin=-zHalfSize; | |
414 | if(zlocmax>zHalfSize) zlocmax=zHalfSize; | |
415 | if(zlocmax<-zHalfSize || zlocmin>zHalfSize){ | |
416 | AliWarning("Search region completely outside module"); | |
417 | return kFALSE; | |
418 | } | |
419 | Float_t xHalfSize=0.5*seg->Dx()/10000.; | |
420 | xHalfSize*=tolerance; | |
421 | if(xlocmin<-xHalfSize) xlocmin=-xHalfSize; | |
422 | if(xlocmax>xHalfSize) xlocmax=xHalfSize; | |
423 | if(xlocmax<-xHalfSize || xlocmin>xHalfSize){ | |
424 | AliWarning("Search region completely outside module"); | |
425 | return kFALSE; | |
426 | } | |
427 | ||
428 | Int_t iz1,ix1,iz2,ix2; | |
429 | seg->LocalToDet(xlocmin,zlocmin,ix1,iz1); | |
430 | seg->LocalToDet(xlocmax,zlocmax,ix2,iz2); | |
431 | izmin=TMath::Min(iz1,iz2); | |
432 | izmax=TMath::Max(iz1,iz2); | |
433 | ixmin=TMath::Min(ix1,ix2); | |
434 | ixmax=TMath::Max(ix1,ix2); | |
435 | delete seg; | |
436 | return kTRUE; | |
437 | } | |
438 | //______________________________________________________________________ | |
6a0fdcbd | 439 | Bool_t AliITSChannelStatus::GetSSDLimits(Int_t layer, Float_t zlocmin, Float_t zlocmax, Float_t xlocmin, Float_t xlocmax, Int_t& iPmin, Int_t& iPmax, Int_t& iNmin, Int_t& iNmax) const { |
440 | // Returns min, max strip for SSD, given a search window | |
441 | static AliITSsegmentationSSD seg; | |
442 | ||
443 | AliDebug(2,Form("xmin %f zmin %f xmax %f zmax %f\n",xlocmin,zlocmin,xlocmax,zlocmax)); | |
444 | ||
445 | Int_t p,n; | |
446 | seg.SetLayer(layer); | |
447 | seg.GetPadIxz(xlocmin,zlocmin,p,n); | |
448 | iPmin = iPmax = p; | |
449 | iNmin = iNmax = n; | |
450 | AliDebug(5,Form("lay %d xmin, zmin p %d n %d\n",layer,p,n)); | |
451 | seg.GetPadIxz(xlocmax,zlocmin,p,n); | |
452 | iPmin = TMath::Min(iPmin,p); | |
7ef72c1e | 453 | iPmax = TMath::Max(iPmax,p); |
6a0fdcbd | 454 | iNmin = TMath::Min(iNmin,n); |
7ef72c1e | 455 | iNmax = TMath::Max(iNmax,n); |
6a0fdcbd | 456 | AliDebug(5,Form("lay %d xmax, zmin p %d n %d\n",layer,p,n)); |
457 | seg.GetPadIxz(xlocmax,zlocmax,p,n); | |
458 | iPmin = TMath::Min(iPmin,p); | |
7ef72c1e | 459 | iPmax = TMath::Max(iPmax,p); |
6a0fdcbd | 460 | iNmin = TMath::Min(iNmin,n); |
7ef72c1e | 461 | iNmax = TMath::Max(iNmax,n); |
6a0fdcbd | 462 | AliDebug(5,Form("lay %d xmax, zmax p %d n %d\n",layer,p,n)); |
463 | seg.GetPadIxz(xlocmin,zlocmax,p,n); | |
464 | iPmin = TMath::Min(iPmin,p); | |
7ef72c1e | 465 | iPmax = TMath::Max(iPmax,p); |
6a0fdcbd | 466 | iNmin = TMath::Min(iNmin,n); |
7ef72c1e | 467 | iNmax = TMath::Max(iNmax,n); |
6a0fdcbd | 468 | AliDebug(5,Form("lay %d xmin, zmax p %d n %d\n",layer,p,n)); |
469 | ||
470 | if (iPmin < 0) | |
471 | iPmin = 0; | |
472 | if (iNmin < 0) | |
473 | iNmin = 0; | |
474 | if (iPmax >= kSSDStripsPerSide) | |
475 | iPmax = kSSDStripsPerSide-1; | |
476 | if (iNmax >= kSSDStripsPerSide) | |
477 | iNmax = kSSDStripsPerSide-1; | |
478 | AliDebug(2,Form("lay %d p %d %d n %d %d\n",layer,iPmin,iPmax,iNmin,iNmax)); | |
479 | return kTRUE; | |
480 | } | |
481 | //______________________________________________________________________ | |
b0702f40 | 482 | Bool_t AliITSChannelStatus::AnyBadInRoad(Int_t imod, Float_t zlocmin, Float_t zlocmax, Float_t xlocmin, Float_t xlocmax) const{ |
483 | // Checks if there is at least one bad channel in the search road | |
6a0fdcbd | 484 | // For SSD: return kTRUE if there is at least one bad strip on both sides |
485 | // if only bad strips on one side 1D clusters can be used | |
486 | AliDebug(2,Form("checking for module %d",imod)); | |
b0702f40 | 487 | if(imod<kSPDModules){ |
488 | Int_t izmin,izmax,ixmin,ixmax; | |
489 | Bool_t retcode=GetSPDLimits(zlocmin,zlocmax,xlocmin,xlocmax,izmin,izmax,ixmin,ixmax); | |
490 | if(!retcode) return kFALSE; | |
491 | for(Int_t iz=izmin; iz<=izmax;iz++){ | |
492 | for(Int_t ix=ixmin; ix<=ixmax;ix++){ | |
493 | if(GetChannelStatus(imod,iz,ix)==kFALSE) return kTRUE; | |
494 | } | |
495 | } | |
6a0fdcbd | 496 | }else if (imod < kSSDFirstModule) { |
b0702f40 | 497 | Int_t izmin,izmax,izmin2,izmax2; |
498 | Bool_t retcode=GetSDDLimits(zlocmin,zlocmax,xlocmin,xlocmax,izmin,izmax,izmin2,izmax2); | |
499 | if(!retcode) return kFALSE; | |
500 | for(Int_t iz=izmin; iz<=izmax;iz++){ | |
6a0fdcbd | 501 | if(GetChannelStatus(imod,iz,0)==kFALSE) { return kTRUE;} |
b0702f40 | 502 | } |
503 | if(izmin2!=-1 && izmax2!=-1){ | |
504 | for(Int_t iz=izmin2; iz<=izmax2;iz++){ | |
6a0fdcbd | 505 | if(GetChannelStatus(imod,iz,0)==kFALSE) { return kTRUE;} |
b0702f40 | 506 | } |
507 | } | |
508 | } | |
6a0fdcbd | 509 | else { |
510 | Int_t layer = 5; | |
511 | if (imod > kSSDMaxModLay5) | |
512 | layer = 6; | |
513 | Int_t iPmin,iPmax,iNmin,iNmax; | |
514 | Bool_t retcode=GetSSDLimits(layer,zlocmin,zlocmax,xlocmin,xlocmax,iPmin,iPmax,iNmin,iNmax); | |
515 | if(!retcode) return kFALSE; | |
516 | Int_t nPbad = 0; | |
517 | for(Int_t iP=iPmin; iP<=iPmax;iP++){ | |
518 | if(GetChannelStatus(imod,iP,0)==kFALSE) nPbad++; | |
519 | } | |
520 | if (nPbad == 0) | |
521 | return kFALSE; | |
522 | for(Int_t iN=iNmin; iN<=iNmax;iN++){ | |
523 | if(GetChannelStatus(imod,iN+768,0)==kFALSE) { return kTRUE; } | |
524 | } | |
525 | } | |
b0702f40 | 526 | return kFALSE; |
527 | } | |
528 | //______________________________________________________________________ | |
529 | Float_t AliITSChannelStatus::FractionOfBadInRoad(Int_t imod, Float_t zlocmin, Float_t zlocmax, Float_t xlocmin, Float_t xlocmax) const{ | |
530 | // Calculate the fraction of bad channels in the road | |
6a0fdcbd | 531 | // Note: SSD returns fraction of dead strips on 'best' side. This |
532 | // is not proportional to dead surface area. | |
b0702f40 | 533 | Float_t totChan=0.; |
534 | Float_t badChan=0.; | |
535 | if(imod<kSPDModules){ | |
536 | Int_t izmin,izmax,ixmin,ixmax; | |
537 | Bool_t retcode=GetSPDLimits(zlocmin,zlocmax,xlocmin,xlocmax,izmin,izmax,ixmin,ixmax); | |
538 | if(!retcode) return 0.; | |
539 | for(Int_t iz=izmin; iz<=izmax;iz++){ | |
540 | for(Int_t ix=ixmin; ix<=ixmax;ix++){ | |
541 | totChan+=1; | |
542 | if(GetChannelStatus(imod,iz,ix)==kFALSE) badChan+=1.; | |
543 | } | |
544 | } | |
6a0fdcbd | 545 | }else if (imod < kSSDFirstModule) { |
b0702f40 | 546 | Int_t izmin,izmax,izmin2,izmax2; |
547 | Bool_t retcode=GetSDDLimits(zlocmin,zlocmax,xlocmin,xlocmax,izmin,izmax,izmin2,izmax2); | |
548 | if(!retcode) return 0.; | |
549 | for(Int_t iz=izmin; iz<=izmax;iz++){ | |
550 | totChan+=1; | |
551 | if(GetChannelStatus(imod,iz,0)==kFALSE) badChan+=1.; | |
552 | } | |
553 | if(izmin2!=-1 && izmax2!=-1){ | |
554 | for(Int_t iz=izmin2; iz<=izmax2;iz++){ | |
555 | totChan+=1; | |
556 | if(GetChannelStatus(imod,iz,0)==kFALSE) badChan+=1.; | |
557 | } | |
558 | } | |
559 | } | |
6a0fdcbd | 560 | else { |
561 | Int_t layer = 5; | |
562 | if (imod > kSSDMaxModLay5) | |
563 | layer = 6; | |
564 | Int_t iPmin,iPmax,iNmin,iNmax; | |
565 | Bool_t retcode=GetSSDLimits(layer,zlocmin,zlocmax,xlocmin,xlocmax,iPmin,iPmax,iNmin,iNmax); | |
566 | if(!retcode) return kFALSE; | |
567 | Int_t nPbad = 0; | |
568 | for(Int_t iP=iPmin; iP<=iPmax;iP++){ | |
569 | if(GetChannelStatus(imod,iP,0)==kFALSE) nPbad++; | |
570 | } | |
571 | Float_t fracP = (Float_t) nPbad / (iPmax-iPmin+1); | |
572 | if (nPbad == 0) | |
573 | return 0; | |
574 | Int_t nNbad = 0; | |
575 | for(Int_t iN=iNmin; iN<=iNmax;iN++){ | |
576 | if(GetChannelStatus(imod,iN+768,0)==kFALSE) nNbad++; | |
577 | } | |
578 | Float_t fracN = (Float_t) nNbad / (iPmax-iPmin+1); | |
579 | return TMath::Min(fracP,fracN); | |
580 | } | |
b0702f40 | 581 | if(totChan==0.) return 0.; |
582 | else return badChan/totChan; | |
583 | } | |
6a0fdcbd | 584 |