Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TGeoPgon.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: Andrei Gheata   31/01/02
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_TGeoPgon
0013 #define ROOT_TGeoPgon
0014 
0015 #include "TGeoPcon.h"
0016 
0017 #include <mutex>
0018 #include <vector>
0019 
0020 class TGeoPgon : public TGeoPcon {
0021 public:
0022    struct ThreadData_t {
0023       Int_t *fIntBuffer;    //![fNedges+4] temporary int buffer array
0024       Double_t *fDblBuffer; //![fNedges+4] temporary double buffer array
0025 
0026       ThreadData_t();
0027       ~ThreadData_t();
0028    };
0029    ThreadData_t &GetThreadData() const;
0030    void ClearThreadData() const override;
0031    void CreateThreadData(Int_t nthreads) override;
0032 
0033 protected:
0034    // data members
0035    Int_t fNedges;                                   // number of edges (at least one)
0036    mutable std::vector<ThreadData_t *> fThreadData; //! Navigation data per thread
0037    mutable Int_t fThreadSize;                       //! Size for the navigation data array
0038    mutable std::mutex fMutex;                       //! Mutex for thread data
0039 
0040    // internal utility methods
0041    Int_t GetPhiCrossList(const Double_t *point, const Double_t *dir, Int_t istart, Double_t *sphi, Int_t *iphi,
0042                          Double_t stepmax = TGeoShape::Big()) const;
0043    Bool_t IsCrossingSlice(const Double_t *point, const Double_t *dir, Int_t iphi, Double_t sstart, Int_t &ipl,
0044                           Double_t &snext, Double_t stepmax) const;
0045    void LocatePhi(const Double_t *point, Int_t &ipsec) const;
0046    Double_t Rpg(Double_t z, Int_t ipl, Bool_t inner, Double_t &a, Double_t &b) const;
0047    Double_t Rproj(Double_t z, const Double_t *point, const Double_t *dir, Double_t cphi, Double_t sphi, Double_t &a,
0048                   Double_t &b) const;
0049    Bool_t SliceCrossing(const Double_t *point, const Double_t *dir, Int_t nphi, Int_t *iphi, Double_t *sphi,
0050                         Double_t &snext, Double_t stepmax) const;
0051    Bool_t SliceCrossingIn(const Double_t *point, const Double_t *dir, Int_t ipl, Int_t nphi, Int_t *iphi,
0052                           Double_t *sphi, Double_t &snext, Double_t stepmax) const;
0053    Bool_t SliceCrossingZ(const Double_t *point, const Double_t *dir, Int_t nphi, Int_t *iphi, Double_t *sphi,
0054                          Double_t &snext, Double_t stepmax) const;
0055    Bool_t SliceCrossingInZ(const Double_t *point, const Double_t *dir, Int_t nphi, Int_t *iphi, Double_t *sphi,
0056                            Double_t &snext, Double_t stepmax) const;
0057    void SetSegsAndPolsNoInside(TBuffer3D &buff) const;
0058 
0059    TGeoPgon(const TGeoPgon &) = delete;
0060    TGeoPgon &operator=(const TGeoPgon &) = delete;
0061 
0062 public:
0063    // constructors
0064    TGeoPgon();
0065    TGeoPgon(Double_t phi, Double_t dphi, Int_t nedges, Int_t nz);
0066    TGeoPgon(const char *name, Double_t phi, Double_t dphi, Int_t nedges, Int_t nz);
0067    TGeoPgon(Double_t *params);
0068    // destructor
0069    ~TGeoPgon() override;
0070    // methods
0071    Double_t Capacity() const override;
0072    void ComputeBBox() override;
0073    void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override;
0074    void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override;
0075    Bool_t Contains(const Double_t *point) const override;
0076    void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override;
0077    Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact = 1, Double_t step = TGeoShape::Big(),
0078                            Double_t *safe = nullptr) const override;
0079    void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
0080                          Double_t *step) const override;
0081    Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact = 1,
0082                             Double_t step = TGeoShape::Big(), Double_t *safe = nullptr) const override;
0083    void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
0084                           Double_t *step) const override;
0085    Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
0086    TGeoVolume *
0087    Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override;
0088    void GetBoundingCylinder(Double_t *param) const override;
0089    const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override;
0090    Int_t GetByteCount() const override { return 64 + 12 * fNz; }
0091    TGeoShape *GetMakeRuntimeShape(TGeoShape * /*mother*/, TGeoMatrix * /*mat*/) const override { return nullptr; }
0092    void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override;
0093    Int_t GetNedges() const { return fNedges; }
0094    Int_t GetNmeshVertices() const override;
0095    Int_t GetNsegments() const override { return fNedges; }
0096    Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const override
0097    {
0098       return TGeoBBox::GetPointsOnSegments(npoints, array);
0099    }
0100    void InspectShape() const override;
0101    TBuffer3D *MakeBuffer3D() const override;
0102    Double_t Safety(const Double_t *point, Bool_t in = kTRUE) const override;
0103    void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override;
0104    Double_t SafetyToSegment(const Double_t *point, Int_t ipl, Int_t iphi, Bool_t in, Double_t safphi,
0105                             Double_t safmin = TGeoShape::Big()) const;
0106    void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0107    void SetDimensions(Double_t *param) override;
0108    void SetNedges(Int_t ne)
0109    {
0110       if (ne > 2)
0111          fNedges = ne;
0112    }
0113    void SetPoints(Double_t *points) const override;
0114    void SetPoints(Float_t *points) const override;
0115    void SetSegsAndPols(TBuffer3D &buff) const override;
0116    void Sizeof3D() const override;
0117 
0118    ClassDefOverride(TGeoPgon, 1) // polygone class
0119 };
0120 
0121 #endif