Problem 1445 - G4TessellatedSolid Triangular Facets are still creating problems in geant4.9.5.p02.
Summary: G4TessellatedSolid Triangular Facets are still creating problems in geant4.9....
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: geometry (show other problems)
Version: 9.5
Hardware: All All
: P5 major
Assignee: tatiana.nikitina
URL:
Depends on:
Blocks:
 
Reported: 2013-02-20 21:03 CET by alex_leatherland
Modified: 2013-02-27 09:50 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description alex_leatherland 2013-02-20 21:03:30 CET
G4TessellatedSolid is still creating problems in geant4.9.5.p02.

I created the same effective volume arrangement (one 10mm cube in the
world) with with two different approaches. 1) G4TessellatedSolid using
12 triangular facets with extent +/- 5mm, each vertex for defining
facets used the boxes corners. 2) G4Box solid with halfX halfY and halfZ
of 5mm Besides the World volume, no other volumes were used.

For Case (2) a particle will encounter both sides of the box as it is
supposed to.

For Case (1) the first boundary seems to have been missed, no matter the
starting angle. The following G4Exception is reported for particles
originating from -X travelling +dX:

-------- WWWW ------- GException-START -------- WWWW -------
*** G4Exception : GeomNav1002
      isued by : G4Navigator::ComputeStep()
Track stuck or not moving
          Track stuck, not moving for 10 steps
          in volume -World_PV- at point (5,0,0)
          direction: (1,0,0).
          Potential geometry or navigation problem!
          Trying pushing it of 1e-07 mm ...Potential overlap in geometry!

*** This is just a warning message. *** -------- WWWW -------
GException-END --------- WWWW -------

For other directions of travel the same error is listed with
correspondingly different "at point (....)"


I use a GDML script to define the solid. The relevant sections are here:

<define>
  <position name="v1" unit="mm" x="5" y="5" z="5" />
  <position name="v2" unit="mm" x="5" y="5" z="-5" />
  <position name="v3" unit="mm" x="5" y="-5" z="5" />
  <position name="v4" unit="mm" x="5" y="-5" z="-5" />
  <position name="v5" unit="mm" x="-5" y="5" z="5" />
  <position name="v6" unit="mm" x="-5" y="5" z="-5" />
  <position name="v7" unit="mm" x="-5" y="-5" z="5" />
  <position name="v8" unit="mm" x="-5" y="-5" z="-5" />
  <position name="t9" unit="mm" x="0" y="0" z="0" />
  <rotation name="r0" unit="radian" x="0" y="0" z="0" />
</define>

...materials defined, not important for geantinos...

<solids>
  <box aunit="radian" lunit="m" name="WorldBox" x="15" y="15" z="15" />
  <box aunit="radian" lunit="mm" name="BigBox1" x="10" y="10" z="10" />
  <tessellated aunit="radian" lunit="mm" name="BigBox2" />
     <triangular vertex1="v1" vertex2="v3" vertex3="v7" />
     <triangular vertex1="v1" vertex2="v7" vertex3="v5" />
     <triangular vertex1="v6" vertex2="v8" vertex3="v4" />
     <triangular vertex1="v6" vertex2="v4" vertex3="v2" />
     <triangular vertex1="v1" vertex2="v2" vertex3="v4" />
     <triangular vertex1="v1" vertex2="v4" vertex3="v3" />
     <triangular vertex1="v7" vertex2="v8" vertex3="v6" />
     <triangular vertex1="v7" vertex2="v6" vertex3="v5" />
     <triangular vertex1="v1" vertex2="v5" vertex3="v6" />
     <triangular vertex1="v1" vertex2="v6" vertex3="v2" />
     <triangular vertex1="v4" vertex2="v8" vertex3="v7" />
     <triangular vertex1="v4" vertex2="v7" vertex3="v3" />
  </tessellated>
</solids>

.....then there is the structure and setup, tried alternating between
using BigBox1 BigBox2as the solid to define the volume target........



The reason I used GDML is because the implementation I have available for writing GDML

files based on CAD designs, outputs objects defined as tessellated shapes
with triangular facets. So I wanted to confirm that the
G4TesselatedSolid behaved correctly first.


I have also tried the same test of G4TessallatedSolid by hard coding the
volume description into the DetectorConstruction class, and the same
incorrect result emerges.





G4TesselatedSolid* solidTarget = new G4TessellatedSolid("Target");
G4double side = 5*mm;

G4ThreeVector v1(side,side,side);
G4ThreeVector v2(side,side,-side);
G4ThreeVector v3(side,-side,side);
G4ThreeVector v4(side,-side,-side);
G4ThreeVector v5(-side,side,side);
G4ThreeVector v6(-side,side,-side);
G4ThreeVector v7(-side,-side,side);
G4ThreeVector v8(-side,-side,-side);

