+//______________________________________________________________________
+void AliITSTrackerV1::RecursiveTracking(TList *trackITSlist) {
+ // This function perform the recursive tracking in ITS detectors
+ // reference is a pointer to the final best track
+ // Origin A. Badala' and G.S. Pappalardo:
+ // e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it
+ // The authors thank Mariana Bondila to have help them to resolve some
+ // problems. July-2000
+
+ //Rlayer[0]=4.; Rlayer[1]=7.; Rlayer[2]=14.9;
+ // Rlayer[3]=23.8; Rlayer[4]=39.1; Rlayer[5]=43.6; //vecchio
+
+ //////////////////////
+ Float_t sigmaphil[6], sigmazl[6];
+ sigmaphil[0]=1.44e-6/(fAvrad[0]*fAvrad[0]);
+ sigmaphil[1]=1.44e-6/(fAvrad[1]*fAvrad[1]);
+ sigmaphil[2]=1.444e-5/(fAvrad[2]*fAvrad[2]);
+ sigmaphil[3]=1.444e-5/(fAvrad[3]*fAvrad[3]);
+ sigmaphil[4]=4e-6/(fAvrad[4]*fAvrad[4]);
+ sigmaphil[5]=4e-6/(fAvrad[5]*fAvrad[5]);
+ sigmazl[0]=1e-2;
+ sigmazl[1]=1e-2;
+ sigmazl[2]=7.84e-4;
+ sigmazl[3]=7.84e-4;
+ sigmazl[4]=0.6889;
+ sigmazl[5]=0.6889;
+ ///////////////////////////////////////////////////////////
+ Int_t index;
+ AliITSgeom *g1 = fITS->GetITSgeom();
+ AliITSRecPoint *recp;
+ for(index =0; index<trackITSlist->GetSize(); index++) {
+ AliITSTrackV1 *trackITS = (AliITSTrackV1 *) trackITSlist->At(index);
+ if((*trackITS).GetLayer()==7) fresult->SetChi2(10.223e140);
+ // cout <<" Layer inizio = "<<(*trackITS).GetLayer()<<"\n";
+ // cout<<"fvtrack =" <<"\n";
+ // cout << (*trackITS)(0) << " "<<(*trackITS)(1)<<" "
+ // <<(*trackITS)(2)<<" "<<(*trackITS)(3)<<" "
+ // <<(*trackITS)(4)<<"\n";
+ // cout<< " rtrack = "<<(*trackITS).Getrtrack()<<"\n";
+ // cout<< " Pt = "<<(*trackITS).GetPt()<<"\n";
+ // getchar();
+ Double_t chi2Now, chi2Ref;
+ Float_t numClustRef = fresult->GetNumClust();
+ if((*trackITS).GetLayer()==1 ) {
+ chi2Now = trackITS->GetChi2();
+ Float_t numClustNow = trackITS->GetNumClust();
+ if(trackITS->GetNumClust())
+ chi2Now /= (Double_t)trackITS->GetNumClust();
+ chi2Ref = fresult->GetChi2();
+ if(fresult->GetNumClust())
+ chi2Ref /= (Double_t)fresult->GetNumClust();
+ //cout<<" chi2Now and chi2Ref = "<<chi2Now<<" "<<chi2Ref<<"\n";
+ if( numClustNow > numClustRef ) {*fresult = *trackITS;}
+ if((numClustNow == numClustRef )&&
+ (chi2Now < chi2Ref)) {
+ *fresult = *trackITS;
+ } // end if
+ continue;
+ } // end if
+
+ if(trackITS->Getfnoclust()>=2) continue;
+ Float_t numClustNow = trackITS->GetNumClust();
+ if(numClustNow) {
+ chi2Now = trackITS->GetChi2();
+
+ if(numClustNow<numClustRef && chi2Now>fresult->GetChi2()) continue;
+ //cout<<" chi2Now = "<<chi2Now<<"\n";
+
+ chi2Now/=numClustNow;
+ if(fPtref > 1.0 && chi2Now > 30.) continue;
+ if((fPtref >= 0.6 && fPtref<=1.0) && chi2Now > 40.) continue;
+ // if((fPtref <= 0.6 && fPtref>0.2)&& chi2Now > 40.) continue;
+ // if(fPtref <= 0.2 && chi2Now > 8.) continue;
+ if((fPtref <= 0.6 && fPtref>0.2)&& chi2Now > 30.) continue;
+ if(fPtref <= 0.2 && chi2Now > 7.) continue;
+ /////////////////////////////
+ } // end if
+
+ Int_t layerInit = (*trackITS).GetLayer();
+ Int_t layernew = layerInit - 2;// -1 for new layer, -1 for matrix index
+ TList listoftrack;
+ Int_t ladp, ladm, detp,detm,ladinters,detinters;
+ Int_t layerfin=layerInit-1;
+ // cout<<"Prima di intersection \n";
+ Int_t outinters=Intersection(*trackITS,layerfin,ladinters,detinters);
+ // cout<<" outinters = "<<outinters<<"\n";
+ // cout<<" Layer ladder detector intersection ="
+ // <<layerfin<<" "<<ladinters<<" "<<detinters<<"\n";
+ // cout << " phiinters zinters = "<<(*trackITS)(0)
+ // << " "<<(*trackITS)(1)<<"\n"; getchar();
+ if(outinters==-1) continue;
+ Int_t flaghit=0;
+ (*trackITS).SetLayer(layerfin); // oggi
+ (*trackITS).Setfcor(); // oggi
+ if(outinters==0){
+ TVector toucLad(9), toucDet(9);
+ Int_t lycur=layerfin;
+ ladp=ladinters+1;
+ ladm=ladinters-1;
+ if(ladm <= 0) ladm=fNlad[layerfin-1];
+ if(ladp > fNlad[layerfin-1]) ladp=1;
+ detp=detinters+1;
+ detm=detinters-1;
+ Int_t idetot=1;
+ /*
+ toucLad(0)=ladinters; toucLad(1)=ladm; toucLad(2)=ladp;
+ toucLad(3)=ladinters; toucLad(4)=ladm; toucLad(5)=ladp;
+ toucLad(6)=ladinters; toucLad(7)=ladm; toucLad(8)=ladp;
+ toucDet(0)=detinters; toucDet(1)=detinters; toucDet(2)=detinters;
+ if(detm > 0 && detp <= fNdet[layerfin-1]) {
+ idetot=9;
+ toucDet(3)=detm; toucDet(4)=detm; toucDet(5)=detm;
+ toucDet(6)=detp; toucDet(7)=detp; toucDet(8)=detp;
+ } // end if
+ if(detm > 0 && detp > fNdet[layerfin-1]) {
+ idetot=6;
+ toucDet(3)=detm; toucDet(4)=detm; toucDet(5)=detm;
+ } // end if
+ if(detm <= 0 && detp <= fNdet[layerfin-1]) {
+ idetot=6;
+ toucDet(3)=detp; toucDet(4)=detp; toucDet(5)=detp;
+ } // end if
+ */
+ Float_t epsphi=5.0, epsz=5.0;
+ if(fPtref<0.2) {epsphi=3.; epsz=3.;}
+ // new definition of idetot e toucLad e toucDet to be
+ // transformed in a method
+ // these values could be modified
+ Float_t pigre=TMath::Pi();
+ Float_t rangephi=5., rangez=5.;
+ if(layerfin==1 || layerfin ==2){
+ rangephi=40.*epsphi*TMath::Sqrt(sigmaphil[layerfin-1]+
+ (*trackITS).GetSigmaphi());
+ rangez = 40.*epsz*TMath::Sqrt(sigmazl[layerfin-1]+
+ (*trackITS).GetSigmaZ());
+ } // end if
+ if(layerfin==3 || layerfin ==4){
+ //rangephi=30.*fepsphi*TMath::Sqrt(sigmaphil[layerfin-1]+
+ // (*trackITS).GetSigmaphi());
+ //rangez = 40.*fepsz*TMath::Sqrt(sigmazl[layerfin-1]+
+ // (*trackITS).GetSigmaZ());
+ rangephi=40.*epsphi*TMath::Sqrt(sigmaphil[layerfin-1]+
+ (*trackITS).GetSigmaphi());
+ rangez = 50.*epsz*TMath::Sqrt(sigmazl[layerfin-1]+
+ (*trackITS).GetSigmaZ());
+ } // end if
+ if(layerfin==5 || layerfin ==6){
+ rangephi=20.*epsphi*TMath::Sqrt(sigmaphil[layerfin-1]+
+ (*trackITS).GetSigmaphi());
+ rangez =5.*epsz*TMath::Sqrt(sigmazl[layerfin-1]+
+ (*trackITS).GetSigmaZ());
+ } // end if
+ Float_t phinters, zinters;
+ phinters=(*trackITS).Getphi();
+ zinters=(*trackITS).GetZ();
+ Float_t distz = 0.0;
+ Float_t phicm, phicp, distphim, distphip;
+ phicm=phinters;
+ if(phinters>fphimax[layerfin-1][ladm-1]) phicm=phinters-2*pigre; //corretto il 20-11-2001
+ distphim=TMath::Abs(phicm-fphimax[layerfin-1][ladm-1]); //corretto il 20-11-2001
+ phicp=phinters;
+ //cout<<" fNlad[layerfin-1] e ladp = "<<fNlad[layerfin-1]<<" "<<ladp<<endl;
+ if(phinters>fphimin[layerfin-1][ladp-1]) phicp=phinters-2.*pigre; //corretto il 20-11-2001
+ distphip=TMath::Abs(phicp-fphimin[layerfin-1][ladp-1]); //corretto il 20-11-2001
+ Int_t flagzmin=0;
+ Int_t flagzmax=0;
+ idetot=1;
+ toucLad(0)=ladinters; toucDet(0)=detinters;
+ if(detm>0) distz=TMath::Abs(zinters-fzmax[layerfin-1][detm-1]);
+ if(detm>0 && rangez>=distz){
+ flagzmin=1;
+ idetot++; toucLad(idetot-1)=ladinters; toucDet(idetot-1)=detm;
+ if(rangephi>=distphim){
+ idetot++;
+ toucLad(idetot-1)=ladm;
+ toucDet(idetot-1)=detinters;
+ idetot++;
+ toucLad(idetot-1)=ladm;
+ toucDet(idetot-1)=detm;
+ } // end if
+ if(rangephi>=distphip){
+ idetot++;
+ toucLad(idetot-1)=ladp;
+ toucDet(idetot-1)=detinters;
+ idetot++;
+ toucLad(idetot-1)=ladp;
+ toucDet(idetot-1)=detm;
+ } // end if
+ } //end detm>0....
+ if(detp<=fNdet[layerfin-1])
+ distz=TMath::Abs(zinters-fzmin[layerfin-1][detp-1]);
+ if(detp<=fNdet[layerfin-1] && rangez>=distz){
+ flagzmax=1;
+ idetot++; toucLad(idetot-1)=ladinters; toucDet(idetot-1)=detp;
+ if(rangephi>=distphim){
+ idetot++; toucLad(idetot-1)=ladm; toucDet(idetot-1)=detp;
+ if(flagzmin == 0) {
+ idetot++;
+ toucLad(idetot-1)=ladm;
+ toucDet(idetot-1)=detinters;
+ } // end if
+ } // end if
+ if(rangephi>=distphip){
+ idetot++;
+ toucLad(idetot-1)=ladp;
+ toucDet(idetot-1)=detp;
+ if(flagzmin == 0) {
+ idetot++;
+ toucLad(idetot-1)=ladp;
+ toucDet(idetot-1)=detinters;
+ } // end if
+ } // end if
+ } //end detm<fNdet[.......
+
+ if(flagzmin == 0 && flagzmax==0){
+ if(rangephi>=distphim){
+ idetot++;
+ toucLad(idetot-1)=ladm;
+ toucDet(idetot-1)=detinters;
+ } // end if
+ if(rangephi>=distphip){
+ idetot++;
+ toucLad(idetot-1)=ladp;
+ toucDet(idetot-1)=detinters;
+ } // end if
+ } // end if
+ ////////////////////////////////////////////////////////////
+ Int_t iriv;
+ for (iriv=0; iriv<idetot; iriv++) { //for on detectors
+ ///////////////////////////////////////////////////////
+ /*** Rec points sorted by module *****/
+ /**************************************/
+ Int_t indexmod;
+ indexmod = g1->GetModuleIndex(lycur,(Int_t)toucLad(iriv),
+ (Int_t)toucDet(iriv));
+ fITS->ResetRecPoints();
+ gAlice->TreeR()->GetEvent(indexmod);
+ Int_t npoints=frecPoints->GetEntries();