library: libGeom #include "TGeoXtru.h"

# TGeoXtru

class description - source file - inheritance tree (.pdf)

## class TGeoXtru : public TGeoBBox

| Inheritance Chart:
`TObject`
| <- | `TNamed`
| <- | `TGeoShape`
| <- | `TGeoBBox`
| <- | `TGeoXtru` |

        protected:

          Double_t DistToPlane(Double_t* point, Double_t* dir, Int_t iz, Int_t ivert, Double_t stepmax, Bool_t in) const
              void GetPlaneNormal(const Double_t* vert, Double_t* norm) const
              void GetPlaneVertices(Int_t iz, Int_t ivert, Double_t* vert) const
            Bool_t IsPointInsidePlane(Double_t* point, Double_t* vert, Double_t* norm) const
          Double_t SafetyToSector(Double_t* point, Int_t iz, Double_t safmin)
              void SetIz(Int_t iz)
              void SetSeg(Int_t iseg)

        public:

                                   TGeoXtru()
                                   TGeoXtru(Int_t nz)
                                   TGeoXtru(Double_t* param)
                                   TGeoXtru(const TGeoXtru&)
                           virtual ~TGeoXtru()
                    static TClass* Class()
                      virtual void ComputeBBox()
                      virtual void ComputeNormal(Double_t* point, Double_t* dir, Double_t* norm)
                    virtual Bool_t Contains(Double_t* point) const
                            Bool_t DefinePolygon(Int_t nvert, const Double_t* xv, const Double_t* yv)
                      virtual void DefineSection(Int_t snum, Double_t z, Double_t x0 = 0., Double_t y0 = 0., Double_t scale = 1.)
                     virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
                  virtual Double_t DistFromInside(Double_t* point, Double_t* dir, Int_t iact = 1, Double_t step = TGeoShape::Big(), Double_t* safe = 0) const
                  virtual Double_t DistFromOutside(Double_t* point, Double_t* dir, Int_t iact = 1, Double_t step = TGeoShape::Big(), Double_t* safe = 0) const
          virtual const TBuffer3D& GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
                virtual TGeoShape* GetMakeRuntimeShape(TGeoShape*, TGeoMatrix*) const
                     virtual Int_t GetNmeshVertices() const
                             Int_t GetNvert() const
                             Int_t GetNz() const
                          Double_t GetScale(Int_t i) const
                          Double_t GetX(Int_t i) const
                          Double_t GetXOffset(Int_t i) const
                          Double_t GetY(Int_t i) const
                          Double_t GetYOffset(Int_t i) const
                         Double_t* GetZ() const
                          Double_t GetZ(Int_t ipl) const
                      virtual void InspectShape() const
                   virtual TClass* IsA() const
                virtual TBuffer3D* MakeBuffer3D() const
                         TGeoXtru& operator=(const TGeoXtru&)
                  virtual Double_t Safety(Double_t* point, Bool_t in = kTRUE) const
                      virtual void SavePrimitive(ofstream& out, Option_t* option)
                              void SetCurrentVertices(Double_t x0, Double_t y0, Double_t scale)
                              void SetCurrentZ(Double_t z, Int_t iz)
                      virtual void SetDimensions(Double_t* param)
                      virtual void SetPoints(Double_t* points) const
                      virtual void SetPoints(Float_t* points) const
                      virtual void SetSegsAndPols(TBuffer3D& buff) const
                      virtual void ShowMembers(TMemberInspector& insp, char* parent)
                      virtual void Sizeof3D() const
                      virtual void Streamer(TBuffer& b)
                              void StreamerNVirtual(TBuffer& b)
                         Double_t& Z(Int_t ipl)

### Data Members

        protected:

                 Int_t fNvert     number of vertices of the 2D polygon (at least 3)
                 Int_t fNz        number of z planes (at least two)
              Double_t fZcurrent  current Z position
          TGeoPolygon* fPoly      polygon defining section shape
             Double_t* fX         [fNvert] X positions for polygon vertices
             Double_t* fY         [fNvert] Y positions for polygon vertices
             Double_t* fXc        [fNvert] current X positions for polygon vertices
             Double_t* fYc        [fNvert] current Y positions for polygon vertices
             Double_t* fZ         [fNz] array of Z planes positions
             Double_t* fScale     [fNz] array of scale factors (for each Z)
             Double_t* fX0        [fNz] array of X offsets (for each Z)
             Double_t* fY0        [fNz] array of Y offsets (for each Z)
                 Int_t fSeg       !current segment [0,fNvert-1]
                 Int_t fIz        !current z plane [0,fNz-1]

## Class Description

TGeoXtru()

     dummy ctor

TGeoXtru(Int_t nz) :TGeoBBox(0, 0, 0)

     Default constructor

TGeoXtru(Double_t *param) :TGeoBBox(0, 0, 0)

     Default constructor in GEANT3 style
     param[0] = nz  // number of z planes

     param[1] = z1  // Z position of first plane
     param[2] = x1  // X position of first plane
     param[3] = y1  // Y position of first plane
     param[4] = scale1  // scale factor for first plane
     ...
     param[4*(nz-1]+1] = zn
     param[4*(nz-1)+2] = xn
     param[4*(nz-1)+3] = yn
     param[4*(nz-1)+4] = scalen

~TGeoXtru()

     destructor

void ComputeBBox()

     compute bounding box of the pcon

