]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
fix in split clusters determination (problem spotted by Luca)
authorshahoian <ruben.shahoyan@cern.ch>
Fri, 8 Aug 2014 17:34:58 +0000 (19:34 +0200)
committershahoian <ruben.shahoyan@cern.ch>
Fri, 8 Aug 2014 17:35:19 +0000 (19:35 +0200)
ITS/UPGRADE/testITSU/compClusHits.C

index dfba17898a0e9982fc28679eb245599bcf3425a9..75eda66e2655c27b64b8e0641b8eacd563d08496 100644 (file)
@@ -192,11 +192,10 @@ void compClusHits(int nev=-1)
        int modID = cl->GetVolumeId();
        
        //------------ check if this is a split cluster
-       int sInL = modID - gm->GetFirstChipIndex(ilr);
        if (!cl->TestBit(kSplCheck)) {
          cl->SetBit(kSplCheck);
          // check if there is no other cluster with same label on this module
-         AliITSURecoSens* sens = lr->GetSensor(sInL);
+         AliITSURecoSens* sens = lr->GetSensorFromID(modID);
          int nclSn = sens->GetNClusters();
          int offs = sens->GetFirstClusterId();
          //    printf("To check for %d (mod:%d) N=%d from %d\n",icl,modID,nclSn,offs);
@@ -245,11 +244,18 @@ void compClusHits(int nev=-1)
          //
          int nh = htArr->GetEntriesFast();
          AliITSUHit *pHit=0;
+         double dst2Max = 1e33;
          for (int ih=nh;ih--;) {
            AliITSUHit* tHit = (AliITSUHit*)htArr->At(ih);
            if (tHit->GetChip()!=modID) continue;
-           pHit = tHit;
-           break;
+           tHit->GetPositionG(xg1,yg1,zg1);
+           tHit->GetPositionG0(xg0,yg0,zg0,tg0);
+           double gxyzHDif[3] = { (xg1+xg0)/2 - xyzClGlo[0], (yg1+yg0)/2 - xyzClGlo[1], (zg1+zg0)/2 - xyzClGlo[2] };
+           double dst2 = gxyzHDif[0]*gxyzHDif[0] + gxyzHDif[1]*gxyzHDif[1] + gxyzHDif[2]*gxyzHDif[2];
+           if (dst2<dst2Max) {
+             pHit = tHit;
+             dst2Max = dst2;
+           }
          }
          if (!pHit) {
            printf("did not find MChit for label %d on module %d ",il,modID);