]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/hough/AliL3HoughEval.cxx
Corrected index (aplhacxx6)
[u/mrichter/AliRoot.git] / HLT / hough / AliL3HoughEval.cxx
index 51a7bcfd7e84f7853e2ccf5e68c9aa26514d378a..cfb807c7c228bf539384822a6879abed41a40a5b 100644 (file)
@@ -1,18 +1,19 @@
-//$Id$
+// @(#) $Id$
 
 // Author: Anders Vestbo <mailto:vestbo@fi.uib.no>
-//*-- Copyright &copy ASV 
+//*-- Copyright &copy ALICE HLT Group
+
+#include "AliL3StandardIncludes.h"
 
-#include <math.h>
-#include <iostream.h>
 #ifdef use_root
 #include <TH1.h>
 #include <TFile.h>
 #endif
-#include "AliL3MemHandler.h"
-#include "AliL3TrackArray.h"
+
 #include "AliL3Logging.h"
 #include "AliL3HoughEval.h"
+#include "AliL3MemHandler.h"
+#include "AliL3TrackArray.h"
 #include "AliL3HoughBaseTransformer.h"
 #include "AliL3DigitData.h"
 #include "AliL3HoughTrack.h"
 #include "AliL3Histogram.h"
 #include "AliL3Histogram1D.h"
 