void ComputeNormal(Double_t * /*point*/, Double_t *dir, Double_t *norm)

     Compute normal to closest surface from POINT.

Bool_t Contains(Double_t *point) const

     test if point is inside this shape
     Check Z range

Int_t DistancetoPrimitive(Int_t px, Int_t py)

     compute closest distance from point px,py to each corner

Double_t DistToPlane(Double_t *point, Double_t *dir, Int_t iz, Int_t ivert, Double_t stepmax, Bool_t in) const

     Compute distance to a Xtru lateral surface.

Double_t DistFromInside(Double_t *point, Double_t *dir, Int_t iact, Double_t step, Double_t *safe) const

     compute distance from inside point to surface of the polycone
     locate Z segment

Double_t DistFromOutside(Double_t *point, Double_t *dir, Int_t iact, Double_t step, Double_t *safe) const

     compute distance from outside point to surface of the tube
       Warning("DistFromOutside", "not implemented");

Bool_t DefinePolygon(Int_t nvert, const Double_t *xv, const Double_t *yv)

     Creates the polygon representing the blueprint of any Xtru section.
       nvert     = number of vertices >2
       xv[nvert] = array of X vertex positions
       yv[nvert] = array of Y vertex positions
     *NOTE* should be called before DefineSection or ctor with 'param'

void DefineSection(Int_t snum, Double_t z, Double_t x0, Double_t y0, Double_t scale)

     defines z position of a section plane, rmin and rmax at this z.

Double_t GetZ(Int_t ipl) const

void GetPlaneNormal(const Double_t *vert, Double_t *norm) const

     Returns normal vector to the planar quadrilateral defined by vector VERT.
     The normal points outwards the xtru.

void GetPlaneVertices(Int_t iz, Int_t ivert, Double_t *vert) const

     Returns (x,y,z) of 3 vertices of the surface defined by Z sections (iz, iz+1)
     and polygon vertices (ivert, ivert+1). No range check.

Bool_t IsPointInsidePlane(Double_t *point, Double_t *vert, Double_t *norm) const

     Check if the quadrilateral defined by VERT contains a coplanar POINT.

void InspectShape() const

     Print actual Xtru parameters.

TBuffer3D* MakeBuffer3D() const

     Creates a TBuffer3D describing *this* shape.
     Coordinates are in local reference frame.

void SetSegsAndPols(TBuffer3D &buff) const

     Fill TBuffer3D structure for segments and polygons.

Double_t SafetyToSector(Double_t *point, Int_t iz, Double_t safmin)

     Compute safety to sector iz, returning also the closest segment index.

Double_t Safety(Double_t *point, Bool_t in) const

     computes the closest distance from given point to this shape, according
     to option. The matching point on the shape is stored in spoint.
    ---> localize the Z segment

void SavePrimitive(ofstream &out, Option_t * /*option*/)

     Save a primitive as a C++ statement(s) on output stream "out".

void SetCurrentZ(Double_t z, Int_t iz)

     Recompute current section vertices for a given Z position within range of section iz.

void SetCurrentVertices(Double_t x0, Double_t y0, Double_t scale)

     Set current vertex coordinates according X0, Y0 and SCALE.

void SetDimensions(Double_t *param)

     param[0] = nz  // number of z planes

     param[1] = z1  // Z position of first plane
     param[2] = x1  // X position of first plane
     param[3] = y1  // Y position of first plane
     param[4] = scale1  // scale factor for first plane
     ...
     param[4*(nz-1]+1] = zn
     param[4*(nz-1)+2] = xn
     param[4*(nz-1)+3] = yn
     param[4*(nz-1)+4] = scalen

void SetPoints(Double_t *points) const

     create polycone mesh points

void SetPoints(Float_t *points) const

     create polycone mesh points

Int_t GetNmeshVertices() const

     Return number of vertices of the mesh representation

void Sizeof3D() const

    /// fill size of this 3-D object
    /   TVirtualGeoPainter *painter = gGeoManager->GetGeomPainter();
    /   if (!painter) return;

    /   Int_t numPoints = fNz*fNvert;
    /   Int_t numSegs   = fNvert*(2*fNz-1);
    /   Int_t numPolys  = fNvert*(fNz-1)+2;
    /   painter->AddSize3D(numPoints, numSegs, numPolys);

void Streamer(TBuffer &R__b)

     Stream an object of class TGeoVolume.

const TBuffer3D& GetBuffer3D(Int_t reqSections, Bool_t localFrame) const

### Inline Functions

                   void SetIz(Int_t iz)
                   void SetSeg(Int_t iseg)
                  Int_t GetNz() const
                  Int_t GetNvert() const
               Double_t GetX(Int_t i) const
               Double_t GetY(Int_t i) const
               Double_t GetXOffset(Int_t i) const
               Double_t GetYOffset(Int_t i) const
               Double_t GetScale(Int_t i) const
               Double_t GetZ(Int_t ipl) const
             TGeoShape* GetMakeRuntimeShape(TGeoShape*, TGeoMatrix*) const
              Double_t& Z(Int_t ipl)
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void StreamerNVirtual(TBuffer& b)
               TGeoXtru TGeoXtru(const TGeoXtru&)
              TGeoXtru& operator=(const TGeoXtru&)

Author: Mihaela Gheata 24/01/04
Last update: root/geom:$Name: $:$Id: TGeoXtru.cxx,v 1.26 2005/05/17 12:00:23 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *