Message: Re: Particles Dont Recognize Parameterized MLC Geometries Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Particles Dont Recognize Parameterized MLC Geometries  

Forum: Geometry
Re: Question Particles Dont Recognize Parameterized MLC Geometries (Oguzhan Ayrancioglu)
Re: None Re: Particles Dont Recognize Parameterized MLC Geometries (John Apostolakis)
Date: 22 May, 2018
From: John Apostolakis <John Apostolakis>

Dear Oguzhan,

I noticed that you are allocating a Rotation Matrix (with a new) each time that ComputeTransformation is called.

This will cause a memory leak because ComputeTransformation is called during the navigation of each track that touches any of the volumes.  ( It is inside the event loop. )

The idea of having parameterisations was to be able to cope with a very large number of volumes. Twenty years ago
it made sense to use it if you had thousands of volumes, as it avoided having a separate object in memory (a physical volume) for every volume represented by the parameterisation.

1) If you are using the parameterisation to represent less than 1,000 volumes, it is simpler and more performant to just create the relevant copies as physical volumes in memory.

2) If you decide to keep using parameterisations you will need to consider whether you are using or plan to use multi-threading for your application.  If not it would be enough to pre-allocate one copy of the rotation matrix for each Parameteristion instance (e.g. as a member variable).

3) If you do use parameterised volumes and plan to use multi-threading then something like the following code is needed in your parameterisation to ensure that you have one rotation matrix per thread - as required to ensure that

G4ThreadLocal G4RotationMatrix* fRot;

ChangeRotMatrix( G4VPhysicalVolume *physVol, G4double rotZ ) const
  if (!fRot)
    fRot = new G4RotationMatrix();
  fRot->rotateZ( rotZ );

Best regards,
John Apostolakis,  EP Department, CERN

On 17 May 2018, at 17:17, John Apostolakis <<>> wrote:

Dear Oguzhan,

Typically a volume is ignored in a Geant4 simulation if it is incorrectly placed - e.g. if it placed complete outside its parent volume.

With the complexity of your geometry description, it is difficult to verify whether this is the case by inspecting your code.

I suggest to run the overlap checking for your geometry, which should help you to identify many of the geometry errors that could result in volumes not been intersected in the simulation.

After this, I suggest to try tracking with a few simple ‘rays’  (either geantinos or gammas) with verbose tracking to see whether the volumes that you expect to be cross in your simulation are seen by Geant4 tracking.

Best regards,

On 15 May 2018, at 15:46, Oguzhan Ayrancioglu <<>> wrote:

*** Discussion title: Geometry


I try to build Medical Linear Accelerator (Linac) geometry and also use
phasespace files as a generator on that build. So i created some of
parts of the Linac like Jaws, Baseplate under the Jaws, Phantom and

I used parameterization algorithm for creating MLCs but there is
something wrong about it. What i mean i set the MLCs by using
parameterized volumes and place them into seperated containers cause of
GEANT4 wanted me to divide parameterized volumes into different logical
volumes. GEANT4 warns me that one logical volume (in that case
containers) has only the same parameterized volumes' logical volume. So
i created 2 of MLCs that have different geometry and then parameterized
them into 4 of containers which are "CarriageA +X" , "CarriageA -X",
"CarriageB +X", "CarriageB -X"

When i run my simulation scoring deposit doses, particles go through the
parameterized-MLCs and nothing happens.. parameterized-MLCs dont block
the particles like they are not there.. I see them all in the QT as a
solid geometries but they dont interact with the particles. When i get
the scoring datas there are just 2 of MLCs that blocks the particles and
the others don't. You can see in the figure at attachment. Also i upload
my geometry source files so you can find them too.

Thank you for help,



Visit this GEANT4 at<> message (to reply or unsubscribe) at:

 [ MIME part of type text/html without a name stripped ]

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Sad: Particles Dont Recognize Parameterized MLC Geometries   (Oguzhan Ayrancioglu - 06 Jun, 2018)
 Add Message Add Message
to: "Re: Particles Dont Recognize Parameterized MLC Geometries "

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]