ITS Standalone tracker: 1) possibility to seed from outermost layers 2) possibility...
authorprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 13 Mar 2009 15:36:07 +0000 (15:36 +0000)
committerprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 13 Mar 2009 15:36:07 +0000 (15:36 +0000)
ITS/AliITSRecoParam.cxx
ITS/AliITSRecoParam.h
ITS/AliITSReconstructor.cxx
ITS/AliITStrackerSA.cxx
ITS/AliITStrackerSA.h

index 9fd9acb..a6edb7b 100644 (file)
@@ -125,7 +125,10 @@ fUseBadZonesFromOCDB(kTRUE),
 fUseSingleBadChannelsFromOCDB(kFALSE),
 fMinFractionOfBadInRoad(0),
 fAllowProlongationWithEmptyRoad(kFALSE),
-fOuterStartLayerSA(0),
+fInwardFlagSA(kFALSE),
+fOuterStartLayerSA(2),
+fInnerStartLayerSA(3),
+fMinNPointsSA(3),
 fFactorSAWindowSizes(1.),
 fNLoopsSA(33),
 fMinPhiSA(0.002),
index cc1d1b4..99648a7 100644 (file)
@@ -227,8 +227,16 @@ class AliITSRecoParam : public AliDetectorRecoParam
   void   SetMinFractionOfBadInRoad(Float_t frac=0) { fMinFractionOfBadInRoad=frac; return; }
   Float_t GetMinFractionOfBadInRoad() const { return fMinFractionOfBadInRoad; }
 
+  void   SetOutwardFindingSA() {fInwardFlagSA=kFALSE;}
+  void   SetInwardFindingSA() {fInwardFlagSA=kTRUE;}
+  Bool_t GetInwardFindingSA() const {return fInwardFlagSA;}
   void   SetOuterStartLayerSA(Int_t lay) { fOuterStartLayerSA=lay; return; }
   Int_t  GetOuterStartLayerSA() const { return fOuterStartLayerSA; }
+  void   SetInnerStartLayerSA(Int_t lay) { fInnerStartLayerSA=lay; return; }
+  Int_t  GetInnerStartLayerSA() const { return fInnerStartLayerSA; }
+  void   SetMinNPointsSA(Int_t np) { fMinNPointsSA=np; return; }
+  Int_t  GetMinNPointsSA() const { return fMinNPointsSA;}
+
   void   SetFactorSAWindowSizes(Double_t fact=1.) { fFactorSAWindowSizes=fact; return; }
   Double_t GetFactorSAWindowSizes() const { return fFactorSAWindowSizes; }
 
@@ -442,7 +450,10 @@ class AliITSRecoParam : public AliDetectorRecoParam
   Bool_t fUseSingleBadChannelsFromOCDB; // enable using OCDB info on bad single SPD pixels and SDD anodes (MI)
   Float_t fMinFractionOfBadInRoad; // to decide whether to skip the layer (MI)
   Bool_t fAllowProlongationWithEmptyRoad; // allow to prolong even if road is empty (MI)
-  Int_t fOuterStartLayerSA;      // outer ITS layer to start track in SA
+  Int_t fInwardFlagSA;           // flag for inward track finding in SA
+  Int_t fOuterStartLayerSA;      // outer ITS layer to start track in SA outward
+  Int_t fInnerStartLayerSA;      // inner ITS layer to start track in SA inward
+  Int_t fMinNPointsSA;           // min. number of ITS clusters for a SA track
   Double_t fFactorSAWindowSizes; // larger window sizes in SA
   Int_t fNLoopsSA;               // number of loops in tracker SA
   Double_t fMinPhiSA;               // minimum phi value for SA windows
@@ -476,7 +487,7 @@ class AliITSRecoParam : public AliDetectorRecoParam
   Bool_t fUseCosmicRunShiftsSSD; // SSD time shifts for cosmic run 2007/2008 (use for data taken up to 18 sept 2008)
 
 
-  ClassDef(AliITSRecoParam,16) // ITS reco parameters
+  ClassDef(AliITSRecoParam,17) // ITS reco parameters
 };
 
 #endif
