How can i create this geometry?

did you place the second sphere into the first?
otherwise: post the (relevant!) code :wink:

i think you mixed both comments, now you cascade the spheres (sphere 3 is in the world, sphere 2 is inside sphere 3…), but sphere 1 Rmin is not 0. so either cascade/stack, or make them hollow.

second: you try to make two of these sensitive detectors, but the second command command of
fScoringVolume = logicShape1;
fScoringVolume = logicShape2;
will only overwrite the first

and also, I think your world is too small (60cm half length does not fit a 150cm radius sphere :slight_smile: )

try to fix your code by making the mother volume of all 3 spheres the world volume and see if you still have the overlaps?

yes, i am using now only one that is logicShape1 (smallest sphere).

i have changed this to 200cm.

on making world volume as a mother volume for all spheres, now it is not giving the warning. it’s perfect.

i didn’t understand this, can you please elaborate this more, what do you mean by cascading here ? and in sphere 1 , Rmin, i have kept zero but why are saying , i didn’t understand this.

how can i do cascading ? i think , the way i am doing , is creating a hollow sphere.

with „cascading“ I tried to describe the „stacking“ of logical volumes, i.e. the mother volume of the next is the previous volume, so volume in volume in volume … in world.

there is no need to do it that way, sorry that I mentioned it and caused confusion. (and I also mixed up the numbering, in your code sphere 1 was the „innermost“, when I said Rmin was not zero I was actually referring to sphere 3 (the first sphere ;-)) in your code)

for completeness: you could achieve this by making all spheres not hollow, and placing each sphere into the previous, bigger sphere. your code did not work, because you tried to place a smaller sphere into a hollow sphere, thus creating the overlap. there must be no overlap between mother and daughter volume, and the daughter volume must be completely inside the mother volume. the hollow region of the spheres with Rmin>0 counts as outside, of course.
note that there is no need to do the cascading. again sorry for the confusion

working in a sense of “not crashing”, and maybe visualizing the spheres. if you ran a simulation, I am pretty sure that no particles would have ever hit the smallest sphere, as it was outside its mother volume.

looks OK to me, did you test it yourself? no overlap warnings is a first good sign…

now, mother volume of all the spheres is world volume.
and after running a simulation, it looks like this,

But it is taking too much time to complete the simulation just only for one event (since in one event there is a gcr file with 10,000 entries) but i think , for only one event it is taking 3-4 minutes that is too high.
also my system is hanged after running this simulation, even in multi-threading it is also taking the same time , really i am not getting this problem.
can you please help me to figure out this problem , it will be very helpful.
Thanks in advance!

multi-threading will only help speed things up if there are multiple events. each event is computed in one single thread.

how many primary particles do you have per event?
what things have you already tried to speed up the simulation? There is a list of things here: Geant4PerformanceTips < Geant4 < TWiki

10k particles of different energy in one event.

how long does the run take if you make it 1 primary and 10k events?

just one click with multi-threading, it completes if i am using 1 primary with 10k events .

good, that is your solution then

what, sorry, i didn’t understand ?

your simulation is slow when you calculate 10k primaries bunched into one event, and fast when you make it 10k events of 1 primary each…
→ don’t use 10k primaries per event, use 1 primary per event

but for my application, we are creating a space radiation environment so its necessary to do so because we have generated a gcr file by using some model as advanced/radio-protection example does.

but in radio-protection example they have used GPS and for our application we are using particle gun.
so can please tell me one thing, using GPS in place of particle gun can speed up the simulation? will this effect the simulation ?
Thanks
Priyanshu

What exactly do you think makes it necessary that 10k particles are created in a single event? Your histogram having 10k bins does not make 10k particles in one event having each particle a different energy. They are merely sampled from this histogram, and will be a random distribution.

The only thing that I have experienced with gps a while ago is that the position of all particles in one event is the same (This could be on purpose, I don’t know…)

and btw:
Currently histograms are limited to 1024 bins.
https://geant4-userdoc.web.cern.ch/UsersGuides/ForApplicationDeveloper/html/GettingStarted/generalParticleSource.html?highlight=hist#user-defined-histograms

probably not

Why don’t you replace the particle gun with gps and check? It’s only PrimaryGeneratorAction (.hh & .cc) and your macro that you have to change, and you can get inspiration from the radioprotection example…

1 Like