Re: [fluka-discuss]: High resolution x-ray imaging in two steps using mgdraw.f and source.f

From: Andrea Fontana <andrea.fontana_at_pv.infn.it>
Date: Thu, 18 Apr 2019 21:04:05 +0200

Hi Thomas,
    yes, there is a way: simply put the "save matrix" command in the
USREOUT (USeR Event OUtput) routine (not to be confused with USROUT),
which is called after all the particles are transported at the end
of each event (see manual for details).

Please also have a look at the slides on User Routines from the Fluka
advanced course:

https://indico.cern.ch/event/489973/contributions/2000440/attachments/1272042/1972478/09_AdvancedUserRoutines2016.pdf

For your convenience, I attach the general scheme for the sequence
call in a Fluka run.

I have checked in the code and, if you want to get the event number,
NCASE is the simplest way (just an integer). NUMPAR(NPFLKA) is
more general (it is an array), as it is available for each particle
in the stack through the pointer NPFLKA: as you say, for NPFLKA=1
they coincide.

Hope this helps.
Kind regards,
Andrea



On 18/04/2019 19:57, Primidis, Thomas wrote:
>
> Hello Andrea,
>
>
> thank you for the reply. It seems that NCASE from common CASLIM and
> NUMPAR from common FLKSTACK are the same thing?
>
>
> I have managed to do what I wanted but I am left with one problem now.
> How can I save the file at the end of the primary event and not at the
> beginning?
>
>
> At the moment I am having my "save matrix" command in the source.f
> routine and I have an "IF NUMPAR(1).EQ.'some number' THEN save the
> matrix" but this means that it saves it before transporting the last
> of "some number" primary.
>
>
> Is there a way I can call the write command at the end of the user
> defined primary event and not at the beginning?
>
>
> Best,
>
> Thomas
>
> ------------------------------------------------------------------------
> *From:* owner-fluka-discuss_at_mi.infn.it
> <owner-fluka-discuss_at_mi.infn.it> on behalf of Andrea Fontana
> <andrea.fontana_at_pv.infn.it>
> *Sent:* Thursday, April 18, 2019 3:31:58 PM
> *To:* Primidis, Thomas; fluka-discuss
> *Subject:* Re: [fluka-discuss]: High resolution x-ray imaging in two
> steps using mgdraw.f and source.f
> Hi Thomas,
>     interesting problem. One idea is the following: instead of using
> NCASES, you could try to use NCASE (both are in common CASLIM).
>
> NCASES is the number of primary particles requested in input with
> command START and is fixed, while NCASE is the number of the current
> primary and increases event by event. They coincide only at the end
> of the run (if the run is not terminated with an error) and I think
> that you could save your ouput only once because you have used NCASES.
>
> If you use NCASE with a IF instruction, you could save the 2D matrix
> every 100 or 1000 primaries, for example.
>
> I am not sure that this will work, but you could try.
>
> Kind regards,
> Andrea
>
> On 18/04/2019 13:13, Primidis, Thomas wrote:
> >
> > Dear all,
> >
> >
> > I wish to simulate a medical x-ray system that is equipped with a high
> > resolution detector. I would like to see the effect of various source
> > intensities on the image quality. The following description concerns
> > only fully analogue simulations.
> >
> >
> > After simulating just the source with an electron primary beam, I
> > dumped the generated photons on a file. From this initial simulation I
> > got ~6E+5(photons) with 42E+8(electrons) thus an approximate yield of
> > photons/electron=1.6E-4.
> >
> >
> > With post processing of those 6E+5 photons I managed to derive an
> > analytical description of the X-ray beam phase space which then I
> > wrote on a source.f card.
> >
> >
> > I plan on using this source.f card for the second part of the
> > simulation which is photon transport through the phantom and the
> > detector. I have prepared an mgdraw.f card to save photons on a 2D
> > array which represents the pixelated photon counting detector i.e. if
> > a photon enters the detector region, add +1 to the matrix element
> > depending on the photon crossing position. Do not account for any
> > efficiency issues at the moment.
> >
> >
> > I know that the real electron source has 50uA*50ms and I can translate
> > this in total number of electrons and multiplying this with my 1.6E-4
> > yield I get how many photons would exit the real source. That amount
> > of photons I will also sample from my analytical photon source.
> >
> >
> > However, I want not only to see the effect of nominal performance but
> > several cases of lower current as well(thus lower total number of
> > electrons). And do this for 45 different positions of the source as
> > well. So I thought of doing one simulation per position and just save
> > the 2D matrix in intervals, therefore having the image at different
> > total number of electrons(total number of photons in practice).
> >
> >
> > Is there a way I can ask fluka to save this matrix whenever it has
> > finished transporting various user defined number of particles and
> > save these multiple files differently? So far I have managed to only
> > save it once using NUMPAR(1) and NCASES with "save matrix when
> > NUMPAR(1)=NCASES(this also results in the matrix being saved before
> > the last primary has finished transportation).
> >
> >
> > One could suggest getting the <photons>/pixel/primary photons and then
> > multiplying with any number of primary photons to get the resulting
> > image but the high resolution of the detector does not allow for low
> > statistical errors in reasonable time.
> >
> >
> > Best regards,
> >
> > Thomas
> >
>
> --
> ========================================================================
> Dr. Andrea Fontana                    tel: +39 0382 987991
> Istituto Nazionale                    fax: +39 0382 423241
> di Fisica Nucleare
> Sezione di Pavia                      e-mail: andrea.fontana_at_pv.infn.it
> Via Bassi 6                           web   : www.pv.infn.it/~fontana
> <http://www.pv.infn.it/~fontana>
> 27100 PAVIA, Italy
> ========================================================================
>
> __________________________________________________________________________
> You can manage unsubscription from this mailing list at
> https://www.fluka.org/fluka.php?id=acc_info
> <https://www.fluka.org/fluka.php?id=acc_info>
>

-- 
========================================================================
Dr. Andrea Fontana                    tel: +39 0382 987991
Istituto Nazionale                    fax: +39 0382 423241
di Fisica Nucleare
Sezione di Pavia                      e-mail: andrea.fontana_at_pv.infn.it
Via Bassi 6                           web   : www.pv.infn.it/~fontana
27100 PAVIA, Italy
========================================================================



__________________________________________________________________________
You can manage unsubscription from this mailing list at https://www.fluka.org/fluka.php?id=acc_info

Received on Thu Apr 18 2019 - 22:25:48 CEST

This archive was generated by hypermail 2.3.0 : Thu Apr 18 2019 - 22:25:54 CEST