Int_t AliITStrackerSA::FindTracks(AliESDEvent* event){
// Track finder using the ESD object
+
+
if(!fITSclusters){
Fatal("FindTracks","ITS cluster tree is not accessed - Abort!!!\n Please use method SetClusterTree to pass the pointer to the tree\n");
}
}
+ // 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)) {
}
}
-
- Int_t ntrack=0;
- //loop on the different windows
static Int_t nClusLay[AliITSgeomTGeo::kNLayers];//counter for clusters on each layer
- 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);
+
+ //loop on different minNPoints
+ Int_t minMinNPoints=minNPoints;
+ if(AliITSReconstructor::GetRecoParam()->GetSAOnePointTracks()) 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
- if(!cl) continue;
- if (cl->GetQ()<=0) continue;
+ ResetForFinding();
+ Int_t pflag=0;
- AliITSclusterTable* arr = (AliITSclusterTable*)GetClusterCoord(0,ncl);
- fPhic = arr->GetPhi();
- fLambdac = arr->GetLambda();
- if (TMath::Abs(fLambdac)>0.26*TMath::Pi()) continue;
- fPhiEstimate = fPhic;
- AliITStrackSA* trs = new AliITStrackSA();
- fPoint1[0]=primaryVertex[0];
- fPoint1[1]=primaryVertex[1];
+ AliITSRecPoint* cl = (AliITSRecPoint*)fCluLayer[0]->At(ncl);
+ if(!cl) continue;
+ if (cl->GetQ()<=0) continue;
- 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>=minNPoints) {
- AliITStrackV2* tr2 = 0;
- tr2 = FitTrack(trs,primaryVertex);
- if(!tr2) continue;
-
- AliESDtrack outtrack;
- outtrack.UpdateTrackParams(tr2,AliESDtrack::kITSin);
- event->AddTrack(&outtrack);
- ntrack++;
- }
- delete trs;
- }//end loop on clusters of layer1
- //end loop2
- }
+ AliITSclusterTable* arr = (AliITSclusterTable*)GetClusterCoord(0,ncl);
+ fPhic = arr->GetPhi();
+ fLambdac = arr->GetLambda();
+ if (TMath::Abs(fLambdac)>0.26*TMath::Pi()) continue;
+ 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());
+
+ AliESDtrack outtrack;
+ outtrack.UpdateTrackParams(tr2,AliESDtrack::kITSin);
+ event->AddTrack(&outtrack);
+ ntrack++;
+ }
+ delete trs;
+ }//end loop on clusters of layer1
+ }//end loop on windows
+ }//end loop on min points
minNPoints--;
//if 5/6 points are required, second loop starting
//from second layer (SPD2), to find tracks with point of
- //layer 1 missing
- if(!fSixPoints) {
+ //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++){
for(Int_t nnp=0;nnp<AliITSgeomTGeo::GetNLayers()-1;nnp++){
if(nClusLay[nnp]!=0) layOK+=1;
}
- if(layOK>=minNPoints){ // 5/6
+ 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());
AliESDtrack outtrack;
outtrack.UpdateTrackParams(tr2,AliESDtrack::kITSin);
// search for tracks starting from SPD2, SDD1, SDD2, SSD2
// for cosmics (A. Dainese 31.07.07)
- if(fOuterStartLayer>0) {
+ if(fOuterStartLayer>0 && !AliITSReconstructor::GetRecoParam()->GetSAOnePointTracks()) {
for(Int_t innLay=1; innLay<=fOuterStartLayer; innLay++) {
//printf("Searching from layer %d outward\n",innLay);
minNPoints=AliITSgeomTGeo::GetNLayers()-innLay;
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());
AliESDtrack outtrack;
outtrack.UpdateTrackParams(tr2,AliESDtrack::kITSin);
} //end if(fOuterStartLayer>0)
- // search for 1-point tracks, only for cosmics
+ // search for 1-point tracks in SPD, only for cosmics
// (A.Dainese 21.03.08)
if(AliITSReconstructor::GetRecoParam()->GetSAOnePointTracks() &&
TMath::Abs(event->GetMagneticField())<0.01) {
- for(Int_t innLay=0; innLay<=fOuterStartLayer; innLay++) {
+ Int_t outerLayer=1; // only SPD
+ for(Int_t innLay=0; innLay<=TMath::Min(1,fOuterStartLayer); innLay++) {
// counter for clusters on each layer
for(Int_t nloop=0;nloop<fNloop;nloop++){
kk=0;
nClusLay[kk] = SearchClusters(innLay,fPhiWin[nloop],fLambdaWin[nloop],
trs,primaryVertex[2],pflag);
- for(Int_t nextLay=innLay+1; nextLay<AliITSgeomTGeo::GetNLayers(); nextLay++) {
+ for(Int_t nextLay=innLay+1; nextLay<=outerLayer; nextLay++) {
kk++;
nClusLay[kk] = SearchClusters(nextLay,fPhiWin[nloop],fLambdaWin[nloop],
trs,primaryVertex[2],pflag);
if(nClusLay[nnp]!=0) layOK+=1;
}
if(layOK==1) {
+ //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;
Bool_t onePoint = kTRUE;
tr2 = FitTrack(trs,primaryVertex,onePoint);
if(!tr2) continue;
+ //printf("----NPOINTS fit: %d\n",tr2->GetNumberOfClusters());
AliESDtrack outtrack;
outtrack.UpdateTrackParams(tr2,AliESDtrack::kITSin);
Double_t minChi2=trk->GetChi2();
Int_t index=0;
for(Int_t i=1;i<dim;i++){
- AliITStrackV2* trk = (AliITStrackV2*)fListOfTracks->At(i);
+ trk = (AliITStrackV2*)fListOfTracks->At(i);
Double_t chi2=trk->GetChi2();
if(chi2<minChi2){
minChi2=chi2;