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