Some changes in AliL3Hough::Evaluate. Comments have been added in the code.
authorvestbo <vestbo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 31 May 2002 14:41:19 +0000 (14:41 +0000)
committervestbo <vestbo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 31 May 2002 14:41:19 +0000 (14:41 +0000)
Added some timing outputs in AliL3Hough.
In AliL3HoughEval::LookInsideRoad; removed the check whether the tracks is
leaving the slice; because this fails when the tracks is bending _in_ to the
slice. In the argument, one can also access the number of padrows which where
good; meaning padrows along the road which had signal.
In AliL3HoughMaxFinder; currently the check for the gradient is commented out.

HLT/hough/AliL3Hough.cxx
HLT/hough/AliL3Hough.h
HLT/hough/AliL3HoughEval.cxx
HLT/hough/AliL3HoughEval.h
HLT/hough/AliL3HoughGlobalMerger.cxx
HLT/hough/AliL3HoughGlobalMerger.h
HLT/hough/AliL3HoughMaxFinder.cxx

index 8af03dfc42c816be847a5907a5c4ddb6f12b3361..085458615ce655c67fd0cc737a789b65671b3b78 100644 (file)
@@ -5,6 +5,7 @@
 
 
 #include <string.h>
+#include <sys/time.h>
 
 #include "AliL3HoughMerger.h"
 #include "AliL3HoughIntMerger.h"
@@ -137,13 +138,15 @@ void AliL3Hough::Init(Char_t *path,Bool_t binary,Int_t n_eta_segments,Bool_t bit
        fHoughTransformer[i] = new AliL3HoughTransformerVhdl(1,i,fNEtaSegments);
        fHoughTransformer[i]->CreateHistograms(180,0.1,180,-90,90);
        fHoughTransformer[i]->SetLowerThreshold(3);
+       
        break;
       default:
        fHoughTransformer[i] = new AliL3HoughTransformer(1,i,fNEtaSegments);
        fHoughTransformer[i]->CreateHistograms(64,0.1,64,-30,30);
        fHoughTransformer[i]->SetLowerThreshold(3);
       }
-
+      LOG(AliL3Log::kInformational,"AliL3Hough::Init","Version")
+       <<"Initializing Hough transformer version "<<fversion<<ENDLOG;
       fEval[i] = new AliL3HoughEval();
       fTracks[i] = new AliL3TrackArray("AliL3HoughTrack");
       if(fUse8bits)
@@ -225,7 +228,9 @@ void AliL3Hough::Transform(Int_t row_range=-1)
 {
   //Transform all data given to the transformer within the given slice
   //(after ReadData(slice))
-
+  
+  Double_t initTime,cpuTime;
+  initTime = GetCpuTime();
   for(Int_t i=0; i<fNPatches; i++)
     {
       fHoughTransformer[i]->Reset();//Reset the histograms
@@ -234,6 +239,9 @@ void AliL3Hough::Transform(Int_t row_range=-1)
       else
        fHoughTransformer[i]->TransformCircleC(row_range);
     }
+  cpuTime = GetCpuTime() - initTime;
+  LOG(AliL3Log::kInformational,"AliL3Hough::Transform()","Timing")
+    <<"Transform done in average per patch of "<<cpuTime*1000/fNPatches<<" ms"<<ENDLOG;
 }
 
 void AliL3Hough::MergePatches()
@@ -312,6 +320,8 @@ void AliL3Hough::AddAllHistograms()
   //Add the histograms within one etaslice.
   //Resulting histogram are in patch=0.
 
+  Double_t initTime,cpuTime;
+  initTime = GetCpuTime();
   for(Int_t i=0; i<fNEtaSegments; i++)
     {
       AliL3Histogram *hist0 = fHoughTransformer[0]->GetHistogram(i);
@@ -322,6 +332,9 @@ void AliL3Hough::AddAllHistograms()
        }
     }
   fAddHistograms = kTRUE;
+  cpuTime = GetCpuTime() - initTime;
+  LOG(AliL3Log::kInformational,"AliL3Hough::AddAllHistograms()","Timing")
+    <<"Adding histograms in "<<cpuTime*1000<<" ms"<<ENDLOG;
 }
 
 void AliL3Hough::FindTrackCandidates()
