Problem 1063

Summary: Problem with patch 01 naming of GDML solids and volumes in loops
Product: Geant4 Reporter: John Watts <john.w.watts>
Component: persistency/gdmlAssignee: Gabriele Cosmo <Gabriele.Cosmo>
Status: RESOLVED FIXED    
Severity: normal CC: tatiana.nikitina
Priority: P5    
Version: 9.2   
Hardware: All   
OS: All   
Attachments: example gdml file with single solid and logical volume with mulitpule placements

Description John Watts 2009-05-08 19:39:57 CEST
One of the changes in patch 01 for geant4.9.2 was a modification to the way G4GDMLRead names solids, logical volumes and physical volumes. G4GDMLRead member GenerateName appends an underscore plus the variable LoopCount to the end of the name generated.  Previous to this change one could make a single solid and a single logical volume then place multiple physical volume into a mother volume in a loop much in the way geant4 is designed to operate.  This allows the generation of repetitive multilevel tree structure geometries. With this change one can only generate flat single level geometries when using loops. I have tried fixing my geometry by using multilevel loops (loop over daughter inside loop over mother.) but the volumeref's in the inner loops generate syntact errors.

I suggest a change to included an option in GDML that preserves the previous naming convention.

Note: The names generated using LoopCount are some what strange. There are gaps in the sequence. One would really like a way reference the individual solids or volumes previously generate in a loop in later parts of the GDML file.
Comment 1 Gabriele Cosmo 2009-05-11 10:49:35 CEST
Can you please provide a simple GDML file illustrating the problem, so we can get quickly to the issue ?
The generation of names for entities inside a loop must be quoted as unique for the parsing process. Entities like logical-volumes or materials, should never be placed inside loops; similar for solids, if their parameters relevant to their dimension are not subject to change.
The value appended to the name refers to a -flat- loop count starting from the innermost loop; it is used for internal reference and should not be considered as a way for referencing the individual entities in the user code. A possibility can be to strip off such extension at the time the entity gets loaded in Geant4, so it will not be visible at all.
Comment 2 John Watts 2009-05-11 21:24:30 CEST
Created attachment 47 [details]
example gdml file with single solid and logical volume with mulitpule placements

The attached gdml file is the loop.gdml file from geant4.9.2/examples/extended/persistance/gdml/G01 with the loops over solids and logical volumes removed.
Before patch 01 this would be processed to create multiple placements of a single logical volume.
Comment 3 Gabriele Cosmo 2009-05-12 17:56:51 CEST
Thanks for providing the test-case. After some corrections applied to it, the problem has been reproduced. Indeed, usage of the loop statement has been now restricted to only handle multiple placements of a volume. Loops over logical-volumes, materials or solids will no longer be considered.