anchor.diff:            else
               call roffpos(xv1(j),xv2(j),xchk(1),xchk(2),ape(9,ix),ape(10,ix),ape(11,ix))
             end if
  -          llostp(j)=checkRT(xchk(1),xchk(2),ape(50,ix),ape(6,ix),ape(3,ix),ape(4,ix),apxx,apyy,apxy).or. &
  +          llostp(j)=checkRT(xchk(1),xchk(2),ape(5,ix),ape(6,ix),ape(3,ix),ape(4,ix),apxx,apyy,apxy).or. &
               isnan_mb(xchk(1)).or.isnan_mb(xchk(2))
           else
             if(lbacktracking) then
  
positive.code:   character(len=2), parameter, dimension(-1:6) :: apeName=(/'TR','NA','CR','RE','EL','RL','OC','RT'/)
  
    ! aperture parameteres ape(11,nele)
    ! ape( 1,:): hor rect dimension (RECT/RECTELLIPSE/OCT/RACETR) [mm] for RACETRAK: ape(1)=ape(3)+ape(10)
    ! ape( 2,:): ver rect dimension (RECT/RECTELLIPSE/OCT/RACETR) [mm] for RACETRAK: ape(2)=ape(4)+ape(11)
    ! ape( 3,:): hor elliptical dimension (CIRC/ELLI/RECTELLIPSE/RACETR) [mm]
    ! ape( 4,:): ver elliptical dimension (CIRC/ELLI/RECTELLIPSE/RACETR) [mm]
    ! ape( 5,:): hor offset of rounded/ellyptical corner (RACETR) [mm]
    ! ape( 6,:): ver offset of rounded/ellyptical corner (RACETR) [mm]
    ! ape( 7,:): m of sloped side (OCT) []
    ! ape( 8,:): q of sloped side (OCT) [mm]
    ! ape( 9,:): tilt angle of marker (all) [rad]
    ! ape(10,:): hor offset of marker (all) [mm]
    ! ape(11,:): ver offset of marker (all) [mm]
  
negative.code: 
    case (6) ! Racetrack
      !   NB: it follows the MadX definition
      apxx = ape(3,ix)**2
      apyy = ape(4,ix)**2
      apxy = apxx * apyy
      do j=1,napx
        if((do_coll .and. part_abs_turn(j).eq.0) .or. (.not.do_coll)) then
  