GeantTips: Difference between revisions

From Mu2eWiki
Jump to navigation Jump to search
No edit summary
 
Line 24: Line 24:


  G4Tet  (tetrahedron)
  G4Tet  (tetrahedron)
  Generic polycone and polyhedron (the ones one can make a Christmas tree with)
  Generic polycone and polyhedron
  Twisted solids
  Twisted solids
  CSGfaceted  
  CSGfaceted  
Line 30: Line 30:
  displaced solid
  displaced solid


Please take that into account when using them in the Geant4 code defining the geometry.
The list may not be fully complete. Please take that into account when using them in the Geant4 code defining the geometry.
In general it is a good idea to verify if a solid that has not been used in the geometry is displayable by a display program.
In general it is a good idea to verify if a solid that has not been used in the geometry is displayable by a display program.

Latest revision as of 20:44, 16 August 2024

Introduction

Duplicate volume names

In G4 it is legal to create multiple logical volumes with the same name. For many purposes this is just fine; in particular G4 itself will work just fine. However if you do this there is one feature of G4 you must never use or it will silently produce incorrect results and without warning.

The class G4LogicalVolumeStore provides a member function:

G4LogicalVolume* G4LogicalVolumeStore::GetVolume( G4String const& );

This function returns a pointer to the *first* G4LogicalVolume whose name matches the G4String argument. Here "first" means the first volume encountered by looping over the store. If there are multiple volumes with the same name you can never access the second or subsequent volumes this way.

If you need to do something to all of the volumes with the same name, you need to loop over the volume store and find each match yourself.

G4 Solids unknown to ROOT (and therefore ROOT based display programs)

As of August 2024 the following G4 solids were not supported by ROOT

G4Tet  (tetrahedron)
Generic polycone and polyhedron
Twisted solids
CSGfaceted 
multi-union
displaced solid

The list may not be fully complete. Please take that into account when using them in the Geant4 code defining the geometry. In general it is a good idea to verify if a solid that has not been used in the geometry is displayable by a display program.