index 7e5ca37..a669825 100644 (file)
@@ -141,7 +141,14 @@ AliTracker* AliITSReconstructor::CreateTracker() const
     sat->SetDetTypeRec(fDetTypeRec);
     if(GetRecoParam()->GetTrackerSAOnly()) sat->SetSAFlag(kTRUE);
     if(sat->GetSAFlag())AliDebug(1,"Tracking Performed in ITS only\n");
-    sat->SetOuterStartLayer(GetRecoParam()->GetOuterStartLayerSA());
+    if(GetRecoParam()->GetInwardFindingSA()){
+      sat->SetInwardFinding();
+      sat->SetInnerStartLayer(GetRecoParam()->GetInnerStartLayerSA());
+    }else{
+      sat->SetOutwardFinding();
+      sat->SetOuterStartLayer(GetRecoParam()->GetOuterStartLayerSA());
+    }
+    sat->SetMinNPoints(GetRecoParam()->GetMinNPointsSA());
   }
 
   Int_t pidOpt = GetRecoParam()->GetPID();
index b78b1a3..454aadf 100644 (file)
@@ -60,8 +60,10 @@ fVertexer(0),
 fListOfTracks(0),
 fListOfSATracks(0),
 fITSclusters(0),
-fSixPoints(0),
+fInwardFlag(0),
 fOuterStartLayer(0),
