From f7db207169e038a5f5c0257472321b16c8ed139d Mon Sep 17 00:00:00 2001 From: martinez Date: Thu, 10 Mar 2005 06:59:59 +0000 Subject: [PATCH] fix some bugs for new segmentation in clusterization (Christian) --- MUON/AliMUONClusterFinderVS.cxx | 102 ++++++++++++++------------ MUON/AliMUONClusterReconstructor.cxx | 35 +++++---- MUON/AliMUONSt345SlatSegmentation.cxx | 27 +++---- 3 files changed, 92 insertions(+), 72 deletions(-) diff --git a/MUON/AliMUONClusterFinderVS.cxx b/MUON/AliMUONClusterFinderVS.cxx index a1fc4870437..1e5701e3e0c 100644 --- a/MUON/AliMUONClusterFinderVS.cxx +++ b/MUON/AliMUONClusterFinderVS.cxx @@ -44,7 +44,6 @@ AliMUONClusterFinderVS::AliMUONClusterFinderVS() { // Default constructor fInput=AliMUONClusterInput::Instance(); - fSegmentationType = fInput->GetSegmentationType(); // cout << " TYPE" << fSegmentationType << endl; fHitMap[0] = 0; fHitMap[1] = 0; @@ -1023,54 +1022,63 @@ void AliMUONClusterFinderVS::FindLocalMaxima(AliMUONRawCluster* /*c*/) // number of next neighbours and arrays to store them Int_t nn; Int_t x[10], y[10]; -// loop over cathodes + // loop over cathodes for (cath=0; cath<2; cath++) { -// loop over cluster digits - for (i=0; iNeighbours(fIx[i][cath], fIy[i][cath], &nn, x, y); - else - fSeg2[cath]->Neighbours(fInput->DetElemId(), fIx[i][cath], fIy[i][cath], &nn, x, y); + // loop over cluster digits + for (i=0; iSector(fIx[i][cath], fIy[i][cath]); - Float_t a0 = fSeg[cath]->Dpx(isec)*fSeg[cath]->Dpy(isec); -// loop over next neighbours, if at least one neighbour has higher charger assumption -// digit is not local maximum - for (j=0; jTestHit(x[j], y[j])==kEmpty) continue; - digt=(AliMUONDigit*) fHitMap[cath]->GetHit(x[j], y[j]); - Float_t a1; - if (fSegmentationType == 1) { - isec=fSeg[cath]->Sector(x[j], y[j]); - a1 = fSeg[cath]->Dpx(isec)*fSeg[cath]->Dpy(isec); - } else { - isec=fSeg2[cath]->Sector(fInput->DetElemId(), x[j], y[j]); - a1 = fSeg2[cath]->Dpx(fInput->DetElemId(),isec)*fSeg2[cath]->Dpy(fInput->DetElemId(), isec); - } - if (digt->Signal()/a1 > fQ[i][cath]/a0) { + if (fSegmentationType == 1) + fSeg[cath]->Neighbours(fIx[i][cath], fIy[i][cath], &nn, x, y); + else + fSeg2[cath]->Neighbours(fInput->DetElemId(), fIx[i][cath], fIy[i][cath], &nn, x, y); + + isLocal[i][cath]=kTRUE; + + if (fSegmentationType == 1) { + isec = fSeg[cath]->Sector(fIx[i][cath], fIy[i][cath]); + a0 = fSeg[cath]->Dpx(isec)*fSeg[cath]->Dpy(isec); + } else { + isec = fSeg2[cath]->Sector(fInput->DetElemId(), fIx[i][cath], fIy[i][cath]); + a0 = fSeg2[cath]->Dpx(fInput->DetElemId(), isec)*fSeg2[cath]->Dpy(fInput->DetElemId(), isec); + } + // loop over next neighbours, if at least one neighbour has higher charger assumption + // digit is not local maximum + for (j=0; jTestHit(x[j], y[j])==kEmpty) continue; + digt=(AliMUONDigit*) fHitMap[cath]->GetHit(x[j], y[j]); + Float_t a1; + if (fSegmentationType == 1) { + isec=fSeg[cath]->Sector(x[j], y[j]); + a1 = fSeg[cath]->Dpx(isec)*fSeg[cath]->Dpy(isec); + } else { + isec=fSeg2[cath]->Sector(fInput->DetElemId(), x[j], y[j]); + a1 = fSeg2[cath]->Dpx(fInput->DetElemId(),isec)*fSeg2[cath]->Dpy(fInput->DetElemId(), isec); + } + if (digt->Signal()/a1 > fQ[i][cath]/a0) { + isLocal[i][cath]=kFALSE; + break; + // + // handle special case of neighbouring pads with equal signal + } else if (digt->Signal() == fQ[i][cath]) { + if (fNLocal[cath]>0) { + for (Int_t k=0; kSignal() == fQ[i][cath]) { - if (fNLocal[cath]>0) { - for (Int_t k=0; kNDigits(0) && !fInput->NDigits(1)) return; + fSegmentationType = fInput->GetSegmentationType(); + if (fSegmentationType == 1) { fSeg[0] = fInput->Segmentation(0); fSeg[1] = fInput->Segmentation(1); diff --git a/MUON/AliMUONClusterReconstructor.cxx b/MUON/AliMUONClusterReconstructor.cxx index 9a6caf339eb..c1658e9ece0 100644 --- a/MUON/AliMUONClusterReconstructor.cxx +++ b/MUON/AliMUONClusterReconstructor.cxx @@ -190,8 +190,8 @@ void AliMUONClusterReconstructor::Digits2ClustersNew() AliMUONDigit* digit; - TArrayI id(100); // contains the different IdDE - id.Reset(); + TArrayI id(200); // contains the different IdDE + // Loop on chambers and on cathode planes TClonesArray* muonDigits; @@ -200,6 +200,8 @@ void AliMUONClusterReconstructor::Digits2ClustersNew() Int_t flag = 0; for (Int_t ich = 0; ich < AliMUONConstants::NTrackingCh(); ich++) { + + id.Reset(); n1 = 0; n2 = 0; //cathode 0 @@ -216,8 +218,9 @@ void AliMUONClusterReconstructor::Digits2ClustersNew() digit = (AliMUONDigit*) muonDigits->UncheckedAt(k); new(lDigit[n1++]) AliMUONDigit(*digit); idDE = digit->DetElemId(); - if (idDE != idDE_prev) + if (idDE != idDE_prev) { id.AddAt(idDE,n2++); + } idDE_prev = idDE; } @@ -227,6 +230,8 @@ void AliMUONClusterReconstructor::Digits2ClustersNew() muonDigits = fMUONData->Digits(ich); ndig = muonDigits->GetEntriesFast(); + Int_t idSize = n2; + for (k = 0; k < ndig; k++) { digit = (AliMUONDigit*) muonDigits->UncheckedAt(k); @@ -234,31 +239,35 @@ void AliMUONClusterReconstructor::Digits2ClustersNew() idDE = digit->DetElemId(); flag = 0; - for (Int_t n = 0; n < id.GetSize(); n++) { - if (id[n] == idDE) { + // looking for new idDE in cathode 1 (method to be checked CF) + for (Int_t n = 0; n < idSize; n++) { + if (idDE == id[n]) { flag = 1; break; } - if (flag) continue; - id[id.GetSize()+1] = idDE; } + if (flag) continue; + id.AddAt(idDE,n2++); } - // loop over id DE - for (idDE = 0; idDE < id.GetSize(); idDE++) { + idSize = n2; + // loop over id DE + for (idDE = 0; idDE < idSize; idDE++) { TClonesArray &lhits1 = *dig1; TClonesArray &lhits2 = *dig2; n1 = n2 = 0; + // printf("idDE %d\n", id[idDE]); for (k = 0; k < digAll->GetEntriesFast(); k++) { digit = (AliMUONDigit*) digAll->UncheckedAt(k); - if (id[idDE] == digit->DetElemId()) + // printf("digit idDE %d\n", digit->DetElemId()); + if (id[idDE] == digit->DetElemId()) { if (digit->Cathode() == 1) new(lhits1[n1++]) AliMUONDigit(*digit); else new(lhits2[n2++]) AliMUONDigit(*digit); - + } } // cluster finder @@ -274,9 +283,9 @@ void AliMUONClusterReconstructor::Digits2ClustersNew() } dig1->Delete(); dig2->Delete(); - digAll->Delete(); - } + } // idDE + digAll->Delete(); } // for ich delete dig1; delete dig2; diff --git a/MUON/AliMUONSt345SlatSegmentation.cxx b/MUON/AliMUONSt345SlatSegmentation.cxx index 19a9c151b75..3b2e8dee3ac 100644 --- a/MUON/AliMUONSt345SlatSegmentation.cxx +++ b/MUON/AliMUONSt345SlatSegmentation.cxx @@ -172,7 +172,7 @@ Float_t AliMUONSt345SlatSegmentation::GetAnod(Float_t xhit) const void AliMUONSt345SlatSegmentation::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y) { if (ix<1 || ix>Npx() || iy<1 || iy>Npy() ){ - AliWarning(Form("ix or iy out of boundaries: Npx=%d and Npy=%d",Npx(),Npy())); + AliWarning(Form("ix %d or iy %d out of boundaries: Npx=%d and Npy=%d",ix, iy, Npx(), Npy())); x=-99999.; y=-99999.; } else { @@ -209,7 +209,7 @@ void AliMUONSt345SlatSegmentation::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_ break; } } - if (isec == -1) AliWarning(Form("isector equal to %d with x %f, y %f", isec, x, y)); + if (isec == -1) AliWarning(Form("isector equal to %d with xl %f, yl %f", isec, x, y)); if (isec>0) { ix= Int_t((x-fCx[isec-1])/(*fDpxD)[isec]) +fNpxS[isec-1]+1; @@ -272,11 +272,11 @@ void AliMUONSt345SlatSegmentation::SetHit(Float_t x, Float_t y) fXhit = x; fYhit = y; - if (x < 0) fXhit = 0; - if (y < 0) fYhit = 0; + // if (x < 0) fXhit = 0; +// if (y < 0) fYhit = 0; - if (x >= fCx[fNsec-1]) fXhit = fCx[fNsec-1]; - if (y >= fDyPCB) fYhit = fDyPCB; +// if (x >= fCx[fNsec-1]) fXhit = fCx[fNsec-1]; +// if (y >= fDyPCB) fYhit = fDyPCB; } //---------------------------------------------------------------------------- @@ -301,7 +301,7 @@ void AliMUONSt345SlatSegmentation::FirstPad(Float_t xhit, Float_t yhit, Float_t Float_t x02=x0a + dx; Float_t y01=yhit - dy; Float_t y02=yhit + dy; - // if (x01 < 0) x01 = 0; +// if (x01 < 0) x01 = 0; // if (y01 < 0) y01 = 0; // if (x02 >= fCx[fNsec-1]) x02 = fCx[fNsec-1]; @@ -325,6 +325,8 @@ void AliMUONSt345SlatSegmentation::FirstPad(Float_t xhit, Float_t yhit, Float_t if (fIxmax > fNpx) fIxmax=fNpx; if (fIymax > fNpyS[isec]) fIymax = fNpyS[isec]; + if (fIxmin < 1) fIxmin = 1; // patch for the moment (Ch. Finck) + if (fIymin < 1) fIymin = 1; fXmin=x01; fXmax=x02; @@ -374,10 +376,9 @@ void AliMUONSt345SlatSegmentation::NextPad() fSector=Sector(fIx,fIy); } else { - fIx=-1; - fIy=-1; + fIx=-999; + fIy=-999; } - // printf("\n Next Pad %d %d %f %f %d %d %d %d %d ", } //------------------------------------------------------------------------- Int_t AliMUONSt345SlatSegmentation::MorePads() @@ -386,7 +387,7 @@ Int_t AliMUONSt345SlatSegmentation::MorePads() // // Are there more pads in the integration region - return (fIx != -1 || fIy != -1); + return (fIx != -999 || fIy != -999); } //-------------------------------------------------------------------------- Int_t AliMUONSt345SlatSegmentation::Sector(Int_t ix, Int_t iy) @@ -401,8 +402,8 @@ Int_t AliMUONSt345SlatSegmentation::Sector(Int_t ix, Int_t iy) break; } } - if (isec == -1) printf("\n Sector: Attention isec ! %d %d %d %d \n", - fId, ix, iy,fNpxS[3]); + if (isec == -1) AliWarning(Form("Sector = %d with ix %d and iy %d, max padx %d", + isec, ix, iy,fNpxS[3])); return isec; -- 2.43.0