Problem 1602 - G4Trap solid not properly written
Summary: G4Trap solid not properly written
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: persistency/gdml (show other problems)
Version: 9.6
Hardware: All All
: P5 trivial
Assignee: tatiana.nikitina
URL:
Depends on:
Blocks:
 
Reported: 2014-04-03 16:37 CEST by Maurik
Modified: 2014-04-11 09:53 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
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.