init_annulus_dect Function

private function init_annulus_dect(pos, dir, layer, r1, r2, nbins, maxval, trackHistory) result(out)

Initalise Annular detector

Arguments

Type IntentOptional Attributes Name
type(vector), intent(in) :: pos

Centre of detector

type(vector), intent(in) :: dir

Normal of the detector

integer, intent(in) :: layer

Layer ID

real(kind=wp), intent(in) :: r1

Inner radius

real(kind=wp), intent(in) :: r2

Outer radius

integer, intent(in) :: nbins

Number of bins in the detector

real(kind=wp), intent(in) :: maxval

Maximum value to store in bins

logical, intent(in) :: trackHistory

Boolean on if to store photon's history prior to hitting the detector.

Return Value type(annulus_dect)


Source Code

    function init_annulus_dect(pos, dir, layer, r1, r2, nbins, maxval, trackHistory) result(out)
        !! Initalise Annular detector

        !> Centre of detector
        type(vector),  intent(in) :: pos
        !> Normal of the detector
        type(vector),  intent(in) :: dir
        !> Layer ID
        integer,       intent(in) :: layer
        !> Inner radius
        real(kind=wp), intent(IN) :: r1
        !> Outer radius
        real(kind=wp), intent(IN) :: r2
        !> Number of bins in the detector
        integer,       intent(in) :: nbins
        !> Maximum value to store in bins
        real(kind=wp), intent(in) :: maxval
        !> Boolean on if to store photon's history prior to hitting the detector.
        logical,       intent(in) :: trackHistory

        type(annulus_dect) :: out

        out%pos = pos
        out%dir = dir
        out%layer = layer
        !extra bin for data beyond end of array
        out%nbins = nbins + 1
        out%r1 = r1
        out%r2 = r2
        allocate(out%data(out%nbins))
        out%data = 0.0_wp
        if(nbins == 0)then
            out%bin_wid = 1._wp
        else
            out%bin_wid = maxval / real(nbins, kind=wp)
        end if
        out%trackHistory = trackHistory

    end function init_annulus_dect