Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TGeoXtru.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/geom:$Id$
0002 // Author: Mihaela Gheata   24/01/04
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGeoXtru
0013 #define ROOT_TGeoXtru
0014 
0015 #include "TGeoBBox.h"
0016 
0017 #include <mutex>
0018 #include <vector>
0019 
0020 class TGeoPolygon;
0021 
0022 class TGeoXtru : public TGeoBBox {
0023 public:
0024    struct ThreadData_t {
0025       Int_t fSeg;         // !current segment [0,fNvert-1]
0026       Int_t fIz;          // !current z plane [0,fNz-1]
0027       Double_t *fXc;      // ![fNvert] current X positions for polygon vertices
0028       Double_t *fYc;      // ![fNvert] current Y positions for polygon vertices
0029       TGeoPolygon *fPoly; // !polygon defining section shape
0030 
0031       ThreadData_t();
0032       ~ThreadData_t();
0033    };
0034    ThreadData_t &GetThreadData() const;
0035    void ClearThreadData() const override;
0036    void CreateThreadData(Int_t nthreads) override;
0037 
0038 protected:
0039    // data members
0040    Int_t fNvert;       // number of vertices of the 2D polygon (at least 3)
0041    Int_t fNz;          // number of z planes (at least two)
0042    Double_t fZcurrent; // current Z position
0043    Double_t *fX;       //[fNvert] X positions for polygon vertices
0044    Double_t *fY;       //[fNvert] Y positions for polygon vertices
0045    Double_t *fZ;       //[fNz] array of Z planes positions
0046    Double_t *fScale;   //[fNz] array of scale factors (for each Z)
0047    Double_t *fX0;      //[fNz] array of X offsets (for each Z)
0048    Double_t *fY0;      //[fNz] array of Y offsets (for each Z)
0049 
0050    mutable std::vector<ThreadData_t *> fThreadData; //! Navigation data per thread
0051    mutable Int_t fThreadSize;                       //! size of thread-specific array
0052    mutable std::mutex fMutex;                       //! mutex for thread data
0053 
0054    TGeoXtru(const TGeoXtru &) = delete;
0055    TGeoXtru &operator=(const TGeoXtru &) = delete;
0056 
0057    // methods
0058    Double_t
0059    DistToPlane(const Double_t *point, const Double_t *dir, Int_t iz, Int_t ivert, Double_t stepmax, Bool_t in) const;
0060    void GetPlaneVertices(Int_t iz, Int_t ivert, Double_t *vert) const;
0061    void GetPlaneNormal(const Double_t *vert, Double_t *norm) const;
0062    Bool_t IsPointInsidePlane(const Double_t *point, Double_t *vert, Double_t *norm) const;
0063    Double_t SafetyToSector(const Double_t *point, Int_t iz, Double_t safmin, Bool_t in);
0064    void SetIz(Int_t iz);
0065    void SetSeg(Int_t iseg);
0066 
0067 public:
0068    // constructors
0069    TGeoXtru();
0070    TGeoXtru(Int_t nz);
0071    TGeoXtru(Double_t *param);
0072    // destructor
0073    ~TGeoXtru() override;
0074    // methods
0075    Double_t Capacity() const override;
0076    void ComputeBBox() override;
0077    void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) const override;
0078    void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override;
0079    Bool_t Contains(const Double_t *point) const override;
0080    void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override;
0081    Bool_t DefinePolygon(Int_t nvert, const Double_t *xv, const Double_t *yv);
0082    virtual void DefineSection(Int_t snum, Double_t z, Double_t x0 = 0., Double_t y0 = 0., Double_t scale = 1.);
0083    Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact = 1, Double_t step = TGeoShape::Big(),
0084                            Double_t *safe = nullptr) const override;
0085    void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
0086                          Double_t *step) const override;
0087    Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact = 1,
0088                             Double_t step = TGeoShape::Big(), Double_t *safe = nullptr) const override;
0089    void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
0090                           Double_t *step) const override;
0091    Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
0092    void DrawPolygon(Option_t *option = "");
0093    const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override;
0094    //   virtual Int_t         GetByteCount() const {return 60+12*fNz;}
0095    Int_t GetNz() const { return fNz; }
0096    Int_t GetNvert() const { return fNvert; }
0097    Double_t GetX(Int_t i) const { return (i < fNvert && i > -1 && fX) ? fX[i] : -1.0E10; }
0098    Double_t GetY(Int_t i) const { return (i < fNvert && i > -1 && fY) ? fY[i] : -1.0E10; }
0099    Double_t GetXOffset(Int_t i) const { return (i < fNz && i > -1 && fX0) ? fX0[i] : 0.0; }
0100    Double_t GetYOffset(Int_t i) const { return (i < fNz && i > -1 && fY0) ? fY0[i] : 0.0; }
0101    Double_t GetScale(Int_t i) const { return (i < fNz && i > -1 && fScale) ? fScale[i] : 1.0; }
0102    Double_t *GetZ() const { return fZ; }
0103    Double_t GetZ(Int_t ipl) const;
0104    TGeoShape *GetMakeRuntimeShape(TGeoShape * /*mother*/, TGeoMatrix * /*mat*/) const override { return nullptr; }
0105    void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override;
0106    Int_t GetNmeshVertices() const override;
0107    void InspectShape() const override;
0108    TBuffer3D *MakeBuffer3D() const override;
0109    Double_t &Z(Int_t ipl) { return fZ[ipl]; }
0110    Double_t Safety(const Double_t *point, Bool_t in = kTRUE) const override;
0111    void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override;
0112    void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0113    void SetCurrentZ(Double_t z, Int_t iz);
0114    void SetCurrentVertices(Double_t x0, Double_t y0, Double_t scale);
0115    void SetDimensions(Double_t *param) override;
0116    void SetPoints(Double_t *points) const override;
0117    void SetPoints(Float_t *points) const override;
0118    void SetSegsAndPols(TBuffer3D &buff) const override;
0119    void Sizeof3D() const override;
0120 
0121    ClassDefOverride(TGeoXtru, 3) // extruded polygon class
0122 };
0123 
0124 #endif