Message: Problem with G4IntersectionSolid Not Logged In (login)

## Problem with G4IntersectionSolid

Forum: Geometry
Date: 22 Feb, 2006
From: Emanuele Leonardi <Emanuele Leonardi>

 ```I am creating a diaphragm-like slice by intersecting two cylindrical sectors (see my previous post "Special cylindrical sector"). I am currently using G4 v.8.0. The code I use is the following: /------------------------------------------------------------------/ G4IntersectionSolid* TileCalDetectorConstruction::DiaphragmSlice (G4double inRadius, G4double outRadius, G4double zLength, G4double delta, G4double phi) { // Create AECF slice G4Tubs* bigSlice = new G4Tubs("bigSlice",inRadius,outRadius,0.5*zLength,0.,phi+delta); // Create AVQ slice G4double AD = sqrt(outRadius*outRadius+inRadius*inRadius-2.*outRadius*inRadius*cos(phi)); G4double sinA = inRadius*sin(phi)/AD; G4double cosA = (outRadius-inRadius*cos(phi))/AD; G4double alpha = atan2(sinA,cosA); G4double tgD2 = tan(0.5*delta); G4double AV = outRadius*(cosA+tgD2*sinA); G4Tubs* cutSlice = new G4Tubs("cutSlice",0.,AV,0.5*zLength,-alpha,delta); // Displace AVQ slice and create intersection volume G4double xV = outRadius*sinA*(sinA-tgD2*cosA); G4double yV = outRadius*sinA*(cosA+tgD2*sinA); G4ThreeVector translation(xV,yV,0.); G4IntersectionSolid* diaphragmSlice = new G4IntersectionSolid("diaphragmSlice",bigSlice,cutSlice,0,translation); G4cout << "r " << inRadius << " R " << outRadius << " delta " << delta << " phi " << phi << G4endl << "sinA " << sinA << " cosA " << cosA << " alpha " << alpha << " tgD2 " << tgD2 << " AD " << AD << " AV " << AV << " xV,yV " << xV << "," << yV << G4endl; return diaphragmSlice; } /------------------------------------------------------------------/ Given the construction method, I would expect that the four intersection points of the two sectors sit 2 on the internal radius of "bigSlice" and 2 on the external radius of "bigSlice". While inspecting the resulting solid by looking at the coordinates of the vertexes, I found that this is not the case. As an example, I set the following parameters: G4double inRadius = 8.*cm; G4double outRadius = 12.*cm; G4double zLength = 1.*cm; G4double delta = 0.5880026*rad; G4double phi = 0.46364761*rad; Some (more-or-less) simple trigonometrics give the following intersection coordinates (all measures are in cm): A(12,0) B(9.9846,6.6564) C(3.9691,6.9459) D(7.1554,3.5777) But a dump of the G4Polyhedron vertexes gives the following list: V 1 11.5876 3.11873 0.5 cm V 2 10.3789 6.02312 0.5 cm V 3 6.91928 4.01541 0.5 cm V 4 5.63793 5.67571 0.5 cm V 5 3.96911 6.94595 0.5 cm V 6 11.9999 0.000529901 -0.499823 cm V 7 11.5876 3.11873 -0.499823 cm V 8 11.9999 0.000529901 0.5 cm V 9 11.2643 3.89564 -0.499823 cm V 10 10.3789 6.02312 -0.499823 cm V 11 9.88633 6.66139 -0.499823 cm V 12 9.88633 6.66139 0.5 cm V 13 7.0772 3.63595 -0.499823 cm V 14 6.91928 4.01541 -0.499823 cm V 15 7.0772 3.63595 0.5 cm V 16 5.63793 5.67571 -0.499823 cm V 17 5.08623 6.09564 -0.499823 cm V 18 3.96911 6.94595 -0.499823 cm V 19 8.79525 2.36718 0.5 cm V 20 6.76622 6.81157 0.5 cm V 21 3.96925 6.94619 0.5 cm V 22 3.96925 6.94619 -0.499823 cm As you see the 4 intersection points appear to be at A(11.9999,0.0005) ~OK B(9.88633,6.66139) NO! radius~11.92cm (<>12cm) C(3.96911,6.94595) ~OK D(7.0772,3.64595) NO! radius~7.96cm (<>8cm) A visual scan of the solid confirms the discrepancy. From the numerical point of view, the printout in DiaphragmSlice shows the expected values for all the relevant quantities (values are here in mm and rad): r 80 R 120 delta 0.588003 phi 0.463648 sinA 0.594061 cosA 0.80442 alpha 0.636098 tgD2 0.302776 AD 60.2246 AV 118.114 xV,yV 24.9864,70.1672 Does anybody have a clue of where the problem is? Emanuele Leonardi ```

1 Re: Problem with G4IntersectionSolid   (John Apostolakis - 22 Feb, 2006)  Re: Problem with G4IntersectionSolid   (Emanuele Leonardi - 23 Feb, 2006)  Re: Problem with G4IntersectionSolid   (Emanuele Leonardi - 23 Feb, 2006)
 to: "Problem with G4IntersectionSolid"
This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]