Problem 1602

Summary: G4Trap solid not properly written
Product: Geant4 Reporter: Maurik <holtrop>
Component: persistency/gdmlAssignee: tatiana.nikitina
Status: RESOLVED FIXED    
Severity: trivial    
Priority: P5    
Version: 9.6   
Hardware: All   
OS: All   

Description Maurik 2014-04-03 16:37:00 CEST
Any G4Trap volume is not properly written if the "theta" angle is negative, with "phi=0", OR, if "theta" is positive and "phi=180".

The fix is rather simple. In the file G4GDMLWriteSolids.cc line 651, method TrapWrite, use the G4ThreeVector methods theta() and phi() to get the angles. See code snippet, instead of the incorrect calculation using aran(y/x), since y is zero and x negative.

--------------------------

void G4GDMLWriteSolids::
TrapWrite(xercesc::DOMElement* solElement, const G4Trap* const trap)
{
   const G4String& name = GenerateName(trap->GetName(),trap);

   const G4ThreeVector& simaxis = trap->GetSymAxis();
   const G4double phi =  simaxis.phi();// (simaxis.z() != 1.0)? (std::atan(simaxis.y()/simaxis.x())) : (0.0);
   const G4double theta = simaxis.theta(); //std::acos(simaxis.z());
Comment 1 Maurik 2014-04-05 00:54:48 CEST
The exact same problem occurs on lines 376 and 376 for the G4Para.
Comment 2 Gabriele Cosmo 2014-04-11 09:53:15 CEST
Thanks for reporting this. The fix is now introduced in the development version and will be part of a future patch/release.