Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGeoArb8.h
Go to the documentation of this file.
1// @(#)root/geom:$Id$
2// Author: Andrei Gheata 24/10/01
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TGeoArb8
13#define ROOT_TGeoArb8
14
15#include "TGeoBBox.h"
16
17class TGeoArb8 : public TGeoBBox {
18protected:
20 // kArb8Trd1 = BIT(25), // trd1 type
21 // kArb8Trd2 = BIT(26), // trd2 type
22 kArb8Trap = BIT(27), // planar surface trapezoid
23 kArb8Tra = BIT(28) // general twisted trapezoid
24 };
25 // data members
26 Double_t fDz{0}; // half length in Z
27 Double_t *fTwist{nullptr}; //! [4] tangents of twist angles
28 Double_t fXY[8][2]; // list of vertices
29
30 TGeoArb8(const TGeoArb8 &) = delete;
31 TGeoArb8 &operator=(const TGeoArb8 &) = delete;
32
33 void CopyTwist(Double_t *twist = nullptr);
34
35public:
36 // constructors
38 TGeoArb8(Double_t dz, Double_t *vertices = nullptr);
39 TGeoArb8(const char *name, Double_t dz, Double_t *vertices = nullptr);
40 // destructor
41 ~TGeoArb8() override;
42 // methods
43 Double_t Capacity() const override;
44 void ComputeBBox() override;
45 void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override;
46 void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override;
48 Bool_t Contains(const Double_t *point) const override;
49 void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override;
50 Double_t DistToPlane(const Double_t *point, const Double_t *dir, Int_t ipl, Bool_t in) const;
51 Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact = 1, Double_t step = TGeoShape::Big(),
52 Double_t *safe = nullptr) const override;
53 void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
54 Double_t *step) const override;
55 Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact = 1,
56 Double_t step = TGeoShape::Big(), Double_t *safe = nullptr) const override;
57 void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
58 Double_t *step) const override;
60 Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override;
61 Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override;
62 void GetBoundingCylinder(Double_t *param) const override;
63 Int_t GetByteCount() const override { return 100; }
64 Double_t GetClosestEdge(const Double_t *point, Double_t *vert, Int_t &isegment) const;
65 Bool_t GetPointsOnFacet(Int_t /*index*/, Int_t /*npoints*/, Double_t * /*array*/) const override;
66 Double_t GetDz() const { return fDz; }
67 Int_t
68 GetFittingBox(const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz) const override;
69 TGeoShape *GetMakeRuntimeShape(TGeoShape * /*mother*/, TGeoMatrix * /*mat*/) const override { return nullptr; }
70 static void GetPlaneNormal(Double_t *p1, Double_t *p2, Double_t *p3, Double_t *norm);
71 Double_t *GetVertices() { return &fXY[0][0]; }
72 Double_t GetTwist(Int_t iseg) const;
73 Bool_t IsCylType() const override { return kFALSE; }
74 static Bool_t IsSamePoint(const Double_t *p1, const Double_t *p2)
75 {
76 return (TMath::Abs(p1[0] - p2[0]) < 1.E-16 && TMath::Abs(p1[1] - p2[1]) < 1.E-16) ? kTRUE : kFALSE;
77 }
79 void InspectShape() const override;
80 Bool_t IsTwisted() const { return !fTwist ? kFALSE : kTRUE; }
81 Double_t SafetyToFace(const Double_t *point, Int_t iseg, Bool_t in) const;
82 Double_t Safety(const Double_t *point, Bool_t in = kTRUE) const override;
83 void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override;
84 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
85 void SetPlaneVertices(Double_t zpl, Double_t *vertices) const;
86 virtual void SetVertex(Int_t vnum, Double_t x, Double_t y);
87 void SetDimensions(Double_t *param) override;
88 void SetDz(Double_t dz) { fDz = dz; }
89 void SetPoints(Double_t *points) const override;
90 void SetPoints(Float_t *points) const override;
91 void Sizeof3D() const override;
92
93 ClassDefOverride(TGeoArb8, 1) // arbitrary trapezoid with 8 vertices
94};
95
96class TGeoTrap : public TGeoArb8 {
97protected:
98 // data members
99 Double_t fTheta; // theta angle
100 Double_t fPhi; // phi angle
101 Double_t fH1; // half length in y at low z
102 Double_t fBl1; // half length in x at low z and y low edge
103 Double_t fTl1; // half length in x at low z and y high edge
104 Double_t fAlpha1; // angle between centers of x edges an y axis at low z
105 Double_t fH2; // half length in y at high z
106 Double_t fBl2; // half length in x at high z and y low edge
107 Double_t fTl2; // half length in x at high z and y high edge
108 Double_t fAlpha2; // angle between centers of x edges an y axis at low z
109
110public:
111 // constructors
115 Double_t h2, Double_t bl2, Double_t tl2, Double_t alpha2);
116 TGeoTrap(const char *name, Double_t dz, Double_t theta, Double_t phi, Double_t h1, Double_t bl1, Double_t tl1,
117 Double_t alpha1, Double_t h2, Double_t bl2, Double_t tl2, Double_t alpha2);
118 // destructor
119 ~TGeoTrap() override;
120 Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact = 1, Double_t step = TGeoShape::Big(),
121 Double_t *safe = nullptr) const override;
122 void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
123 Double_t *step) const override;
124 Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact = 1,
125 Double_t step = TGeoShape::Big(), Double_t *safe = nullptr) const override;
126 void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
127 Double_t *step) const override;
128 TGeoVolume *
129 Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override;
130 Double_t GetTheta() const { return fTheta; }
131 Double_t GetPhi() const { return fPhi; }
132 Double_t GetH1() const { return fH1; }
133 Double_t GetBl1() const { return fBl1; }
134 Double_t GetTl1() const { return fTl1; }
135 Double_t GetAlpha1() const { return fAlpha1; }
136 Double_t GetH2() const { return fH2; }
137 Double_t GetBl2() const { return fBl2; }
138 Double_t GetTl2() const { return fTl2; }
139 Double_t GetAlpha2() const { return fAlpha2; }
140 TGeoShape *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override;
141 void SetDimensions(Double_t *param) override;
142 Double_t Safety(const Double_t *point, Bool_t in = kTRUE) const override;
143 void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override;
144 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
145
146 ClassDefOverride(TGeoTrap, 1) // G3 TRAP shape
147};
148
149class TGeoGtra : public TGeoTrap {
150protected:
151 // data members
152 Double_t fTwistAngle; // twist angle in degrees
153public:
154 // constructors
157 Double_t alpha1, Double_t h2, Double_t bl2, Double_t tl2, Double_t alpha2);
158 TGeoGtra(const char *name, Double_t dz, Double_t theta, Double_t phi, Double_t twist, Double_t h1, Double_t bl1,
159 Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2, Double_t tl2, Double_t alpha2);
160 // destructor
161 ~TGeoGtra() override;
162 Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact = 1, Double_t step = TGeoShape::Big(),
163 Double_t *safe = nullptr) const override;
164 void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
165 Double_t *step) const override;
166 Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact = 1,
167 Double_t step = TGeoShape::Big(), Double_t *safe = nullptr) const override;
168 void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
169 Double_t *step) const override;
170 TGeoShape *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override;
172 Double_t Safety(const Double_t *point, Bool_t in = kTRUE) const override;
173 void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override;
174 void SetDimensions(Double_t *param) override;
175 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
176
177 ClassDefOverride(TGeoGtra, 1) // G3 GTRA shape
178};
179
180#endif
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
const char Option_t
Definition RtypesCore.h:66
#define BIT(n)
Definition Rtypes.h:90
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
char name[80]
Definition TGX11.cxx:110
void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override
Int_t GetByteCount() const override
Definition TGeoArb8.h:63
void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Double_t GetDz() const
Definition TGeoArb8.h:66
Double_t GetClosestEdge(const Double_t *point, Double_t *vert, Int_t &isegment) const
Double_t fXY[8][2]
[4] tangents of twist angles
Definition TGeoArb8.h:28
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
void SetPoints(Double_t *points) const override
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override
TGeoArb8(const char *name, Double_t dz, Double_t *vertices=nullptr)
virtual void SetVertex(Int_t vnum, Double_t x, Double_t y)
void SetPoints(Float_t *points) const override
void CopyTwist(Double_t *twist=nullptr)
void SetDimensions(Double_t *param) override
Bool_t Contains(const Double_t *point) const override
void SetDz(Double_t dz)
Definition TGeoArb8.h:88
Bool_t GetPointsOnFacet(Int_t, Int_t, Double_t *) const override
TGeoArb8(const TGeoArb8 &)=delete
void ComputeTwist()
Double_t DistToPlane(const Double_t *point, const Double_t *dir, Int_t ipl, Bool_t in) const
static Bool_t InsidePolygon(Double_t x, Double_t y, Double_t *pts)
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
Double_t fDz
Definition TGeoArb8.h:26
TGeoArb8 & operator=(const TGeoArb8 &)=delete
void GetBoundingCylinder(Double_t *param) const override
@ kArb8Trap
Definition TGeoArb8.h:22
@ kArb8Tra
Definition TGeoArb8.h:23
Double_t * fTwist
Definition TGeoArb8.h:27
Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override
static void GetPlaneNormal(Double_t *p1, Double_t *p2, Double_t *p3, Double_t *norm)
Double_t Capacity() const override
Double_t SafetyToFace(const Double_t *point, Int_t iseg, Bool_t in) const
void Sizeof3D() const override
Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
Bool_t IsTwisted() const
Definition TGeoArb8.h:80
Double_t * GetVertices()
Definition TGeoArb8.h:71
void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override
void InspectShape() const override
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
Double_t GetTwist(Int_t iseg) const
TGeoArb8(Double_t dz, Double_t *vertices=nullptr)
Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override
static Bool_t IsSamePoint(const Double_t *p1, const Double_t *p2)
Definition TGeoArb8.h:74
~TGeoArb8() override
Bool_t IsCylType() const override
Definition TGeoArb8.h:73
TGeoShape * GetMakeRuntimeShape(TGeoShape *, TGeoMatrix *) const override
Definition TGeoArb8.h:69
void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
void SetPlaneVertices(Double_t zpl, Double_t *vertices) const
void ComputeBBox() override
Int_t GetFittingBox(const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz) const override
void SetDimensions(Double_t *param) override
Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
Double_t fTwistAngle
Definition TGeoArb8.h:152
TGeoGtra(Double_t dz, Double_t theta, Double_t phi, Double_t twist, Double_t h1, Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2, Double_t tl2, Double_t alpha2)
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
TGeoGtra(const char *name, Double_t dz, Double_t theta, Double_t phi, Double_t twist, Double_t h1, Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2, Double_t tl2, Double_t alpha2)
TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override
Double_t GetTwistAngle() const
Definition TGeoArb8.h:171
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override
void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
~TGeoGtra() override
Geometrical transformation package.
Definition TGeoMatrix.h:38
Base abstract class for all shapes.
Definition TGeoShape.h:25
static Double_t Big()
Definition TGeoShape.h:87
~TGeoTrap() override
TGeoTrap(const char *name, Double_t dz, Double_t theta, Double_t phi, Double_t h1, Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2, Double_t tl2, Double_t alpha2)
Double_t fTl2
Definition TGeoArb8.h:107
Double_t GetTl1() const
Definition TGeoArb8.h:134
Double_t GetPhi() const
Definition TGeoArb8.h:131
Double_t fBl2
Definition TGeoArb8.h:106
Double_t fAlpha2
Definition TGeoArb8.h:108
void SetDimensions(Double_t *param) override
Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
Double_t fBl1
Definition TGeoArb8.h:102
void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Double_t fH1
Definition TGeoArb8.h:101
void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override
Double_t fPhi
Definition TGeoArb8.h:100
Double_t GetAlpha2() const
Definition TGeoArb8.h:139
Double_t GetTheta() const
Definition TGeoArb8.h:130
TGeoTrap(Double_t dz, Double_t theta, Double_t phi)
Double_t fTl1
Definition TGeoArb8.h:103
Double_t fH2
Definition TGeoArb8.h:105
Double_t GetAlpha1() const
Definition TGeoArb8.h:135
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
Double_t GetBl2() const
Definition TGeoArb8.h:137
Double_t GetTl2() const
Definition TGeoArb8.h:138
void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Double_t GetH1() const
Definition TGeoArb8.h:132
Double_t fTheta
Definition TGeoArb8.h:99
TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override
Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
Double_t fAlpha1
Definition TGeoArb8.h:104
Double_t GetH2() const
Definition TGeoArb8.h:136
Double_t GetBl1() const
Definition TGeoArb8.h:133
TGeoTrap(Double_t dz, Double_t theta, Double_t phi, Double_t h1, Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2, Double_t tl2, Double_t alpha2)
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:43
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
TH1F * h1
Definition legend1.C:5
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:123