@@ -333,8 +346,9 @@ void AliL3Hough::FindTrackCandidates()
     n_patches = 1; //Histograms have been added.
   else
     n_patches = fNPatches;
-
   
+  Double_t initTime,cpuTime;
+  initTime = GetCpuTime();
   for(Int_t i=0; i<n_patches; i++)
     {
       AliL3HoughBaseTransformer *tr = fHoughTransformer[i];
@@ -363,6 +377,9 @@ void AliL3Hough::FindTrackCandidates()
        }
       fTracks[i]->QSort();
     }
+  cpuTime = GetCpuTime() - initTime;
+  LOG(AliL3Log::kInformational,"AliL3Hough::FindTrackCandidates()","Timing")
+    <<"Maxima finding done in "<<cpuTime*1000<<" ms"<<ENDLOG;
 }
 
 void AliL3Hough::InitEvaluate()
@@ -375,30 +392,47 @@ void AliL3Hough::InitEvaluate()
     fEval[i]->InitTransformer(fHoughTransformer[i]);
 }
 
-void AliL3Hough::Evaluate(Int_t road_width)
+Int_t AliL3Hough::Evaluate(Int_t road_width,Int_t nrowstomiss)
 {
   //Evaluate the tracks, by looking along the road in the raw data.
   //If track does not cross all padrows - rows2miss, it is removed from the arrray.
+  //If histograms were not added, the check is done locally in patch,
+  //meaning that nrowstomiss is the number of padrows the road can miss with respect
+  //to the number of rows in the patch.
+  //If the histograms were added, the comparison is done globally in the _slice_, 
+  //meaing that nrowstomiss is the number of padrows the road can miss with
+  //respect to the total number of padrows in the slice.
+  //
+  //Return value = number of tracks which were removed (only in case of fAddHistograms)
   
   if(!fTracks[0])
     {
       LOG(AliL3Log::kError,"AliL3Hough::Evaluate","Track Array")
        <<"No tracks to work with..."<<ENDLOG;
-      return;
+      return 0;
     }
   
   InitEvaluate();
   
-  AliL3TrackArray *tracks;
+  Int_t removed_tracks=0;
+  AliL3TrackArray *tracks=0;
+  Int_t *total_rows=0;
+  if(fAddHistograms)
+    {    
+      tracks = fTracks[0];
+      total_rows = new Int_t[tracks->GetNTracks()];
+      for(Int_t i=0; i<tracks->GetNTracks(); i++)
+       total_rows[i]=0;
+    }
+
   for(Int_t i=0; i<fNPatches; i++)
     {
       fEval[i]->InitTransformer(fHoughTransformer[i]);
-      fEval[i]->SetNumOfRowsToMiss(2);
       fEval[i]->SetNumOfPadsToLook(road_width);
-      if(fAddHistograms)
-       tracks = fTracks[0];
-      else
+      fEval[i]->SetNumOfRowsToMiss(nrowstomiss);
+      if(!fAddHistograms)
        tracks = fTracks[i];
+      
       for(Int_t j=0; j<tracks->GetNTracks(); j++)
        {
          AliL3HoughTrack *track = (AliL3HoughTrack*)tracks->GetCheckedTrack(j);
@@ -409,18 +443,39 @@ void AliL3Hough::Evaluate(Int_t road_width)
              continue;
            }
          
-         if(!fEval[i]->LookInsideRoad(track,track->GetEtaIndex()))
-           tracks->Remove(j);
-         if(fAddHistograms)
-           track->SetRowRange(AliL3Transform::GetFirstRow(0),AliL3Transform::GetLastRow(5));//All rows included
+         Bool_t result = fEval[i]->LookInsideRoad(track,total_rows[j]);
+         if(!fAddHistograms)//the track crossed too few good padrows (padrows with signal) in the patch, so remove it
+           {
+             if(result == kFALSE)
+               tracks->Remove(j);
+           }
        }
-      tracks->Compress();
-      tracks->QSort(); //Sort the tracks according to weight
-      
       if(!fAddHistograms)
-       fMerger->FillTracks(tracks,i); //Copy tracks to the track merger
+       {
+         tracks->Compress();
+         tracks->QSort(); 
+         fMerger->FillTracks(tracks,i); //Copy tracks to the track merger
+       }
     }
   
