check_hit_annulus Function

private function check_hit_annulus(this, hitpoint)

Check if a hitpoint is in the annulus

Type Bound

annulus_dect

Arguments

Type IntentOptional Attributes Name
class(annulus_dect), intent(inout) :: this
type(hit_t), intent(in) :: hitpoint

Hitpoint to check

Return Value logical


Source Code

    logical function check_hit_annulus(this, hitpoint)
        !! Check if a hitpoint is in the annulus
        class(annulus_dect), intent(INOUT) :: this
        !> Hitpoint to check
        type(hit_t),         intent(IN)    :: hitpoint

        real(kind=wp) :: newpos

        check_hit_annulus = .false.
        if(this%layer /= hitpoint%layer)return
        newpos = sqrt((hitpoint%pos%x - this%pos%x)**2 + (hitpoint%pos%y - this%pos%y)**2 + (hitpoint%pos%z - this%pos%z)**2)
        if(newpos >= this%r1 .and. newpos <= this%r2)then
            check_hit_annulus = .true.
        end if

    end function check_hit_annulus