+
+//____________________________________________________________________
+void
+AliITSMultReconstructor::FlagClustersInOverlapRegions (Int_t iC1, Int_t iC2WithBestDist) {
+
+ Float_t distClSameMod=0.;
+ Float_t distClSameModMin=0.;
+ Int_t iClOverlap =0;
+ Float_t meanRadiusLay1 = 3.99335; // average radius inner layer
+ Float_t meanRadiusLay2 = 7.37935; // average radius outer layer;
+
+ Float_t zproj1=0.;
+ Float_t zproj2=0.;
+ Float_t deZproj=0.;
+
+ // Loop on inner layer clusters
+ for (Int_t iiC1=0; iiC1<fNClustersLay1; iiC1++) {
+ if (!fOverlapFlagClustersLay1[iiC1]) {
+ // only for adjacent modules
+ if ((TMath::Abs(fDetectorIndexClustersLay1[iC1]-fDetectorIndexClustersLay1[iiC1])==4)||
+ (TMath::Abs(fDetectorIndexClustersLay1[iC1]-fDetectorIndexClustersLay1[iiC1])==76)) {
+ Float_t dePhi=TMath::Abs(fClustersLay1[iiC1][1]-fClustersLay1[iC1][1]);
+ if (dePhi>TMath::Pi()) dePhi=2.*TMath::Pi()-dePhi;
+
+ zproj1=meanRadiusLay1/TMath::Tan(fClustersLay1[iC1][0]);
+ zproj2=meanRadiusLay1/TMath::Tan(fClustersLay1[iiC1][0]);
+
+ deZproj=TMath::Abs(zproj1-zproj2);
+
+ distClSameMod = TMath::Sqrt(TMath::Power(deZproj/fZetaOverlapCut,2)+TMath::Power(dePhi/fPhiOverlapCut,2));
+ if (distClSameMod<=1.) fOverlapFlagClustersLay1[iiC1]=kTRUE;
+
+// if (distClSameMod<=1.) {
+// if (distClSameModMin==0. || distClSameMod<distClSameModMin) {
+// distClSameModMin=distClSameMod;
+// iClOverlap=iiC1;
+// }
+// }
+
+
+ } // end adjacent modules
+ }
+ } // end Loop on inner layer clusters
+
+// if (distClSameModMin!=0.) fOverlapFlagClustersLay1[iClOverlap]=kTRUE;
+
+ distClSameMod=0.;
+ distClSameModMin=0.;
+ iClOverlap =0;
+ // Loop on outer layer clusters
+ for (Int_t iiC2=0; iiC2<fNClustersLay2; iiC2++) {
+ if (!fOverlapFlagClustersLay2[iiC2]) {
+ // only for adjacent modules
+ if ((TMath::Abs(fDetectorIndexClustersLay2[iC2WithBestDist]-fDetectorIndexClustersLay2[iiC2])==4) ||
+ (TMath::Abs(fDetectorIndexClustersLay2[iC2WithBestDist]-fDetectorIndexClustersLay2[iiC2])==156)) {
+ Float_t dePhi=TMath::Abs(fClustersLay2[iiC2][1]-fClustersLay2[iC2WithBestDist][1]);
+ if (dePhi>TMath::Pi()) dePhi=2.*TMath::Pi()-dePhi;
+
+ zproj1=meanRadiusLay2/TMath::Tan(fClustersLay2[iC2WithBestDist][0]);
+ zproj2=meanRadiusLay2/TMath::Tan(fClustersLay2[iiC2][0]);
+
+ deZproj=TMath::Abs(zproj1-zproj2);
+ distClSameMod = TMath::Sqrt(TMath::Power(deZproj/fZetaOverlapCut,2)+TMath::Power(dePhi/fPhiOverlapCut,2));
+ if (distClSameMod<=1.) fOverlapFlagClustersLay2[iiC2]=kTRUE;
+
+// if (distClSameMod<=1.) {
+// if (distClSameModMin==0. || distClSameMod<distClSameModMin) {
+// distClSameModMin=distClSameMod;
+// iClOverlap=iiC2;
+// }
+// }
+
+ } // end adjacent modules
+ }
+ } // end Loop on outer layer clusters
+
+// if (distClSameModMin!=0.) fOverlapFlagClustersLay2[iClOverlap]=kTRUE;
+
+}