-
- for (Int_t j=0; j< cluster.Multiplicity(); ++j)
- {
- AliMUONPad* pad = cluster.Pad(j);
- if ( pad->Cathode() != cath) continue;
- ix = pad->Ix();
- iy = pad->Iy();
- if (iy == iy0 && ix == ix0) continue;
- for (Int_t k=0; k<nn; ++k)
- {
- if (xList[k] != ix || yList[k] != iy) continue;
- if (!mirror)
- {
- if ((!cath || maxpad[0][0] < 0) &&
- (TMath::Abs(iy-iy0) == 1 || iy*iy0 == -1)) {
- if (!iPad && TMath::Abs(ix-ix0) == 1 || ix*ix0 == -1) ix1 = xList[k]; //19-12-05
- xList[k] = yList[k] = 0;
- neighb--;
- break;
- }
- if ((cath || maxpad[1][0] < 0) &&
- (TMath::Abs(ix-ix0) == 1 || ix*ix0 == -1)) {
- if (!iPad) ix1 = xList[k]; //19-12-05
- xList[k] = yList[k] = 0;
- neighb--;
- }
- } else {
- if ((!cath || maxpad[0][0] < 0) &&
- (TMath::Abs(ix-ix0) == 1 || ix*ix0 == -1)) {
- if (!iPad) ix1 = xList[k]; //19-12-05
- xList[k] = yList[k] = 0;
- neighb--;
- break;
- }
- if ((cath || maxpad[1][0] < 0) &&
- (TMath::Abs(iy-iy0) == 1 || iy*iy0 == -1)) {
- xList[k] = yList[k] = 0;
- neighb--;
- }
- }
- break;
- } // for (Int_t k=0; k<nn;
- if (!neighb) break;
- } // for (Int_t j=0; j< cluster.Multiplicity();
- if (!neighb) continue;
-
- // Add virtual pad
- Int_t npads, isec;
- isec = npads = 0;
- for (Int_t j=0; j<nn; j++)
- {
- if (xList[j] == 0 && yList[j] == 0) continue;
- // npads = fnPads[0] + fnPads[1];
- // fPadIJ[0][npads] = cath;
- // fPadIJ[1][npads] = 0;
- ix = xList[j];
- iy = yList[j];
- if (TMath::Abs(ix-ix0) == 1 || ix*ix0 == -1) {
- if (iy != iy0) continue; // new segmentation - check
- if (nInX != 2) continue; // new
- if (!mirror) {
- if (!cath && maxpad[1][0] >= 0) continue;
- } else {
- if (cath && maxpad[0][0] >= 0) continue;
- }
- if (iPad && !iAddX) continue;
- AliMpPad pad = fSegmentation[cath]->PadByIndices(AliMpIntPair(ix,iy),kTRUE);
- // fXyq[0][npads] = pad.Position().X();
- // fXyq[1][npads] = pad.Position().Y();
- AliMUONPad muonPad(fDetElemId, cath, ix, iy, pad.Position().X(), pad.Position().Y(), 0, 0, 0);
- // fSegmentation[cath]->GetPadC(ix, iy, fXyq[0][npads], fXyq[1][npads], zpad);
- // if (fXyq[0][npads] > 1.e+5) continue; // temporary fix
- if (muonPad.Coord(0) > 1.e+5) continue; // temporary fix
- if (ix == ix1) continue; //19-12-05
- if (ix1 == ix0) continue;
- if (maxpad[1][0] < 0 || mirror && maxpad[0][0] >= 0) {
- // if (!iPad) fXyq[2][npads] = TMath::Min (sigmax[0]/100, 5.);
- // else fXyq[2][npads] = TMath::Min (aamax[0]/100, 5.);
- if (!iPad) muonPad.SetCharge(TMath::Min (sigmax[0]/100, 5.));
- else muonPad.SetCharge(TMath::Min (aamax[0]/100, 5.));
- }
- else {
- // if (!iPad) fXyq[2][npads] = TMath::Min (sigmax[1]/100, 5.);
- // else fXyq[2][npads] = TMath::Min (aamax[1]/100, 5.);
- if (!iPad) muonPad.SetCharge(TMath::Min (sigmax[1]/100, 5.));
- else muonPad.SetCharge(TMath::Min (aamax[1]/100, 5.));
- }
- // fXyq[2][npads] = TMath::Max (fXyq[2][npads], (float)1);
- if (muonPad.Charge() < 1.) muonPad.SetCharge(1.);
- // fXyq[3][npads] = -2; // flag
- // fPadIJ[2][npads] = ix;
- // fPadIJ[3][npads] = iy;
- muonPad.SetSize(0,-2.); //flag
- // fnPads[1]++;
- // iAddX = npads;
- iAddX = 1;
- //AliDebug(1,Form("Add virtual pad in X %f %f %f %3d %3d \n",
- // fXyq[2][npads], fXyq[0][npads], fXyq[1][npads], ix, iy));
- //muonPad.Charge(), muonPad.Coord(0), muonPad.Coord(1), ix, iy));
- if (fDebug) printf(" ***** Add virtual pad in X ***** %f %f %f %3d %3d \n",
- muonPad.Charge(), muonPad.Coord(0), muonPad.Coord(1), ix, iy);
- cluster.AddPad(muonPad); // add pad to the cluster
- ix1 = ix0;
- continue;
- }
- if (nInY != 2) continue;
- if (!mirror && cath && maxpad[0][0] >= 0) continue;
- if (mirror && !cath && maxpad[1][0] >= 0) continue;
- if (TMath::Abs(iy-iy0) == 1 || TMath::Abs(iy*iy0) == 1) {
- if (ix != ix0) continue; // new segmentation - check
- if (iPad && !iAddY) continue;
- AliMpPad pad = fSegmentation[cath]->PadByIndices(AliMpIntPair(ix,iy),kTRUE);
- // fXyq[0][npads] = pad.Position().X();
- // fXyq[1][npads] = pad.Position().Y();
- // fSegmentation[cath]->GetPadC(ix, iy, fXyq[0][npads], fXyq[1][npads], zpad);
- AliMUONPad muonPad(fDetElemId, cath, ix, iy, pad.Position().X(), pad.Position().Y(), 0, 0, 0);
- if (iy1 == iy0) continue;
- //if (iPad && iy1 == iy0) continue;
- if (maxpad[0][0] < 0 || mirror && maxpad[1][0] >= 0) {
- // if (!iPad) fXyq[2][npads] = TMath::Min (sigmax[1]/15, fgkZeroSuppression);
- // else fXyq[2][npads] = TMath::Min (aamax[1]/15, fgkZeroSuppression);
- if (!iPad) muonPad.SetCharge(TMath::Min (sigmax[1]/15, fgkZeroSuppression));
- else muonPad.SetCharge(TMath::Min (aamax[1]/15, fgkZeroSuppression));
- }
- else {
- // if (!iPad) fXyq[2][npads] = TMath::Min (sigmax[0]/15, fgkZeroSuppression);
- // else fXyq[2][npads] = TMath::Min (aamax[0]/15, fgkZeroSuppression);
- if (!iPad) muonPad.SetCharge(TMath::Min (sigmax[0]/15, fgkZeroSuppression));
- else muonPad.SetCharge(TMath::Min (aamax[0]/15, fgkZeroSuppression));
- }
- // fXyq[2][npads] = TMath::Max (fXyq[2][npads], (float)1);
- if (muonPad.Charge() < 1.) muonPad.SetCharge(1.);
- // fXyq[3][npads] = -2; // flag
- // fPadIJ[2][npads] = ix;
- // fPadIJ[3][npads] = iy;
- muonPad.SetSize(0,-2.); //flag
- // fnPads[1]++;
- // iAddY = npads;
- iAddY = 1;
- if (fDebug) printf(" ***** Add virtual pad in Y ***** %f %f %f %3d %3d \n",
- muonPad.Charge(), muonPad.Coord(0), muonPad.Coord(1), ix, iy);
- cluster.AddPad(muonPad); // add pad to the cluster
- iy1 = iy0;
- }
- } // for (Int_t j=0; j<nn;
- } // for (Int_t iPad=0;
- } // for (cath=0; cath<2;
+ if (j == 1 && idir == idirAdd) break; // this pad has been already added
+
+ // Add pad (if it exists)
+ TVector2 pos;
+ if (inb == 0) pos.Set (pad->X() + idir * (pad->DX()+fgkDistancePrecision), pad->Y());
+ else pos.Set (pad->X(), pad->Y() + idir * (pad->DY()+fgkDistancePrecision));
+ //AliMpPad mppad = fkSegmentation[nonb[inb]]->PadByPosition(pos,kTRUE);
+ AliMpPad mppad = fkSegmentation[nonb[inb]]->PadByPosition(pos.X(), pos.Y(),kFALSE);
+ if (!mppad.IsValid()) continue; // non-existing pad
+ AliMUONPad muonPad(fDetElemId, nonb[inb], mppad.GetIx(), mppad.GetIy(),
+ mppad.GetPositionX(), mppad.GetPositionY(),
+ mppad.GetDimensionX(), mppad.GetDimensionY(), 0);
+ if (inb == 0) muonPad.SetCharge(TMath::Min (amax[j]/100, fLowestPadCharge));
+ //else muonPad.SetCharge(TMath::Min (amax[j]/15, fgkZeroSuppression));
+ else muonPad.SetCharge(TMath::Min (amax[j]/15, fLowestPadCharge));
+ if (muonPad.Charge() < 2.0*fLowestPixelCharge) muonPad.SetCharge(2.0*fLowestPixelCharge);
+ muonPad.SetReal(kFALSE);
+ if (fDebug) printf(" ***** Add virtual pad in %d direction ***** %f %f %f %3d %3d %f %f \n",
+ inb, muonPad.Charge(), muonPad.X(), muonPad.Y(), muonPad.Ix(),
+ muonPad.Iy(), muonPad.DX(), muonPad.DY());
+ cluster.AddPad(muonPad); // add pad to the cluster
+ add = kTRUE;
+ idirAdd = idir;
+ }
+ }