[Gate-users] Comment line on UserSpectrum
David Boersma
david.boersma at acmit.at
Thu May 7 19:45:34 CEST 2020
Dear Hiroshi!
Thank you for reporting this error. I made an attempt at fixing it here:
https://github.com/djboersma/Gate/blob/fix_userspectrum_comments/source/physics/src/GateSPSEneDistribution.cc#L154
The fix does several things. It simplifies the reading process a bit by using more (modern) standard library features than the original code. It allows comment lines anywhere in the input text file and tries to keep the "dimension" of the spectrum correct. When I run this on an example in GateContrib it doesn't crash, but I think more testing is needed before I dare to commit this to the main repository.
Thank you so much for hosting the GATE training at Tohoku university in February, it was a wonderful group of students and a great location to teach GATE!
Best regards,
David Boersma
________________________________
Von: Gate-users <gate-users-bounces at lists.opengatecollaboration.org> im Auftrag von Hiroshi Watabe <watabe at cyric.tohoku.ac.jp>
Gesendet: Mittwoch, 6. Mai 2020 14:23:50
An: gate-users at lists.opengatecollaboration.org
Betreff: [Gate-users] Comment line on UserSpectrum
Dear GATE developers,
Thank you for developing the wonderful software.
Today I've struggled to solve a problem to run GATE (I'm currently
running GATE9 but I believe it happens in the previous versions).
I defined a source with user-defined energy spectrum as follows;
/gate/source/spectrumLine/gps/energytype UserSpectrum
/gate/source/spectrumLine/gps/setSpectrumFile DiscreteSpectrum.txt
In DiscreteSpectrum.txt, if I put # (comment out) at the beginning of
the energy-spectrum definition, Gate cannot
correctly read the energy spectrum and become all 0.
For example
DiscreteSpectrum.txt
1 0
#0.4 0.02
0.5 0.01
0.6 0.02
0.8 0.03
does not work.
I'm not sure this is correct modification but to avoid this error,
I modified physics/src/GateSPSEneDistribution.cc
as follows;
*** 177,183 ****
inputFile.seekg(cursorPosition, inputFile.beg); // return to the
2nd line in the file
while(nline < mDimSpectrum) {
- skipComment(inputFile);
inputFile >> energyRead;
inputFile >> probaRead;
--- 177,182 ----
Best regards,
Hiroshi
p.s. Lydia and David, thank you for organizing GATE
course in Sendai this Feb. I hope COVID-19 does not effect your work
for GATE.
--
--------------------------------------------------
Hiroshi Watabe, PhD
hwatabe at tohoku.ac.jp
Division of Radiation Protection & Safety Control,
Cyclotron and Radioisotope Center,
Tohoku University
6-3 Aoba, Aramaki, Aoba, Sendai 980-8578 Japan
Tel:+81-22-795-7803 Fax:+81-22-795-7809
--------------------------------------------------
_______________________________________________
Gate-users mailing list
Gate-users at lists.opengatecollaboration.org
http://lists.opengatecollaboration.org/mailman/listinfo/gate-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opengatecollaboration.org/pipermail/gate-users/attachments/20200507/d29a5733/attachment.html>
More information about the Gate-users
mailing list