+fInnerStartLayer(5),
+fMinNPoints(0),
 fMinQ(0.),
 fCluLayer(0),
 fCluCoord(0){
@@ -86,8 +88,10 @@ fVertexer(0),
 fListOfTracks(0),
 fListOfSATracks(0),
 fITSclusters(0),
-fSixPoints(0),
+fInwardFlag(0),
 fOuterStartLayer(0),
+fInnerStartLayer(5),
+fMinNPoints(0),
 fMinQ(0.),
 fCluLayer(0),
 fCluCoord(0) 
@@ -119,8 +123,10 @@ fVertexer(0),
 fListOfTracks(0),
 fListOfSATracks(0),
 fITSclusters(0),
-fSixPoints(0),
+fInwardFlag(0),
 fOuterStartLayer(0),
+fInnerStartLayer(5),
+fMinNPoints(0),
 fMinQ(0.),
 fCluLayer(0),
 fCluCoord(0)
@@ -150,8 +156,10 @@ fVertexer(vertexer),
 fListOfTracks(0),
 fListOfSATracks(0),
 fITSclusters(0),
-fSixPoints(0),
+fInwardFlag(0),
 fOuterStartLayer(0),
+fInnerStartLayer(5),
+fMinNPoints(0),
 fMinQ(0.),
 fCluLayer(0),
 fCluCoord(0)
@@ -182,8 +190,10 @@ fVertexer(tracker.fVertexer),
 fListOfTracks(tracker.fListOfTracks),
 fListOfSATracks(tracker.fListOfSATracks),
 fITSclusters(tracker.fITSclusters),
-fSixPoints(tracker.fSixPoints),
+fInwardFlag(tracker.fInwardFlag),
 fOuterStartLayer(tracker.fOuterStartLayer),
+fInnerStartLayer(tracker.fInnerStartLayer),
+fMinNPoints(tracker.fMinNPoints),
 fMinQ(tracker.fMinQ),
 fCluLayer(tracker.fCluLayer),
 fCluCoord(tracker.fCluCoord) {
@@ -296,13 +306,13 @@ void AliITStrackerSA::Init(){
     }
     fMinQ=AliITSReconstructor::GetRecoParam()->GetSAMinClusterCharge();
     fITSclusters = 0;
-    SetSixPoints();
-    SetOuterStartLayer(0);
+    SetOuterStartLayer(1);
     SetSAFlag(kFALSE);
     fListOfTracks=new TObjArray(0,0);
     fListOfSATracks=new TObjArray(0,0);
     fCluLayer = 0;
     fCluCoord = 0;
+    fMinNPoints = 3;
  }
 //_______________________________________________________________________
 void AliITStrackerSA::ResetForFinding(){
@@ -406,239 +416,139 @@ Int_t AliITStrackerSA::FindTracks(AliESDEvent* event){
   // track counter
   Int_t ntrack=0;
 
-  Int_t minNPoints = (fSixPoints ? AliITSgeomTGeo::GetNLayers() : AliITSgeomTGeo::GetNLayers()-1);  
-  for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++) {
-    if(AliITSReconstructor::GetRecoParam()->GetLayersToSkip(i)) {
-      minNPoints--;
-    }
-  }
-
   static Int_t nClusLay[AliITSgeomTGeo::kNLayers];//counter for clusters on each layer
 
-  //loop on different minNPoints
-  Int_t minMinNPoints=minNPoints;
-  if(AliITSReconstructor::GetRecoParam()->GetAllowProlongationWithEmptyRoad()) minMinNPoints=2;
-  for(Int_t iMinNPoints=minNPoints; iMinNPoints>=minMinNPoints; iMinNPoints--) {
-    //loop on the different windows
-    for(Int_t nloop=0;nloop<fNloop;nloop++){
-      for(Int_t ncl=0;ncl<fCluLayer[0]->GetEntries();ncl++){ //loop starting from layer 0
-      
-       ResetForFinding();
-       Int_t pflag=0;
-      
-       AliITSRecPoint* cl = (AliITSRecPoint*)fCluLayer[0]->At(ncl);
-      
-       if(!cl) continue;
-       if (cl->GetQ()<=0) continue;
-
-       AliITSclusterTable* arr = (AliITSclusterTable*)GetClusterCoord(0,ncl); 
-       fPhic = arr->GetPhi();
-       fLambdac = arr->GetLambda();
-       fPhiEstimate = fPhic;
-       AliITStrackSA* trs = new AliITStrackSA(); 
-       fPoint1[0]=primaryVertex[0];
-       fPoint1[1]=primaryVertex[1];
-       
-       
-       fPoint2[0]=arr->GetX();
-       fPoint2[1]=arr->GetY();
-       for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++) nClusLay[i]=0;
-       nClusLay[0] = SearchClusters(0,fPhiWin[nloop],fLambdaWin[nloop],trs,primaryVertex[2],pflag);
-       nClusLay[1] = SearchClusters(1,fPhiWin[nloop],fLambdaWin[nloop],trs,primaryVertex[2],pflag);
-       if(nClusLay[1]>0){
-         pflag=1;
-         fPoint3[0] = fPointc[0];
-         fPoint3[1] = fPointc[1];
-       }
-       nClusLay[2] = SearchClusters(2,fPhiWin[nloop],fLambdaWin[nloop],trs,primaryVertex[2],pflag);
-       if(nClusLay[1]==0 && nClusLay[2]==0) pflag=0;
-       if(nClusLay[2]!=0 && nClusLay[1]!=0){ pflag=1; UpdatePoints();}
-       if(nClusLay[2]!=0 && nClusLay[1]==0){
-         pflag=1;
-         fPoint3[0]=fPointc[0];
-         fPoint3[1]=fPointc[1];
-       }
-       
-       nClusLay[3] = SearchClusters(3,fPhiWin[nloop],fLambdaWin[nloop],trs,primaryVertex[2],pflag);
-       pflag=1;
-       if(nClusLay[3]!=0) UpdatePoints();
-       nClusLay[4] = SearchClusters(4,fPhiWin[nloop],fLambdaWin[nloop],trs,primaryVertex[2],pflag); 
-       pflag=1;
-       if(nClusLay[4]!=0) UpdatePoints();
-       nClusLay[5] = SearchClusters(5,fPhiWin[nloop],fLambdaWin[nloop],trs,primaryVertex[2],pflag); 
-       
-       
-       Int_t layOK=0;
-       //check of the candidate track
-       for(Int_t nnp=0;nnp<AliITSgeomTGeo::GetNLayers();nnp++) {
-         if(nClusLay[nnp]!=0) layOK+=1;
-       }
-       
-       if(layOK>=iMinNPoints) {
-         //printf("-NPOINTS: %d; MAP: %d %d %d %d %d %d\n",layOK,nClusLay[0],nClusLay[1],nClusLay[2],nClusLay[3],nClusLay[4],nClusLay[5]);
-         AliITStrackV2* tr2 = 0;
-         tr2 = FitTrack(trs,primaryVertex);
-         if(!tr2) continue;
-         //printf("-NPOINTS fit: %d\n",tr2->GetNumberOfClusters());      
-
-         StoreTrack(tr2,event);
-         ntrack++;
-       }
-       delete trs;
-      }//end loop on clusters of layer1
-    }//end loop on windows
-  }//end loop on min points
-
+  if(AliITSReconstructor::GetRecoParam()->GetAllowProlongationWithEmptyRoad()) fMinNPoints=2;
 
-  minNPoints--;
-
-  //if 5/6 points are required, second loop starting 
-  //from second layer (SPD2), to find tracks with point of 
-  //layer 1 missing. Not done for cosmics.   
-  if(!fSixPoints && fOuterStartLayer==0) {
-    //printf("looking from SPD2\n");
-    //   counter for clusters on each layer  
-    for(Int_t nloop=0;nloop<fNloop;nloop++){
-      Int_t ncl2=fCluLayer[1]->GetEntries();
-      while(ncl2--){ //loop starting from layer 2
-       ResetForFinding();
-       Int_t pflag=0;
-       AliITSRecPoint* cl = (AliITSRecPoint*)fCluLayer[1]->At(ncl2);
-       
-       if(!cl) continue;
-       AliITSclusterTable* arr = (AliITSclusterTable*)GetClusterCoord(1,ncl2);
-       fPhic = arr->GetPhi();
-       fLambdac = arr->GetLambda();
-       fPhiEstimate = fPhic;
-       
-       AliITStrackSA* trs = new AliITStrackSA(); 
-       fPoint1[0]=primaryVertex[0];
-       fPoint1[1]=primaryVertex[1];
-       
-       fPoint2[0]=arr->GetX();
-       fPoint2[1]=arr->GetY();
-       for(Int_t kk=0;kk<AliITSgeomTGeo::GetNLayers();kk++) nClusLay[kk] = 0;
-       nClusLay[0] = SearchClusters(1,fPhiWin[nloop],fLambdaWin[nloop],
-                              trs,primaryVertex[2],pflag);
-       nClusLay[1] = SearchClusters(2,fPhiWin[nloop],fLambdaWin[nloop],
-                              trs,primaryVertex[2],pflag);
-       if(nClusLay[1]!=0){
-         pflag=1;
-         fPoint3[0]=fPointc[0];
-         fPoint3[1]=fPointc[1];
-       }
-       nClusLay[2]= SearchClusters(3,fPhiWin[nloop],fLambdaWin[nloop],
-                             trs,primaryVertex[2],pflag);
-       if(nClusLay[2]!=0){
-         pflag=1;
-         UpdatePoints();
-       }
-       nClusLay[3]= SearchClusters(4,fPhiWin[nloop],fLambdaWin[nloop],
-                             trs,primaryVertex[2],pflag);
-       if(nClusLay[3]!=0){
-         pflag=1;
-         UpdatePoints();
-       }
-       nClusLay[4]=SearchClusters(5,fPhiWin[nloop],fLambdaWin[nloop],
-                            trs,primaryVertex[2],pflag);
-       
-       Int_t layOK=0;
-       for(Int_t nnp=0;nnp<AliITSgeomTGeo::GetNLayers()-1;nnp++){
-         if(nClusLay[nnp]!=0) layOK+=1;
-       }
-       if(layOK>=minNPoints){  // 5/6
-         //printf("--NPOINTS: %d; MAP: %d %d %d %d %d %d\n",layOK,nClusLay[0],nClusLay[1],nClusLay[2],nClusLay[3],nClusLay[4],nClusLay[5]);
-       
-         AliITStrackV2* tr2 = 0;
-         tr2 = FitTrack(trs,primaryVertex);
-         if(!tr2) continue;
-         //printf("--NPOINTS fit: %d\n",tr2->GetNumberOfClusters());
-         
-         StoreTrack(tr2,event);
-         ntrack++;
-         
-       }   
+  // loop on minimum number of points
+  for(Int_t iMinNPoints=AliITSgeomTGeo::GetNLayers(); iMinNPoints>=fMinNPoints; iMinNPoints--) {
+
+    if(!fInwardFlag){ // Tracking outwards from the inner layers
+      // loop on starting layer for track finding 
+      for(Int_t innLay=0; innLay<=fOuterStartLayer; innLay++) {
+       if(AliITSReconstructor::GetRecoParam()->GetLayersToSkip(innLay)) continue; 
+       Int_t minNPoints=iMinNPoints-innLay;
+       for(Int_t i=innLay+1;i<AliITSgeomTGeo::GetNLayers();i++)
+         if(AliITSReconstructor::GetRecoParam()->GetLayersToSkip(i)) 
+           minNPoints--;
+       if(minNPoints<fMinNPoints) continue;
+
+       // loop on phi and lambda window size
+       for(Int_t nloop=0;nloop<fNloop;nloop++){
+         Int_t nclInnLay=fCluLayer[innLay]->GetEntries();
+         while(nclInnLay--){ 
+           ResetForFinding();
+           Bool_t useRP=SetFirstPoint(innLay,nclInnLay,primaryVertex);
+           if(!useRP) continue;            
+           AliITStrackSA* trs = new AliITStrackSA(); 
+           
+           Int_t pflag=0;          
+           Int_t kk;
+           for(kk=0;kk<AliITSgeomTGeo::GetNLayers();kk++) nClusLay[kk] = 0;
+           
+           kk=0;
+           nClusLay[kk] = SearchClusters(innLay,fPhiWin[nloop],fLambdaWin[nloop],
+                                         trs,primaryVertex[2],pflag);
+           for(Int_t nextLay=innLay+1; nextLay<AliITSgeomTGeo::GetNLayers(); nextLay++) {
+             kk++;
+             nClusLay[kk] = SearchClusters(nextLay,fPhiWin[nloop],fLambdaWin[nloop],
+                                           trs,primaryVertex[2],pflag);
+             if(nClusLay[kk]!=0){
+               pflag=1;
+               if(kk==1) {
+                 fPoint3[0]=fPointc[0];
+                 fPoint3[1]=fPointc[1];
+               } else {
+                 UpdatePoints();
+               }
+             }
+           }
+           
+           Int_t layOK=0;
+           for(Int_t nnp=0;nnp<AliITSgeomTGeo::GetNLayers()-innLay;nnp++){
+             if(nClusLay[nnp]!=0) layOK+=1;
+           }
+           if(layOK>=minNPoints){ 
+             //printf("---NPOINTS: %d; MAP: %d %d %d %d %d %d\n",layOK,nClusLay[0],nClusLay[1],nClusLay[2],nClusLay[3],nClusLay[4],nClusLay[5]);
+             AliITStrackV2* tr2 = 0;
+             tr2 = FitTrack(trs,primaryVertex);
+             if(!tr2) continue;
+             //printf("---NPOINTS fit: %d\n",tr2->GetNumberOfClusters());
+             
+             StoreTrack(tr2,event);
+             ntrack++;
+             
+           }   
+           
+           delete trs;
+         }//end loop on clusters of innLay
+       } //end loop on window sizes
+      } //end loop on innLay
+    }else{// Tracking inwards from the outer layers
+    // loop on starting layer for track finding 
+      for(Int_t outLay=AliITSgeomTGeo::GetNLayers()-1; outLay>=fInnerStartLayer; outLay--) {
+
+       if(AliITSReconstructor::GetRecoParam()->GetLayersToSkip(outLay)) continue;
+       Int_t minNPoints=iMinNPoints-(AliITSgeomTGeo::GetNLayers()-1-outLay);
+       for(Int_t i=0;i<outLay-1;i++)
+         if(AliITSReconstructor::GetRecoParam()->GetLayersToSkip(i)) 
+           minNPoints--;
+       if(minNPoints<fMinNPoints) continue;
        
-        delete trs;
-      }//end loop on clusters of layer2
-    }
-    
-  } //end opt="5/6"  
-
-  // search for tracks starting from SPD2, SDD1, SDD2, SSD2
-  // for cosmics (A. Dainese 31.07.07)
-  if(fOuterStartLayer>0 && !AliITSReconstructor::GetRecoParam()->GetAllowProlongationWithEmptyRoad()) {
-    for(Int_t innLay=1; innLay<=fOuterStartLayer; innLay++) {
-      //printf("Searching from layer %d outward\n",innLay);
-      minNPoints=AliITSgeomTGeo::GetNLayers()-innLay;
-      for(Int_t i=innLay;i<AliITSgeomTGeo::GetNLayers();i++) 
-       if(AliITSReconstructor::GetRecoParam()->GetLayersToSkip(i)) 
-         minNPoints--;
-      //   counter for clusters on each layer  
-
-      for(Int_t nloop=0;nloop<fNloop;nloop++){
-       Int_t nclInnLay=fCluLayer[innLay]->GetEntries();
-       while(nclInnLay--){ //loop starting from layer innLay
-         ResetForFinding();
-         Int_t pflag=0;
-         AliITSRecPoint* cl = (AliITSRecPoint*)fCluLayer[innLay]->At(nclInnLay);
-         
-         if(!cl) continue;
-         AliITSclusterTable* arr = (AliITSclusterTable*)GetClusterCoord(innLay,nclInnLay);
-         fPhic = arr->GetPhi();
-         fLambdac = arr->GetLambda();
-         fPhiEstimate = fPhic;
-         
-         AliITStrackSA* trs = new AliITStrackSA(); 
-         fPoint1[0]=primaryVertex[0];
-         fPoint1[1]=primaryVertex[1];
-         fPoint2[0]=arr->GetX();
-         fPoint2[1]=arr->GetY();
-         
-         Int_t kk;
-         for(kk=0;kk<AliITSgeomTGeo::GetNLayers();kk++) nClusLay[kk] = 0;
-         
-         kk=0;
-         nClusLay[kk] = SearchClusters(innLay,fPhiWin[nloop],fLambdaWin[nloop],
+       // loop on phi and lambda window size
+       for(Int_t nloop=0;nloop<fNloop;nloop++){
+         Int_t nclOutLay=fCluLayer[outLay]->GetEntries();
+         while(nclOutLay--){ 
+           ResetForFinding();
+           Bool_t useRP=SetFirstPoint(outLay,nclOutLay,primaryVertex);
+           if(!useRP) continue;            
+           AliITStrackSA* trs = new AliITStrackSA(); 
+           
+           Int_t pflag=0;          
+           Int_t kk;
+           for(kk=0;kk<AliITSgeomTGeo::GetNLayers();kk++) nClusLay[kk] = 0;
+           
+           kk=0;
+           nClusLay[kk] = SearchClusters(outLay,fPhiWin[nloop],fLambdaWin[nloop],
                                  trs,primaryVertex[2],pflag);
-         for(Int_t nextLay=innLay+1; nextLay<AliITSgeomTGeo::GetNLayers(); nextLay++) {
-           kk++;
-           nClusLay[kk] = SearchClusters(nextLay,fPhiWin[nloop],fLambdaWin[nloop],
-                                   trs,primaryVertex[2],pflag);
-           if(nClusLay[kk]!=0){
-             pflag=1;
-             if(kk==1) {
-               fPoint3[0]=fPointc[0];
-               fPoint3[1]=fPointc[1];
-             } else {
-               UpdatePoints();
+           for(Int_t nextLay=outLay-1; nextLay>=0; nextLay--) {
+             kk++;
+             nClusLay[kk] = SearchClusters(nextLay,fPhiWin[nloop],fLambdaWin[nloop],
+                                           trs,primaryVertex[2],pflag);
+             if(nClusLay[kk]!=0){
+               pflag=1;
+               if(kk==1) {
+                 fPoint3[0]=fPointc[0];
+                 fPoint3[1]=fPointc[1];
+               } else {
+                 UpdatePoints();
+               }
              }
            }
-         }
          
-         Int_t layOK=0;
-         for(Int_t nnp=0;nnp<AliITSgeomTGeo::GetNLayers()-innLay;nnp++){
-           if(nClusLay[nnp]!=0) layOK+=1;
-         }
-         if(layOK>=minNPoints){ 
-           //printf("---NPOINTS: %d; MAP: %d %d %d %d %d %d\n",layOK,nClusLay[0],nClusLay[1],nClusLay[2],nClusLay[3],nClusLay[4],nClusLay[5]);
-           AliITStrackV2* tr2 = 0;
-           tr2 = FitTrack(trs,primaryVertex);
-           if(!tr2) continue;
-           //printf("---NPOINTS fit: %d\n",tr2->GetNumberOfClusters());
-           
-           StoreTrack(tr2,event);
-           ntrack++;
+           Int_t layOK=0;
+           for(Int_t nnp=outLay; nnp>=0; nnp--){
+             if(nClusLay[nnp]!=0) layOK+=1;
+           }
+           if(layOK>=minNPoints){ 
+             //printf("---NPOINTS: %d; MAP: %d %d %d %d %d %d\n",layOK,nClusLay[0],nClusLay[1],nClusLay[2],nClusLay[3],nClusLay[4],nClusLay[5]);
+             AliITStrackV2* tr2 = 0;
+             tr2 = FitTrack(trs,primaryVertex);
+             if(!tr2) continue;
+             //printf("---NPOINTS fit: %d\n",tr2->GetNumberOfClusters());
+             
+             StoreTrack(tr2,event);
+             ntrack++;
+             
+           }   
            
-         }   
-         
-         delete trs;
+           delete trs;
        }//end loop on clusters of innLay
-      } //end loop on window sizes
-      
-    } //end loop on innLay
-  } //end if(fOuterStartLayer>0)
-  
+       } //end loop on window sizes
+      } //end loop on innLay
+    } // end if (fInwardFlag)
+  }//end loop on min points
 
   // search for 1-point tracks in SPD, only for cosmics
   // (A.Dainese 21.03.08)
@@ -652,21 +562,11 @@ Int_t AliITStrackerSA::FindTracks(AliESDEvent* event){
        Int_t nclInnLay=fCluLayer[innLay]->GetEntries();
        while(nclInnLay--){ //loop starting from layer innLay
          ResetForFinding();
-         Int_t pflag=0;
-         AliITSRecPoint* cl = (AliITSRecPoint*)fCluLayer[innLay]->At(nclInnLay);
-         
-         if(!cl) continue;
-         AliITSclusterTable* arr = (AliITSclusterTable*)GetClusterCoord(innLay,nclInnLay);
-         fPhic = arr->GetPhi();
-         fLambdac = arr->GetLambda();
-         fPhiEstimate = fPhic;
-         
+         Bool_t useRP=SetFirstPoint(innLay,nclInnLay,primaryVertex);
+         if(!useRP) continue;
          AliITStrackSA* trs = new AliITStrackSA(); 
-         fPoint1[0]=primaryVertex[0];
-         fPoint1[1]=primaryVertex[1];
-         fPoint2[0]=arr->GetX();
-         fPoint2[1]=arr->GetY();
-         
+           
+         Int_t pflag=0;            
          Int_t kk;
          for(kk=0;kk<AliITSgeomTGeo::GetNLayers();kk++) nClusLay[kk] = 0;
          
@@ -1074,6 +974,26 @@ 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);
+  if(!cl) return kFALSE;
+  if (cl->GetQ()<=0) return kFALSE;
+  if(lay>1 && cl->GetQ()<=fMinQ) return kFALSE;
+
+  AliITSclusterTable* arr = (AliITSclusterTable*)GetClusterCoord(lay,clu);
+  fPhic = arr->GetPhi();
+  fLambdac = arr->GetLambda();
+  fPhiEstimate = fPhic;
+  fPoint1[0]=primaryVertex[0];
+  fPoint1[1]=primaryVertex[1];
+  fPoint2[0]=arr->GetX();
+  fPoint2[1]=arr->GetY();
+  return kTRUE; 
+}
+
+//________________________________________________________________
 void AliITStrackerSA::UpdatePoints(){
   //update of points for the estimation of the curvature  
 
index 7ad9e98..cb95785 100644 (file)
@@ -45,28 +45,39 @@ class AliITStrackerSA : public AliITStrackerMI {
   AliITStrackV2* FitTrack(AliITStrackSA* tr,Double_t* primaryVertex,Bool_t onePoint=kFALSE);
   void StoreTrack(AliITStrackV2 *t,AliESDEvent *event) const; 
   Int_t FindTrackLowChiSquare() const;
-  Int_t LoadClusters(TTree *cf) {Int_t rc=AliITStrackerMI::LoadClusters(cf); SetClusterTree(cf); SetSixPoints(kTRUE); return rc;}
+  Int_t LoadClusters(TTree *cf) {Int_t rc=AliITStrackerMI::LoadClusters(cf); SetClusterTree(cf); return rc;}
   void SetVertex(AliESDVertex *vtx){fVert = vtx;}
   void SetClusterTree(TTree * itscl){fITSclusters = itscl;}
-  void SetSixPoints(Bool_t sp = kFALSE){fSixPoints = sp;}
-  Bool_t GetSixPoints() const {return fSixPoints;}
-  void SetOuterStartLayer(Int_t osl = 0) {if(osl>(AliITSgeomTGeo::GetNLayers()-2)) osl=AliITSgeomTGeo::GetNLayers()-2; fOuterStartLayer = osl;}
+
+  void SetOutwardFinding() {fInwardFlag=kFALSE;}
+  void SetInwardFinding() {fInwardFlag=kTRUE;}
+  void SetOuterStartLayer(Int_t osl = 0) {
+    if(osl>(AliITSgeomTGeo::GetNLayers()-2)) AliWarning("Minimum Number of layers is 2. OuterStartLayer set to Nlayers-2");
+    fOuterStartLayer = TMath::Min(AliITSgeomTGeo::GetNLayers()-2,osl);
+  }
   Int_t GetOuterStartLayer() const {return fOuterStartLayer;}
+  void SetInnerStartLayer(Int_t isl = 5) {
+    if(isl<1) AliWarning("Minimum Number of layers is 2. InnerStartLayer set to 1");
+    fInnerStartLayer = TMath::Max(1,isl);
+  }
+  Int_t GetInnerStartLayer() const {return fInnerStartLayer;}
+
   void SetSAFlag(Bool_t fl){fITSStandAlone=fl;}  // StandAlone flag setter
   Bool_t GetSAFlag() const {return fITSStandAlone;} // StandAlone flag getter
   void SetFixedWindowSizes(Int_t n=46, Double_t *phi=0, Double_t *lam=0);
   void SetCalculatedWindowSizes(Int_t n=10, Float_t phimin=0.002, Float_t phimax=0.0145, Float_t lambdamin=0.003, Float_t lambdamax=0.008);
 
+  void SetMinNPoints(Int_t np){fMinNPoints=np;}
+  Int_t GetMinNPoints() const {return fMinNPoints;}
   void SetMinimumChargeSDDSSD(Float_t minq=0.){fMinQ=minq;}
   enum {kSAflag=0x8000}; //flag to mark clusters used in the SA tracker
-
  protected:
 
   //Initialization
   void Init();
   void ResetForFinding();
   void UpdatePoints();
-
+  Bool_t SetFirstPoint(Int_t lay, Int_t clu, Double_t* primaryVertex);
   static Double_t Curvature(Double_t x1,Double_t y1,Double_t x2,Double_t y2,
                      Double_t x3,Double_t y3);
 
@@ -113,14 +124,16 @@ class AliITStrackerSA : public AliITStrackerMI {
   TObjArray *fListOfTracks;   //! container for found tracks 
   TObjArray *fListOfSATracks; //! container for found SA tracks 
   TTree *fITSclusters;        //! pointer to ITS tree of clusters
-  Bool_t fSixPoints;          // If true 6/6 points are required (default). 5/6 otherwise
-  Int_t fOuterStartLayer;     // Search for tracks with <6 points: outer layer to start from
+  Bool_t fInwardFlag;       // set to kTRUE for inward track finding
+  Int_t fOuterStartLayer;     // Outward search for tracks with <6 points: outer layer to start from
+  Int_t fInnerStartLayer;     // Inward search for tracks with <6 points: inner layer to start from
+  Int_t fMinNPoints;        // minimum number of clusters for a track
   Float_t fMinQ;              // lower cut on cluster charge (SDD and SSD)
 
   TClonesArray** fCluLayer; //! array with clusters 
   TClonesArray** fCluCoord; //! array with cluster info
 
-  ClassDef(AliITStrackerSA,8)
+  ClassDef(AliITStrackerSA,9)
 };
 
 #endif