init_circle_dect Function

private function init_circle_dect(pos, dir, layer, radius, nbins, maxval, trackHistory) result(out)

Initalise Circle 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) :: radius

Radius of the detector

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(circle_dect)


Source Code

    function init_circle_dect(pos, dir, layer, radius, nbins, maxval, trackHistory) result(out)
        !! Initalise Circle detector
        !> Centre of detector
        type(vector),  intent(in) :: pos
        !> Normal of the detector
        type(vector),  intent(in) :: dir
        !> Layer ID
        integer,       intent(in) :: layer
        !> Number of bins in the detector
        integer,       intent(in) :: nbins
        !> Radius of the detector
        real(kind=wp), intent(in) :: radius
        !> 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(circle_dect) :: out

        out%dir = dir
        out%pos = pos
        out%layer = layer
        !extra bin for data beyond end of array
        out%nbins = nbins + 1
        out%radius = radius
        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-1, kind=wp)
        end if
        out%trackHistory = trackHistory

    end function init_circle_dect