Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGeoCompositeShape.cxx
Go to the documentation of this file.
1// @(#)root/geom:$Id$
2// Author: Andrei Gheata 31/01/02
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/** \class TGeoCompositeShape
13\ingroup Shapes_classes
14
15Composite shapes are Boolean combinations of two or more shape
16components. The supported Boolean operations are union (+), intersection
17(\*) and subtraction(-). Composite shapes derive from the base
18**`TGeoShape`** class, therefore providing all shape features:
19computation of bounding box, finding if a given point is inside or
20outside the combination, as well as computing the distance to
21entering/exiting. They can be directly used for creating volumes or used
22in the definition of other composite shapes.
23
24Composite shapes are provided in order to complement and extend the set
25of basic shape primitives. They have a binary tree internal structure,
26therefore all shape-related geometry queries are signals propagated from
27top level down to the final leaves, while the provided answers are
28assembled and interpreted back at top. This `CSG`
29`(composite solid geometry)` hierarchy is effective for small number of
30components, while performance drops dramatically for large structures.
31Building a complete geometry in this style is virtually possible but
32highly not recommended.
33
34#### The Structure of Composite Shapes
35
36A composite shape can always be looked as the result of a Boolean
37operation between only two shape components. All information identifying
38these two components as well as their positions with respect to the
39frame of the composite is represented by an object called Boolean node.
40A composite shape has a pointer to such a Boolean node. Since the shape
41components may also be composites, they will also contain binary Boolean
42nodes branching out other two shapes in the hierarchy. Any such branch
43ends-up when the final leaves are no longer composite shapes, but basic
44primitives. The figure shows the composite shapes structure.
45
46\image html geom_composite_shape001.png "The composite shapes structure" width=600px
47
48Suppose that A, B, C and D represent basic shapes, we will illustrate
49how the internal representation of few combinations look like. We do
50this only for understanding how to create them in a proper way, since
51the user interface for this purpose is in fact very simple. We will
52ignore for the time being the positioning of components. The definition
53of a composite shape takes an expression where the identifiers are shape
54names. The expression is parsed and decomposed in 2 sub-expressions and
55the top-level Boolean operator.
56
571. Union: `A+B+C`
58
59Just to illustrate the Boolean expression parsing and the composite
60shape structure, let's take a simple example. We will describe the union
61of A, B and C. Both union operators are at the same level. Since:
62
63`A+B+C = (A+B)+C = A+(B+C)`
64
65The first` (+)` is taken as separator, hence the expression split in:
66`A` and `(B+C)`. A Boolean node of type **`TGeoUnion`**`("A","B+C")` is
67created. This tries to replace the 2 expressions by actual pointers to
68corresponding shapes. The first expression (A) contains no operators
69therefore is interpreted as representing a shape. The shape named "A" is
70searched into the list of shapes handled by the manager class and stored
71as the "left" shape in the Boolean union node. Since the second
72expression is not yet fully decomposed, the "right" shape in the
73combination is created as a new composite shape. This will split at its
74turn B+C into B and C and create a **`TGeoUnion`**`("B","C")`. The B and
75C identifiers will be looked for and replaced by the pointers to the
76actual shapes into the new node. Finally, the composite "`A+B+C`" will
77be represented as shown in Fig.17-23.**
78
79\image html geom_composite_shape002.png "Representation of A+B+C" width=600px
80
81To build this composite shape:
82
83~~~{.cpp}
84TGeoCompositeShape *cs1 = new TGeoCompositeShape("CS1","A+B+C");
85~~~
86
87Any shape entering a Boolean combination can be prior positioned. In
88order to do so, one has to attach a matrix name to the shape name by
89using a colon (:). As for shapes, the named matrix has to be prior
90defined:
91
92~~~{.cpp}
93TGeoMatrix *mat;
94// ... code creating some geometrical transformation
95mat->SetName("mat1");
96mat->RegisterYourself(); // see Geometrical transformations
97~~~
98
99An identifier `shape:matrix` have the meaning: `shape` is translated or
100rotated with `matrix` with respect to the Boolean combination it enters
101as operand. Note that in the expression A+B+C no matrix identifier was
102provided, therefore the identity matrix was used for positioning the
103shape components. The next example will illustrate a more complex case.
104
1052. `(A:m1+B):m2-(C:m3*D:m4):m5`
106
107Let's try to understand the expression above. This expression means:
108subtract the intersection of **C** and **D** from the union of **A** and
109**B**. The usage of parenthesis to force the desired precedence is
110always recommended. One can see that not only the primitive shapes have
111some geometrical transformations, but also their intermediate
112compositions.
113
114
115\image html geom_composite_shape003.png "Internal representation for composite shapes" width=600px
116
117~~~{.cpp}
118TGeoCompositeShape *cs2 = new TGeoCompositeShape("CS2",
119"(A:m1+B):m2-(C:m3*D:m4):m5");
120~~~
121
122Building composite shapes as in the first example is not always quite
123useful since we were using un-positioned shapes. When supplying just
124shape names as identifiers, the created Boolean nodes will assume that
125the shapes are positioned with an identity transformation with respect
126to the frame of the created composite. In order to provide some
127positioning of the combination components, we have to attach after each
128shape identifier the name of an existing transformation, separated by a
129colon. Obviously all transformations created for this purpose have to be
130objects with unique names in order to be properly substituted during
131parsing.
132
133#### Composite Shape Example
134
135One should have in mind that the same shape or matrix identifiers can be
136used many times in the same expression, as in the following example:
137
138~~~{.cpp}
139{
140 TCanvas *c = new TCanvas("c", "c",0,0,600,600);
141 const Double_t sq2 = TMath::Sqrt(2.);
142 TGeoManager *mgr =
143 new TGeoManager("Geom","composite shape example");
144 TGeoMedium *medium = 0;
145 TGeoVolume *top = mgr->MakeBox("TOP",medium,100,250,250);
146 mgr->SetTopVolume(top);
147
148 // make shape components
149 TGeoBBox *sbox = new TGeoBBox("B",100,125*sq2,125*sq2);
150 TGeoTube *stub = new TGeoTube("T",0,100,250);
151 TGeoPgon *spgon = new TGeoPgon("P",0.,360.,6,2);
152 spgon->DefineSection(0,-250,0,80);
153 spgon->DefineSection(1,250,0,80);
154
155 // define some rotations
156 TGeoRotation *r1 = new TGeoRotation("r1",90,0,0,180,90,90);
157 r1->RegisterYourself();
158 TGeoRotation *r2 = new TGeoRotation("r2",90,0,45,90,45,270);
159 r2->RegisterYourself();
160 // create a composite
161 TGeoCompositeShape *cs = new TGeoCompositeShape("cs", "((T+T:r1)-(P+P:r1))*B:r2");
162 TGeoVolume *comp = new TGeoVolume("COMP",cs);
163 comp->SetLineColor(kRed);
164
165 // put it in the top volume
166 top->AddNode(comp,1);
167 mgr->CloseGeometry();
168 // visualize it with ray tracing
169 top->Raytrace();
170}
171~~~
172
173\image html geom_composite_shape004.png "A composite shape example" width=400px
174
175
176Composite shapes can be subsequently used for defining volumes.
177Moreover, these volumes contain other volumes, following the general
178criteria. Volumes created based on composite shapes cannot be divided.
179
180*/
181
182#include <iostream>
183#include "TRandom3.h"
184
185#include "TGeoManager.h"
186#include "TGeoMatrix.h"
187#include "TGeoBoolNode.h"
188
189#include "TVirtualPad.h"
190#include "TVirtualViewer3D.h"
191#include "TBuffer3D.h"
192#include "TBuffer3DTypes.h"
193
194#include "TGeoCompositeShape.h"
196
197////////////////////////////////////////////////////////////////////////////////
198/// Needed just for cleanup.
199
201{
202 if (fNode)
204}
205
206////////////////////////////////////////////////////////////////////////////////
207/// Needed just for cleanup.
208
210{
211 if (fNode)
212 fNode->CreateThreadData(nthreads);
213}
214
215////////////////////////////////////////////////////////////////////////////////
216/// Default constructor
217
219{
221 fNode = nullptr;
222}
223
224////////////////////////////////////////////////////////////////////////////////
225/// Default constructor
226
227TGeoCompositeShape::TGeoCompositeShape(const char *name, const char *expression) : TGeoBBox(0, 0, 0)
228{
230 SetName(name);
231 fNode = nullptr;
232 MakeNode(expression);
233 if (!fNode) {
234 Error("ctor", "Composite %s: cannot parse expression: %s", name, expression);
235 return;
236 }
237 ComputeBBox();
238}
239
240////////////////////////////////////////////////////////////////////////////////
241/// Default constructor
242
243TGeoCompositeShape::TGeoCompositeShape(const char *expression) : TGeoBBox(0, 0, 0)
244{
246 fNode = nullptr;
247 MakeNode(expression);
248 if (!fNode) {
249 TString message = TString::Format("Composite (no name) could not parse expression %s", expression);
250 Error("ctor", "%s", message.Data());
251 return;
252 }
253 ComputeBBox();
254}
255
256////////////////////////////////////////////////////////////////////////////////
257/// Constructor with a Boolean node
258
260{
261 SetName(name);
262 fNode = node;
263 if (!fNode) {
264 Error("ctor", "Composite shape %s has null node", name);
265 return;
266 }
267 ComputeBBox();
268}
269
270////////////////////////////////////////////////////////////////////////////////
271/// destructor
272
274{
275 if (fNode)
276 delete fNode;
277}
278
279////////////////////////////////////////////////////////////////////////////////
280/// Computes capacity of this shape [length^3] by sampling with 1% error.
281
283{
284 Double_t pt[3];
285 if (!gRandom)
286 gRandom = new TRandom3();
287 Double_t vbox = 8 * fDX * fDY * fDZ; // cm3
288 Int_t igen = 0;
289 Int_t iin = 0;
290 while (iin < 10000) {
291 pt[0] = fOrigin[0] - fDX + 2 * fDX * gRandom->Rndm();
292 pt[1] = fOrigin[1] - fDY + 2 * fDY * gRandom->Rndm();
293 pt[2] = fOrigin[2] - fDZ + 2 * fDZ * gRandom->Rndm();
294 igen++;
295 if (Contains(pt))
296 iin++;
297 }
298 Double_t capacity = iin * vbox / igen;
299 return capacity;
300}
301
302////////////////////////////////////////////////////////////////////////////////
303/// compute bounding box of the sphere
304
306{
307 if (fNode)
309}
310
311////////////////////////////////////////////////////////////////////////////////
312/// Computes normal vector in POINT to the composite shape.
313
314void TGeoCompositeShape::ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
315{
316 if (fNode)
317 fNode->ComputeNormal(point, dir, norm);
318}
319
320////////////////////////////////////////////////////////////////////////////////
321/// Tests if point is inside the shape.
322
324{
325 if (fNode)
326 return fNode->Contains(point);
327 return kFALSE;
328}
329
330////////////////////////////////////////////////////////////////////////////////
331/// Compute closest distance from point px,py to each corner.
332
334{
335 const Int_t numPoints = GetNmeshVertices();
336 return ShapeDistancetoPrimitive(numPoints, px, py);
337}
338
339////////////////////////////////////////////////////////////////////////////////
340/// Compute distance from outside point to this composite shape.
341/// Check if the bounding box is crossed within the requested distance
342
344 Double_t *safe) const
345{
346 Double_t sdist = TGeoBBox::DistFromOutside(point, dir, fDX, fDY, fDZ, fOrigin, step);
347 if (sdist >= step)
348 return TGeoShape::Big();
349 if (fNode)
350 return fNode->DistFromOutside(point, dir, iact, step, safe);
351 return TGeoShape::Big();
352}
353
354////////////////////////////////////////////////////////////////////////////////
355/// Compute distance from inside point to outside of this composite shape.
356
358 Double_t *safe) const
359{
360 if (fNode)
361 return fNode->DistFromInside(point, dir, iact, step, safe);
362 return TGeoShape::Big();
363}
364
365////////////////////////////////////////////////////////////////////////////////
366/// Divide all range of iaxis in range/step cells
367
368TGeoVolume *TGeoCompositeShape::Divide(TGeoVolume * /*voldiv*/, const char * /*divname*/, Int_t /*iaxis*/,
369 Int_t /*ndiv*/, Double_t /*start*/, Double_t /*step*/)
370{
371 Error("Divide", "Composite shapes cannot be divided");
372 return nullptr;
373}
374
375////////////////////////////////////////////////////////////////////////////////
376/// Returns numbers of vertices, segments and polygons composing the shape mesh.
377
378void TGeoCompositeShape::GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
379{
380 nvert = GetNmeshVertices();
381 nsegs = 0;
382 npols = 0;
383}
384
385////////////////////////////////////////////////////////////////////////////////
386/// print shape parameters
387
389{
390 printf("*** TGeoCompositeShape : %s = %s\n", GetName(), GetTitle());
391 printf(" Bounding box:\n");
393}
394
395////////////////////////////////////////////////////////////////////////////////
396/// Make a boolean node according to the top level boolean operation of expression.
397/// Propagates signal to branches until expression is fully decomposed.
398/// printf("Making node for : %s\n", expression);
399
400void TGeoCompositeShape::MakeNode(const char *expression)
401{
402 if (fNode)
403 delete fNode;
404 fNode = nullptr;
405 SetTitle(expression);
406 TString sleft, sright, smat;
407 Int_t boolop;
408 boolop = TGeoManager::Parse(expression, sleft, sright, smat);
409 if (boolop < 0) {
410 // fail
411 Error("MakeNode", "parser error");
412 return;
413 }
414 if (smat.Length())
415 Warning("MakeNode", "no geometrical transformation allowed at this level");
416 switch (boolop) {
417 case 0: Error("MakeNode", "Expression has no boolean operation"); return;
418 case 1: fNode = new TGeoUnion(sleft.Data(), sright.Data()); return;
419 case 2: fNode = new TGeoSubtraction(sleft.Data(), sright.Data()); return;
420 case 3: fNode = new TGeoIntersection(sleft.Data(), sright.Data());
421 }
422}
423
424////////////////////////////////////////////////////////////////////////////////
425/// Paint this composite shape into the current 3D viewer
426/// Returns bool flag indicating if the caller should continue to
427/// paint child objects
428
430{
431 Bool_t addChildren = kTRUE;
432
434 TVirtualViewer3D *viewer = gPad->GetViewer3D();
435 if (!painter || !viewer)
436 return kFALSE;
437
438 if (fNode) {
439 // Fill out the buffer for the composite shape - nothing extra
440 // over TGeoBBox
441 Bool_t preferLocal = viewer->PreferLocalFrame();
443 preferLocal = kFALSE;
446
447 Bool_t paintComponents = kTRUE;
448
449 // Start a composite shape, identified by this buffer
451 paintComponents = viewer->OpenComposite(buffer, &addChildren);
452
454
455 // Paint the boolean node - will add more buffers to viewer
457 TGeoHMatrix backup(*matrix);
458 if (preferLocal)
459 matrix->Clear();
460 if (paintComponents)
462 if (preferLocal)
463 *matrix = backup;
464 // Close the composite shape
466 viewer->CloseComposite();
467 }
468
469 return addChildren;
470}
471
472////////////////////////////////////////////////////////////////////////////////
473/// Register the shape and all components to TGeoManager class.
474
476{
478 return;
479 gGeoManager->AddShape(this);
480 TGeoMatrix *matrix;
481 TGeoShape *shape;
482 TGeoCompositeShape *comp;
483 if (fNode) {
484 matrix = fNode->GetLeftMatrix();
485 if (!matrix->IsRegistered())
486 matrix->RegisterYourself();
487 else if (!gGeoManager->GetListOfMatrices()->FindObject(matrix)) {
489 }
490 matrix = fNode->GetRightMatrix();
491 if (!matrix->IsRegistered())
492 matrix->RegisterYourself();
493 else if (!gGeoManager->GetListOfMatrices()->FindObject(matrix)) {
495 }
496 shape = fNode->GetLeftShape();
497 if (!gGeoManager->GetListOfShapes()->FindObject(shape)) {
498 if (shape->IsComposite()) {
499 comp = (TGeoCompositeShape *)shape;
500 comp->RegisterYourself();
501 } else {
502 gGeoManager->AddShape(shape);
503 }
504 }
505 shape = fNode->GetRightShape();
506 if (!gGeoManager->GetListOfShapes()->FindObject(shape)) {
507 if (shape->IsComposite()) {
508 comp = (TGeoCompositeShape *)shape;
509 comp->RegisterYourself();
510 } else {
511 gGeoManager->AddShape(shape);
512 }
513 }
514 }
515}
516
517////////////////////////////////////////////////////////////////////////////////
518/// computes the closest distance from given point to this shape, according
519/// to option. The matching point on the shape is stored in spoint.
520
522{
523 if (fNode)
524 return fNode->Safety(point, in);
525 return 0.;
526}
527
528////////////////////////////////////////////////////////////////////////////////
529/// Save a primitive as a C++ statement(s) on output stream "out".
530
531void TGeoCompositeShape::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
532{
534 return;
535 if (fNode)
537 out << " // Shape: " << GetName() << " type: " << ClassName() << std::endl;
538 out << " TGeoShape *" << GetPointerName() << " = new TGeoCompositeShape(\"" << GetName() << "\", pBoolNode);"
539 << std::endl;
540 if (strlen(GetTitle()))
541 out << " " << GetPointerName() << "->SetTitle(\"" << GetTitle() << "\");" << std::endl;
543}
544
545////////////////////////////////////////////////////////////////////////////////
546/// create points for a composite shape
547
549{
550 if (fNode)
552}
553
554////////////////////////////////////////////////////////////////////////////////
555/// create points for a composite shape
556
558{
559 if (fNode)
561}
562
563////////////////////////////////////////////////////////////////////////////////
564/// compute size of this 3D object
565
567{
568 if (fNode)
569 fNode->Sizeof3D();
570}
571
572////////////////////////////////////////////////////////////////////////////////
573/// Return number of vertices of the mesh representation
574
576{
577 if (!fNode)
578 return 0;
579 return fNode->GetNpoints();
580}
581
582////////////////////////////////////////////////////////////////////////////////
583/// Check the inside status for each of the points in the array.
584/// Input: Array of point coordinates + vector size
585/// Output: Array of Booleans for the inside of each point
586
587void TGeoCompositeShape::Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const
588{
589 for (Int_t i = 0; i < vecsize; i++)
590 inside[i] = Contains(&points[3 * i]);
591}
592
593////////////////////////////////////////////////////////////////////////////////
594/// Compute the normal for an array o points so that norm.dot.dir is positive
595/// Input: Arrays of point coordinates and directions + vector size
596/// Output: Array of normal directions
597
599{
600 for (Int_t i = 0; i < vecsize; i++)
601 ComputeNormal(&points[3 * i], &dirs[3 * i], &norms[3 * i]);
602}
603
604////////////////////////////////////////////////////////////////////////////////
605/// Compute distance from array of input points having directions specified by dirs. Store output in dists
606
608 Double_t *step) const
609{
610 for (Int_t i = 0; i < vecsize; i++)
611 dists[i] = DistFromInside(&points[3 * i], &dirs[3 * i], 3, step[i]);
612}
613
614////////////////////////////////////////////////////////////////////////////////
615/// Compute distance from array of input points having directions specified by dirs. Store output in dists
616
618 Double_t *step) const
619{
620 for (Int_t i = 0; i < vecsize; i++)
621 dists[i] = DistFromOutside(&points[3 * i], &dirs[3 * i], 3, step[i]);
622}
623
624////////////////////////////////////////////////////////////////////////////////
625/// Compute safe distance from each of the points in the input array.
626/// Input: Array of point coordinates, array of statuses for these points, size of the arrays
627/// Output: Safety values
628
629void TGeoCompositeShape::Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const
630{
631 for (Int_t i = 0; i < vecsize; i++)
632 safe[i] = Safety(&points[3 * i], inside[i]);
633}
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:377
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
R__EXTERN TGeoManager * gGeoManager
R__EXTERN TRandom * gRandom
Definition TRandom.h:62
#define gPad
Generic 3D primitive description class.
Definition TBuffer3D.h:18
@ kBoundingBox
Definition TBuffer3D.h:51
static UInt_t DecCSLevel()
Decrement CS level.
static UInt_t GetCSLevel()
Return CS level.
static void IncCSLevel()
Increment CS level.
Box class.
Definition TGeoBBox.h:17
void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections, Bool_t localFrame) const override
Fills the supplied buffer, with sections in desired frame See TBuffer3D.h for explanation of sections...
Double_t fDX
Definition TGeoBBox.h:20
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 box.
Definition TGeoBBox.cxx:477
Double_t fOrigin[3]
Definition TGeoBBox.h:23
void InspectShape() const override
Prints shape parameters.
Definition TGeoBBox.cxx:855
Double_t fDY
Definition TGeoBBox.h:21
Double_t fDZ
Definition TGeoBBox.h:22
Base class for Boolean operations between two shapes.
virtual void Sizeof3D() const
Register size of this 3D object.
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)=0
void ClearThreadData() const
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
void CreateThreadData(Int_t nthreads)
Create thread data for n threads max.
TGeoMatrix * GetRightMatrix() const
TGeoShape * GetLeftShape() const
void Paint(Option_t *option) override
Special schema for feeding the 3D buffers to the painter client.
TGeoMatrix * GetLeftMatrix() const
virtual void SetPoints(Double_t *points) const
Fill buffer with shape vertices.
virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const =0
virtual Bool_t Contains(const Double_t *point) const =0
virtual void ComputeBBox(Double_t &dx, Double_t &dy, Double_t &dz, Double_t *origin)=0
virtual Int_t GetNpoints()=0
virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=0, Double_t *safe=nullptr) const =0
TGeoShape * GetRightShape() const
virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=0, Double_t *safe=nullptr) const =0
Composite shapes are Boolean combinations of two or more shape components.
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
Divide all range of iaxis in range/step cells.
void ComputeBBox() override
compute bounding box of the sphere
void Sizeof3D() const override
compute size of this 3D object
TGeoCompositeShape()
Default constructor.
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
computes the closest distance from given point to this shape, according to option.
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 this composite shape.
Int_t GetNmeshVertices() const override
Return number of vertices of the mesh representation.
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 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 ClearThreadData() const override
Needed just for cleanup.
Double_t Capacity() const override
Computes capacity of this shape [length^3] by sampling with 1% error.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
virtual Bool_t PaintComposite(Option_t *option="") const
Paint this composite shape into the current 3D viewer Returns bool flag indicating if the caller shou...
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 outside of this composite shape.
void InspectShape() const override
print shape parameters
~TGeoCompositeShape() override
destructor
void CreateThreadData(Int_t nthreads) override
Needed just for cleanup.
Bool_t Contains(const Double_t *point) const override
Tests if point is inside the shape.
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override
Computes normal vector in POINT to the composite 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...
void RegisterYourself()
Register the shape and all components to TGeoManager class.
void SetPoints(Double_t *points) const override
create points for a composite shape
void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override
Returns numbers of vertices, segments and polygons composing the shape mesh.
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...
void MakeNode(const char *expression)
Make a boolean node according to the top level boolean operation of expression.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute closest distance from point px,py to each corner.
Matrix class used for computing global transformations Should NOT be used for node definition.
Definition TGeoMatrix.h:458
void Clear(Option_t *option="") override
clear the data for this matrix
TObjArray * GetListOfMatrices() const
TVirtualGeoPainter * GetGeomPainter()
Make a default painter if none present. Returns pointer to it.
static Int_t Parse(const char *expr, TString &expr1, TString &expr2, TString &expr3)
Parse a string boolean expression and do a syntax check.
TObjArray * GetListOfShapes() const
Int_t AddShape(const TGeoShape *shape)
Add a shape to the list. Returns index of the shape in list.
Geometrical transformation package.
Definition TGeoMatrix.h:38
virtual void RegisterYourself()
Register the matrix in the current manager, which will become the owner.
Bool_t IsRegistered() const
Definition TGeoMatrix.h:72
Base abstract class for all shapes.
Definition TGeoShape.h:25
static Double_t Big()
Definition TGeoShape.h:87
void SetShapeBit(UInt_t f, Bool_t set)
Equivalent of TObject::SetBit.
virtual Bool_t IsComposite() const
Definition TGeoShape.h:130
const char * GetPointerName() const
Provide a pointer name containing uid.
Int_t ShapeDistancetoPrimitive(Int_t numpoints, Int_t px, Int_t py) const
Returns distance to shape primitive mesh.
const char * GetName() const override
Get the shape name.
static TGeoMatrix * GetTransform()
Returns current transformation matrix that applies to shape.
@ kGeoSavePrimitive
Definition TGeoShape.h:64
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:43
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:164
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:48
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:140
TObject * FindObject(const char *name) const override
Find an object in this collection using its name.
void Add(TObject *obj) override
Definition TObjArray.h:68
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:201
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition TObject.cxx:207
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:973
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:780
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:987
Random number generator class based on M.
Definition TRandom3.h:27
Double_t Rndm() override
Machine independent random number generator.
Definition TRandom.cxx:559
Basic string class.
Definition TString.h:139
Ssiz_t Length() const
Definition TString.h:417
const char * Data() const
Definition TString.h:376
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2378
Abstract class for geometry painters.
Abstract 3D shapes viewer.
virtual Bool_t PreferLocalFrame() const =0
virtual void CloseComposite()=0
virtual Bool_t OpenComposite(const TBuffer3D &buffer, Bool_t *addChildren=nullptr)=0
TPaveText * pt