OpenGATE / Gate

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

GATE Generic pencil beam scanning problem(Physics error) #578

Closed RicardLee9808 closed 1 year ago

RicardLee9808 commented 1 year ago

Dear all Recently i am design a carbon pencil beam scanning model in GATE.While an unexpecetd error happens, Here is the detail

The aim of this project is to design an easy pencil beam scanning model, the beam will be directly transported to a water box. And all spot information is described in two attached files: plan description file and source properties file. Firstly we examed the proton as a particle type. all code runs well. Then the particle type has changed to gerriccion(C-ions). When the energy is lower than 1000 MeV(83.3MeV/u), this project also runs well until the ion energy is higher than 1000MeV. The error information is

-------- EEEE ------- G4Exception-START -------- EEEE ------- *** G4Exception : had001 issued by : G4CrossSectionDataStore::GetIsoCrossSection No isotope cross section found for C12 off Element Nitrogen in Air Z= 7 A= 14 E(MeV)= -nan

This may not be the physicslsit problem cause we choose the recommond physicslist QGSP_BIC_EMY and the error information will disapper if we defind the same source in pencil beam defination form.

image

So here is my question, what cause the cross-section error? Why the energy turns to be nan? The excuatble mac file is attached here, Thanks a lot for your kind help.

Best wishes Richard Lee PlanDescriptionToGATE.txt PlanDescriptionToGATE.txt test.txt Source-Properties.txt

djboersma commented 1 year ago

Hi Richard, I see that you attached the PlanDescriptionToGATE.txt twice and that the mac file is missing. So I suspect that something unintended happened during the upload/attachment part of your issue. Could you try again uploading your mac file? /DavidB

RicardLee9808 commented 1 year ago

Hi Richard, I see that you attached the PlanDescriptionToGATE.txt twice and that the mac file is missing. So I suspect that something unintended happened during the upload/attachment part of your issue. Could you try again uploading your mac file? /DavidB

Hi David The test.txt is the attached main mac file.

Now i had fix this error, the reason why this project can not execute well is the wrong setting of the Source-Properties file. When i change the # energy spread setting , the polynomial parameters specifically. When the energy spread adjusted from 0.027 to 0.0027, the error information will disappear,

Although the error had been fixed, i still feel confused. I do not know why this cause such error. Do u know the cause of this error? Thanks for your help.

djboersma commented 1 year ago

Ah sorry, I should have looked at that test file. We have the convention that "mac" files have a ".mac" suffix, so when I didn't see a file with such a suffix I assumed (wrongly) that there was no mac file. Sorry!

Which release of Gate & Geant4 are you using? Did you do anything special with CLHEP?

RicardLee9808 commented 1 year ago

Ah sorry, I should have looked at that test file. We have the convention that "mac" files have a ".mac" suffix, so when I didn't see a file with such a suffix I assumed (wrongly) that there was no mac file. Sorry!

Which release of Gate & Geant4 are you using? Did you do anything special with CLHEP?

Thanks for your suggestion and sorry for the misunderstanding, I will use a more acceptable name next time.

The GATE version in this project is GATE version 9.1(2021). I did not make any changes with CLHEP and used the recommended physics list for the carbon-ion application. Nothing has been edited since I download GATE from the official website.

andiresch commented 1 year ago

Hi Richard,

in your macro there is a small mistake: you need to uncomment the set particle type command. Otherwise, by default it would run protons. So should look like this: /gate/source/PBS/setParticleType GenericIon /gate/source/PBS/setIonProperties 6 12 6 0

Further, 0.28% energy spread is more realistic than the 2.8% you used.

If I apply both those changes, your example seems to work. I also added a decimal point to all parameters in the source description, just to be sure that it uses a float (probably doesn't change anything though). (maybe you could use G4_WATER as material, and try out a 60 MeV proton and a 120 MeV/n (1440 MeV) carbon ion beam to check if it is correct; both should give you about 30 mm range in g4water).

best, Andreas

Am Do., 9. März 2023 um 02:40 Uhr schrieb carbon @.***>:

Ah sorry, I should have looked at that test file. We have the convention that "mac" files have a ".mac" suffix, so when I didn't see a file with such a suffix I assumed (wrongly) that there was no mac file. Sorry!

Which release of Gate & Geant4 are you using? Did you do anything special with CLHEP?

Thanks for your suggestion and sorry for the misunderstanding, I will use a more acceptable name next time.

The GATE version in this project is GATE version 9.1(2021). I did not make any changes with CLHEP and used the recommended physics list for the carbon-ion application. Nothing has been edited since I download GATE from the official website.

— Reply to this email directly, view it on GitHub https://github.com/OpenGATE/Gate/issues/578#issuecomment-1461139633, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD4TUDRFSCJGDDDXNLDGCVTW3EYKXANCNFSM6AAAAAAVTHW27Y . You are receiving this because you are subscribed to this thread.Message ID: @.***>

djboersma commented 1 year ago

Hi Andreas, Thanks for catching that. But this means that there is a bug. If the user is setting ion parameters, then it's clear that the particle type should be "generic ion". And the GateSourceTPSPencilBeamMessenger.cc code also tries to do that, here:

https://github.com/OpenGATE/Gate/blob/develop/source/physics/src/GateSourceTPSPencilBeamMessenger.cc#L137

But the "SetIsGenericIon" method only sets a boolean flag, it does not set the particle type:

https://github.com/OpenGATE/Gate/blob/develop/source/physics/include/GateSourceTPSPencilBeam.hh#L48

And the pencil beam source itself does not take any action either: if you set an "ion parameter" (implying that generic ion is the desired particle type) then it is doing just that, it sets the ion parameter, it does not automatically set the particle type to generic ion:

https://github.com/OpenGATE/Gate/blob/develop/source/physics/src/GateSourcePencilBeam.cc#L93

It's not a critical bug, but i think it's definitely confusing if you set ion parameters and then it turns out that the generated particles are just protons.

I think the minimal thing to do is to add a warning (a reminder/warning/error to the user to set the particle type to generic ion if ion parameters are set but no explicit particle type). A more invasive fix is to implement somewhere (I can think of at least three places) the logic "if user sets ion parameters then the particle type must be generic ion". (And if the user explicitly configures some other particle type but then anyway sets ion parameters, then Gate should just refuse to run and spit out an unambiguous error message.)

RicardLee9808 commented 1 year ago

Dear Andreas Thanks for your help, I have changed the energy spread from 2.8% to 0.28% and now the project runs well. Maybe this is the error reason, Although I am still confused why such a small energy spread caused a crash. The whole project can move forward now. Thank you again.