[Gate-users] Annulus cylinder source/phantom pair in Gate 6.2
Marc Chamberland
MarcChamberland at cmail.carleton.ca
Fri Jun 28 15:40:28 CEST 2013
Hi Leo,
I'm replying to the mailing list because I think this might be relevant to other people.
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:
void G4SPSPosDistribution::GeneratePointsInVolume()
{
G4ThreeVector RandPos;
G4double tempx, tempy, tempz;
G4double x, y, z;
x = y = z = 0.;
if(SourcePosType != "Volume" && verbosityLevel >= 1)
G4cout << "Error SourcePosType not Volume" << G4endl;
//Private method to create points in a volume
[Marc's note: I'm skipping some irrelevant lines here]
else if(Shape == "Cylinder")
{
x = Radius*2.;
y = Radius*2.;
while(((x*x)+(y*y)) > (Radius*Radius))
{
x = posRndm->GenRandX();
y = posRndm->GenRandY();
z = posRndm->GenRandZ();
x = (x*2.*Radius) - Radius;
y = (y*2.*Radius) - Radius;
z = (z*2.*halfz) - halfz;
}
}
(This is from the file G4SPSPosDistribution.cc within Geant4's source code.)
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.
It should not be too hard to fix by yourself, though.
Cheers,
Marc
__________________________
Marc Chamberland, MSc
PhD candidate
Department of Physics
Carleton University
Ottawa (ON)
On 2013-06-28, at 9:23 AM, Leo Read <leoread at gmail.com>
wrote:
> Hi Marc,
>
> 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.
>
>
>
> I'd greatly appreciate any advice. I will post the final solution to the forum once I have it sorted out.
>
> Thanks,
> Leo
>
> ##code to define annular phantom
> /gate/world/daughters/name myphantom
> /gate/world/daughters/insert cylinder
> /gate/myphantom/setMaterial Water
> /gate/myphantom/geometry/setRmax 32 cm
> /gate/myphantom/geometry/setRmin 30 cm
> /gate/myphantom/geometry/setHeight 15 cm
>
> /gate/myphantom/vis/forceSolid
> /gate/myphantom/vis/setColor magenta
> /gate/myphantom/vis/setVisible 1
>
> /gate/myphantom/attachPhantomSD
>
> ##code to define source to occupy region defined by the phantom
> /gate/source/addSource mysource
> /gate/source/mysource/setActivity 100000. becquerel
> /gate/source/mysource/gps/particle gamma
> /gate/source/mysource/setType backtoback
> /gate/source/mysource/gps/energytype Mono
> /gate/source/mysource/gps/monoenergy 511 keV
>
> /gate/source/mysource/gps/angtype iso
> #/gate/source/mysource/gps/mintheta 90 deg
> #/gate/source/mysource/gps/maxtheta 90 deg
> #/gate/source/mysource/gps/minphi 0 deg
> #/gate/source/mysource/gps/maxphi 360 deg
>
> /gate/source/mysource/gps/type Volume
> /gate/source/mysource/gps/shape Cylinder
> /gate/source/mysource/gps/radius0 30 cm
> /gate/source/mysource/gps/radius 32 cm
>
> /gate/source/mysource/gps/halfz 7.5 cm
>
> /gate/source/mysource/gps/centre 0.0 0.0 0. mm
>
> /gate/source/list
>
> /gate/source/mysource/visualize 2000 white
>
>
>
> On Fri, Jun 28, 2013 at 8:07 AM, Marc Chamberland <MarcChamberland at cmail.carleton.ca> wrote:
> Hi Leo,
>
> 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.
>
> 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.
>
> Am I missing something?
>
> Marc
>
>
>
> __________________________
>
> Marc Chamberland, MSc
> PhD candidate
> Department of Physics
> Carleton University
> Ottawa (ON)
>
> On 2013-06-28, at 7:56 AM, Leo Read <leoread at gmail.com>
> wrote:
>
>> Hello all,
>>
>> 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?
>>
>> Thank you all for your time and assistance.
>>
>> Best regards,
>> Leo
>> _______________________________________________
>> Gate-users mailing list
>> Gate-users at lists.opengatecollaboration.org
>> http://lists.opengatecollaboration.org/mailman/listinfo/gate-users
>
>
> _______________________________________________
> Gate-users mailing list
> Gate-users at lists.opengatecollaboration.org
> http://lists.opengatecollaboration.org/mailman/listinfo/gate-users
>
More information about the Gate-users
mailing list