OpenGATE / Gate

Official public repository of Gate
http://www.opengatecollaboration.org
GNU Lesser General Public License v3.0
236 stars 263 forks source link

Simplify convergence and divergence stettings for PBS and TPS source #334

Open GitFuchs opened 4 years ago

GitFuchs commented 4 years ago

Current status

For beam optics (in the PBS and TPS source), the user needs to provide, sigma, divergence, emittance as well as the beam convergence (e.g. converging or diverging beam). Due to the internal code, the sign of the divergence can not be used (squaring). Consequently, an additional parameter, beam convergence is used.

Proposal

I propose to implement the possibility to use the sign of the divergence (negative for convergence, positive for divergence) as a default. The current convergence flags could be used as a backup to keep the macros compatible. If one of the convergence flags is set, these should take precedence.

I believe this could be implemented with minimal changes, while simplifying macros and the overal use of GATE.

djboersma commented 4 years ago

Thanks for bringing this up! I agree that the current implementation of convergence/divergence not ideal. One problem that I see is that for TPS, it's not possible to model a beam that is e.g. divergent at low energies and convergent at high energies. Using the sign of one of the optical parameters would possibly help to remove this limitation.

Question: I think that in your question you use "divergence" to mean the standard deviation of the angular distribution of the source particles, denoted by mSigmaTheta and mSigmaPhi in the code. Right?

It's a pity that "emittance" is defined in such a weird way. Instead of emittance I'd like to use the correlation coefficient rho between position and angle of a particle, which would be -1 for a perfectly convergent beam, zero for a beam that is neither convergent nor divergent (which happens at the "waist" of an initially convergent beam) and +1 for a perfectly divergent beam. The non-diagonal element in the Gaussian (https://github.com/OpenGATE/Gate/blob/develop/source/physics/src/GateSourcePencilBeam.cc#L181) would then be equal to -rho*mSigmaX*mSigmaTheta and similar for the Y and Phi Gaussian. If the "source properties files" would provide a polynomial (or maybe we should use tables instead, like we discussed a while ago) of the correlation coefficient instead of the emittance, then your wish to encode the convergence/divergence as a sign in one of the optical parameters is perfectly implemented, I think.

Your proposal to allow the standard deviation of the angular coordinate to have a sign, positive referring to convergence and negative to divergence, is in my opinion less optimal. Because in the example above, in which a beam is divergent at low energy (mSigmaTheta positive) and convergent at high energy (mSigmaTheta negative), so then there is an energy in between at which mSigmaTheta will be zero (regardless of whether we implement this with polynomials like now or with tables in the near future), while actually the standard deviation of the angles is not zero at all (for this energy the particles happen to be generated at the waist of the beam).

In short:

andiresch commented 4 years ago

Thanks for bringing this topic up again. The current situation with the flags is very bad/dangerous.

The correlation coefficient is in my opinion an excellent idea to implement a diverging/converging beam. I am not familiar with the Gate source code in this area, but is there a need to combine/mix the implementation of tabulated vs. polynomial source description and flag vs. correlation coefficient implementation? Otherwise we could do it step by step or keep both options (tabulated and polynomial).

GrevillotL commented 4 years ago

Hi all,

I used to write the initial code on my own as I was learning about beam optics at IBA during my PhD about 10 years ago… I agree that different descriptions could be used, however the question is about the benefit? If the only purpose is to remove one parameter, the gain is rather little? Or? However I agree with David that additional features could be proposed. I would propose the following features:

[cid:image001.jpg@01D62497.41205D30][cid:image002.jpg@01D62497.41205D30] [cid:image003.jpg@01D62497.41205D30]

Best, Loïc

From: andiresch [mailto:notifications@github.com] Sent: Donnerstag, 7. Mai 2020 11:29 To: OpenGATE/Gate Gate@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [OpenGATE/Gate] Simplify convergence and divergence stettings for PBS and TPS source (#334)

Thanks for bringing this topic up again. The current situation with the flags is very bad/dangerous.

The correlation coefficient is in my opinion an excellent idea to implement a diverging/converging beam. I am not familiar with the Gate source code in this area, but is there a need to combine/mix the implementation of tabulated vs. polynomial source description and flag vs. correlation coefficient implementation? Otherwise we could do it step by step or keep both options (tabulated and polynomial).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FOpenGATE%2FGate%2Fissues%2F334%23issuecomment-625140084&data=02%7C01%7Cloic.grevillot%40medaustron.at%7C4bec1f6ab18b4d99469608d7f269186b%7Cadb749e06dfd4f6fbea8cd9f8e0c9b89%7C0%7C0%7C637244405508792420&sdata=KBbzbGki4rVO6FP5Fc22K6OuMlX6dhQuUAZhwucysdE%3D&reserved=0, or unsubscribehttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAFPJCOI4VSGM4FY3X4YCNELRQJ5OJANCNFSM4M3CM6CQ&data=02%7C01%7Cloic.grevillot%40medaustron.at%7C4bec1f6ab18b4d99469608d7f269186b%7Cadb749e06dfd4f6fbea8cd9f8e0c9b89%7C0%7C0%7C637244405508792420&sdata=qn2cnLAYJapMM7aqGoQMdbrrPx914QAnpgt%2Brdbck9I%3D&reserved=0. Disclaimer: Please notice our E-Mail Disclaimer http://www.medaustron.at/email-disclaimer/