Problem 1912

Summary: replicavol around direction phi requires width in length unit instead of angle unit
Product: Geant4 Reporter: Wouter Deconinck <wdconinc>
Component: persistency/gdmlAssignee: Witold.Pokorski
Status: RESOLVED FIXED    
Severity: minor    
Priority: P4    
Version: 10.2   
Hardware: All   
OS: All   

Description Wouter Deconinck 2016-11-16 17:43:43 CET
When using <replicavol> to create replicated volumes in gdml, the <width value="" unit=""> tag does not accept units other than lengths. When replicating around direction="phi", this requires the user to enter a width value in radians with unit mm (which is defined identical to 1). 

Code that fails to run:
    <replicavol number="7">
      <volumeref ref="pionDetectorGEMOpenSector_logical"/>
      <replicate_along_axis>
        <direction phi="1"/>
        <width value="360.0/7.0" unit="deg"/>
        <offset value="0.0" unit="deg"/>
      </replicate_along_axis>
    </replicavol>

Work-around:
    <replicavol number="7">
      <volumeref ref="pionDetectorGEMOpenSector_logical"/>
      <replicate_along_axis>
        <direction phi="1"/>
        <width value="2.0*pi/7.0" unit="mm"/> <!-- bug geant4.10.02.p02: unit must be a length, but mm == 1 -->
        <offset value="0.0" unit="mm"/>
      </replicate_along_axis>
    </replicavol>

The bug is caused by G4GDMLReadStructure::QuantityRead which throws an exception in line 559 when the unit is not of the category length.

Suggested solution could be to relax the requirement in QuantityRead, or to pass the axis in ReplicaRead and check accordingly (this requires the <direction> tag to appear before <width> and <offset>).
Comment 1 Gabriele Cosmo 2016-11-23 17:18:46 CET
Thanks, the problem is now fixed in the development version and will be available in the next release of Geant4.