G4TriangularFacet *f1 = new G4TriangularFacet(v1,v3,v7,ABSOLUTE)
G4TriangularFacet *f2 = new G4TriangularFacet(v1,v5,v7,ABSOLUTE)
G4TriangularFacet *f3 = new G4TriangularFacet(v6,v8,v4,ABSOLUTE)
G4TriangularFacet *f4 = new G4TriangularFacet(v6,v4,v2,ABSOLUTE)
G4TriangularFacet *f5 = new G4TriangularFacet(v1,v2,v4,ABSOLUTE)
G4TriangularFacet *f6 = new G4TriangularFacet(v1,v4,v3,ABSOLUTE)
G4TriangularFacet *f7 = new G4TriangularFacet(v7,v8,v6,ABSOLUTE)
G4TriangularFacet *f8 = new G4TriangularFacet(v7,v6,v5,ABSOLUTE)
G4TriangularFacet *f9 = new G4TriangularFacet(v1,v5,v6,ABSOLUTE)
G4TriangularFacet *f10 = new G4TriangularFacet(v1,v6,v2,ABSOLUTE)
G4TriangularFacet *f11 = new G4TriangularFacet(v4,v8,v7,ABSOLUTE)
G4TriangularFacet *f12 = new G4TriangularFacet(v4,v7,v3,ABSOLUTE)

solidTarget->AddFacet((G4VFacet*) f1);
solidTarget->AddFacet((G4VFacet*) f2);
solidTarget->AddFacet((G4VFacet*) f3);
solidTarget->AddFacet((G4VFacet*) f4);
solidTarget->AddFacet((G4VFacet*) f5);
solidTarget->AddFacet((G4VFacet*) f6);
solidTarget->AddFacet((G4VFacet*) f7);
solidTarget->AddFacet((G4VFacet*) f8);
solidTarget->AddFacet((G4VFacet*) f9);
solidTarget->AddFacet((G4VFacet*) f10);
solidTarget->AddFacet((G4VFacet*) f11);
solidTarget->AddFacet((G4VFacet*) f12);

solidTarget->SetSolidClosed(true)
Comment 1 alex_leatherland 2013-02-22 11:19:17 CET
Further to the issue I have tried assembling the same cubic geometry with 6 G4QuadrangluarFacets

Using the same vertices as described previously.

G4QuadrangluarFacets *q1 = new G4QuadrangluarFacets(v1,v2,v4,v3,Absolute);
G4QuadrangluarFacets *q2 = new G4QuadrangluarFacets(v7,v8,v6,v5,Absolute);
G4QuadrangluarFacets *q3 = new G4QuadrangluarFacets(v5,v6,v2,v1,Absolute);
G4QuadrangluarFacets *q4 = new G4QuadrangluarFacets(v7,v8,v4,v3,Absolute);
G4QuadrangluarFacets *q5 = new G4QuadrangluarFacets(v1,v5,v7,v3,Absolute);
G4QuadrangluarFacets *q6 = new G4QuadrangluarFacets(v2,v6,v8,v4,Absolute);

Then adding these facets to the tessellated shape instead of the triangular ones.


I recieve the same failure to identify the first boundary and G4Exception as when G4TrianglarFacets are used.

Given what was said by Ivana Hrivnacova about extruded solids working correctly with quadrangular facets(1), I suspect it is G4TessellatedSolid might be at fault as well as or instead of G4TriangularFacet.

http://hypernews.slac.stanford.edu/HyperNews/geant4/get/geometry/1257/1/1/1/1.html
Comment 2 tatiana.nikitina 2013-02-22 11:58:18 CET
Dear Alex,
Thank you for reporting the problem and for all your help.

 I have the same results as you have,
 Box created from G4TriangularFacets or G4QuadrangularFacets has difficulty to find the first boundary.
It is definitely a G4TessellatedSolid issue. 
 If I create G4ExtrudedSolid instead, there is no problem with transportation.
I will continue investigate this problem.

Best Regards,
Tatiana.
Comment 3 alex_leatherland 2013-02-25 16:40:02 CET
Hi Tatiana,

Is there anything further I can do to help solve this problem?

Best Regards,

Alex Leatherland

(In reply to comment #2)
> Dear Alex,
> Thank you for reporting the problem and for all your help.
>  I have the same results as you have,
>  Box created from G4TriangularFacets or G4QuadrangularFacets has difficulty to
> find the first boundary.
> It is definitely a G4TessellatedSolid issue. 
>  If I create G4ExtrudedSolid instead, there is no problem with transportation.
> I will continue investigate this problem.
> Best Regards,
> Tatiana.
Comment 4 tatiana.nikitina 2013-02-26 08:31:21 CET
Dear Alex,

If I change the orientation of facets, the problem disappears.
I'm looking now for the explanation for this. 
G4TessellatedSolid working fine, but the documentation about orientation of the facets has to be verified.

Best Regards,
Tatiana.
Comment 5 tatiana.nikitina 2013-02-27 09:50:08 CET
Dear Alex,

The orientation of facets in your case is clockwise when looking from outside of Solid. But it has to be anti-clockwise.
This is the reason why the solid behaviors correctly when one change the orientation of facets.
There is one missing thing in the documentation, that could mislead you,the orientation of the system of coordinates.
In Geant4 right-handed system of coordinates is used. We will add this to documentation.

Best Regards,
Tatiana.