anchor.diff:        nspx   = sqrt(abs(gammax*xndisp**2 + two*talphax(ie)*xndisp*xpj + tbetax(ie)*xpj**2)/c_emitx0_collgap)
         nspy   = sqrt(abs(gammay*yj**2 +     two*talphay(ie)*yj*ypj +     tbetay(ie)*ypj**2)/c_emity0_collgap)
   
  -      if(part_abs_pos(j).eq.0 .and. part_abs_turn(j).eq.0) then
  -
  -!GRD HERE WE APPLY THE SAME KIND OF CUT THAN THE SIGSECUT PARAMETER
  -         if(nhit_type(j) > 0 .and. &
  -           (xv1(j).lt.99.0_fPrec .and. xv2(j).lt.99.0_fPrec) .and. &
  -           ((((xv1(j)*c1m3)**2 / (tbetax(ie)*c_emitx0_collgap)) .ge. sigsecut2).or. &
  -           (((xv2(j)*c1m3)**2  / (tbetay(ie)*c_emity0_collgap)) .ge. sigsecut2).or. &
  -           (((xv1(j)*c1m3)**2  / (tbetax(ie)*c_emitx0_collgap)) + &
  -           ((xv2(j)*c1m3)**2  /  (tbetay(ie)*c_emity0_collgap)) .ge. sigsecut3)) ) then
  +      if(part_abs_pos(j) == 0 .and. part_abs_turn(j) == 0) then
  +        ! Here we apply the same kind of cut than the sigsecut parameter
  +        if(nhit_type(j) > 0 .and. xv1(j) < 99.0_fPrec .and. xv2(j) < 99.0_fPrec .and. ( &
  +            (((xv1(j)*c1m3)**2 / (tbetax(ie)*c_emitx0_collgap)) >= sigsecut2).or. &
  +            (((xv2(j)*c1m3)**2 / (tbetay(ie)*c_emity0_collgap)) >= sigsecut2).or. &
  +            (((xv1(j)*c1m3)**2 / (tbetax(ie)*c_emitx0_collgap)) +                 &
  +            ( (xv2(j)*c1m3)**2 / (tbetay(ie)*c_emity0_collgap)) >= sigsecut3))    &
  +          ) then
   
             xj  = (xv1(j)-torbx(ie)) /c1e3
             xpj = (yv1(j)-torbxp(ie))/c1e3
  
positive.code:         end if
        end if
      end do
    end if !!JUNE2005 here I close the "if(dowritetracks)" outside of the firstrun flag
  
  end subroutine collimate_end_element
  
  
negative.code: #endif
    end if
  
    ! Call end element one extra time
    call collimate_end_element
  
  end subroutine collimate_end_turn
  
  