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
17#include <cstdlib>
18
19class TGeoArb8 : public TGeoBBox {
20protected:
22 // kArb8Trd1 = BIT(25), // trd1 type
23 // kArb8Trd2 = BIT(26), // trd2 type
24 kArb8Trap = BIT(27), // planar surface trapezoid
25 kArb8Tra = BIT(28) // general twisted trapezoid
26 };
27 // data members
28 Double_t fDz{0}; // half length in Z
29 Double_t *fTwist{nullptr}; //! [4] tangents of twist angles
30 Double_t fXY[8][2]; // list of vertices
31
32 TGeoArb8(const TGeoArb8 &) = delete;
33 TGeoArb8 &operator=(const TGeoArb8 &) = delete;
34
35 void CopyTwist(Double_t *twist = nullptr);
36
37public:
38 // constructors
39 TGeoArb8();
40 TGeoArb8(Double_t dz, Double_t *vertices = nullptr);
41 TGeoArb8(const char *name, Double_t dz, Double_t *vertices = nullptr);
42 // destructor
43 ~TGeoArb8() override;
44 // methods
45 Double_t Capacity() const override;
46 void ComputeBBox() override;
47 void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) const override;
48 void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override;
49 void ComputeTwist();
50 Bool_t Contains(const Double_t *point) const override;
51 void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override;
52 Double_t DistToPlane(const Double_t *point, const Double_t *dir, Int_t ipl, Bool_t in) const;
53 Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact = 1, Double_t step = TGeoShape::Big(),
54 Double_t *safe = nullptr) const override;
56 Double_t *step) const override;
57 Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact = 1,
58 Double_t step = TGeoShape::Big(), Double_t *safe = nullptr) const override;
60 Double_t *step) const override;
62 Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override;
63 Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override;
64 void GetBoundingCylinder(Double_t *param) const override;
65 Int_t GetByteCount() const override { return 100; }
67 Bool_t GetPointsOnFacet(Int_t /*index*/, Int_t /*npoints*/, Double_t * /*array*/) const override;
68 Double_t GetDz() const { return fDz; }
69 Int_t
71 TGeoShape *GetMakeRuntimeShape(TGeoShape * /*mother*/, TGeoMatrix * /*mat*/) const override { return nullptr; }
73 Double_t *GetVertices() { return &fXY[0][0]; }
75 Bool_t IsCylType() const override { return kFALSE; }
76 static Bool_t IsSamePoint(const Double_t *p1, const Double_t *p2)
77 {
78 return (std::abs(p1[0] - p2[0]) < 1.E-16 && std::abs(p1[1] - p2[1]) < 1.E-16) ? kTRUE : kFALSE;
79 }
81 void InspectShape() const override;
82 Bool_t IsTwisted() const { return !fTwist ? kFALSE : kTRUE; }
83 Double_t SafetyToFace(const Double_t *point, Int_t iseg, Bool_t in) const;
84 Double_t Safety(const Double_t *point, Bool_t in = kTRUE) const override;
85 void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override;
86 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
87 void SetPlaneVertices(Double_t zpl, Double_t *vertices) const;
88 virtual void SetVertex(Int_t vnum, Double_t x, Double_t y);
89 void SetDimensions(Double_t *param) override;
90 void SetDz(Double_t dz) { fDz = dz; }
91 void SetPoints(Double_t *points) const override;
92 void SetPoints(Float_t *points) const override;
93 void Sizeof3D() const override;
94
95 ClassDefOverride(TGeoArb8, 1) // arbitrary trapezoid with 8 vertices
96};
97
98class TGeoTrap : public TGeoArb8 {
99protected:
100 // data members
101 Double_t fTheta; // theta angle
102 Double_t fPhi; // phi angle
103 Double_t fH1; // half length in y at low z
104 Double_t fBl1; // half length in x at low z and y low edge
105 Double_t fTl1; // half length in x at low z and y high edge
106 Double_t fAlpha1; // angle between centers of x edges an y axis at low z
107 Double_t fH2; // half length in y at high z
108 Double_t fBl2; // half length in x at high z and y low edge
109 Double_t fTl2; // half length in x at high z and y high edge
110 Double_t fAlpha2; // angle between centers of x edges an y axis at low z
111
112public:
113 // constructors
114 TGeoTrap();
115 TGeoTrap(Double_t dz, Double_t theta, Double_t phi);
120 // destructor
121 ~TGeoTrap() override;
122 Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact = 1, Double_t step = TGeoShape::Big(),
123 Double_t *safe = nullptr) const override;
125 Double_t *step) const override;
126 Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact = 1,
127 Double_t step = TGeoShape::Big(), Double_t *safe = nullptr) const override;
129 Double_t *step) const override;
130 TGeoVolume *
131 Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override;
132 Double_t GetTheta() const { return fTheta; }
133 Double_t GetPhi() const { return fPhi; }
134 Double_t GetH1() const { return fH1; }
135 Double_t GetBl1() const { return fBl1; }
136 Double_t GetTl1() const { return fTl1; }
137 Double_t GetAlpha1() const { return fAlpha1; }
138 Double_t GetH2() const { return fH2; }
139 Double_t GetBl2() const { return fBl2; }
140 Double_t GetTl2() const { return fTl2; }
141 Double_t GetAlpha2() const { return fAlpha2; }
143 void SetDimensions(Double_t *param) override;
144 Double_t Safety(const Double_t *point, Bool_t in = kTRUE) const override;
145 void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override;
146 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
147
148 ClassDefOverride(TGeoTrap, 1) // G3 TRAP shape
149};
150
151class TGeoGtra : public TGeoTrap {
152protected:
153 // data members
154 Double_t fTwistAngle; // twist angle in degrees
155public:
156 // constructors
157 TGeoGtra();
162 // destructor
163 ~TGeoGtra() override;
164 Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact = 1, Double_t step = TGeoShape::Big(),
165 Double_t *safe = nullptr) const override;
167 Double_t *step) const override;
168 Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact = 1,
169 Double_t step = TGeoShape::Big(), Double_t *safe = nullptr) const override;
171 Double_t *step) const override;
174 Double_t Safety(const Double_t *point, Bool_t in = kTRUE) const override;
175 void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override;
176 void SetDimensions(Double_t *param) override;
177 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
178
179 ClassDefOverride(TGeoGtra, 1) // G3 GTRA shape
180};
181
182#endif
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:77
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
#define BIT(n)
Definition Rtypes.h:91
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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
An arbitrary trapezoid with less than 8 vertices standing on two parallel planes perpendicular to Z a...
Definition TGeoArb8.h:19
void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override
Compute safe distance from each of the points in the input array.
virtual void SetVertex(Int_t vnum, Double_t x, Double_t y)
Set values for a given vertex.
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) const override
Compute normal to closest surface from POINT.
Definition TGeoArb8.cxx:465
Int_t GetByteCount() const override
Definition TGeoArb8.h:65
void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Compute distance from array of input points having directions specified by dirs. Store output in dist...
Double_t GetDz() const
Definition TGeoArb8.h:68
Double_t GetClosestEdge(const Double_t *point, Double_t *vert, Int_t &isegment) const
Get index of the edge of the quadrilater represented by vert closest to point.
Definition TGeoArb8.cxx:398
Double_t fXY[8][2]
[4] tangents of twist angles
Definition TGeoArb8.h:30
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
Creates arb8 mesh points.
void CopyTwist(Double_t *twist=nullptr)
Copy twist values from source array.
Definition TGeoArb8.cxx:234
void SetDimensions(Double_t *param) override
Set all arb8 params in one step.
Bool_t Contains(const Double_t *point) const override
Test if point is inside this shape.
Definition TGeoArb8.cxx:531
void SetDz(Double_t dz)
Definition TGeoArb8.h:90
static void GetPlaneNormal(Double_t *p1, Double_t *p2, Double_t *p3, Double_t *norm)
Computes normal to plane defined by P1, P2 and P3.
Definition TGeoArb8.cxx:966
Bool_t GetPointsOnFacet(Int_t, Int_t, Double_t *) const override
Fills array with n random points located on the surface of indexed facet.
Definition TGeoArb8.cxx:996
TGeoArb8(const TGeoArb8 &)=delete
void ComputeTwist()
Computes tangents of twist angles (angles between projections on XY plane of corresponding -dz +dz ed...
Definition TGeoArb8.cxx:297
Double_t DistToPlane(const Double_t *point, const Double_t *dir, Int_t ipl, Bool_t in) const
Computes distance to plane ipl :
Definition TGeoArb8.cxx:556
static Bool_t InsidePolygon(Double_t x, Double_t y, Double_t *pts)
Finds if a point in XY plane is inside the polygon defines by PTS.
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
Divide this shape along one axis.
Definition TGeoArb8.cxx:862
Double_t fDz
Definition TGeoArb8.h:28
TGeoArb8 & operator=(const TGeoArb8 &)=delete
void GetBoundingCylinder(Double_t *param) const override
Fill vector param[4] with the bounding cylinder parameters.
Definition TGeoArb8.cxx:890
@ kArb8Trap
Definition TGeoArb8.h:24
@ kArb8Tra
Definition TGeoArb8.h:25
Double_t * fTwist
Definition TGeoArb8.h:29
Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override
Get shape range on a given axis.
Definition TGeoArb8.cxx:872
Double_t Capacity() const override
Computes capacity of the shape in [length^3].
Definition TGeoArb8.cxx:249
Double_t SafetyToFace(const Double_t *point, Int_t iseg, Bool_t in) const
Estimate safety to lateral plane defined by segment iseg in range [0,3] Might be negative: plane seen...
void Sizeof3D() const override
Fill size of this 3-D object.
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
Computes distance from outside point to surface of the shape.
Definition TGeoArb8.cxx:688
Bool_t IsTwisted() const
Definition TGeoArb8.h:82
Double_t * GetVertices()
Definition TGeoArb8.h:73
void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override
Check the inside status for each of the points in the array.
void InspectShape() const override
Prints shape parameters.
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
Computes the closest distance from given point to this shape.
TGeoArb8()
Default constructor.
Definition TGeoArb8.cxx:166
Double_t GetTwist(Int_t iseg) const
Get twist for segment I in range [0,3].
Definition TGeoArb8.cxx:388
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
Compute distance from inside point to surface of the shape.
Definition TGeoArb8.cxx:721
void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override
Compute the normal for an array o points so that norm.dot.dir is positive Input: Arrays of point coor...
static Bool_t IsSamePoint(const Double_t *p1, const Double_t *p2)
Definition TGeoArb8.h:76
~TGeoArb8() override
Destructor.
Definition TGeoArb8.cxx:225
Bool_t IsCylType() const override
Definition TGeoArb8.h:75
TGeoShape * GetMakeRuntimeShape(TGeoShape *, TGeoMatrix *) const override
Definition TGeoArb8.h:71
void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Compute distance from array of input points having directions specified by dirs. Store output in dist...
void SetPlaneVertices(Double_t zpl, Double_t *vertices) const
Computes intersection points between plane at zpl and non-horizontal edges.
void ComputeBBox() override
Computes bounding box for an Arb8 shape.
Definition TGeoArb8.cxx:267
Int_t GetFittingBox(const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz) const override
Fills real parameters of a positioned box inside this arb8. Returns 0 if successful.
Definition TGeoArb8.cxx:909
Box class.
Definition TGeoBBox.h:17
A twisted trapezoid.
Definition TGeoArb8.h:151
void SetDimensions(Double_t *param) override
Set all arb8 params in one step.
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
Compute distance from inside point to surface of the shape.
Double_t fTwistAngle
Definition TGeoArb8.h:154
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
Compute distance from array of input points having directions specified by dirs. Store output in dist...
TGeoGtra()
Default ctor.
TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override
In case shape has some negative parameters, these has to be computed in order to fit the mother.
Double_t GetTwistAngle() const
Definition TGeoArb8.h:173
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
Computes the closest distance from given point to this shape.
void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override
Compute safe distance from each of the points in the input array.
void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Compute distance from array of input points having directions specified by dirs. Store output in dist...
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
Compute distance from inside point to surface of the shape.
~TGeoGtra() override
Destructor.
Geometrical transformation package.
Definition TGeoMatrix.h:38
Base abstract class for all shapes.
Definition TGeoShape.h:25
static Double_t Big()
Definition TGeoShape.h:94
A general trapezoid.
Definition TGeoArb8.h:98
~TGeoTrap() override
Destructor.
Double_t fTl2
Definition TGeoArb8.h:109
Double_t GetTl1() const
Definition TGeoArb8.h:136
Double_t GetPhi() const
Definition TGeoArb8.h:133
Double_t fBl2
Definition TGeoArb8.h:108
Double_t fAlpha2
Definition TGeoArb8.h:110
void SetDimensions(Double_t *param) override
Set all arb8 params in one step.
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
Compute distance from inside point to surface of the trapezoid.
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
Computes the closest distance from given point to this shape.
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:104
void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Compute distance from array of input points having directions specified by dirs. Store output in dist...
Double_t fH1
Definition TGeoArb8.h:103
void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override
Compute safe distance from each of the points in the input array.
Double_t fPhi
Definition TGeoArb8.h:102
Double_t GetAlpha2() const
Definition TGeoArb8.h:141
Double_t GetTheta() const
Definition TGeoArb8.h:132
TGeoTrap()
Default ctor.
Double_t fTl1
Definition TGeoArb8.h:105
Double_t fH2
Definition TGeoArb8.h:107
Double_t GetAlpha1() const
Definition TGeoArb8.h:137
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
Divide this trapezoid shape belonging to volume "voldiv" into ndiv volumes called divname,...
Double_t GetBl2() const
Definition TGeoArb8.h:139
Double_t GetTl2() const
Definition TGeoArb8.h:140
void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Compute distance from array of input points having directions specified by dirs. Store output in dist...
Double_t GetH1() const
Definition TGeoArb8.h:134
Double_t fTheta
Definition TGeoArb8.h:101
TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override
In case shape has some negative parameters, these have to be computed in order to fit the mother.
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
Compute distance from outside point to surface of the trapezoid.
Double_t fAlpha1
Definition TGeoArb8.h:106
Double_t GetH2() const
Definition TGeoArb8.h:138
Double_t GetBl1() const
Definition TGeoArb8.h:135
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