]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITStrackerSA.cxx
Set init parameters from args
[u/mrichter/AliRoot.git] / ITS / AliITStrackerSA.cxx
index fb7135b30720374237b33f496480569cbbeb15ae..9bb4ff54537d9c31f72b41de2d717b6e88a6fef2 100644 (file)
@@ -172,7 +172,7 @@ fCluCoord(0)
   fVertexer = vertexer;
  
 }
-
+/*
 //____________________________________________________________________________
 AliITStrackerSA::AliITStrackerSA(const AliITStrackerSA& tracker):AliITStrackerMI(),
 fPhiEstimate(tracker.fPhiEstimate),
@@ -223,7 +223,7 @@ AliITStrackerSA& AliITStrackerSA::operator=(const AliITStrackerSA& source){
   return *this;
  
 }
-
+*/
 //____________________________________________________________________________
 AliITStrackerSA::~AliITStrackerSA(){
   // destructor
@@ -270,6 +270,7 @@ Int_t AliITStrackerSA::Clusters2Tracks(AliESDEvent *event){
 // is done in the ITS only. In the standard reconstruction chain this option
 // can be set via AliReconstruction::SetOption("ITS","onlyITS")
   Int_t rc=0;
+
   if(!fITSStandAlone){
     rc=AliITStrackerMI::Clusters2Tracks(event);
   }
@@ -278,11 +279,14 @@ Int_t AliITStrackerSA::Clusters2Tracks(AliESDEvent *event){
   }
   if(!rc){ 
     rc=FindTracks(event,kFALSE);
-    if(AliITSReconstructor::GetRecoParam()->GetSAUseAllClusters()==kTRUE) {
+    Int_t nSPDcontr=0;
+    const AliESDVertex *spdv = event->GetPrimaryVertexSPD();
+    if(spdv) nSPDcontr = spdv->GetNContributors();
+    if(AliITSReconstructor::GetRecoParam()->GetSAUseAllClusters()==kTRUE && 
+       nSPDcontr<=AliITSReconstructor::GetRecoParam()->GetMaxSPDcontrForSAToUseAllClusters()) {
       rc=FindTracks(event,kTRUE);
     }
   }
-
   return rc;
 }
 
@@ -487,6 +491,7 @@ Int_t AliITStrackerSA::FindTracks(AliESDEvent* event, Bool_t useAllClusters){
                                        &trs,primaryVertex[2],pflag);
          Int_t nextLay=theLay+seedStep;
          Bool_t goon=kTRUE;
+         if(nextLay<0 || nextLay == 6) goon = kFALSE;
          while(goon){
            kk++;
            nClusLay[kk] = SearchClusters(nextLay,fPhiWin[nloop],fLambdaWin[nloop],
@@ -834,32 +839,37 @@ Int_t AliITStrackerSA::SearchClusters(Int_t layer,Double_t phiwindow,Double_t la
   }
 
  
-  Int_t ncl = fCluLayer[layer]->GetEntries();
+  Double_t phiExpect=fPhiEstimate;
+  Double_t lamExpect=fLambdac;
+
+  Int_t ncl = fCluLayer[layer]->GetEntriesFast();
   for (Int_t index=0; index<ncl; index++) {
-    AliITSRecPoint *c = (AliITSRecPoint*)fCluLayer[layer]->At(index);
+    AliITSRecPoint *c = (AliITSRecPoint*)fCluLayer[layer]->UncheckedAt(index);
     if (!c) continue;
-    if (c->GetQ()<=0) continue;
-    if(layer>1 && c->GetQ()<=fMinQ) continue;
     
-     AliITSclusterTable* arr = (AliITSclusterTable*)GetClusterCoord(layer,index);
-     Double_t phi = arr->GetPhi();
-     if (TMath::Abs(phi-fPhiEstimate)>phiwindow) continue;
-
-     Double_t lambda = arr->GetLambda();
-     if (TMath::Abs(lambda-fLambdac)>lambdawindow) continue;
-
-     if(trs->GetNumberOfClustersSA()==trs->GetMaxNumberOfClusters()) return 0;
-     if(trs->GetNumberOfMarked(layer)==trs->GetMaxNMarkedPerLayer()) return 0;
-     Int_t orind = arr->GetOrInd();
-     trs->AddClusterSA(layer,orind);
-     trs->AddClusterMark(layer,index);
-     nc++;
-     fLambdac=lambda;
-     fPhiEstimate=phi;
+    AliITSclusterTable* arr = (AliITSclusterTable*)GetClusterCoord(layer,index);
 
-     fPointc[0]=arr->GetX();
-     fPointc[1]=arr->GetY();
+    Double_t lambda = arr->GetLambda();
+    if (TMath::Abs(lambda-lamExpect)>lambdawindow) continue;
 
+    Double_t phi = arr->GetPhi();
+    Double_t deltaPhi = phi-phiExpect;
+    if(deltaPhi>TMath::Pi()) deltaPhi-=2*TMath::Pi();
+    else if(deltaPhi<-TMath::Pi()) deltaPhi+=2*TMath::Pi();
+    if (TMath::Abs(deltaPhi)>phiwindow) continue;
+    
+    if(trs->GetNumberOfClustersSA()==trs->GetMaxNumberOfClusters()) return 0;
+    if(trs->GetNumberOfMarked(layer)==trs->GetMaxNMarkedPerLayer()) return 0;
+    Int_t orind = arr->GetOrInd();
+    trs->AddClusterSA(layer,orind);
+    trs->AddClusterMark(layer,index);
+    nc++;
+    fLambdac=lambda;
+    fPhiEstimate=phi;
+    
+    fPointc[0]=arr->GetX();
+    fPointc[1]=arr->GetY();
+    
   }
   return nc;
 }
@@ -868,7 +878,7 @@ Int_t AliITStrackerSA::SearchClusters(Int_t layer,Double_t phiwindow,Double_t la
 Bool_t AliITStrackerSA::SetFirstPoint(Int_t lay, Int_t clu, Double_t* primaryVertex){
   // Sets the first point (seed) for tracking
 
-  AliITSRecPoint* cl = (AliITSRecPoint*)fCluLayer[lay]->At(clu);
+  AliITSRecPoint* cl = (AliITSRecPoint*)fCluLayer[lay]->UncheckedAt(clu);
   if(!cl) return kFALSE;
   if (cl->GetQ()<=0) return kFALSE;
   if(lay>1 && cl->GetQ()<=fMinQ) return kFALSE;