File indexing completed on 2025-01-18 10:11:55
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TGeoTube
0013 #define ROOT_TGeoTube
0014
0015 #include "TGeoBBox.h"
0016
0017 class TGeoTube : public TGeoBBox {
0018 protected:
0019
0020 Double_t fRmin;
0021 Double_t fRmax;
0022 Double_t fDz;
0023
0024
0025 TGeoTube(const TGeoTube &) = delete;
0026 TGeoTube &operator=(const TGeoTube &) = delete;
0027
0028 public:
0029
0030 TGeoTube();
0031 TGeoTube(Double_t rmin, Double_t rmax, Double_t dz);
0032 TGeoTube(const char *name, Double_t rmin, Double_t rmax, Double_t dz);
0033 TGeoTube(Double_t *params);
0034
0035 ~TGeoTube() override;
0036
0037
0038 Double_t Capacity() const override;
0039 static Double_t Capacity(Double_t rmin, Double_t rmax, Double_t dz);
0040 void ComputeBBox() override;
0041 void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override;
0042 void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override;
0043 static void ComputeNormalS(const Double_t *point, const Double_t *dir, Double_t *norm, Double_t rmin, Double_t rmax,
0044 Double_t dz);
0045 Bool_t Contains(const Double_t *point) const override;
0046 void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override;
0047 static Double_t
0048 DistFromInsideS(const Double_t *point, const Double_t *dir, Double_t rmin, Double_t rmax, Double_t dz);
0049 Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact = 1, Double_t step = TGeoShape::Big(),
0050 Double_t *safe = nullptr) const override;
0051 void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
0052 Double_t *step) const override;
0053 static Double_t
0054 DistFromOutsideS(const Double_t *point, const Double_t *dir, Double_t rmin, Double_t rmax, Double_t dz);
0055 Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact = 1,
0056 Double_t step = TGeoShape::Big(), Double_t *safe = nullptr) const override;
0057 void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
0058 Double_t *step) const override;
0059 static void DistToTube(Double_t rsq, Double_t nsq, Double_t rdotn, Double_t radius, Double_t &b, Double_t &delta);
0060 Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
0061 TGeoVolume *
0062 Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override;
0063 const char *GetAxisName(Int_t iaxis) const override;
0064 Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override;
0065 void GetBoundingCylinder(Double_t *param) const override;
0066 const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override;
0067 Int_t GetByteCount() const override { return 48; }
0068 Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const override;
0069 TGeoShape *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override;
0070 void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override;
0071 Int_t GetNmeshVertices() const override;
0072 virtual Double_t GetRmin() const { return fRmin; }
0073 virtual Double_t GetRmax() const { return fRmax; }
0074 virtual Double_t GetDz() const { return fDz; }
0075 Bool_t HasRmin() const { return (fRmin > 0) ? kTRUE : kFALSE; }
0076 void InspectShape() const override;
0077 Bool_t IsCylType() const override { return kTRUE; }
0078 TBuffer3D *MakeBuffer3D() const override;
0079 Double_t Safety(const Double_t *point, Bool_t in = kTRUE) const override;
0080 void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override;
0081 static Double_t
0082 SafetyS(const Double_t *point, Bool_t in, Double_t rmin, Double_t rmax, Double_t dz, Int_t skipz = 0);
0083 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0084 void SetTubeDimensions(Double_t rmin, Double_t rmax, Double_t dz);
0085 void SetDimensions(Double_t *param) override;
0086 void SetPoints(Double_t *points) const override;
0087 void SetPoints(Float_t *points) const override;
0088 void SetSegsAndPols(TBuffer3D &buff) const override;
0089 void Sizeof3D() const override;
0090
0091 ClassDefOverride(TGeoTube, 1)
0092 };
0093
0094 class TGeoTubeSeg : public TGeoTube {
0095 protected:
0096
0097 Double_t fPhi1;
0098 Double_t fPhi2;
0099
0100 Double_t fS1;
0101 Double_t fC1;
0102 Double_t fS2;
0103 Double_t fC2;
0104 Double_t fSm;
0105 Double_t fCm;
0106 Double_t fCdfi;
0107
0108 void InitTrigonometry();
0109
0110 public:
0111
0112 TGeoTubeSeg();
0113 TGeoTubeSeg(Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2);
0114 TGeoTubeSeg(const char *name, Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2);
0115 TGeoTubeSeg(Double_t *params);
0116
0117 ~TGeoTubeSeg() override;
0118
0119 void AfterStreamer() override;
0120 Double_t Capacity() const override;
0121 static Double_t Capacity(Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2);
0122 void ComputeBBox() override;
0123 void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override;
0124 void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override;
0125 static void ComputeNormalS(const Double_t *point, const Double_t *dir, Double_t *norm, Double_t rmin, Double_t rmax,
0126 Double_t dz, Double_t c1, Double_t s1, Double_t c2, Double_t s2);
0127 Bool_t Contains(const Double_t *point) const override;
0128 void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override;
0129 Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
0130 static Double_t DistFromInsideS(const Double_t *point, const Double_t *dir, Double_t rmin, Double_t rmax,
0131 Double_t dz, Double_t c1, Double_t s1, Double_t c2, Double_t s2, Double_t cm,
0132 Double_t sm, Double_t cdfi);
0133 Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact = 1, Double_t step = TGeoShape::Big(),
0134 Double_t *safe = nullptr) const override;
0135 void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
0136 Double_t *step) const override;
0137 static Double_t DistFromOutsideS(const Double_t *point, const Double_t *dir, Double_t rmin, Double_t rmax,
0138 Double_t dz, Double_t c1, Double_t s1, Double_t c2, Double_t s2, Double_t cm,
0139 Double_t sm, Double_t cdfi);
0140 Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact = 1,
0141 Double_t step = TGeoShape::Big(), Double_t *safe = nullptr) const override;
0142 void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
0143 Double_t *step) const override;
0144 TGeoVolume *
0145 Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override;
0146 Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override;
0147 void GetBoundingCylinder(Double_t *param) const override;
0148 const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override;
0149 Int_t GetByteCount() const override { return 56; }
0150 Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const override;
0151 TGeoShape *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override;
0152 Int_t GetNmeshVertices() const override;
0153 void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override;
0154 Double_t GetPhi1() const { return fPhi1; }
0155 Double_t GetPhi2() const { return fPhi2; }
0156 void InspectShape() const override;
0157 TBuffer3D *MakeBuffer3D() const override;
0158 Double_t Safety(const Double_t *point, Bool_t in = kTRUE) const override;
0159 void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override;
0160 static Double_t SafetyS(const Double_t *point, Bool_t in, Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1,
0161 Double_t phi2, Int_t skipz = 0);
0162 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0163 void SetTubsDimensions(Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2);
0164 void SetDimensions(Double_t *param) override;
0165 void SetPoints(Double_t *points) const override;
0166 void SetPoints(Float_t *points) const override;
0167 void SetSegsAndPols(TBuffer3D &buff) const override;
0168 void Sizeof3D() const override;
0169
0170 ClassDefOverride(TGeoTubeSeg, 2)
0171 };
0172
0173 class TGeoCtub : public TGeoTubeSeg {
0174 protected:
0175
0176 Double_t fNlow[3];
0177 Double_t fNhigh[3];
0178
0179 public:
0180
0181 TGeoCtub();
0182 TGeoCtub(Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2, Double_t lx, Double_t ly,
0183 Double_t lz, Double_t tx, Double_t ty, Double_t tz);
0184 TGeoCtub(const char *name, Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2, Double_t lx,
0185 Double_t ly, Double_t lz, Double_t tx, Double_t ty, Double_t tz);
0186 TGeoCtub(Double_t *params);
0187
0188 ~TGeoCtub() override;
0189
0190 Double_t Capacity() const override;
0191 void ComputeBBox() override;
0192 void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override;
0193 void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override;
0194 Bool_t Contains(const Double_t *point) const override;
0195 void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override;
0196 Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact = 1, Double_t step = TGeoShape::Big(),
0197 Double_t *safe = nullptr) const override;
0198 void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
0199 Double_t *step) const override;
0200 Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact = 1,
0201 Double_t step = TGeoShape::Big(), Double_t *safe = nullptr) const override;
0202 void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
0203 Double_t *step) const override;
0204 TGeoVolume *
0205 Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override;
0206 Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override;
0207 const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override;
0208 Int_t GetByteCount() const override { return 98; }
0209 Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const override;
0210 TGeoShape *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override;
0211 void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override;
0212 Int_t GetNmeshVertices() const override;
0213 const Double_t *GetNlow() const { return &fNlow[0]; }
0214 const Double_t *GetNhigh() const { return &fNhigh[0]; }
0215 Double_t GetZcoord(Double_t xc, Double_t yc, Double_t zc) const;
0216 void InspectShape() const override;
0217 Double_t Safety(const Double_t *point, Bool_t in = kTRUE) const override;
0218 void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override;
0219 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0220 void SetCtubDimensions(Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2, Double_t lx,
0221 Double_t ly, Double_t lz, Double_t tx, Double_t ty, Double_t tz);
0222 void SetDimensions(Double_t *param) override;
0223 void SetPoints(Double_t *points) const override;
0224 void SetPoints(Float_t *points) const override;
0225
0226 ClassDefOverride(TGeoCtub, 1)
0227 };
0228
0229 #endif