- }
- else{
- for (Int_t i=0; i<nt; i++) {
- AliAODTrack *aodTrack=aod->GetTrack(i);
-
- // Skip the tracks having "wrong" status (has to be checked/tuned)
- ULong_t status = aodTrack->GetStatus();
- if ((status & AliESDtrack::kTPCout) == 0) continue;
-
- //Continue extrapolation from TPC outer surface
- const AliExternalTrackParam *outerParam=aodTrack->GetOuterParam();
- if (!outerParam) continue;
- AliExternalTrackParam t(*outerParam);
-
- t.GetBxByBz(b) ;
- //Direction to the current PHOS module
- Double_t phiMod=kAlpha0-kAlpha*mod ;
- if(!t.Rotate(phiMod))
- continue ;
-
- Double_t y; // Some tracks do not reach the PHOS
- if (!t.GetYAt(rPHOS,bz,y)) continue; // because of the bending
-
- Double_t z;
- if(!t.GetZAt(rPHOS,bz,z))
- continue ;
- if (TMath::Abs(z) > kZmax)
- continue; // Some tracks miss the PHOS in Z
- if(TMath::Abs(y) < kYmax){
- t.PropagateToBxByBz(rPHOS,b); // Propagate to the matching module
- //t.CorrectForMaterial(...); // Correct for the TOF material, if needed
- t.GetXYZ(gposTrack) ;
- TVector3 globalPositionTr(gposTrack) ;
- TVector3 localPositionTr ;
- fPHOSGeo->Global2Local(localPositionTr,globalPositionTr,mod) ;
- Double_t ddx = locpos->X()-localPositionTr.X();
- Double_t ddz = locpos->Z()-localPositionTr.Z();
- Double_t d2 = ddx*ddx + ddz*ddz;
- if(d2 < minDistance) {
- dx = ddx ;
- dz = ddz ;
- minDistance=d2 ;
- pt=aodTrack->Pt() ;
- charge=aodTrack->Charge() ;
- }
- }
- }//Scanned all tracks
-
- }