+#if __GNUC__ == 3
+using namespace std;
+#endif
+
+/** /class AliL3HoughEval
+//<pre>
 //_____________________________________________________________
 // AliL3HoughEval
 //
 // Evaluation class for tracklets produced by the Hough transform.
+//
+</pre>
+*/
 
 ClassImp(AliL3HoughEval)
 
 AliL3HoughEval::AliL3HoughEval()
 {
-  
+  //default ctor  
   fRemoveFoundTracks = kFALSE;
   fNumOfPadsToLook = 1;
   fNumOfRowsToMiss = 1;
@@ -40,6 +50,7 @@ AliL3HoughEval::AliL3HoughEval()
 
 AliL3HoughEval::~AliL3HoughEval()
 {
+  //dtor
   fHoughTransformer = 0;
   if(fRowPointers)
     {
@@ -51,6 +62,7 @@ AliL3HoughEval::~AliL3HoughEval()
 
 void AliL3HoughEval::InitTransformer(AliL3HoughBaseTransformer *transformer)
 {
+  //Init hough transformer
   fHoughTransformer = transformer;
   fSlice = fHoughTransformer->GetSlice();
   fPatch = fHoughTransformer->GetPatch();
@@ -58,6 +70,7 @@ void AliL3HoughEval::InitTransformer(AliL3HoughBaseTransformer *transformer)
   fNEtaSegments = fHoughTransformer->GetNEtaSegments();
   fEtaMin = fHoughTransformer->GetEtaMin();
   fEtaMax = fHoughTransformer->GetEtaMax();
+  fZVertex = fHoughTransformer->GetZVertex();
   GenerateLUT();
 }
 
@@ -81,46 +94,42 @@ void AliL3HoughEval::GenerateLUT()
   
 }
 
-Bool_t AliL3HoughEval::LookInsideRoad(AliL3HoughTrack *track,Int_t eta_index,Bool_t remove)
+Bool_t AliL3HoughEval::LookInsideRoad(AliL3HoughTrack *track,Int_t &nrowscrossed,Int_t *rowrange,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
+  Int_t totalcharge=0;//total charge along the road
   
-  //Check if the track is leaving the sector at some point
-  Float_t maxrow=300;
-  Double_t angle=AliL3Transform::Pi()/18;
-  track->CalculateEdgePoint(angle);
-  if(!track->IsPoint())
-    {
-      track->CalculateEdgePoint(-1.*angle);
-      if(track->IsPoint())
-       maxrow = track->GetPointX();
-    }
-  else
-    maxrow = track->GetPointX();
-
-  for(Int_t padrow = AliL3Transform::GetFirstRow(fPatch); padrow <= AliL3Transform::GetLastRow(fPatch); padrow++)
+  //for(Int_t padrow = AliL3Transform::GetFirstRow(fPatch); padrow <= AliL3Transform::GetLastRow(fPatch); padrow++)
+  for(Int_t padrow = rowrange[0]; padrow<=rowrange[1]; padrow++)
     {
-      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))  
+      if(track->IsHelix())
        {
-         continue;
+         if(!track->GetCrossingPoint(padrow,xyz))  
+           {
+             continue;
+           }
+       }
+      else
+       {
+         track->GetLineCrossingPoint(padrow,xyz);
+         xyz[0] += AliL3Transform::Row2X(track->GetFirstRow());
+         Float_t r = sqrt(xyz[0]*xyz[0] + xyz[1]*xyz[1]);
+         xyz[2] = r*track->GetTgl();
        }
       
       AliL3Transform::Slice2Sector(fSlice,padrow,sector,row);
       AliL3Transform::Local2Raw(xyz,sector,row);
+
       npixs=0;
       
-      
       //Get the timebins for this pad
       AliL3DigitRowData *tempPt = fRowPointers[prow];
       if(!tempPt) 
@@ -135,17 +144,18 @@ Bool_t AliL3HoughEval::LookInsideRoad(AliL3HoughTrack *track,Int_t eta_index,Boo
          AliL3DigitData *digPt = tempPt->fDigitData;
          for(UInt_t j=0; j<tempPt->fNDigit; j++)
            {
-             UChar_t pad = digPt[j].fPad;
+             Int_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;
-             total_charge += digPt[j].fCharge;
+             Double_t eta = AliL3Transform::GetEta(fSlice,padrow,pad,time);
+             Int_t pixelindex = fHoughTransformer->GetEtaIndex(eta);
+             if(pixelindex != track->GetEtaIndex()) continue;
+             totalcharge += digPt[j].fCharge;
              if(remove)
-               digPt[j].fCharge = 0; //Erase the track from image
+               digPt[j].fCharge = 0; //Erease the track from image
              npixs++;
            }
        }
@@ -158,10 +168,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
+  nrowscrossed += nrow; //Update the number of rows crossed.
+  
+  if(nrow >= rowrange[1]-rowrange[0]+1 - fNumOfRowsToMiss)//this was a good track
     {
       if(fRemoveFoundTracks)
-       LookInsideRoad(track,eta_index,kTRUE);
+       {
+         Int_t dummy=0;
+         LookInsideRoad(track,dummy,rowrange,kTRUE);
+       }
       return kTRUE;
     }
   else
@@ -170,7 +185,7 @@ Bool_t AliL3HoughEval::LookInsideRoad(AliL3HoughTrack *track,Int_t eta_index,Boo
 
 void AliL3HoughEval::FindEta(AliL3TrackArray *tracks)
 {
-  
+  //Find the corresponding eta slice hough space  
   Int_t sector,row;
   Float_t xyz[3];
   
@@ -217,14 +232,15 @@ 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;
-                 Double_t eta = AliL3Transform::GetEta(padrow,pad,time);
-                 Int_t pixel_index = (Int_t)(eta/etaslice);
-                 if(pixel_index > track->GetEtaIndex()+1) continue;
-                 if(pixel_index < track->GetEtaIndex()-1) break;
+                 Double_t eta = AliL3Transform::GetEta(fSlice,padrow,pad,time);
+                 Int_t pixelindex = (Int_t)(eta/etaslice);
+                 if(pixelindex > track->GetEtaIndex()+1) continue;
+                 if(pixelindex < track->GetEtaIndex()-1) break;
                  fEtaHistos[ntr]->Fill(eta,digPt[j].fCharge);
                }
            }
@@ -234,14 +250,14 @@ void AliL3HoughEval::FindEta(AliL3TrackArray *tracks)
   for(Int_t i=0; i<ntracks; i++)
     {
       AliL3Histogram1D *hist = fEtaHistos[i];
-      Int_t max_bin = hist->GetMaximumBin();
-      Double_t max_value = hist->GetBinContent(max_bin);
+      Int_t maxbin = hist->GetMaximumBin();
+      Double_t maxvalue = hist->GetBinContent(maxbin);
       AliL3HoughTrack *track = (AliL3HoughTrack*)tracks->GetCheckedTrack(i);
       if(!track) continue;
-      if(hist->GetBinContent(max_bin-1)<max_value && hist->GetBinContent(max_bin+1)<max_value)
+      if(hist->GetBinContent(maxbin-1)<maxvalue && hist->GetBinContent(maxbin+1)<maxvalue)
        {
-         track->SetWeight((Int_t)max_value,kTRUE); 
-         track->SetEta(hist->GetBinCenter(max_bin));
+         track->SetWeight((Int_t)maxvalue,kTRUE); 
+         track->SetEta(hist->GetBinCenter(maxbin));
          track->SetNHits(track->GetWeight());
        }
       else
@@ -257,7 +273,7 @@ void AliL3HoughEval::FindEta(AliL3TrackArray *tracks)
   //delete [] fEtaHistos;
 }
 
-void AliL3HoughEval::DisplayEtaSlice(Int_t eta_index,AliL3Histogram *hist)
+void AliL3HoughEval::DisplayEtaSlice(Int_t etaindex,AliL3Histogram *hist)
 {
   //Display the current raw data inside the (slice,patch)
 
@@ -289,14 +305,15 @@ 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);
          AliL3Transform::Raw2Local(xyz,sector,row,pad,time);
+         xyz[2] -= fZVertex;
          Double_t eta = AliL3Transform::GetEta(xyz);
-         Int_t pixel_index = fHoughTransformer->GetEtaIndex(eta);//(Int_t)(eta/etaslice);
-         if(pixel_index != eta_index) continue;
+         Int_t pixelindex = fHoughTransformer->GetEtaIndex(eta);//(Int_t)(eta/etaslice);
+         if(pixelindex != etaindex) continue;
          hist->Fill(xyz[0],xyz[1],charge);
        }
     }
@@ -304,7 +321,7 @@ void AliL3HoughEval::DisplayEtaSlice(Int_t eta_index,AliL3Histogram *hist)
 }
 
 #ifdef use_root
-void AliL3HoughEval::CompareMC(AliL3TrackArray *tracks,Char_t *trackfile,Int_t threshold)
+void AliL3HoughEval::CompareMC(AliL3TrackArray */*tracks*/,Char_t */*trackfile*/,Int_t /*threshold*/)
 {
   /*  
   struct GoodTrack goodtracks[15000];