<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
After a bit more of snooping around, the source particles are also generated with a call to the same function, which means that the inner radius of your source will be effectively ignored and you'll be left with a full cylindrical source.
<div><br>
</div>
<div>You'll definitely need to fix the bug in the Geant4 code.<br>
<div><br>
</div>
<div>
<div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div>Marc</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>__________________________</div>
<div><br>
</div>
<div>Marc Chamberland, MSc</div>
PhD candidate<br>
Department of Physics<br>
Carleton University<br>
Ottawa (ON)</div>
</span></div>
<br>
<div>
<div>On 2013-06-28, at 9:40 AM, Marc Chamberland <<a href="mailto:MarcChamberland@cmail.carleton.ca">MarcChamberland@cmail.carleton.ca</a>></div>
<div> wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">Hi Leo,<br>
<br>
I'm replying to the mailing list because I think this might be relevant to other people.<br>
<br>
<br>
Your macro commands looked fine, so my first thought was there must be a problem with the visualization. After a bit of snooping in the source code, I tracked down the source visualization to a call to:<br>
<br>
void G4SPSPosDistribution::GeneratePointsInVolume()<br>
{<br>
G4ThreeVector RandPos;<br>
G4double tempx, tempy, tempz;<br>
G4double x, y, z;<br>
x = y = z = 0.;<br>
if(SourcePosType != "Volume" && verbosityLevel >= 1)<br>
G4cout << "Error SourcePosType not Volume" << G4endl;<br>
//Private method to create points in a volume<br>
<br>
[Marc's note: I'm skipping some irrelevant lines here] <br>
<br>
else if(Shape == "Cylinder")<br>
{<br>
x = Radius*2.;<br>
y = Radius*2.;<br>
while(((x*x)+(y*y)) > (Radius*Radius))<br>
<span class="Apple-tab-span" style="white-space:pre"></span>{<br>
<span class="Apple-tab-span" style="white-space:pre"></span> x = posRndm->GenRandX();<br>
<span class="Apple-tab-span" style="white-space:pre"></span> y = posRndm->GenRandY();<br>
<span class="Apple-tab-span" style="white-space:pre"></span> z = posRndm->GenRandZ();<br>
<br>
<span class="Apple-tab-span" style="white-space:pre"></span> x = (x*2.*Radius) - Radius;<br>
<span class="Apple-tab-span" style="white-space:pre"></span> y = (y*2.*Radius) - Radius;<br>
<span class="Apple-tab-span" style="white-space:pre"></span> z = (z*2.*halfz) - halfz;<br>
<span class="Apple-tab-span" style="white-space:pre"></span>}<br>
}<br>
<br>
<br>
(This is from the file G4SPSPosDistribution.cc within Geant4's source code.)<br>
<br>
As you can see, the visualization of a cylindrical (or annulus) volume does NOT take into account the inner radius (radius0); it only takes into account the outer radius! This is why the source looks wrong. I would consider this a bug in Geant4.<br>
<br>
It should not be too hard to fix by yourself, though.<br>
<br>
Cheers,<br>
Marc<br>
<br>
<br>
<br>
__________________________<br>
<br>
Marc Chamberland, MSc<br>
PhD candidate<br>
Department of Physics<br>
Carleton University<br>
Ottawa (ON)<br>
<br>
On 2013-06-28, at 9:23 AM, Leo Read <<a href="mailto:leoread@gmail.com">leoread@gmail.com</a>><br>
wrote:<br>
<br>
<blockquote type="cite">Hi Marc,<br>
<br>
Thank you for your prompt reply. The reason I posted is because I tried to write the code (see below the figure) to define my annular phantom but got the following result. I must be missing something very trivial as I can't seem to figure out how to get the
source (white dots) to stay occupy the same volume as the phantom.<br>
<br>
<br>
<br>
I'd greatly appreciate any advice. I will post the final solution to the forum once I have it sorted out.<br>
<br>
Thanks,<br>
Leo<br>
<br>
##code to define annular phantom<br>
/gate/world/daughters/name myphantom<br>
/gate/world/daughters/insert cylinder<br>
/gate/myphantom/setMaterial Water<br>
/gate/myphantom/geometry/setRmax 32 cm<br>
/gate/myphantom/geometry/setRmin 30 cm<br>
/gate/myphantom/geometry/setHeight 15 cm<br>
<br>
/gate/myphantom/vis/forceSolid<br>
/gate/myphantom/vis/setColor magenta<br>
/gate/myphantom/vis/setVisible 1<br>
<br>
/gate/myphantom/attachPhantomSD<br>
<br>
##code to define source to occupy region defined by the phantom<br>
/gate/source/addSource mysource<br>
/gate/source/mysource/setActivity 100000. becquerel<br>
/gate/source/mysource/gps/particle gamma<br>
/gate/source/mysource/setType backtoback<br>
/gate/source/mysource/gps/energytype Mono<br>
/gate/source/mysource/gps/monoenergy 511 keV<br>
<br>
/gate/source/mysource/gps/angtype iso<br>
#/gate/source/mysource/gps/mintheta 90 deg<br>
#/gate/source/mysource/gps/maxtheta 90 deg<br>
#/gate/source/mysource/gps/minphi 0 deg<br>
#/gate/source/mysource/gps/maxphi 360 deg<br>
<br>
/gate/source/mysource/gps/type Volume<br>
/gate/source/mysource/gps/shape Cylinder<br>
/gate/source/mysource/gps/radius0 30 cm<br>
/gate/source/mysource/gps/radius 32 cm<br>
<br>
/gate/source/mysource/gps/halfz 7.5 cm<br>
<br>
/gate/source/mysource/gps/centre 0.0 0.0 0. mm<br>
<br>
/gate/source/list<br>
<br>
/gate/source/mysource/visualize 2000 white<br>
<br>
<br>
<br>
On Fri, Jun 28, 2013 at 8:07 AM, Marc Chamberland <<a href="mailto:MarcChamberland@cmail.carleton.ca">MarcChamberland@cmail.carleton.ca</a>> wrote:<br>
Hi Leo,<br>
<br>
I'm not sure what you mean. Gate can create a cylindrical annulus: a cylinder with a different inner and outer radius. This can be used for either a phantom or a source.<br>
<br>
For example, if you want your source to be inside the phantom, you just have to define your source to be exactly the same shape as the phantom.<br>
<br>
Am I missing something?<br>
<br>
Marc<br>
<br>
<br>
<br>
__________________________<br>
<br>
Marc Chamberland, MSc<br>
PhD candidate<br>
Department of Physics<br>
Carleton University<br>
Ottawa (ON)<br>
<br>
On 2013-06-28, at 7:56 AM, Leo Read <<a href="mailto:leoread@gmail.com">leoread@gmail.com</a>><br>
wrote:<br>
<br>
<blockquote type="cite">Hello all,<br>
<br>
I'm new to Gate (using version 6.2) and it seems like there isn't a simple solution to model the commonly used annulus cylindrical phantom with the source embedded inside. Could somebody please help?<br>
<br>
Thank you all for your time and assistance.<br>
<br>
Best regards,<br>
Leo<br>
_______________________________________________<br>
Gate-users mailing list<br>
<a href="mailto:Gate-users@lists.opengatecollaboration.org">Gate-users@lists.opengatecollaboration.org</a><br>
http://lists.opengatecollaboration.org/mailman/listinfo/gate-users<br>
</blockquote>
<br>
<br>
_______________________________________________<br>
Gate-users mailing list<br>
<a href="mailto:Gate-users@lists.opengatecollaboration.org">Gate-users@lists.opengatecollaboration.org</a><br>
http://lists.opengatecollaboration.org/mailman/listinfo/gate-users<br>
<br>
</blockquote>
<br>
<br>
_______________________________________________<br>
Gate-users mailing list<br>
<a href="mailto:Gate-users@lists.opengatecollaboration.org">Gate-users@lists.opengatecollaboration.org</a><br>
http://lists.opengatecollaboration.org/mailman/listinfo/gate-users<br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</body>
</html>