+ Int_t detType=-1;
+ Float_t detSizeFactorX=0.0001,detSizeFactorZ=0.0001;
+ if (ilayer==0 || ilayer==1) { // ---------- SPD
+ detType = 0;
+ } else if (ilayer==2 || ilayer==3) { // ---------- SDD
+ detType = 1;
+ detSizeFactorX *= 2.;
+ } else if (ilayer==4 || ilayer==5) { // ---------- SSD
+ detType = 2;
+ }
+ AliITSsegmentation *segm = (AliITSsegmentation*)fDetTypeRec->GetSegmentationModel(detType);
+ if (detType==2) segm->SetLayer(ilayer+1);
+ Float_t detSizeX = detSizeFactorX*segm->Dx();
+ Float_t detSizeZ = detSizeFactorZ*segm->Dz();
+
+ // check if the road overlaps with bad chips
+ Float_t xloc,zloc;
+ LocalModuleCoord(ilayer,idet,track,xloc,zloc);
+ Float_t zlocmin = zloc-dz;
+ Float_t zlocmax = zloc+dz;
+ Float_t xlocmin = xloc-dy;
+ Float_t xlocmax = xloc+dy;
+ Int_t chipsInRoad[100];
+
+ if (TMath::Max(TMath::Abs(xlocmin),TMath::Abs(xlocmax))>0.5*detSizeX ||
+ TMath::Max(TMath::Abs(zlocmin),TMath::Abs(zlocmax))>0.5*detSizeZ) return 0;
+ //printf("lay %d det %d zmim zmax %f %f xmin xmax %f %f %f %f\n",ilayer,idet,zlocmin,zlocmax,xlocmin,xlocmax,segm->Dx(),segm->Dz());
+ Int_t nChipsInRoad = segm->GetChipsInLocalWindow(chipsInRoad,zlocmin,zlocmax,xlocmin,xlocmax);
+ //printf("lay %d nChipsInRoad %d\n",ilayer,nChipsInRoad);
+ if (!nChipsInRoad) return 0;
+
+ Bool_t anyBad=kFALSE,anyGood=kFALSE;
+ for (Int_t iCh=0; iCh<nChipsInRoad; iCh++) {
+ if (chipsInRoad[iCh]<0 || chipsInRoad[iCh]>det.GetNChips()-1) continue;
+ //printf(" chip %d bad %d\n",chipsInRoad[iCh],(Int_t)det.IsChipBad(chipsInRoad[iCh]));
+ if (det.IsChipBad(chipsInRoad[iCh])) {
+ anyBad=kTRUE;
+ } else {
+ anyGood=kTRUE;
+ }
+ }
+
+ if (!anyGood) return 2; // all chips in road are bad
+
+ if (anyBad) return 3; // at least a bad chip in road
+
+
+ if (!AliITSReconstructor::GetRecoParam()->GetUseSingleBadChannelsFromOCDB()
+ || ilayer==4 || ilayer==5 // SSD
+ || !noClusters) return 0;
+
+ // There are no clusters in road: check if there is at least
+ // a bad SPD pixel or SDD anode
+
+ if(ilayer==1 || ilayer==3 || ilayer==5)
+ idet += AliITSgeomTGeo::GetNLadders(ilayer)*AliITSgeomTGeo::GetNDetectors(ilayer);
+
+ //if (fITSChannelStatus->AnyBadInRoad(idet,zlocmin,zlocmax,xlocmin,xlocmax)) return 3;
+
+ if (fITSChannelStatus->FractionOfBadInRoad(idet,zlocmin,zlocmax,xlocmin,xlocmax) > AliITSReconstructor::GetRecoParam()->GetMinFractionOfBadInRoad()) return 3;
+