]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Automatic calculation of the paramters of the hough space. Optimization of the hough...
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 8 Nov 2004 11:31:13 +0000 (11:31 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 8 Nov 2004 11:31:13 +0000 (11:31 +0000)
HLT/hough/AliL3Hough.cxx
HLT/hough/AliL3Hough.h
HLT/hough/AliL3HoughMaxFinder.cxx
HLT/hough/AliL3HoughMaxFinder.h
HLT/hough/AliL3HoughTransformerRow.cxx
HLT/hough/AliL3HoughTransformerRow.h
HLT/src/AliHLTReconstructor.cxx
MONITOR/monitorGDC.cxx
RAW/AliMDC.cxx

index c1330dbf05467bd0eddeb68944f37dda8d38bb18..50e85aa9f146d441cb7c0222cae1a4b03f80ea1b 100644 (file)
@@ -409,29 +409,55 @@ void AliL3Hough::SetTransformerParams(Int_t nx,Int_t ny,Float_t ptmin,Int_t /*pa
 {
   // Setup the parameters for the Hough Transformer
 
-
-  Int_t mrow=79;
-  Double_t lineradius = sqrt(pow(AliL3Transform::Row2X(mrow),2) + pow(AliL3Transform::GetMaxY(mrow),2));
-  Double_t alpha1 = AliL3Transform::GetMaxY(mrow)/pow(lineradius,2);
-  Double_t kappa = 1*AliL3Transform::GetBField()*AliL3Transform::GetBFact()/ptmin;
+  Double_t lineradius = 1.0/(AliL3HoughTransformerRow::GetBeta1()*sqrt(1.0+tan(AliL3Transform::Pi()*10/180)*tan(AliL3Transform::Pi()*10/180)));
+  Double_t alpha1 = AliL3HoughTransformerRow::GetBeta1()*tan(AliL3Transform::Pi()*10/180);
+  Double_t kappa = 1*AliL3Transform::GetBField()*AliL3Transform::GetBFact()/(ptmin*0.9);
   Double_t psi = AliL3Transform::Deg2Rad(10) - asin(lineradius*kappa/2);
   //  cout<<"Calculated psi range "<<psi<<" in patch "<<patch<<endl;
-  AliL3HoughTrack track;
-  track.SetTrackParameters(kappa,psi,1);
-  Float_t hit[3];
-  Int_t mrow2 = 158;
-  track.GetCrossingPoint(mrow2,hit);
-  Double_t lineradius2 = sqrt(pow(AliL3Transform::Row2X(mrow2),2) + pow(AliL3Transform::GetMaxY(mrow2),2));
-  Double_t alpha2 = hit[1]/pow(lineradius2,2);
+  Double_t alpha2 = alpha1 - (AliL3HoughTransformerRow::GetBeta1()-AliL3HoughTransformerRow::GetBeta2())*tan(psi);
   //  cout<<"Calculated alphas range "<<alpha1<<" "<<alpha2<<" in patch "<<patch<<endl;
 
   Int_t i=0;
   while(i < 6)
     {
-      fLowPt[i] = 1.15*alpha1;
+      fLowPt[i] = 1.1*alpha1;
+      fNBinY[i] = ny;
+      fNBinX[i] = nx;
+      fPhi[i] = alpha2;
+      i++;
+    }
+}
+
+void AliL3Hough::CalcTransformerParams(Float_t ptmin)
+{
+  // Setup the parameters for the Row Hough Transformer
+  // Automatically adjusts the number of bins in X and Y in a way
+  // that the size of the hough bin is 2x (in X) and 2.5 (in Y) the
+  // size of the tpc pads
+
+  Double_t lineradius = 1.0/(AliL3HoughTransformerRow::GetBeta1()*sqrt(1.0+tan(AliL3Transform::Pi()*10/180)*tan(AliL3Transform::Pi()*10/180)));
+  Double_t alpha1 = AliL3HoughTransformerRow::GetBeta1()*tan(AliL3Transform::Pi()*10/180);
+  Double_t kappa = 1*AliL3Transform::GetBField()*AliL3Transform::GetBFact()/(ptmin*0.9);
+  Double_t psi = AliL3Transform::Deg2Rad(10) - asin(lineradius*kappa/2);
+  //  cout<<"Calculated psi range "<<psi<<endl;
+  Double_t alpha2 = alpha1 - (AliL3HoughTransformerRow::GetBeta1()-AliL3HoughTransformerRow::GetBeta2())*tan(psi);
+  alpha1 *= 1.1;
+  //  cout<<"Calculated alphas range "<<alpha1<<" "<<alpha2<<endl;
+
+  Double_t sizex = 2.0*AliL3Transform::GetPadPitchWidthLow()*AliL3HoughTransformerRow::GetBeta1()*AliL3HoughTransformerRow::GetBeta1();
+  Double_t sizey = 2.5*AliL3Transform::GetPadPitchWidthUp()*AliL3HoughTransformerRow::GetBeta2()*AliL3HoughTransformerRow::GetBeta2();
+
+  Int_t nx = 2*(Int_t)(alpha1/sizex)+1;
+  Int_t ny = 2*(Int_t)(alpha2/sizey)+1;
+  //  cout<<"Calculated number of bins "<<nx<<" "<<ny<<endl;
+
+  Int_t i=0;
+  while(i < 6)
+    {
+      fLowPt[i] = alpha1;
       fNBinY[i] = ny;
       fNBinX[i] = nx;
-      fPhi[i] = 1.15*alpha2;
+      fPhi[i] = alpha2;
       i++;
     }
 }
@@ -882,7 +908,7 @@ void AliL3Hough::PrepareForNextPatch(Int_t nextpatch)
            lastyvalue = maxvalue;
          }
        UChar_t *tempnextrow = nextrow + endybin + 1;
-       memset(tempnextrow,(UChar_t)(ymax+1),ymax-endybin);
+       memset(tempnextrow,(UChar_t)(ymax+1),ymax-endybin+1);
       }
       else {
        UChar_t lastyvalue = 0;
@@ -914,7 +940,7 @@ void AliL3Hough::PrepareForNextPatch(Int_t nextpatch)
            lastyvalue = maxvalue;
          }
        UChar_t *tempnextrow = nextrow + endybin + 1;
-       memset(tempnextrow,(UChar_t)(ymax+1),ymax-endybin);
+       memset(tempnextrow,(UChar_t)(ymax+1),ymax-endybin+1);
       }
     }
 
@@ -973,7 +999,7 @@ void AliL3Hough::FindTrackCandidatesRow()
          if(hist->GetNEntries()==0) continue;
          fPeakFinder->SetHistogram(hist);
          fPeakFinder->SetEtaSlice(j);
-         fPeakFinder->SetTrackLUTs(((AliL3HoughTransformerRow *)tr)->GetTrackNRows(),((AliL3HoughTransformerRow *)tr)->GetTrackFirstRow(),((AliL3HoughTransformerRow *)tr)->GetTrackLastRow());
+         fPeakFinder->SetTrackLUTs(((AliL3HoughTransformerRow *)tr)->GetTrackNRows(),((AliL3HoughTransformerRow *)tr)->GetTrackFirstRow(),((AliL3HoughTransformerRow *)tr)->GetTrackLastRow(),((AliL3HoughTransformerRow *)tr)->GetNextRow(j));
 #ifdef do_mc
          LOG(AliL3Log::kInformational,"AliL3Hough::FindTrackCandidates()","")
            <<"Starting "<<j<<" etaslice"<<ENDLOG;
index adc077aa2763b1bdda7c327aa6e20a5d8f18be13..7e7a68f88af0476e423fac2d04cd1aeae88986cf 100644 (file)
@@ -76,6 +76,7 @@ class AliL3Hough {
   void SetTransformerParams(Float_t ptres=0,Float_t ptmin=0,Float_t ptmax=0,Int_t ny=0,Int_t patch=-1);
   //{fPtRes=ptres;fNBinY=ny;fLowPt=ptmin;fUpperPt=ptmax;fPhi=psi;}
   void SetTransformerParams(Int_t nx,Int_t ny,Float_t lpt,Int_t patch);
+  void CalcTransformerParams(Float_t lpt);
   void SetTransformerParams(Int_t nx,Int_t ny,Float_t lpt,Float_t phi);
   //{fNBinX=nx;fNBinY=ny;fLowPt=lpt;fPhi=phi;}
   void SetThreshold(Int_t t=3,Int_t patch=-1);
index 1338840a9aefc958265659467dca8469ed783af7..7edf2d744356c32643c08cae75ac26859369c23d 100644 (file)
@@ -676,19 +676,6 @@ struct AliL3PreYPeak
   Int_t fRightValue; // Neighbour values
 };
 
-struct AliL3Pre2DPeak
-{
-  Float_t fX; // X coordinate of the preak
-  Float_t fY; // Y coordinate of the preak
-  Float_t fSizeX; // Size of the peak
-  Float_t fSizeY; // Size of the peak
-  Int_t fStartX; // Start position of the peak
-  Int_t fStartY; // Start position of the peak
-  Int_t fEndX; // End position of the peak
-  Int_t fEndY; // End position of the peak
-  Float_t fWeight; // Weight assigned to the peak
-};
-
 void AliL3HoughMaxFinder::FindAdaptedRowPeaks(Int_t kappawindow,Int_t xsize,Int_t ysize)
 {
   // Peak finder which is working over the Hough Space provided by the AliL3HoughTransformerRow class
@@ -715,11 +702,11 @@ void AliL3HoughMaxFinder::FindAdaptedRowPeaks(Int_t kappawindow,Int_t xsize,Int_
   AliL3PreYPeak **localmaxima = new AliL3PreYPeak*[hist->GetNbinsY()];
   
   Short_t *nmaxs = new Short_t[hist->GetNbinsY()];
+  memset(nmaxs,0,hist->GetNbinsY()*sizeof(Short_t));
   Int_t lastvalue=0,value=0;
-  for(Int_t ybin=ymin; ybin<=ymax; ybin++)
+  for(Int_t ybin=fNextRow[ymin]; ybin<=ymax; ybin = fNextRow[++ybin])
     {
       localmaxima[ybin-ymin] = new AliL3PreYPeak[nxbins-2];
-      nmaxs[ybin-ymin] = 0;
       lastvalue = 0;
       Bool_t found = 0;
       for(Int_t xbin=xmin; xbin<=xmax; xbin++)
@@ -867,133 +854,48 @@ void AliL3HoughMaxFinder::FindAdaptedRowPeaks(Int_t kappawindow,Int_t xsize,Int_
   
   for(Int_t i = 0; i < (nmaxima - 1); i++)
     {
-      if(maxima[i].fWeight < 0) continue;
+      //      if(maxima[i].fWeight < 0) continue;
       for(Int_t j = i + 1; j < nmaxima; j++)
        {
-         if(maxima[j].fWeight < 0) continue;
-         Int_t xtrack1=0,xtrack2=0,ytrack1=0,ytrack2=0;
-         Int_t deltax = 9999;
-         for(Int_t ix1 = maxima[i].fStartX; ix1 <= maxima[i].fEndX; ix1++) {
-           for(Int_t ix2 = maxima[j].fStartX; ix2 <= maxima[j].fEndX; ix2++) {
-             if(abs(ix1 - ix2) < deltax) {
-               deltax = abs(ix1 - ix2);
-               xtrack1 = ix1;
-               xtrack2 = ix2;
-             }
-           }
-         }
-         Int_t deltay = 9999;
-         for(Int_t iy1 = maxima[i].fStartY; iy1 <= maxima[i].fEndY; iy1++) {
-           for(Int_t iy2 = maxima[j].fStartY; iy2 <= maxima[j].fEndY; iy2++) {
-             if(abs(iy1 - iy2) < deltay) {
-               deltay = abs(iy1 - iy2);
-               ytrack1 = iy1;
-               ytrack2 = iy2;
-             }
-           }
-         }
-         Int_t firstrow1 = fTrackFirstRow[xtrack1 + nxbins*ytrack1];
-         Int_t lastrow1 = fTrackLastRow[xtrack1 + nxbins*ytrack1];
-         Int_t firstrow2 = fTrackFirstRow[xtrack1 + nxbins*ytrack1];
-         Int_t lastrow2 = fTrackLastRow[xtrack1 + nxbins*ytrack1];
-         Int_t firstrow,lastrow;
-         if(firstrow1 < firstrow2)
-           firstrow = firstrow2;
-         else
-           firstrow = firstrow1;
-
-         if(lastrow1 > lastrow2)
-           lastrow = lastrow2;
-         else
-           lastrow = lastrow1;
-        
-         AliL3HoughTrack track1;
-         Float_t x1 = hist->GetPreciseBinCenterX(xtrack1);
-         Float_t y1 = hist->GetPreciseBinCenterY(ytrack1);
-         Float_t psi1 = atan((x1-y1)/(AliL3HoughTransformerRow::GetBeta1()-AliL3HoughTransformerRow::GetBeta2()));
-         Float_t kappa1 = 2.0*(x1*cos(psi1)-AliL3HoughTransformerRow::GetBeta1()*sin(psi1));
-         track1.SetTrackParameters(kappa1,psi1,1);
-         Float_t firsthit1[3];
-         if(!track1.GetCrossingPoint(firstrow,firsthit1)) continue;
-         Float_t lasthit1[3];
-         if(!track1.GetCrossingPoint(lastrow,lasthit1)) continue;
-
-         AliL3HoughTrack track2;
-         Float_t x2 = hist->GetPreciseBinCenterX(xtrack2);
-         Float_t y2 = hist->GetPreciseBinCenterY(ytrack2);
-         Float_t psi2 = atan((x2-y2)/(AliL3HoughTransformerRow::GetBeta1()-AliL3HoughTransformerRow::GetBeta2()));
-         Float_t kappa2 = 2.0*(x2*cos(psi2)-AliL3HoughTransformerRow::GetBeta1()*sin(psi2));
-         track2.SetTrackParameters(kappa2,psi2,1);
-         Float_t firsthit2[3];
-         if(!track2.GetCrossingPoint(firstrow,firsthit2)) continue;
-         Float_t lasthit2[3];
-         if(!track2.GetCrossingPoint(lastrow,lasthit2)) continue;
-         
-         Float_t padpitchlow = AliL3Transform::GetPadPitchWidth(AliL3Transform::GetPatch(firstrow));
-         Float_t padpitchup = AliL3Transform::GetPadPitchWidth(AliL3Transform::GetPatch(lastrow));
-         // check the distance between tracks at the edges
-#ifdef do_mc
-         //      cout<<"DEBUG Merge peaks "<<i<<" "<<j<<" "<<firsthit1[1]<<" "<<firsthit2[1]<<"     "<<lasthit1[1]<<" "<<lasthit2[1]<<endl;
-#endif
-         //cvetan please check!!! I added a cast to Int_t
-         if((fabs(firsthit1[1]-firsthit2[1]) < 3.0*padpitchlow) && (fabs(lasthit1[1]-lasthit2[1]) < 3.0*padpitchup)) {
-           if(maxima[i].fSizeX*maxima[i].fSizeY > maxima[j].fSizeX*maxima[j].fSizeY)
-             maxima[j].fWeight = -maxima[j].fWeight;
-           if(maxima[i].fSizeX*maxima[i].fSizeY < maxima[j].fSizeX*maxima[j].fSizeY)
-             maxima[i].fWeight = -maxima[i].fWeight;
-#ifdef do_mc
-           //      cout<<"Merge peaks "<<i<<" "<<j<<" "<<maxima[i].fWeight<<" "<<maxima[j].fWeight<<endl;
-#endif
-         }
+         //      if(maxima[j].fWeight < 0) continue;
+         MergeRowPeaks(&maxima[i],&maxima[j],5.0);
        }
     }
 
   //merge tracks in neighbour eta slices
-  /*
-  for(Int_t i = 0; i < nmaxima; i++) {
-    if(maxima[i].fWeight > 0) {
-      fXPeaks[fNPeaks] = hist->GetPreciseBinCenterX(maxima[i].fX);
-      fYPeaks[fNPeaks] = hist->GetPreciseBinCenterY(maxima[i].fY);
-      fWeight[fNPeaks] = (Int_t)maxima[i].fWeight;
-#ifdef do_mc
-      cout<<"Final Peak found at: "<<maxima[i].fX<<" "<<maxima[i].fY<<" "<<" "<<fXPeaks[fNPeaks]<<" "<<fYPeaks[fNPeaks]<<" with weight "<<fWeight[fNPeaks]<<" and size "<<maxima[i].fSizeX<<" by "<<maxima[i].fSizeY<<endl;
-#endif
-      fNPeaks++;
-    }
-  }
-  */
-
   Int_t currentnpeaks = fNPeaks;
   for(Int_t i = 0; i < nmaxima; i++) {
     if(maxima[i].fWeight < 0) continue;
     Bool_t merged = kFALSE;
     for(Int_t j = fN1PeaksPrevEtaSlice; j < fN2PeaksPrevEtaSlice; j++) {
-      if(fWeight[j] < 0) continue;
-      if((fENDETAPeaks[j]-fSTARTETAPeaks[j]) >= 1) continue;
-      if((maxima[i].fStartX <= fENDXPeaks[j]+1) && (maxima[i].fEndX >= fSTARTXPeaks[j]-1)) {
-       if((maxima[i].fStartY <= fENDYPeaks[j]+1) && (maxima[i].fEndY >= fSTARTYPeaks[j]-1)) {
-         //merge
-         merged = kTRUE;
+      //      if(fWeight[j] < 0) continue;
+      // Merge only peaks with limited size in eta
+      if((fENDETAPeaks[j]-fSTARTETAPeaks[j]) >= 2) continue;
+      if((maxima[i].fStartX <= fENDXPeaks[j]+1) && (maxima[i].fEndX >= fSTARTXPeaks[j]-1) && (maxima[i].fStartY <= fENDYPeaks[j]+1) && (maxima[i].fEndY >= fSTARTYPeaks[j]-1)){
+       //merge
+       merged = kTRUE;
+       if(fWeight[j] > 0) {
          fXPeaks[fNPeaks] = (hist->GetPreciseBinCenterX(maxima[i].fX)+(fENDETAPeaks[j]-fSTARTETAPeaks[j]+1)*fXPeaks[j])/(fENDETAPeaks[j]-fSTARTETAPeaks[j]+2);
          fYPeaks[fNPeaks] = (hist->GetPreciseBinCenterY(maxima[i].fY)+(fENDETAPeaks[j]-fSTARTETAPeaks[j]+1)*fYPeaks[j])/(fENDETAPeaks[j]-fSTARTETAPeaks[j]+2);
-         fWeight[fNPeaks] = (Int_t)maxima[i].fWeight + fWeight[j];
          fSTARTXPeaks[fNPeaks] = maxima[i].fStartX;
          fSTARTYPeaks[fNPeaks] = maxima[i].fStartY;
          fENDXPeaks[fNPeaks] = maxima[i].fEndX;
          fENDYPeaks[fNPeaks] = maxima[i].fEndY;
+
+         fWeight[fNPeaks] = abs((Int_t)maxima[i].fWeight) + abs(fWeight[j]);
          fSTARTETAPeaks[fNPeaks] = fSTARTETAPeaks[j];
          fENDETAPeaks[fNPeaks] = fCurrentEtaSlice;
          fNPeaks++;
-         fWeight[j] = -fWeight[j];
        }
+       fWeight[j] = -abs(fWeight[j]);
       }
     }
     fXPeaks[fNPeaks] = hist->GetPreciseBinCenterX(maxima[i].fX);
     fYPeaks[fNPeaks] = hist->GetPreciseBinCenterY(maxima[i].fY);
     if(!merged)
-      fWeight[fNPeaks] = (Int_t)maxima[i].fWeight;
+      fWeight[fNPeaks] = abs((Int_t)maxima[i].fWeight);
     else
-      fWeight[fNPeaks] = -(Int_t)maxima[i].fWeight;
+      fWeight[fNPeaks] = -abs((Int_t)maxima[i].fWeight);
     fSTARTXPeaks[fNPeaks] = maxima[i].fStartX;
     fSTARTYPeaks[fNPeaks] = maxima[i].fStartY;
     fENDXPeaks[fNPeaks] = maxima[i].fEndX;
@@ -1001,12 +903,13 @@ void AliL3HoughMaxFinder::FindAdaptedRowPeaks(Int_t kappawindow,Int_t xsize,Int_
     fSTARTETAPeaks[fNPeaks] = fCurrentEtaSlice;
     fENDETAPeaks[fNPeaks] = fCurrentEtaSlice;
     fNPeaks++;
-  }  
+  }
+
   fN1PeaksPrevEtaSlice = currentnpeaks;    
   fN2PeaksPrevEtaSlice = fNPeaks;
 
-  for(Int_t i=0; i<hist->GetNbinsY(); i++)
-    delete [] localmaxima[i];
+  for(Int_t ybin=fNextRow[ymin]; ybin<=ymax; ybin = fNextRow[++ybin])
+    delete [] localmaxima[ybin-ymin];
 
   delete [] localmaxima;
   delete [] nmaxs;
@@ -1433,3 +1336,97 @@ Float_t AliL3HoughMaxFinder::GetYPeakSize(Int_t i) const
   Float_t binwidth = fCurrentHisto->GetBinWidthY();
   return binwidth*(fENDYPeaks[i]-fSTARTYPeaks[i]+1);
 }
+
+Bool_t AliL3HoughMaxFinder::MergeRowPeaks(AliL3Pre2DPeak *maxima1, AliL3Pre2DPeak *maxima2, Float_t distance)
+{
+  // Check the distance between tracks corresponding to given Hough space peaks and if the
+  // distance is smaller than some threshold value marks the smaller peak as fake
+  AliL3Histogram *hist = fCurrentHisto;
+  Int_t nxbins = hist->GetNbinsX()+2;
+
+  Int_t xtrack1=0,xtrack2=0,ytrack1=0,ytrack2=0;
+  Int_t deltax = 9999;
+  for(Int_t ix1 = maxima1->fStartX; ix1 <= maxima1->fEndX; ix1++) {
+    for(Int_t ix2 = maxima2->fStartX; ix2 <= maxima2->fEndX; ix2++) {
+      if(abs(ix1 - ix2) < deltax) {
+       deltax = abs(ix1 - ix2);
+       xtrack1 = ix1;
+       xtrack2 = ix2;
+      }
+    }
+  }
+  Int_t deltay = 9999;
+  for(Int_t iy1 = maxima1->fStartY; iy1 <= maxima1->fEndY; iy1++) {
+    for(Int_t iy2 = maxima2->fStartY; iy2 <= maxima2->fEndY; iy2++) {
+      if(abs(iy1 - iy2) < deltay) {
+       deltay = abs(iy1 - iy2);
+       ytrack1 = iy1;
+       ytrack2 = iy2;
+      }
+    }
+  }
+  Int_t firstrow1 = fTrackFirstRow[xtrack1 + nxbins*ytrack1];
+  Int_t lastrow1 = fTrackLastRow[xtrack1 + nxbins*ytrack1];
+  Int_t firstrow2 = fTrackFirstRow[xtrack1 + nxbins*ytrack1];
+  Int_t lastrow2 = fTrackLastRow[xtrack1 + nxbins*ytrack1];
+  Int_t firstrow,lastrow;
+  if(firstrow1 < firstrow2)
+    firstrow = firstrow2;
+  else
+    firstrow = firstrow1;
+
+  if(lastrow1 > lastrow2)
+    lastrow = lastrow2;
+  else
+    lastrow = lastrow1;
+        
+  AliL3HoughTrack track1;
+  Float_t x1 = hist->GetPreciseBinCenterX(xtrack1);
+  Float_t y1 = hist->GetPreciseBinCenterY(ytrack1);
+  Float_t psi1 = atan((x1-y1)/(AliL3HoughTransformerRow::GetBeta1()-AliL3HoughTransformerRow::GetBeta2()));
+  Float_t kappa1 = 2.0*(x1*cos(psi1)-AliL3HoughTransformerRow::GetBeta1()*sin(psi1));
+  track1.SetTrackParameters(kappa1,psi1,1);
+  Float_t firsthit1[3];
+  if(!track1.GetCrossingPoint(firstrow,firsthit1)) return kFALSE;
+  Float_t lasthit1[3];
+  if(!track1.GetCrossingPoint(lastrow,lasthit1)) return kFALSE;
+
+  AliL3HoughTrack track2;
+  Float_t x2 = hist->GetPreciseBinCenterX(xtrack2);
+  Float_t y2 = hist->GetPreciseBinCenterY(ytrack2);
+  Float_t psi2 = atan((x2-y2)/(AliL3HoughTransformerRow::GetBeta1()-AliL3HoughTransformerRow::GetBeta2()));
+  Float_t kappa2 = 2.0*(x2*cos(psi2)-AliL3HoughTransformerRow::GetBeta1()*sin(psi2));
+  track2.SetTrackParameters(kappa2,psi2,1);
+  Float_t firsthit2[3];
+  if(!track2.GetCrossingPoint(firstrow,firsthit2)) return kFALSE;
+  Float_t lasthit2[3];
+  if(!track2.GetCrossingPoint(lastrow,lasthit2)) return kFALSE;
+         
+  Float_t padpitchlow = AliL3Transform::GetPadPitchWidth(AliL3Transform::GetPatch(firstrow));
+  Float_t padpitchup = AliL3Transform::GetPadPitchWidth(AliL3Transform::GetPatch(lastrow));
+  // check the distance between tracks at the edges
+  //  cout<<"Check "<<firsthit1[1]<<" "<<firsthit2[1]<<" "<<padpitchlow<<" "<<lasthit1[1]<<" "<<lasthit2[1]<<" "<<padpitchup<<" "<<xtrack1<<" "<<ytrack1<<" "<<xtrack2<<" "<<ytrack2<<endl;
+  if((fabs(firsthit1[1]-firsthit2[1])/padpitchlow + fabs(lasthit1[1]-lasthit2[1])/padpitchup) < distance) {
+    if(maxima1->fSizeX*maxima1->fSizeY > maxima2->fSizeX*maxima2->fSizeY)
+      maxima2->fWeight = -fabs(maxima2->fWeight);
+    if(maxima1->fSizeX*maxima1->fSizeY < maxima2->fSizeX*maxima2->fSizeY)
+      maxima1->fWeight = -fabs(maxima1->fWeight);
+    if(maxima1->fSizeX*maxima1->fSizeY == maxima2->fSizeX*maxima2->fSizeY) {
+      if(maxima1->fStartX > maxima2->fStartX)
+       maxima1->fStartX = maxima2->fStartX;
+      if(maxima1->fStartY > maxima2->fStartY)
+       maxima1->fStartY = maxima2->fStartY;
+      if(maxima1->fEndX < maxima2->fEndX)
+       maxima1->fEndX = maxima2->fEndX;
+      if(maxima1->fEndY < maxima2->fEndY)
+       maxima1->fEndY = maxima2->fEndY;
+      maxima1->fX = ((Float_t)maxima1->fStartX + (Float_t)maxima1->fEndX)/2.0;
+      maxima1->fY = ((Float_t)maxima1->fStartY + (Float_t)maxima1->fEndY)/2.0;
+      maxima1->fSizeX = (maxima1->fEndX - maxima1->fStartX + 1);
+      maxima1->fSizeY = (maxima1->fEndY - maxima1->fStartY + 1);
+      maxima2->fWeight = -fabs(maxima2->fWeight);
+    }
+    return kTRUE;
+  }
+  return kFALSE;
+}
index 9b5a5623c65048ecd1d0832c715ed5089377651a..fbddc3bba9ac0090248e18dde8ae8c4d53ce44bb 100644 (file)
@@ -19,6 +19,19 @@ struct AliL3AxisWindow
   Int_t fWeight; // weight
 };
 
+struct AliL3Pre2DPeak
+{
+  Float_t fX; // X coordinate of the preak
+  Float_t fY; // Y coordinate of the preak
+  Float_t fSizeX; // Size of the peak
+  Float_t fSizeY; // Size of the peak
+  Int_t fStartX; // Start position of the peak
+  Int_t fStartY; // Start position of the peak
+  Int_t fEndX; // End position of the peak
+  Int_t fEndY; // End position of the peak
+  Float_t fWeight; // Weight assigned to the peak
+};
+
 class AliL3HoughMaxFinder {
 
  public:
@@ -47,7 +60,7 @@ class AliL3HoughMaxFinder {
   void SetGradient(Float_t x,Float_t y) {fGradX=x; fGradY=y;}
   void SetThreshold(Int_t f) {fThreshold = f;}
   void SetHistogram(AliL3Histogram *hist) {fCurrentHisto = hist;}
-  void SetTrackLUTs(UChar_t *tracknrows, UChar_t *trackfirstrow, UChar_t *tracklastrow) {fTrackNRows = tracknrows; fTrackFirstRow = trackfirstrow; fTrackLastRow = tracklastrow;}
+  void SetTrackLUTs(UChar_t *tracknrows, UChar_t *trackfirstrow, UChar_t *tracklastrow, UChar_t *nextrow) {fTrackNRows = tracknrows; fTrackFirstRow = trackfirstrow; fTrackLastRow = tracklastrow; fNextRow = nextrow;}
   void SetEtaSlice(Int_t etaslice) {fCurrentEtaSlice = etaslice;}
   
   //Getters:
@@ -59,6 +72,9 @@ class AliL3HoughMaxFinder {
   Int_t GetStartEta(Int_t i) const;
   Int_t GetEndEta(Int_t i) const;
   Int_t GetEntries() const {return fNPeaks;}
+
+  //Method for merging of peaks produced by AliL3HoughTransfromerRow
+  Bool_t MergeRowPeaks(AliL3Pre2DPeak *maxima1, AliL3Pre2DPeak *maxima2,Float_t distance);
   
  private:
 
@@ -69,6 +85,7 @@ class AliL3HoughMaxFinder {
   UChar_t *fTrackNRows; //!
   UChar_t *fTrackFirstRow; //!
   UChar_t *fTrackLastRow; //!
+  UChar_t *fNextRow; //!
   
   Float_t fGradX; // Gradient threshold inside Peak Finder 
   Float_t fGradY; // Gradient threshold inside Peak Finder 
index c4204d3aac55fe92e912fc43a61145a6709da52f..21b1475bb52bff088da2ed2b0e1fd5054eb85dd4 100644 (file)
@@ -27,7 +27,7 @@ using namespace std;
 
 ClassImp(AliL3HoughTransformerRow)
 
-Float_t AliL3HoughTransformerRow::fgBeta1 = 1.0/AliL3Transform::Row2X(79);
+Float_t AliL3HoughTransformerRow::fgBeta1 = 1.0/AliL3Transform::Row2X(84);
 Float_t AliL3HoughTransformerRow::fgBeta2 = 1.0/(AliL3Transform::Row2X(158)*(1.0+tan(AliL3Transform::Pi()*10/180)*tan(AliL3Transform::Pi()*10/180)));
 
 AliL3HoughTransformerRow::AliL3HoughTransformerRow()
index 63db0550be6d8d6043a328595e4c4bb09cc2ad49..3dacd1f5f0bd8d7233c5312964671a0e6b2c9f6a 100644 (file)
@@ -7,9 +7,7 @@
 #include "AliL3HoughBaseTransformer.h"
 
 #define MAX_N_GAPS 5
-#define MAX_GAP_SIZE 4
 #define MIN_TRACK_LENGTH 70
-#define MAX_MISS_ROWS 2
 
 struct AliL3EtaRow {
   UChar_t fStartPad; //First pad in the cluster
index 59954d7aa5779deaa17bd4e922d9b1fcabac7daf..8c5b774416ac80ac2d078dd9cf446f53a6ead3b7 100644 (file)
@@ -175,7 +175,7 @@ void AliHLTReconstructor::ReconstructWithHoughTransform(AliRunLoader* runLoader,
   AliL3Hough *hough = new AliL3Hough();
     
   hough->SetThreshold(4);
-  hough->SetTransformerParams(76,140,ptmin,-1);
+  hough->CalcTransformerParams(ptmin);
   hough->SetPeakThreshold(70,-1);
   hough->SetRunLoader(runLoader);
   hough->Init("./", kFALSE, 100, kFALSE,4,0,0,zvertex);
index 31734891f101a3962d28e63f4ece17eb1e601bf8..586ff5275f1e1239a3fdb8d33d50c60dcb6e3f4c 100644 (file)
@@ -140,10 +140,10 @@ int main(int argc, char** argv)
        AliL3Hough *hough1 = new AliL3Hough();
 
        hough1->SetThreshold(4);
-       hough1->SetTransformerParams(76,140,0.4,-1);
+       hough1->CalcTransformerParams(0.4);
        hough1->SetPeakThreshold(70,-1);
        //      printf("Pointer is %x\n",ptr);
-       hough1->Init("./", kFALSE, 100, kFALSE,4,0,(Char_t*)ptr,3.82147);
+       hough1->Init("./", kFALSE, 100, kFALSE,4,0,(Char_t*)ptr,0.0);
        hough1->SetAddHistograms();
        fBenchmark->Stop("Init");
 
@@ -151,10 +151,10 @@ int main(int argc, char** argv)
        AliL3Hough *hough2 = new AliL3Hough();
 
        hough2->SetThreshold(4);
-       hough2->SetTransformerParams(76,140,0.4,-1);
+       hough2->CalcTransformerParams(0.4);
        hough2->SetPeakThreshold(70,-1);
        //      printf("Pointer is %x\n",ptr);
-       hough2->Init("./", kFALSE, 100, kFALSE,4,0,(Char_t*)ptr,3.82147);
+       hough2->Init("./", kFALSE, 100, kFALSE,4,0,(Char_t*)ptr,0.0);
        hough2->SetAddHistograms();
        fBenchmark->Stop("Init");
 
index 8a79b19c69bb3cd291c523dd7f78de0a789d989c..99a7ead319c76e091c14b26d395a31d7eb83150c 100644 (file)
@@ -809,7 +809,7 @@ Int_t AliMDC::Filter(
     AliL3Hough *hough1 = new AliL3Hough();
     
     hough1->SetThreshold(4);
-    hough1->SetTransformerParams(76,140,0.4,-1);
+    hough1->CalcTransformerParams(0.4);
     hough1->SetPeakThreshold(70,-1);
     // Attention Z of the vertex to be taken from the event head!
     // So far for debug purposes it is fixed by hand...
@@ -819,7 +819,7 @@ Int_t AliMDC::Filter(
     AliL3Hough *hough2 = new AliL3Hough();
 
     hough2->SetThreshold(4);
-    hough2->SetTransformerParams(76,140,0.4,-1);
+    hough2->CalcTransformerParams(0.4);
     hough2->SetPeakThreshold(70,-1);
     hough2->Init(100,4,event,3.82147);
     hough2->SetAddHistograms();