+  if(fAddHistograms) //Here we check the tracks globally; how many good rows (padrows with signal) did it cross in the slice
+    {
+      for(Int_t j=0; j<tracks->GetNTracks(); j++)
+       {
+         if(total_rows[j] < AliL3Transform::GetNRows() - nrowstomiss)
+           {
+             tracks->Remove(j);
+             removed_tracks++;
+           }
+       }
+      tracks->Compress();
+      tracks->QSort();
+    }
+  
+  if(total_rows)
+    delete [] total_rows;
+  
+  return removed_tracks;
 }
 
 void AliL3Hough::EvaluateWithEta()
@@ -485,3 +540,11 @@ void AliL3Hough::WriteDigits(Char_t *outfile)
 #endif  
 }
 
+Double_t AliL3Hough::GetCpuTime()
+{
+  //Return the Cputime in seconds.
+ struct timeval tv;
+ gettimeofday( &tv, NULL );
+ return tv.tv_sec+(((Double_t)tv.tv_usec)/1000000.);
+ //return (Double_t)(clock()) / CLOCKS_PER_SEC;
+}
index 02960bcba3e3d1a2852fb0dc780edd5ce7b2c2be..7999f4b6690da5924c3c30d41927bd05d2df5549 100644 (file)
@@ -38,6 +38,7 @@ class AliL3Hough {
   AliL3HoughGlobalMerger *fGlobalMerger; //!
 
   void CleanUp();
+  Double_t GetCpuTime();
   
  public:
   
@@ -56,7 +57,7 @@ class AliL3Hough {
   
   void FindTrackCandidates();
   void AddAllHistograms();
-  void Evaluate(Int_t road_width=1);
+  Int_t Evaluate(Int_t road_width=1,Int_t nrowstomiss=1);
   void EvaluateWithEta();
   void WriteTracks(Int_t slice,Char_t *path="./");
   void WriteDigits(Char_t *outfile="output_digits.root");
index 51a7bcfd7e84f7853e2ccf5e68c9aa26514d378a..6a26d0cba86313bb4d4247834c4dc7314099e32e 100644 (file)
@@ -81,19 +81,21 @@ void AliL3HoughEval::GenerateLUT()
   
 }
 
-Bool_t AliL3HoughEval::LookInsideRoad(AliL3HoughTrack *track,Int_t eta_index,Bool_t remove)
+Bool_t AliL3HoughEval::LookInsideRoad(AliL3HoughTrack *track,Int_t &nrows_crossed,Bool_t remove)
 {
   //Look at rawdata along the road specified by the track candidates.
   //If track is good, return true, if not return false.
   
   Int_t sector,row;
   
-  Int_t nrow=0,npixs=0,rows_crossed=0;
+  Int_t nrow=0,npixs=0;//,rows_crossed=0;
   Float_t xyz[3];
   
   Int_t total_charge=0;//total charge along the road
-  
+    
+  /*
   //Check if the track is leaving the sector at some point
+  //This does not work, if the track is bending _in_ to the slice.....
   Float_t maxrow=300;
   Double_t angle=AliL3Transform::Pi()/18;
   track->CalculateEdgePoint(angle);
@@ -105,11 +107,13 @@ Bool_t AliL3HoughEval::LookInsideRoad(AliL3HoughTrack *track,Int_t eta_index,Boo
     }
   else
     maxrow = track->GetPointX();
-
+  */
+  
   for(Int_t padrow = AliL3Transform::GetFirstRow(fPatch); padrow <= AliL3Transform::GetLastRow(fPatch); padrow++)
     {
-      if(AliL3Transform::Row2X(padrow) > maxrow) break;//The track has left this slice
-      rows_crossed++;
+      //if(AliL3Transform::Row2X(padrow) > maxrow) break;//The track has left this slice
+      //rows_crossed++;
+      
       Int_t prow = padrow - AliL3Transform::GetFirstRow(fPatch);
       if(!track->GetCrossingPoint(padrow,xyz))  
        {
@@ -120,7 +124,6 @@ Bool_t AliL3HoughEval::LookInsideRoad(AliL3HoughTrack *track,Int_t eta_index,Boo
       AliL3Transform::Local2Raw(xyz,sector,row);
       npixs=0;
       
-      
       //Get the timebins for this pad
       AliL3DigitRowData *tempPt = fRowPointers[prow];
       if(!tempPt) 
@@ -136,13 +139,15 @@ Bool_t AliL3HoughEval::LookInsideRoad(AliL3HoughTrack *track,Int_t eta_index,Boo
          for(UInt_t j=0; j<tempPt->fNDigit; j++)
            {
              UChar_t pad = digPt[j].fPad;
+             Int_t charge = digPt[j].fCharge;
+             if(charge <= fHoughTransformer->GetLowerThreshold()) continue;
              if(pad < p) continue;
              if(pad > p) break;
              UShort_t time = digPt[j].fTime;
              Double_t eta = AliL3Transform::GetEta(padrow,pad,time);
              Int_t pixel_index = fHoughTransformer->GetEtaIndex(eta);
-             if(pixel_index > eta_index) continue;
-             if(pixel_index != eta_index) break;
+             if(pixel_index > track->GetEtaIndex()) continue;
+             if(pixel_index != track->GetEtaIndex()) break;
              total_charge += digPt[j].fCharge;
              if(remove)
                digPt[j].fCharge = 0; //Erase the track from image
@@ -158,10 +163,15 @@ Bool_t AliL3HoughEval::LookInsideRoad(AliL3HoughTrack *track,Int_t eta_index,Boo
   if(remove)
     return kTRUE;
   
-  if(nrow >= rows_crossed - fNumOfRowsToMiss)//this was a good track
+  nrows_crossed += nrow; //Update the number of rows crossed.
+  
+  if(nrow >= AliL3Transform::GetNRows(fPatch) - fNumOfRowsToMiss)//this was a good track
     {
       if(fRemoveFoundTracks)
-       LookInsideRoad(track,eta_index,kTRUE);
+       {
+         Int_t dummy=0;
+         LookInsideRoad(track,dummy,kTRUE);
+       }
       return kTRUE;
     }
   else
@@ -217,7 +227,8 @@ void AliL3HoughEval::FindEta(AliL3TrackArray *tracks)
              for(UInt_t j=0; j<tempPt->fNDigit; j++)
                {
                  UChar_t pad = digPt[j].fPad;
-                 
+                 Int_t charge = digPt[j].fCharge;
+                 if(charge <= fHoughTransformer->GetLowerThreshold()) continue;
                  if(pad < p) continue;
                  if(pad > p) break;
                  UShort_t time = digPt[j].fTime;
@@ -289,7 +300,7 @@ void AliL3HoughEval::DisplayEtaSlice(Int_t eta_index,AliL3Histogram *hist)
          UChar_t pad = digPt[j].fPad;
          UChar_t charge = digPt[j].fCharge;
          UShort_t time = digPt[j].fTime;
-         if((Int_t)charge < fHoughTransformer->GetLowerThreshold() || (Int_t)charge > fHoughTransformer->GetUpperThreshold()) continue;
+         if((Int_t)charge <= fHoughTransformer->GetLowerThreshold() || (Int_t)charge >= fHoughTransformer->GetUpperThreshold()) continue;
          Float_t xyz[3];
          Int_t sector,row;
          AliL3Transform::Slice2Sector(fSlice,padrow,sector,row);
index 7d6579477161b9d64d11d6be806156af93016bee..ca6c899799b1d11e2d68ab8f97d3a22bf89f2f56 100644 (file)
@@ -37,7 +37,7 @@ class AliL3HoughEval {
   void InitTransformer(AliL3HoughBaseTransformer *transformer);
   void GenerateLUT();
   void DisplayEtaSlice(Int_t eta_index,AliL3Histogram *hist);
-  Bool_t LookInsideRoad(AliL3HoughTrack *track,Int_t eta_index,Bool_t remove=kFALSE);
+  Bool_t LookInsideRoad(AliL3HoughTrack *track,Int_t &nrows_crossed,Bool_t remove=kFALSE);
 #ifdef use_root
   void CompareMC(AliL3TrackArray *tracks,Char_t *goodtracks="good_tracks",Int_t treshold=0);
 #endif
index c5334955c149519d6d72f3d39a9d84d85cf18bdc..66c7af58965d88f15a31929c708bee30677ad836 100644 (file)
 
 ClassImp(AliL3HoughGlobalMerger)
 
-AliL3HoughGlobalMerger::AliL3HoughGlobalMerger(){
-  //Default constructor
-  Is2Global(kTRUE);
-  SetParameter(2,2,0.001,0.05,0.1);
-}
-
-
-AliL3HoughGlobalMerger::AliL3HoughGlobalMerger(Int_t first,Int_t last) : AliL3Merger(last-first+1,"AliL3HoughTrack")
+AliL3HoughGlobalMerger::AliL3HoughGlobalMerger()
 {
-  //Constructor.
-  fNSlices = last-first+1;
-  fFirst = first;
-  fLast = last;
-  Is2Global(kTRUE);
-  SetParameter(2,2,0.001,0.05,0.1);
+  fTracks = 0;
 }
 
-AliL3HoughGlobalMerger::~AliL3HoughGlobalMerger(){
-  //Destructor
-}
-
-
-void AliL3HoughGlobalMerger::FillTracks(AliL3TrackArray *tracks,Int_t slice)
+AliL3HoughGlobalMerger::AliL3HoughGlobalMerger(Int_t first,Int_t last)
 {
-  fSlice = slice;
-  fCurrentTracks = fSlice - fFirst; 
-  if(tracks->GetNTracks()==0)
-    LOG(AliL3Log::kWarning,"AliL3HoughGlobalMerger::FillTracks","Track Array")
-      <<AliL3Log::kDec<<"Adding empty track array in slice "<<fSlice<<ENDLOG;
+  fNSlices = last-first+1;
+  fTracks = new AliL3TrackArray*[fNSlices];
+  for(Int_t i=0; i<fNSlices; i++)
+    fTracks[i] = new AliL3TrackArray("AliL3HoughTrack");
+  
   
-  GetInTracks(fCurrentTracks)->AddTracks(tracks,kFALSE,fSlice);//Copy tracks, and rotate them to global coordinates
 }
-
-Bool_t AliL3HoughGlobalMerger::IsTrack(AliL3Track *innertrack,AliL3Track *outertrack)
+AliL3HoughGlobalMerger::~AliL3HoughGlobalMerger()
 {
-  //Check if the tracks can be merged, called by the track merger
-  
-  AliL3HoughTrack *tr1 = (AliL3HoughTrack*)innertrack;
-  AliL3HoughTrack *tr2 = (AliL3HoughTrack*)outertrack;
-  
-  if( (!tr1->IsPoint()) || (!tr2->IsPoint()) )  return kFALSE; 
-  if(abs(tr1->GetEtaIndex() - tr2->GetEtaIndex()) > 1) return kFALSE;
-  if(tr1->GetCharge() != tr2->GetCharge()) return kFALSE;
-  if(fabs(tr1->GetPhi0() - tr2->GetPhi0()) > fMaxPhi0) return kFALSE;
-  if(fabs(tr1->GetKappa() - tr2->GetKappa()) > fMaxKappa) return kFALSE;
+  if(fTracks)
+    {
+      for(Int_t i=0; i<fNSlices; i++)
+       {
+         if(!fTracks[i])
+           continue;
+         delete fTracks;
+       }
+      delete [] fTracks;
+    }
   
-  return kTRUE;
 }
 
-AliL3Track *AliL3HoughGlobalMerger::MultiMerge(AliL3TrackArray *mergedtrack,AliL3Track **tracks, Int_t ntrack)
+void AliL3HoughGlobalMerger::FillTracks(AliL3TrackArray *tracks,Int_t slice)
 {
-  //Called by the track merger
-
-  AliL3HoughTrack *newtrack = (AliL3HoughTrack*)mergedtrack->NextTrack();
-  AliL3HoughTrack **trs = (AliL3HoughTrack**)tracks;
-  Int_t weight=0;
-
-  //Sum up the total weight:
-  for(Int_t i=ntrack-1; i>=0; i--)
-    weight += trs[i]->GetWeight();
   
-  AliL3HoughTrack *tpt=trs[0];//This is the innermost track
-  AliL3HoughTrack *tpl=trs[ntrack-1];
-  newtrack->SetTrackParameters(tpt->GetKappa(),tpt->GetPhi0(),weight);
-  newtrack->SetEtaIndex(tpt->GetEtaIndex());
-  newtrack->SetEta(tpt->GetEta());
-  newtrack->SetPsi(tpt->GetPsi());
-  newtrack->SetCenterX(tpt->GetCenterX());
-  newtrack->SetCenterY(tpt->GetCenterY());
-  newtrack->SetFirstPoint(tpt->GetFirstPointX(),tpt->GetFirstPointY(),tpt->GetFirstPointZ());
-  newtrack->SetLastPoint(tpl->GetLastPointX(),tpl->GetLastPointY(),tpl->GetLastPointZ());
-  newtrack->SetCharge(tpt->GetCharge());
-  newtrack->SetRowRange(tpt->GetFirstRow(),tpl->GetLastRow());
+  fTracks[slice]->AddTracks(tracks,kTRUE,slice);
   
-  return (AliL3Track*)newtrack;
-
-}
-
-void AliL3HoughGlobalMerger::SlowMerge(){
-  void* ntuple=GetNtuple();
-  AliL3Track *track[2];
-  AliL3TrackArray *tout = GetOutTracks();
-  if(fNSlices<2){
-    LOG(AliL3Log::kWarning,"AliL3HoughGlobalMerger::SlowMerge","Slice Number")
-    <<"Need more than one Slice!"<<ENDLOG;
-    return;
-  }
-  for(Int_t i=0; i<fNSlices; i++){
-    if(fNSlices!=18 && i+1 == fNSlices) continue; //full cicle == 18 slices
-    Int_t slice = fFirst + i;
-    AliL3TrackArray *ttt0=GetInTracks(i);
-    Int_t slice2 = i+1;
-    if(slice2==fNSlices) slice2 =0; 
-    AliL3TrackArray *ttt1=GetInTracks(slice2);
-    Float_t angle = PI/18.; //10 degrees -> the border of the slices
-    AliL3Transform::Local2GlobalAngle(&angle,slice);
-    if(i==0)
-      ttt0->QSort();
-    ttt1->QSort();
-    for(Int_t s0=0;s0<ttt0->GetNTracks();s0++){
-      AliL3Track *track0=ttt0->GetCheckedTrack(s0);
-      if(!track0) continue;
-      track0->CalculateHelix();
-      track0->CalculateEdgePoint(angle);
-//      if(track0->IsPoint()) AddTrack(tout,track0);
-    }
-    for(Int_t s1=0;s1<ttt1->GetNTracks();s1++){
-      AliL3Track *track1=ttt1->GetCheckedTrack(s1);
-      if(!track1) continue;
-      track1->CalculateHelix();
-      track1->CalculateEdgePoint(angle);
-//      if(track1->IsPoint())  AddTrack(tout,track1); 
-    }
-    Bool_t merge = kTRUE;
-    while(merge){
-      Int_t min0=-1,min1=-1;
-      Double_t min=10;
-      for(Int_t s0=0;s0<ttt0->GetNTracks();s0++){
-        AliL3Track *track0=ttt0->GetCheckedTrack(s0);
-        if(!track0) continue;
-        if(!track0->IsPoint()) continue;
-        for(Int_t s1=0;s1<ttt1->GetNTracks();s1++){
-          AliL3Track *track1=ttt1->GetCheckedTrack(s1);
-          if(!track1) continue;
-          if(!track1->IsPoint()) continue;
-          Double_t diff = TrackDiff(track0,track1);
-          if(diff>=0&&diff<min){
-            min=diff;
-            min0=s0;
-            min1=s1;
-          }
-        }
-      }
-      if(min0>=0&&min1>=0){
-        AliL3Track *track0=ttt0->GetTrack(min0);
-        AliL3Track *track1=ttt1->GetTrack(min1);
-        track[0] = track0;
-        track[1] = track1;
-        SortGlobalTracks(track,2);
-        MultiMerge(tout,track,2); 
-        track0->CalculateReferencePoint(angle);
-        track1->CalculateReferencePoint(angle);
-        PrintDiff(track0,track1);
-        FillNtuple(ntuple,track0,track1);
-        ttt0->Remove(min0);
-        ttt1->Remove(min1);
-      }
-      else merge = kFALSE;
-    }
-    ttt0->Compress();
-    ttt1->Compress();
-  LOG(AliL3Log::kInformational,"AliL3HoughGlobalMerger::SlowMerge","Result")
-  <<AliL3Log::kDec<<"Merged Tracks: "<<tout->GetNTracks()<<" at:"
-  <<angle<<ENDLOG;
-  }
-  WriteNtuple("ntuple_s.root",ntuple);
 }
 
 void AliL3HoughGlobalMerger::Merge()
 {
-  AliL3Track *track[2];
-  AliL3TrackArray *tout = GetOutTracks();
-  if(fNSlices<2){
-    LOG(AliL3Log::kWarning,"AliL3HoughGlobalMerger::Merge","Slice Number")
-      <<"Need more than one Slice!"<<ENDLOG;
-    return;
-  }
-  Bool_t *ismatched0=0;
-  Bool_t *ismatched1=0;
-  for(Int_t i=0; i<fNSlices; i++)
+  for(Int_t slice=0; slice<fNSlices; slice++)
     {
-      if(fNSlices!=18 && i+1 == fNSlices) continue; //full cicle == 18 slices
-      Int_t slice = fFirst + i;
-      AliL3TrackArray *ttt0=GetInTracks(i);
-      Int_t slice2 = i+1;
-      if(slice2==fNSlices) slice2 =0;
-      AliL3TrackArray *ttt1=GetInTracks(slice2);
-      Float_t angle = PI/18.; //10 degrees -> the border of the slices
+      if(slice+1 == fNSlices) continue;
+      AliL3TrackArray *t1 = fTracks[slice];
+      AliL3TrackArray *t2 = fTracks[slice+1];
+      Float_t angle = AliL3Transform::Pi()/18;
       AliL3Transform::Local2GlobalAngle(&angle,slice);
-      if(i==0)
-       ttt0->QSort();
-      ttt1->QSort();
-      if(ismatched0) delete [] ismatched0;
-      if(ismatched1) delete [] ismatched1;
-      ismatched0  = new Bool_t[ttt0->GetNTracks()];
-      ismatched1  = new Bool_t[ttt1->GetNTracks()];
-      Int_t n0=0,n1=0;
-      for(Int_t s0=0;s0<ttt0->GetNTracks();s0++)
-       {
-         ismatched0[s0]=kFALSE;
-         AliL3Track *track0=ttt0->GetCheckedTrack(s0);
-         if(!track0) continue;
-         track0->CalculateHelix();
-         track0->CalculateEdgePoint(angle);
-         if(track0->IsPoint()) {n0++;track0->CalculateReferencePoint(angle);
-         }
-       }
-      for(Int_t s1=0;s1<ttt1->GetNTracks();s1++)
-       {
-         ismatched1[s1]=kFALSE;
-         AliL3Track *track1=ttt1->GetCheckedTrack(s1);
-         if(!track1) continue;
-         track1->CalculateHelix();
-         track1->CalculateEdgePoint(angle);
-         if(track1->IsPoint()) {n1++;track1->CalculateReferencePoint(angle);
-         }
-       }
-      for(Int_t s0=0;s0<ttt0->GetNTracks();s0++)
+      
+      for(Int_t i=0; i<t1->GetNTracks(); i++)
        {
-         AliL3Track *track0=ttt0->GetCheckedTrack(s0);
-         if(!track0) continue;
-         if(!track0->IsPoint()) continue;
-         for(Int_t s1=0;s1<ttt1->GetNTracks();s1++)
-           {
-             if(ismatched1[s1]) continue;
-             AliL3Track *track1=ttt1->GetCheckedTrack(s1);
-             if(!track1) continue;
-             if(!track1->IsPoint()) continue;
-             if(IsTrack(track0,track1))
-               {
-                 track[0] = track0;
-                 track[1] = track1;
-                 SortGlobalTracks(track,2);
-                 Double_t r0 = pow(track[0]->GetLastPointX(),2) + pow(track[0]->GetLastPointY(),2);
-                 Double_t r1 = pow(track[1]->GetFirstPointX(),2) + pow(track[1]->GetFirstPointY(),2);
-                 if(r0<r1)
-                   {
-                     MultiMerge(tout,track,2); 
-                     ismatched0[s0]=kTRUE;
-                     ismatched1[s1]=kTRUE;
-                     ttt0->Remove(s0);
-                     ttt1->Remove(s1);
-                   }
-               }
-           }
+         
        }
-      LOG(AliL3Log::kInformational,"AliL3HoughGlobalMerger::Merge","Result")
-       <<AliL3Log::kDec<<"slice0: "<<n0<<" slice1: "<<n1
-       <<" Merged Tracks: "<<tout->GetNTracks()<<ENDLOG;
     }
-  if(ismatched0) delete [] ismatched0;
-  if(ismatched1) delete [] ismatched1;
+  
 }
index f5b5800e8f14f9cb8a1d916e5d48c3e240b3fdb8..a57266da523362ba01cf171235e3b8f52bbfc4e8 100644 (file)
@@ -6,29 +6,19 @@
 class AliL3TrackArray;
 class AliL3Track;
 
-class AliL3HoughGlobalMerger : public AliL3Merger {
+class AliL3HoughGlobalMerger {
 
  private:
+  AliL3TrackArray **fTracks; //!
   Int_t fNSlices;
-  Int_t fFirst;
-  Int_t fLast;
-  Double_t fMaxY;
-  Double_t fMaxZ;
-  Double_t fMaxKappa;
-  Double_t fMaxPsi;
-  Double_t fMaxTgl;
-  Double_t fMaxPhi0;
 
  public:
   AliL3HoughGlobalMerger();
   AliL3HoughGlobalMerger(Int_t first,Int_t last);
   virtual ~AliL3HoughGlobalMerger();
-
-  Bool_t IsTrack(AliL3Track *innertrack,AliL3Track *outertrack);
-  AliL3Track *MultiMerge(AliL3TrackArray *mergedtrack,AliL3Track **tracks, Int_t ntrack);
-  void FillTracks(AliL3TrackArray *tracks,Int_t slice);
-  void SlowMerge();
-  void Merge();  //Loop over tracks from different sectors
+  
+  void FillTracks(AliL3TrackArray *tracks,Int_t i);
+  void Merge();
 
   ClassDef(AliL3HoughGlobalMerger,1) 
 };
index 3a93770f5b4673a435e4896ff712814ec8896b4b..477f5b19d3c36ae1cafca98b5df65bd9c0b1f17f 100644 (file)
@@ -258,19 +258,19 @@ void AliL3HoughMaxFinder::FindMaxima(Double_t grad_x,Double_t grad_y)
              Float_t max_x = fCurrentHisto->GetBinCenterX(xbin);
              Float_t max_y = fCurrentHisto->GetBinCenterY(ybin);
              
-             cout<<"Checking for threshols "<<value[4]<<" "<<fThreshold<<endl;
              if((Int_t)value[4] <= fThreshold) continue;//central bin below threshold
              
-             if(fNPeaks > fNMax)
+             if(fNPeaks >= fNMax)
                {
                  cerr<<"AliL3HoughMaxFinder::FindMaxima : Array out of range "<<fNPeaks<<endl;
                  return;
                }
-             
+             /*
              //Check the gradient:
              if(value[4]/value[3] < grad_x || value[4]/value[5] < grad_x ||
                 value[4]/value[1] < grad_y || value[4]/value[7] < grad_y)
                continue;
+             */
              
              fXPeaks[fNPeaks] = max_x;
              fYPeaks[fNPeaks] = max_y;