TGeoArb8.h

Go to the documentation of this file.
00001 // @(#)root/geom:$Id: TGeoArb8.h 34058 2010-06-22 12:59:51Z agheata $
00002 // Author: Andrei Gheata   24/10/01
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TGeoArb8
00013 #define ROOT_TGeoArb8
00014 
00015 #ifndef ROOT_TGeoBBox
00016 #include "TGeoBBox.h"
00017 #endif
00018 
00019 
00020 ////////////////////////////////////////////////////////////////////////////
00021 //                                                                        //
00022 // TGeoArb8 - a arbitrary trapezoid with less than 8 vertices standing on //
00023 //   two paralel planes perpendicular to Z axis. Parameters :             //
00024 //            - dz - half length in Z;                                    //
00025 //            - xy[8][2] - vector of (x,y) coordinates of vertices        //
00026 //               - first four points (xy[i][j], i<4, j<2) are the (x,y)   //
00027 //                 coordinates of the vertices sitting on the -dz plane;  //
00028 //               - last four points (xy[i][j], i>=4, j<2) are the (x,y)   //
00029 //                 coordinates of the vertices sitting on the +dz plane;  //
00030 //   The order of defining the vertices of an arb8 is the following :     //
00031 //      - point 0 is connected with points 1,3,4                          //
00032 //      - point 1 is connected with points 0,2,5                          //
00033 //      - point 2 is connected with points 1,3,6                          //
00034 //      - point 3 is connected with points 0,2,7                          //
00035 //      - point 4 is connected with points 0,5,7                          //
00036 //      - point 5 is connected with points 1,4,6                          //
00037 //      - point 6 is connected with points 2,5,7                          //
00038 //      - point 7 is connected with points 3,4,6                          //
00039 //   Points can be identical in order to create shapes with less than     // 
00040 //   8 vertices.                                                          //
00041 //                                                                        //
00042 ////////////////////////////////////////////////////////////////////////////
00043 
00044 class TGeoArb8 : public TGeoBBox
00045 {
00046 protected:
00047    enum EGeoArb8Type {
00048 //      kArb8Trd1 = BIT(25), // trd1 type
00049 //      kArb8Trd2 = BIT(26), // trd2 type
00050       kArb8Trap = BIT(27), // planar surface trapezoid
00051       kArb8Tra  = BIT(28)  // general twisted trapezoid
00052    };
00053    // data members
00054    Double_t              fDz;          // half length in Z
00055    Double_t             *fTwist;       //! [4] tangents of twist angles 
00056    Double_t              fXY[8][2];    // list of vertices
00057 
00058    TGeoArb8(const TGeoArb8&); 
00059    TGeoArb8& operator=(const TGeoArb8&); 
00060 
00061 public:
00062    // constructors
00063    TGeoArb8();
00064    TGeoArb8(Double_t dz, Double_t *vertices=0);
00065    TGeoArb8(const char *name, Double_t dz, Double_t *vertices=0);
00066    // destructor
00067    virtual ~TGeoArb8();
00068    // methods
00069    virtual Double_t      Capacity() const;
00070    virtual void          ComputeBBox();
00071    virtual void          ComputeNormal(Double_t *point, Double_t *dir, Double_t *norm);
00072    void                  ComputeTwist();
00073    virtual Bool_t        Contains(Double_t *point) const;     
00074    Double_t              DistToPlane(Double_t *point, Double_t *dir, Int_t ipl, Bool_t in) const;
00075    virtual Double_t      DistFromInside(Double_t *point, Double_t *dir, Int_t iact=1, 
00076                                    Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
00077    virtual Double_t      DistFromOutside(Double_t *point, Double_t *dir, Int_t iact=1, 
00078                                    Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
00079    virtual TGeoVolume   *Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, 
00080                                 Double_t start, Double_t step);
00081    virtual Double_t      GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const;
00082    virtual void          GetBoundingCylinder(Double_t *param) const;
00083    virtual Int_t         GetByteCount() const {return 100;}
00084    Double_t              GetClosestEdge(Double_t *point, Double_t *vert, Int_t &isegment) const;
00085    virtual Bool_t        GetPointsOnFacet(Int_t /*index*/, Int_t /*npoints*/, Double_t * /*array*/) const;
00086    Double_t              GetDz() const {return fDz;}
00087    virtual Int_t         GetFittingBox(const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz) const;
00088    virtual TGeoShape    *GetMakeRuntimeShape(TGeoShape * /*mother*/, TGeoMatrix * /*mat*/) const {return 0;}
00089    static void           GetPlaneNormal(Double_t *p1, Double_t *p2, Double_t *p3, Double_t *norm);
00090    Double_t             *GetVertices() {return &fXY[0][0];}
00091    Double_t              GetTwist(Int_t iseg) const;
00092    virtual Bool_t        IsCylType() const {return kFALSE;}
00093    static Bool_t         IsSamePoint(Double_t *p1, Double_t *p2) {return (TMath::Abs(p1[0]-p2[0])<1.E-16 && TMath::Abs(p1[1]-p2[1])<1.E-16)?kTRUE:kFALSE;}
00094    static Bool_t         InsidePolygon(Double_t x, Double_t y, Double_t *pts);
00095    virtual void          InspectShape() const;
00096    Bool_t                IsTwisted() const {return (fTwist==0)?kFALSE:kTRUE;}
00097    Double_t              SafetyToFace(Double_t *point, Int_t iseg, Bool_t in) const;
00098    virtual Double_t      Safety(Double_t *point, Bool_t in=kTRUE) const;
00099    virtual void          SavePrimitive(ostream &out, Option_t *option = "");
00100    void                  SetPlaneVertices(Double_t zpl, Double_t *vertices) const;
00101    virtual void          SetVertex(Int_t vnum, Double_t x, Double_t y);
00102    virtual void          SetDimensions(Double_t *param);
00103    void                  SetDz(Double_t dz) {fDz = dz;}
00104    virtual void          SetPoints(Double_t *points) const;
00105    virtual void          SetPoints(Float_t *points) const;
00106    virtual void          Sizeof3D() const;
00107 
00108    ClassDef(TGeoArb8, 1)         // arbitrary trapezoid with 8 vertices
00109 };
00110 
00111 ////////////////////////////////////////////////////////////////////////////
00112 //                                                                        //
00113 // TGeoTrap                                                               //
00114 //                                                                        //
00115 // Trap is a general trapezoid, i.e. one for which the faces perpendicular//
00116 // to z are trapezia and their centres are not the same x, y. It has 11   //
00117 // parameters: the half length in z, the polar angles from the centre of  //
00118 // the face at low z to that at high z, H1 the half length in y at low z, //
00119 // LB1 the half length in x at low z and y low edge, LB2 the half length  //
00120 // in x at low z and y high edge, TH1 the angle w.r.t. the y axis from the//
00121 // centre of low y edge to the centre of the high y edge, and H2, LB2,    //
00122 // LH2, TH2, the corresponding quantities at high z.                      //
00123 //                                                                        //
00124 ////////////////////////////////////////////////////////////////////////////
00125 
00126 class TGeoTrap : public TGeoArb8
00127 {
00128 protected:
00129    // data members
00130    Double_t              fTheta; // theta angle
00131    Double_t              fPhi;   // phi angle
00132    Double_t              fH1;    // half length in y at low z
00133    Double_t              fBl1;   // half length in x at low z and y low edge
00134    Double_t              fTl1;   // half length in x at low z and y high edge
00135    Double_t              fAlpha1;// angle between centers of x edges an y axis at low z
00136    Double_t              fH2;    // half length in y at high z
00137    Double_t              fBl2;   // half length in x at high z and y low edge
00138    Double_t              fTl2;   // half length in x at high z and y high edge
00139    Double_t              fAlpha2;// angle between centers of x edges an y axis at low z
00140 
00141 public:
00142    // constructors
00143    TGeoTrap();
00144    TGeoTrap(Double_t dz, Double_t theta, Double_t phi);
00145    TGeoTrap(Double_t dz, Double_t theta, Double_t phi, Double_t h1,
00146             Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2, 
00147             Double_t tl2, Double_t alpha2);
00148    TGeoTrap(const char *name, Double_t dz, Double_t theta, Double_t phi, Double_t h1,
00149             Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2, 
00150             Double_t tl2, Double_t alpha2);
00151    // destructor
00152    virtual ~TGeoTrap();
00153    virtual Double_t      DistFromInside(Double_t *point, Double_t *dir, Int_t iact=1, 
00154                                    Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
00155    virtual Double_t      DistFromOutside(Double_t *point, Double_t *dir, Int_t iact=1, 
00156                                    Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
00157    virtual TGeoVolume   *Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, 
00158                                 Double_t start, Double_t step);
00159    Double_t              GetTheta() const {return fTheta;}
00160    Double_t              GetPhi() const   {return fPhi;}
00161    Double_t              GetH1() const    {return fH1;}
00162    Double_t              GetBl1() const   {return fBl1;}
00163    Double_t              GetTl1() const   {return fTl1;}
00164    Double_t              GetAlpha1() const   {return fAlpha1;}
00165    Double_t              GetH2() const    {return fH2;}
00166    Double_t              GetBl2() const   {return fBl2;}
00167    Double_t              GetTl2() const   {return fTl2;}
00168    Double_t              GetAlpha2() const   {return fAlpha2;}
00169    virtual TGeoShape    *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const;
00170    virtual void          SetDimensions(Double_t *param);
00171    virtual Double_t      Safety(Double_t *point, Bool_t in=kTRUE) const;
00172    virtual void          SavePrimitive(ostream &out, Option_t *option = "");
00173 
00174    ClassDef(TGeoTrap, 1)         // G3 TRAP shape
00175 };
00176 
00177 ////////////////////////////////////////////////////////////////////////////
00178 //                                                                        //
00179 // TGeoGtra                                                               //
00180 //                                                                        //
00181 // Gtra is a twisted general trapezoid, i.e. one for which the faces perpendicular//
00182 // to z are trapezia and their centres are not the same x, y. It has 12   //
00183 // parameters: the half length in z, the polar angles from the centre of  //
00184 // the face at low z to that at high z, the twist angle, H1 the half length in y at low z, //
00185 // LB1 the half length in x at low z and y low edge, LB2 the half length  //
00186 // in x at low z and y high edge, TH1 the angle w.r.t. the y axis from the//
00187 // centre of low y edge to the centre of the high y edge, and H2, LB2,    //
00188 // LH2, TH2, the corresponding quantities at high z.                      //
00189 //                                                                        //
00190 ////////////////////////////////////////////////////////////////////////////
00191 
00192 class TGeoGtra : public TGeoTrap
00193 {
00194 protected:
00195    // data members
00196    Double_t          fTwistAngle; // twist angle in degrees
00197 public:
00198    // constructors
00199    TGeoGtra();
00200    TGeoGtra(Double_t dz, Double_t theta, Double_t phi, Double_t twist, Double_t h1,
00201             Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2, 
00202             Double_t tl2, Double_t alpha2);
00203    TGeoGtra(const char *name, Double_t dz, Double_t theta, Double_t phi, Double_t twist, Double_t h1,
00204             Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2, 
00205             Double_t tl2, Double_t alpha2);
00206    // destructor
00207    virtual ~TGeoGtra();
00208    virtual Double_t      DistFromInside(Double_t *point, Double_t *dir, Int_t iact=1, 
00209                                    Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
00210    virtual Double_t      DistFromOutside(Double_t *point, Double_t *dir, Int_t iact=1, 
00211                                    Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
00212    virtual TGeoShape    *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const;
00213    Double_t              GetTwistAngle() const {return fTwistAngle;}
00214    virtual void          SetDimensions(Double_t *param);
00215    virtual void          SavePrimitive(ostream &out, Option_t *option = "");
00216  
00217    ClassDef(TGeoGtra, 1)         // G3 GTRA shape
00218 };
00219 
00220 #endif

Generated on Tue Jul 5 14:12:11 2011 for ROOT_528-00b_version by  doxygen 1.5.1