- for(Int_t l1=0;l1<end[0];l1++){//loop on layer 1
- AliITSclusterV2* cl0 = (AliITSclusterV2*)listlayer[0]->At(l1);
- TVector3** recp = new TVector3*[3];
- TVector3** errs = new TVector3*[3];
- recp[0] = new TVector3(primaryVertex[0],primaryVertex[1],primaryVertex[2]);
- errs[0] = new TVector3(errorsprimvert[0],errorsprimvert[1],errorsprimvert[2]);
- Double_t x1,y1,z1,sx1,sy1,sz1;
- Double_t x2,y2,z2,sx2,sy2,sz2;
- AliITSclusterV2* p1=0;
- AliITSclusterV2* p2=0;
- Int_t index1=clind0[l1];
- Int_t index2=0;
- for(Int_t l2=0;l2<end[1];l2++){//loop on layer 2
- AliITSclusterV2* cl1 = (AliITSclusterV2*)listlayer[1]->At(l2);
- index2=clind1[l2];
- for(Int_t l3=0;l3<end[2];l3++){ //loop on layer 3
- AliITSclusterV2* cl2 = (AliITSclusterV2*)listlayer[2]->At(l3);
-
- if(cl0==0 && cl1!=0) {
- p2 = cl2;index1=clind2[l3];
- p1=cl1;
-
- }
- if(cl0!=0 && cl1==0){
- p1=cl0;
- p2=cl2;index2=clind2[l3];
- }
- if(cl0!=0 && cl1!=0){
- p1=cl0;
- p2=cl1;
- }
- Int_t lay1=(index1 & 0xf0000000) >> 28;
- Int_t cln1=(index1 & 0x0fffffff) >> 00;
- Int_t lay2=(index2 & 0xf0000000) >> 28;
- Int_t cln2=(index2 & 0x0fffffff) >> 00;
- x1 = fTable->GetXCluster(lay1,cln1);
- x2 = fTable->GetXCluster(lay2,cln2);
- y1 = fTable->GetYCluster(lay1,cln1);
- y2 = fTable->GetYCluster(lay2,cln2);
- z1 = fTable->GetZCluster(lay1,cln1);
- z2 = fTable->GetZCluster(lay2,cln2);
- sx1 = fTable->GetXClusterError(lay1,cln1);
- sx2 = fTable->GetXClusterError(lay2,cln2);
- sy1 = fTable->GetYClusterError(lay1,cln1);
- sy2 = fTable->GetYClusterError(lay2,cln2);
- sz1 = fTable->GetZClusterError(lay1,cln1);
- sz2 = fTable->GetZClusterError(lay2,cln2);
- Double_t phi1 = fTable->GetPhiCluster(lay1,cln1);
- Int_t module1 = p1->GetDetectorIndex()+firstmod[0];
- recp[1] = new TVector3(x1,y1,z1);
- errs[1] = new TVector3(sx1,sy1,sz1);
- recp[2] = new TVector3(x2,y2,z2);
- errs[2] = new TVector3(sx2,sy2,sz2);
-
- //fit on the Riemann sphere
- Float_t seed1,seed2,seed3;
- AliITSRiemannFit fit;
- Int_t rf = fit.FitHelix(3,recp,errs,seed1,seed2,seed3); //this gives phi,tgl,curvature to start Kalman Filter
- if(rf==0) {
- for(Int_t i=1;i<3;i++){
- delete recp[i];
- delete errs[i];
- }
- continue;
- }
- Double_t phi=seed1;
- Double_t tgl=seed2;
-
- if(phi1>0){
- if(seed1>-TMath::Pi() && seed1<-0.5*TMath::Pi()){
- phi=seed1+1.5*TMath::Pi();
- tgl=seed2;
- }
- if(seed1>-0.5*TMath::Pi() && seed1<0.5*TMath::Pi()){
- phi=seed1+0.5*TMath::Pi();
- tgl=(-1)*seed2;
- }
- if(seed1>0.5*TMath::Pi() && seed1<TMath::Pi()){
- phi=seed1-0.5*TMath::Pi();
- tgl=seed2;
- }
- }
- if(phi1<0){
- if(seed1>-TMath::Pi() && seed1<-0.5*TMath::Pi()){
- phi=seed1+0.5*TMath::Pi();
- tgl=(-1)*seed2;
- }
- if(seed1>-0.5*TMath::Pi() && seed1<0.5*TMath::Pi()){
- phi=seed1-0.5*TMath::Pi();
- tgl=seed2;
- }
- if(seed1>0.5*TMath::Pi() && seed1<TMath::Pi()){
- phi=seed1-1.5*TMath::Pi();
- tgl=(-1)*seed2;
- }
- }
-
- Int_t layer,ladder,detector;
- fGeom->GetModuleId(module1,layer,ladder,detector);
- Float_t yclu1 = p1->GetY();
- Float_t zclu1 = p1->GetZ();
- Double_t cv=Curvature(primaryVertex[0],primaryVertex[1],x1,y1,x2,y2);
-
- for(Int_t l4=0;l4<end[3];l4++){ //loop on layer 4
- AliITSclusterV2* cl3 = (AliITSclusterV2*)listlayer[3]->At(l4);
- for(Int_t l5=0;l5<end[4];l5++){ //loop on layer 5
- AliITSclusterV2* cl4 = (AliITSclusterV2*)listlayer[4]->At(l5);
- for(Int_t l6=0;l6<end[5];l6++){ //loop on layer 6
- AliITSclusterV2* cl5 = (AliITSclusterV2*)listlayer[5]->At(l6);
- AliITStrackSA* trac = new AliITStrackSA(fGeom,layer,ladder,detector,yclu1,zclu1,phi,tgl,cv,1);
-
- if(cl5!=0) trac->AddClusterV2(5,(clind5[l6] & 0x0fffffff)>>0);
- if(cl4!=0) trac->AddClusterV2(4,(clind4[l5] & 0x0fffffff)>>0);
- if(cl3!=0) trac->AddClusterV2(3,(clind3[l4] & 0x0fffffff)>>0);
- if(cl2!=0) trac->AddClusterV2(2,(clind2[l3] & 0x0fffffff)>>0);
- if(cl1!=0) trac->AddClusterV2(1,(clind1[l2] & 0x0fffffff)>>0);
- if(cl0!=0) trac->AddClusterV2(0,(clind0[l1] & 0x0fffffff)>>0);
-