-//__________________________________________________________________________
-void AliTRDtracker::MakeSeeds(Int_t inner, Int_t outer, Int_t turn)
-{
- // Creates track seeds using clusters in timeBins=i1,i2
-
- if(turn > 2) {
- cerr<<"MakeSeeds: turn "<<turn<<" exceeds the limit of 2"<<endl;
- return;
- }
-
- Double_t x[5], c[15];
- Int_t maxSec=AliTRDgeometry::kNsect;
- Double_t alpha=AliTRDgeometry::GetAlpha();
- Double_t shift=AliTRDgeometry::GetAlpha()/2.;
- Double_t cs=cos(alpha), sn=sin(alpha);
- Double_t cs2=cos(2.*alpha), sn2=sin(2.*alpha);
- Int_t i2 = fTrSec[0]->GetLayerNumber(inner);
- Int_t i1 = fTrSec[0]->GetLayerNumber(outer);
- Double_t x1 =fTrSec[0]->GetX(i1);
- Double_t xx2=fTrSec[0]->GetX(i2);
-
- for (Int_t ns=0; ns<maxSec; ns++) {
-
- Int_t nl2 = *(fTrSec[(ns-2+maxSec)%maxSec]->GetLayer(i2));
- Int_t nl=(*fTrSec[(ns-1+maxSec)%maxSec]->GetLayer(i2));
- Int_t nm=(*fTrSec[ns]->GetLayer(i2));
- Int_t nu=(*fTrSec[(ns+1)%maxSec]->GetLayer(i2));
- Int_t nu2=(*fTrSec[(ns+2)%maxSec]->GetLayer(i2));
-
- AliTRDpropagationLayer& r1=*(fTrSec[ns]->GetLayer(i1));
-
- for (Int_t is=0; is < r1; is++) {
- Double_t y1=r1[is]->GetY(), z1=r1[is]->GetZ();
-
- for (Int_t js=0; js < nl2+nl+nm+nu+nu2; js++) {
-
- const AliTRDcluster *cl;
- Double_t x2, y2, z2;
- Double_t x3=0., y3=0.;
-
- if (js<nl2) {
- if(turn != 2) continue;
- AliTRDpropagationLayer& r2=*(fTrSec[(ns-2+maxSec)%maxSec]->GetLayer(i2));
- cl=r2[js];
- y2=cl->GetY(); z2=cl->GetZ();
-
- x2= xx2*cs2+y2*sn2;
- y2=-xx2*sn2+y2*cs2;
- }
- else if (js<nl2+nl) {
- if(turn != 1) continue;
- AliTRDpropagationLayer& r2=*(fTrSec[(ns-1+maxSec)%maxSec]->GetLayer(i2));
- cl=r2[js-nl2];
- y2=cl->GetY(); z2=cl->GetZ();
-
- x2= xx2*cs+y2*sn;
- y2=-xx2*sn+y2*cs;
- }
- else if (js<nl2+nl+nm) {
- if(turn != 1) continue;
- AliTRDpropagationLayer& r2=*(fTrSec[ns]->GetLayer(i2));
- cl=r2[js-nl2-nl];
- x2=xx2; y2=cl->GetY(); z2=cl->GetZ();
- }
- else if (js<nl2+nl+nm+nu) {
- if(turn != 1) continue;
- AliTRDpropagationLayer& r2=*(fTrSec[(ns+1)%maxSec]->GetLayer(i2));
- cl=r2[js-nl2-nl-nm];
- y2=cl->GetY(); z2=cl->GetZ();
-
- x2=xx2*cs-y2*sn;
- y2=xx2*sn+y2*cs;
- }
- else {
- if(turn != 2) continue;
- AliTRDpropagationLayer& r2=*(fTrSec[(ns+2)%maxSec]->GetLayer(i2));
- cl=r2[js-nl2-nl-nm-nu];
- y2=cl->GetY(); z2=cl->GetZ();
-
- x2=xx2*cs2-y2*sn2;
- y2=xx2*sn2+y2*cs2;
- }
-
- if(TMath::Abs(z1-z2) > fgkMaxSeedDeltaZ12) continue;
-
- Double_t zz=z1 - z1/x1*(x1-x2);
-
- if (TMath::Abs(zz-z2)>fgkMaxSeedDeltaZ) continue;
-
- Double_t d=(x2-x1)*(0.-y2)-(0.-x2)*(y2-y1);
- if (d==0.) {cerr<<"TRD MakeSeeds: Straight seed !\n"; continue;}
-
- x[0]=y1;
- x[1]=z1;
- x[4]=f1trd(x1,y1,x2,y2,x3,y3);
-
- if (TMath::Abs(x[4]) > fgkMaxSeedC) continue;
-
- x[2]=f2trd(x1,y1,x2,y2,x3,y3);
-
- if (TMath::Abs(x[4]*x1-x[2]) >= 0.99999) continue;
-
- x[3]=f3trd(x1,y1,x2,y2,z1,z2);
-
- if (TMath::Abs(x[3]) > fgkMaxSeedTan) continue;
-
- Double_t a=asin(x[2]);
- Double_t zv=z1 - x[3]/x[4]*(a+asin(x[4]*x1-x[2]));
-
- if (TMath::Abs(zv)>fgkMaxSeedVertexZ) continue;
-
- Double_t sy1=r1[is]->GetSigmaY2(), sz1=r1[is]->GetSigmaZ2();
- Double_t sy2=cl->GetSigmaY2(), sz2=cl->GetSigmaZ2();
- Double_t sy3=fgkSeedErrorSY3, sy=fgkSeedErrorSY, sz=fgkSeedErrorSZ;
-
- // Tilt changes
- Double_t h01 = GetTiltFactor(r1[is]);
- Double_t xuFactor = 100.;
- if(fNoTilt) {
- h01 = 0;
- xuFactor = 1;
- }
-
- sy1=sy1+sz1*h01*h01;
- Double_t syz=sz1*(-h01);
- // end of tilt changes
-
- Double_t f40=(f1trd(x1,y1+sy,x2,y2,x3,y3)-x[4])/sy;
- Double_t f42=(f1trd(x1,y1,x2,y2+sy,x3,y3)-x[4])/sy;
- Double_t f43=(f1trd(x1,y1,x2,y2,x3,y3+sy)-x[4])/sy;
- Double_t f20=(f2trd(x1,y1+sy,x2,y2,x3,y3)-x[2])/sy;
- Double_t f22=(f2trd(x1,y1,x2,y2+sy,x3,y3)-x[2])/sy;
- Double_t f23=(f2trd(x1,y1,x2,y2,x3,y3+sy)-x[2])/sy;
- Double_t f30=(f3trd(x1,y1+sy,x2,y2,z1,z2)-x[3])/sy;
- Double_t f31=(f3trd(x1,y1,x2,y2,z1+sz,z2)-x[3])/sz;
- Double_t f32=(f3trd(x1,y1,x2,y2+sy,z1,z2)-x[3])/sy;
- Double_t f34=(f3trd(x1,y1,x2,y2,z1,z2+sz)-x[3])/sz;
-
-
- c[0]=sy1;
- // c[1]=0.; c[2]=sz1;
- c[1]=syz; c[2]=sz1*xuFactor;
- c[3]=f20*sy1; c[4]=0.; c[5]=f20*sy1*f20+f22*sy2*f22+f23*sy3*f23;
- c[6]=f30*sy1; c[7]=f31*sz1; c[8]=f30*sy1*f20+f32*sy2*f22;
- c[9]=f30*sy1*f30+f31*sz1*f31+f32*sy2*f32+f34*sz2*f34;
- c[10]=f40*sy1; c[11]=0.; c[12]=f40*sy1*f20+f42*sy2*f22+f43*sy3*f23;
- c[13]=f30*sy1*f40+f32*sy2*f42;
- c[14]=f40*sy1*f40+f42*sy2*f42+f43*sy3*f43;
-
- UInt_t index=r1.GetIndex(is);
-
- AliTRDtrack *track=new AliTRDtrack(r1[is],index,x,c,x1,ns*alpha+shift);
-
- Int_t rc=FollowProlongation(*track, i2);
-
- if ((rc < 1) ||
- (track->GetNumberOfClusters() <
- (outer-inner)*fgkMinClustersInSeed)) delete track;
- else {
- fSeeds->AddLast(track); fNseeds++;
-// cerr<<"\r found seed "<<fNseeds;
- }
- }
- }
- }
-}