12 #ifndef ROOT_TGeoShape
13 #define ROOT_TGeoShape
18 class TGeoBoolCombinator;
25 class TGeoShape :
public TNamed
28 static TGeoMatrix *fgTransform;
29 static Double_t fgEpsMch;
32 kBitMask32 = 0xffffffff,
37 kGeoThetaSeg = BIT(3),
41 kGeoRunTimeShape = BIT(7),
42 kGeoInvalidShape = BIT(8),
48 kGeoTubeSeg = BIT(14),
50 kGeoConeSeg = BIT(16),
60 kGeoClosedShape = BIT(26),
62 kGeoParaboloid = BIT(28),
63 kGeoHalfSpace = BIT(29),
65 kGeoSavePrimitive = BIT(20)
67 virtual void ClearThreadData()
const {}
68 virtual void CreateThreadData(Int_t) {}
75 virtual void FillBuffer3D(TBuffer3D & buffer, Int_t reqSections, Bool_t localFrame)
const;
76 Int_t GetBasicColor()
const;
77 void SetOnBoundary(Bool_t ) {;}
78 void TransformPoints(Double_t *points, UInt_t NbPoints)
const;
83 TGeoShape(
const char *name);
88 static Double_t Big() {
return 1.E30;}
89 static TGeoMatrix *GetTransform();
90 static void SetTransform(TGeoMatrix *matrix);
91 static Double_t Tolerance() {
return 1.E-10;}
92 static Double_t ComputeEpsMch();
93 static Double_t EpsMch();
94 virtual void AfterStreamer() {};
95 virtual Double_t Capacity()
const = 0;
96 void CheckShape(Int_t testNo, Int_t nsamples=10000, Option_t *option=
"");
97 virtual void ComputeBBox() = 0;
98 virtual void ComputeNormal(
const Double_t *point,
const Double_t *dir, Double_t *norm) = 0;
99 virtual void ComputeNormal_v(
const Double_t *,
const Double_t *, Double_t *, Int_t) {}
100 virtual Bool_t Contains(
const Double_t *point)
const = 0;
101 virtual void Contains_v(
const Double_t *, Bool_t *, Int_t)
const {}
102 virtual Bool_t CouldBeCrossed(
const Double_t *point,
const Double_t *dir)
const = 0;
103 virtual Int_t DistancetoPrimitive(Int_t px, Int_t py) = 0;
104 virtual Double_t DistFromInside(
const Double_t *point,
const Double_t *dir, Int_t iact=1,
105 Double_t step=TGeoShape::Big(), Double_t *safe=0)
const = 0;
106 virtual void DistFromInside_v(
const Double_t *,
const Double_t *, Double_t *, Int_t, Double_t *)
const {}
107 virtual Double_t DistFromOutside(
const Double_t *point,
const Double_t *dir, Int_t iact=1,
108 Double_t step=TGeoShape::Big(), Double_t *safe=0)
const = 0;
109 virtual void DistFromOutside_v(
const Double_t *,
const Double_t *, Double_t *, Int_t, Double_t *)
const {}
110 static Double_t DistToPhiMin(
const Double_t *point,
const Double_t *dir, Double_t s1, Double_t c1, Double_t s2, Double_t c2,
111 Double_t sm, Double_t cm, Bool_t in=kTRUE);
112 virtual TGeoVolume *Divide(TGeoVolume *voldiv,
const char *divname, Int_t iaxis, Int_t ndiv,
113 Double_t start, Double_t step) = 0;
114 virtual void Draw(Option_t *option=
"");
115 virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
116 virtual const char *GetAxisName(Int_t iaxis)
const = 0;
117 virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi)
const = 0;
118 virtual void GetBoundingCylinder(Double_t *param)
const = 0;
119 virtual const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame)
const;
120 virtual Int_t GetByteCount()
const = 0;
121 virtual Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array)
const = 0;
122 virtual Int_t GetFittingBox(
const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz)
const = 0;
123 Int_t GetId()
const {
return fShapeId;}
124 virtual TGeoShape *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat)
const = 0;
125 virtual void GetMeshNumbers(Int_t &, Int_t &, Int_t &)
const {;}
126 virtual const char *GetName()
const;
127 virtual Int_t GetNmeshVertices()
const {
return 0;}
128 const char *GetPointerName()
const;
129 virtual Bool_t IsAssembly()
const {
return kFALSE;}
130 virtual Bool_t IsComposite()
const {
return kFALSE;}
131 virtual Bool_t IsCylType()
const = 0;
132 static Bool_t IsCloseToPhi(Double_t epsil,
const Double_t *point, Double_t c1, Double_t s1, Double_t c2, Double_t s2);
133 static Bool_t IsCrossingSemiplane(
const Double_t *point,
const Double_t *dir, Double_t cphi, Double_t sphi, Double_t &snext, Double_t &rxy);
134 static Bool_t IsSameWithinTolerance(Double_t a, Double_t b);
135 static Bool_t IsSegCrossing(Double_t x1, Double_t y1, Double_t x2, Double_t y2,Double_t x3, Double_t y3,Double_t x4, Double_t y4);
136 static Bool_t IsInPhiRange(
const Double_t *point, Double_t phi1, Double_t phi2);
137 virtual Bool_t IsReflected()
const {
return kFALSE;}
138 virtual Bool_t IsVecGeom()
const {
return kFALSE;}
139 Bool_t IsRunTimeShape()
const {
return TestShapeBit(kGeoRunTimeShape);}
140 Bool_t IsValid()
const {
return !TestShapeBit(kGeoInvalidShape);}
141 virtual Bool_t IsValidBox()
const = 0;
142 virtual void InspectShape()
const = 0;
143 virtual TBuffer3D *MakeBuffer3D()
const {
return 0;}
144 static void NormalPhi(
const Double_t *point,
const Double_t *dir, Double_t *norm, Double_t c1, Double_t s1, Double_t c2, Double_t s2);
145 virtual void Paint(Option_t *option=
"");
146 virtual Double_t Safety(
const Double_t *point, Bool_t in=kTRUE)
const = 0;
147 virtual void Safety_v(
const Double_t *,
const Bool_t *, Double_t *, Int_t)
const {}
148 static Double_t SafetyPhi(
const Double_t *point, Bool_t in, Double_t phi1, Double_t phi2);
149 static Double_t SafetySeg(Double_t r, Double_t z, Double_t r1, Double_t z1, Double_t r2, Double_t z2, Bool_t outer);
150 virtual void SetDimensions(Double_t *param) = 0;
151 void SetId(Int_t
id) {fShapeId = id;}
152 virtual void SetPoints(Double_t *points)
const = 0;
153 virtual void SetPoints(Float_t *points)
const = 0;
154 virtual void SetSegsAndPols(TBuffer3D &buff)
const = 0;
155 void SetRuntime(Bool_t flag=kTRUE) {SetShapeBit(kGeoRunTimeShape, flag);}
156 Int_t ShapeDistancetoPrimitive(Int_t numpoints, Int_t px, Int_t py)
const;
157 virtual void Sizeof3D()
const = 0;
160 void SetShapeBit(UInt_t f, Bool_t set);
161 void SetShapeBit(UInt_t f) { fShapeBits |= f & kBitMask32; }
162 void ResetShapeBit(UInt_t f) { fShapeBits &= ~(f & kBitMask32); }
163 Bool_t TestShapeBit(UInt_t f)
const {
return (Bool_t) ((fShapeBits & f) != 0); }
164 Int_t TestShapeBits(UInt_t f)
const {
return (Int_t) (fShapeBits & f); }
165 void InvertShapeBit(UInt_t f) { fShapeBits ^= f & kBitMask32; }
167 ClassDef(TGeoShape, 2)