1 / 13

Geometry Revisited

Geometry Revisited. Solids. The geometrical characteristics of a detector element like shape and dimensions are managed in Geant4 through the concept of “Solid” The Geant4 solid modeler is STEP compliant. Step is the ISO standard for exchanging geometrical data between CAD systems

quynh
Télécharger la présentation

Geometry Revisited

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Geometry Revisited

  2. Solids • The geometrical characteristics of a detector element like shape and dimensions are managed in Geant4 through the concept of “Solid” • The Geant4 solid modeler is STEP compliant. Step is the ISO standard for exchanging geometrical data between CAD systems • The STEP standard supports multiple solid representations • CSG (Constructive Solid Geometry) are implemented directly as 3D representations. They are very simple to use and to define, they are very efficient as far as tracking is concerned but they are not suitable for describing complicated detector elements (boolean operations expand the CSG functionality quite a lot though) • Boundary Represented Solids (BREP) are defined via the description of their boundary. Hard to use and very inefficient at tracking time, but powerful for building complex geometries • SWEPT solids are not implemented yet

  3. G4VSolid • G4VSolid is the (abstract) base class for solids, physical shapes that can be tracked through • A Solid Store keeps a list of all solids created in a Geant4 application. Costructors and destructor in G4VSolid automatically add/remove a solid to/from the solid store • G4VSolid defines but does not implement methods to compute distances to/from the shapes. Functions are also defined to check whether a point is inside the shape, to return the surface normal at a given point and to compute the extent of a shape • Protected/private utilities are implemented for the clipping of regions (to calculate the extent of a solid) and for visualization purposes G4VSolid *aSolid= new G4Box(“a_box”,10*cm,10*cm,10*cm);

  4. BREPs • BREPs are defined via the description of their boundaries. The boundaries can be made of planar and second order surfaces. The resulting solids are know as Elementary BREPs • Boundary surfaces can be made of Bezier surfaces and B-splines, or of NURBS (Non-Uniform Rational B-Splines) surfaces. These solids are Advanced BREPs • BREPs solids are defined by creating each surface separately and tying them together. Although it is possible to do this using code, it is much more convenient to use a CAD system • Models from a CAD system can be exported utilising the step standard, so BREP solids are normally defined via the use of a STEP reader. • Implemented in G4BREPSolid and derived classes

  5. CSGs • CSGs are defined directly as 3D primitives (complete analogy with the G3 shapes) • G4Box - A box defined by giving its three half-dimensions • G4Tubs - A tube (or a section of tube) defined by giving its radii, its half-length along Z, its extent in PHI • G4Cons - A cone (or a section of cone) defined by giving its radii at +dZ and -dZ, if half-length along Z, its extent in PHI • G4Trd - A wedge, whose X and Y dimensions can vary along the Z axis • G4Trap - A general trapezoid. The faces perpendicular to the Z axis are trapezia and their centres are not necessarily on a line parallel to the Z axis. 11 parameters are needed to define a G4Trap. Twisted trapezoids not implemented yet • G4Para - A general parallelepiped. Six parameters (three half dimensions and three angles) needed to define one

  6. CSGs (2) G4Sphere - A sphere (or a section of a sphere). 6 parameters (two radii and 4 angles) needed to define one. G4Torus - A torus or a torus segment. 5 parameters (inner and outer radius, revolution radius, two angles for specifying its extent in PHI) needed to define one G4Hype - An hyperbolic volume, with curved sides parallel to the Z axis G4Polycone - A set of cylinders and/or cones along the Z axis (PCON in G3) G4Polyhedra - A set of poligones along the Z axis (PGON in G3)

  7. CSGs (3) • Apart from those methods needed to create a shape, all CSGs implement a full set of methods for R/W access to the solids dimensions • G4Box void SetXHalfLength(G4double) G4double GetXHalfLength() void SetYHalfLength(G4double) G4double GetYHalfLength() void SetZHalfLength(G4double) G4double GetZHalfLength() • G4Trd void SetX1HalfLength(G4double) G4double GetX1HalfLength() void SetX2HalfLength(G4double) G4double GetX2HalfLength() void SetY1HalfLength(G4double) G4double GetY1HalfLength() void SetY2HalfLength(G4double) G4double GetY2HalfLength() void SetZHalfLength(G4double) G4double GetZHalfLength()

  8. CSGs (4) • These functions are needed for modifying the solid after it has been created • Create a “big” Logical Volume, fill it up with lots of other volumes, recalculate its dimensions, squeeze it to its minimum permitted size • Careful! The modification of a solid after it has been assigned to the LV causes the LV, the PV etc… to be modified. Just make sure you have things under control • These “modifiers” are used typically in the calculations being made inside the Parameterisations, to modify the solids shape and dimensions (see later)

  9. Displaced solids • All CSGs come with an implicit definition of a coordinate system, used for defining the solids dimensions and for positioning it. • The position of the coordinate system and its orientation wrt the original system can be modified by creating a DisplacedSolid • DisplacedSolids can be used anywhere in the definition of a logical volume G4Box *aBox= new G4Box(“box”,10.,10.,10.); // a standard box. Its // coordinate system is by // default in the center G4RotationMatrix *rm=new G4RotationMatrix; rm->rotateX(90*deg); G4VSolid *displacedBox = new G4DisplacedSolid(“displacedBox”,aBox, rm,G4ThreeVector(-10.,-10.,-10.));

  10. Solids from boolean operations • A very interesting feature of Geant4 is the possibility of combining simple solids with boolean operations • To create such a “new” boolean solid, one needs: • Two solids • a boolean operation (union, intersection, subtraction) • (optionally) a transformation for the second solid • The solids used should be either CSG solids or another boolean solid (result of a previous boolean operation)

  11. Boolean solids #include “G4UnionSolid.hh” #include “G4SubtractionSolid.hh” #include “G4IntersectionSolid.hh” …. G4Box *box1= new G4Box(“Box #1”,20,30,40); G4Tubs *cylinder1= new G4Tubs(“Cylinder #1”,0,50,50,0,2*M_PI); G4VSolid *aUnion=new G4UnionSolid(“Box+Cylinder”,box1,cylinder1); G4VSolid *anIntersection= new G4IntersectionSolid(“Box intersect Cylinder”,box1,cylinder1); G4VSolid *aSubtraction= newG4SubtractionSolid(“Box-Cylinder”,box1,cylinder1);

  12. Boolean solids (2) • The more useful case is the one where one of the solids is displaced from the origin of the coordinates of the first (reference) solid • This can be done • Either by giving a rotation matrix and a translation vector that are used to transform the coordinate system of the first solid to the coordinate system of the second solid (passive method) • or by creating a transformation that moves the second solid from its desired position to its standard position • In the first case the translation is applied first to move the origin of coordinates. Then the rotation is used to rotate the coordinate system of the first solid to the coordinate system of the second solid

  13. Boolean solids (3) G4RotationMatrix *yRot45deg=new G4RotationMatrix; yRot45deg->rotateY(M_PI/4); G4ThreeVector translation(0,0,50); G4VSolid *union1= new G4UnionSolid (“box union cylinder”,box1,cylinder1,yRot45deg,translation); // the same solid with the active method G4RotationMatrix InvRot=*yRot45deg; InvRot.invert(); G4Transform3D transform(InvRot,translation); G4VSolid *union2= new G4UnionSolid (“box union cylinder”,box1,cylinder1,transform);

More Related