How can i create this geometry?

Hi Experts,
I want to make a geometry in that…
first i want to create a sphere of some radius and then one another sphere filled with different material just outside the sphere 1 of some thickness…and then one another sphere of some thickness filled with different material.

and for this i have done like this…
sphere 1 = Rmin= 0cm and Rmax = acm, material = air
sphere 2= Rmin = acm, Rmax = bcm , material = water
similarly for sphere 3 = Rmin= bcm , Rmax = ccm , and material = Al

then in this my doubt is will this material fill in the radius range only like if i am filling water in second sphere then it should only fill in the range of Rmin = acm & Rmax = bcm . (this i want) it should not be filled outside or inside the sphere (as outside and inside , there are other spheres of different materials so i want this only int this range as a thickness).

but i am not sure i have done right or not , how can i verify this ? also i am attaching the geometry i have created only for two spheres, will do more if my doubt is cleared.

any type of help will be appreciated.
Thanks in advance!
Priyanshu

I don’t see why your approach should not work, doesn’t the image look like what you describe? The volumes do not overlap if you have Rmax of one sphere equal to Rmin of the next… material is only specified for the volume within the sphere shell, so all good! :slight_smile:
Otherwise you could have all spheres with Rmin = 0, and the place the largest sphere1 into the world, and then the next sphere2 into sphere1, and so on - with decreasing Rmax values.

you could verify that the shells are correct for example with a cutawayplane: see help /vis/viewer/set/cutawayPlane
or you attach scorers to the different volumes and obtain doses/volume fluxes/… and check if they are reasonable

means it will not fill the shell inside. actually i was not sure because i was just imaging a hollow ball (like a spherical shell with less thickness) , in this material will be in only shell part not inside but what will be there in this case ?

Not sure what you mean with „inside“, but it will for sure fill the volume between rmin and rmax, and only that. It indeed is a hollow ball!

Edit: you can assign different colors in the gui, That way you see it better

okay. thank you so much for your prompt reply. i just wanted this confirmation.
Thanks
Priyanshu

like upper sphere will behave as a shielding spherical layer of that thickness on the first sphere, right ?

from where i can change this sphere color ? what command i should put ? for both the spheres ?

If you’re working interactively, help at the G4 prompt will get you a simple interface to navigate the command documentations. Go to the /vis section and keep navigating down. The specific command is /vis/geometry/set/colour but there’s a bunch of useful stuff in /vis/geometry/set/*.

You can also set the colors in your C++ code (we do that with our experiment simulation, to make sure everyone’s visualization is consistent and recognizable). See the G4LogicalVolume.hh header file to see how to set visualization attributes like color, transparency, wireframe, etc.

image

or interactively in the scene tree, there should
be a hierarchical list of all volumes. figure out how to click onto them the right way, I don’t know by heart

just make sure they look different…. you could also hide them in the scene tree with a single mouse click, geant4 is really powerful :slight_smile:

Yes, this works really.
Thanks
Priyanshu

Hi,
i didn’t find this in G4LogicalVolume.hh

But i find this here but getting error attached below
https://hep.lancs.ac.uk/~ajf/nd280Geant4Sim/ND280UserDetectorConstruction_8cc_source.html

Can you please help me with this, how can i resolve this or how can i see the exact pointer in place of gMan .
Thanks & Regards
Priyanshu

From G4LogicalVolume.hh:

inline void SetVisAttributes (const G4VisAttributes* pVA);
void  SetVisAttributes (const G4VisAttributes& VA);
  // Gets and sets visualization attributes. A copy of 'VA' on the heap
  // will be made in the case the call with a const reference is used.

In your code, you can call it directly, for instance with

myLV->SetVisAttributes(G4Colour(0.8,0.,0.3));

(G4VisAttributes has an implicit cast constructor from G4Colour).

okay, let me try . i will let you know.
Thanks & Regards
priyanshu


Now i am getting this error.

You can’t set the color or visualization of a material. That’s the first error.

The second error, perhaps you misspelled the name of your local variable?

as you write this command , myLV is name of my logical volume, if i understood right ?
and this is my code in this, my logical volume name is logicEnv
see the attached code SS.

or is there anything i have written wrong as a name of logical volume?

Look at the sequence of lines (including the one you commented out). C++ code is sequential: you cannot use a variable in the code before you have defined it.

oh yes, sorry i didn’t see that .
But again so many warnings

Hmm. I wonder if they tightened things up between 10.6 and 10.7 (we are still using 10.06.p03). Try declaring your own G4VisAttribute object:

G4VisAttribute hdpeColor(G4Colour(0.8,0.0,0.3));    // Arguments are R,G,B fractions
logicEnv->SetVisAttributes(hdpeColor);

Hi,
sorry for coming back to this question.
but when i am doing this, i am getting overlapping error ? so how can i resolve this problem ?

what will it affect ?
is there any problem with this warning ?
and is it something wrong when i run my application with this overlapping warning ?

i think , the geometry i am creating will give this warning because in my geometry , spheres are made for shielding that should be overlapped with one sphere to another like a sphere then inside this one another sphere and one more sphere inside the second sphere.

or is it the right way to create spheres like this ?
or should i create them in a different way. can you please suggest me .

i am getting the error attached below !

Thanks in advance!
Priyanshu