]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
fix some bugs for new segmentation in clusterization (Christian)
authormartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 10 Mar 2005 06:59:59 +0000 (06:59 +0000)
committermartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 10 Mar 2005 06:59:59 +0000 (06:59 +0000)
MUON/AliMUONClusterFinderVS.cxx
MUON/AliMUONClusterReconstructor.cxx
MUON/AliMUONSt345SlatSegmentation.cxx

index a1fc48704370858179b84f79b5cd211c019c063c..1e5701e3e0cf338420f50ebf8888e7c2f9f947c2 100644 (file)
@@ -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; i<fMul[cath]; i++) {
-// get neighbours for that digit and assume that it is local maximum
-           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);
+      // loop over cluster digits
+      for (i=0; i<fMul[cath]; i++) {
+       // get neighbours for that digit and assume that it is local maximum
+       Int_t isec;
+       Float_t a0;
 
-           isLocal[i][cath]=kTRUE;
-           Int_t isec= fSeg[cath]->Sector(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; j<nn; j++) {
-               if (fHitMap[cath]->TestHit(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; j<nn; j++) {
+         if (fHitMap[cath]->TestHit(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; k<fNLocal[cath]; k++) {
+               if (x[j]==fIx[fIndLocal[k][cath]][cath] 
+                   && y[j]==fIy[fIndLocal[k][cath]][cath])
+                 {
                    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; k<fNLocal[cath]; k++) {
-                           if (x[j]==fIx[fIndLocal[k][cath]][cath] 
-                               && y[j]==fIy[fIndLocal[k][cath]][cath])
-                           {
-                               isLocal[i][cath]=kFALSE;
-                           } 
-                       } // loop over local maxima
-                   } // are there already local maxima
-               } // same charge ? 
-           } // loop over next neighbours
-           if (isLocal[i][cath]) {
-               fIndLocal[fNLocal[cath]][cath]=i;
-               fNLocal[cath]++;
-           } 
-       } // loop over all digits
+                 } 
+             } // loop over local maxima
+           } // are there already local maxima
+         } // same charge ? 
+       } // loop over next neighbours
+       if (isLocal[i][cath]) {
+         fIndLocal[fNLocal[cath]][cath]=i;
+         fNLocal[cath]++;
+       } 
+      } // loop over all digits
     } // loop over cathodes
 
     AliDebug(1,Form("\n Found %d %d %d %d local Maxima\n",
@@ -1605,6 +1613,8 @@ void AliMUONClusterFinderVS::FindRawClusters()
 //  Return if no input datad available
     if (!fInput->NDigits(0) && !fInput->NDigits(1)) return;
 
+    fSegmentationType = fInput->GetSegmentationType();
+
     if (fSegmentationType == 1) {
       fSeg[0] = fInput->Segmentation(0);
       fSeg[1] = fInput->Segmentation(1);
index 9a6caf339eb0640bfe7faaaea4da4a72b29e8116..c1658e9ece0247330c7584ca63d377d8dfbd4f5d 100644 (file)
@@ -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;
index 19a9c151b753a2bf037eda5af9a6e159a6e9fce3..3b2e8dee3acff1eff6fe4e41823da07700db295d 100644 (file)
@@ -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;