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);
//
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);