ROOT  6.06/09
Reference Guide
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 
13 ///////////////////////////////////////////////////////////////////////////////
14 // TGeoCompositeShape - class handling Boolean composition of shapes
15 //
16 // Composite shapes are Boolean combination of two or more shape
17 // components. The supported boolean operations are union (+), intersection (*)
18 // and subtraction. Composite shapes derive from the base TGeoShape class,
19 // therefore providing all shape features : computation of bounding box, finding
20 // if a given point is inside or outside the combination, as well as computing the
21 // distance to entering/exiting. It can be directly used for creating volumes or
22 // used in the definition of other composite shapes.
23 // Composite shapes are provided in order to complement and extend the set of
24 // basic shape primitives. They have a binary tree internal structure, therefore
25 // all shape-related geometry queries are signals propagated from top level down
26 // to the final leaves, while the provided answers are assembled and interpreted
27 // back at top. This CSG hierarchy is effective for small number of components,
28 // while performance drops dramatically for large structures. Building a complete
29 // geometry in this style is virtually possible but highly not recommended.
30 //
31 // Structure of composite shapes
32 //
33 // A composite shape can always be regarded as the result of a Boolean operation
34 // between only two shape components. All information identifying these two
35 // components as well as their positions with respect to the frame of the composite
36 // is represented by an object called Boolean node. A composite shape just have
37 // a pointer to such a Boolean node. Since the shape components may also be
38 // composites, they will also contain binary Boolean nodes branching other two
39 // shapes in the hierarcy. Any such branch ends-up when the final leaves are no
40 // longer composite shapes, but basic primitives.
41 //
42 //Begin_Html
43 /*
44 <img src="gif/t_booltree.jpg">
45 */
46 //End_Html
47 //
48 // Suppose that A, B, C and D represent basic shapes, we will illustrate
49 // how the internal representation of few combinations look like. We do this
50 // only for the sake of understanding how to create them in a proper way, since
51 // the user interface for this purpose is in fact very simple. We will ignore
52 // for the time being the positioning of components. The definition of a composite
53 // shape takes an expression where the identifiers are shape names. The
54 // expression is parsed and decomposed in 2 sub-expressions and the top-level
55 // Boolean operator.
56 //
57 // 1. A+B+C
58 // This represent the union of A, B and C. Both union operators are at the
59 // same level. Since:
60 // A+B+C = (A+B)+C = A+(B+C)
61 // the first (+) is taken as separator, hence the expression split:
62 // A and B+C
63 // A Boolean node of type TGeoUnion("A", "B+C") is created. This tries to replace
64 // the 2 expressions by actual pointers to corresponding shapes.
65 // The first expression (A) contains no operators therefore is interpreted as
66 // representing a shape. The shape named "A" is searched into the list of shapes
67 // handled by the manager class and stored as the "left" shape in the Boolean
68 // union node. Since the second expression is not yet fully decomposed, the "right"
69 // shape in the combination is created as a new composite shape. This will split
70 // at its turn B+C into B and C and create a TGeoUnion("B","C"). The B and C
71 // identifiers will be looked for and replaced by the pointers to the actual shapes
72 // into the new node. Finally, the composite "A+B+C" will be represented as:
73 //
74 // A
75 // |
76 // [A+B+C] = (+) B
77 // | |
78 // [B+C] = (+)
79 // |
80 // C
81 //
82 // where [] is a composite shape, (+) is a Boolean node of type union and A, B,
83 // C are pointers to the corresponding shapes.
84 // Building this composite shapes takes the following line :
85 // TGeoCompositeShape *cs1 = new TGeoCompositeShape("CS1", "A+B+C");
86 //
87 // 2. (A+B)-(C+D)
88 // This expression means: subtract the union of C and D from the union of A and
89 // B. The usage of paranthesys to force operator precedence is always recommended.
90 // The representation of the corresponding composite shape looks like:
91 //
92 // A
93 // |
94 // [A+B] = (+)
95 // | |
96 // [(A+B)-(C+D)] = (-) C B
97 // | |
98 // [C+D]=(+)
99 // |
100 // D
101 //
102 // TGeoCompositeShape *cs2 = new TGeoCompositeShape("CS2", "(A+B)-(C+D)");
103 //
104 // Building composite shapes as in the 2 examples above is not always quite
105 // usefull since we were using unpositioned shapes. When suplying just shape
106 // names as identifiers, the created boolean nodes will assume that the shapes
107 // are positioned with an identity transformation with respect to the frame of
108 // the created composite. In order to provide some positioning of the combination
109 // components, we have to attach after each shape identifier the name of an
110 // existing transformation, separated by a colon. Obviously all transformations
111 // created for this purpose have to be objects with unique names in order to be
112 // properly substituted during parsing.
113 // Let's look at the code implementing the second example :
114 //
115 // TGeoTranslation *t1 = new TGeoTranslation("t1",0,0,-20);
116 // TGeoTranslation *t2 = new TGeoTranslation("t2",0,0, 20);
117 // TGeoRotation *r1 = new TGeoRotation("r1"); // transformations need names
118 // r1->SetAngles(90,30,90,120,0,0); // rotation with 30 degrees about Z
119 // TGeoTube *a = new TGeoTube(0, 10,20);
120 // a->SetName("A"); // shapes need names too
121 // TGeoTube *b = new TGeoTube(0, 20,20);
122 // b->SetName("B");
123 // TGeoBBox *c = new TGeoBBox(10,10,50);
124 // c->SetName("C");
125 // TGeoBBox *d = new TGeoBBox(50,10,10);
126 // d->SetName("D");
127 //
128 // TGeoCompositeShape *cs;
129 // cs = new TGeoCompositeShape("CS", "(A:t1+B:t2)-(C+D:r1)");
130 //
131 // The newly created composite looks like 2 cylinders of different radii sitting
132 // one on top of the other and having 2 rectangular holes : a longitudinal one
133 // along Z axis corresponding to C and an other one in the XY plane due to D.
134 // One should have in mind that the same shape or matrix identifier can be
135 // used many times in the same expression. For instance:
136 //
137 // (A:t1-A:t2)*B:t1
138 //
139 // is a valid expression. Expressions that cannot be parsed or identifiers that
140 // cannot be substituted by existing objects generate error messages.
141 // Composite shapes can be subsequently used for defining volumes. Moreover,
142 // these volumes may have daughters but these have to obbey overlapping/extruding
143 // rules (see TGeoVolume). Volumes created based on composite shapes cannot be
144 // divided. Visualization of such volumes is currently not implemented.
145 
146 #include "Riostream.h"
147 #include "TRandom3.h"
148 
149 #include "TGeoManager.h"
150 #include "TGeoMatrix.h"
151 #include "TGeoBoolNode.h"
152 #include "TVirtualGeoPainter.h"
153 
154 #include "TVirtualPad.h"
155 #include "TVirtualViewer3D.h"
156 #include "TBuffer3D.h"
157 #include "TBuffer3DTypes.h"
158 
159 #include "TGeoCompositeShape.h"
161 
162 ////////////////////////////////////////////////////////////////////////////////
163 /// Needed just for cleanup.
164 
165 void TGeoCompositeShape::ClearThreadData() const
166 {
167  if (fNode) fNode->ClearThreadData();
168 }
169 
170 ////////////////////////////////////////////////////////////////////////////////
171 /// Needed just for cleanup.
172 
174 {
175  if (fNode) fNode->CreateThreadData(nthreads);
176 }
177 
178 ////////////////////////////////////////////////////////////////////////////////
179 /// Default constructor
180 
182  :TGeoBBox(0, 0, 0)
183 {
185  fNode = 0;
186 }
187 
188 ////////////////////////////////////////////////////////////////////////////////
189 /// Default constructor
190 
191 TGeoCompositeShape::TGeoCompositeShape(const char *name, const char *expression)
192  :TGeoBBox(0, 0, 0)
193 {
195  SetName(name);
196  fNode = 0;
197  MakeNode(expression);
198  if (!fNode) {
199  Error("ctor", "Composite %s: cannot parse expression: %s", name, expression);
200  return;
201  }
202  ComputeBBox();
203 }
204 
205 ////////////////////////////////////////////////////////////////////////////////
206 /// Default constructor
207 
209  :TGeoBBox(0, 0, 0)
210 {
212  fNode = 0;
213  MakeNode(expression);
214  if (!fNode) {
215  TString message = TString::Format("Composite (no name) could not parse expression %s", expression);
216  Error("ctor", "%s", message.Data());
217  return;
218  }
219  ComputeBBox();
220 }
221 
222 ////////////////////////////////////////////////////////////////////////////////
223 /// Constructor with a Boolean node
224 
226  :TGeoBBox(0,0,0)
227 {
228  SetName(name);
229  fNode = node;
230  if (!fNode) {
231  Error("ctor", "Composite shape %s has null node", name);
232  return;
233  }
234  ComputeBBox();
235 }
236 
237 ////////////////////////////////////////////////////////////////////////////////
238 /// destructor
239 
241 {
242  if (fNode) delete fNode;
243 }
244 
245 ////////////////////////////////////////////////////////////////////////////////
246 /// Computes capacity of this shape [length^3] by sampling with 1% error.
247 
249 {
250  Double_t pt[3];
251  if (!gRandom) gRandom = new TRandom3();
252  Double_t vbox = 8*fDX*fDY*fDZ; // cm3
253  Int_t igen=0;
254  Int_t iin = 0;
255  while (iin<10000) {
256  pt[0] = fOrigin[0]-fDX+2*fDX*gRandom->Rndm();
257  pt[1] = fOrigin[1]-fDY+2*fDY*gRandom->Rndm();
258  pt[2] = fOrigin[2]-fDZ+2*fDZ*gRandom->Rndm();
259  igen++;
260  if (Contains(pt)) iin++;
261  }
262  Double_t capacity = iin*vbox/igen;
263  return capacity;
264 }
265 
266 ////////////////////////////////////////////////////////////////////////////////
267 /// compute bounding box of the sphere
268 
270 {
272 }
273 
274 ////////////////////////////////////////////////////////////////////////////////
275 /// Computes normal vector in POINT to the composite shape.
276 
278 {
279  if (fNode) fNode->ComputeNormal(point,dir,norm);
280 }
281 
282 ////////////////////////////////////////////////////////////////////////////////
283 /// Tests if point is inside the shape.
284 
286 {
287  if (fNode) return fNode->Contains(point);
288  return kFALSE;
289 }
290 
291 ////////////////////////////////////////////////////////////////////////////////
292 /// Compute closest distance from point px,py to each corner.
293 
295 {
296  const Int_t numPoints = GetNmeshVertices();
297  return ShapeDistancetoPrimitive(numPoints, px, py);
298 }
299 
300 ////////////////////////////////////////////////////////////////////////////////
301 /// Compute distance from outside point to this composite shape.
302 /// Check if the bounding box is crossed within the requested distance
303 
305  Double_t step, Double_t *safe) const
306 {
307  Double_t sdist = TGeoBBox::DistFromOutside(point,dir, fDX, fDY, fDZ, fOrigin, step);
308  if (sdist>=step) return TGeoShape::Big();
309  if (fNode) return fNode->DistFromOutside(point, dir, iact, step, safe);
310  return TGeoShape::Big();
311 }
312 
313 ////////////////////////////////////////////////////////////////////////////////
314 /// Compute distance from inside point to outside of this composite shape.
315 
317  Double_t step, Double_t *safe) const
318 {
319  if (fNode) return fNode->DistFromInside(point, dir, iact, step, safe);
320  return TGeoShape::Big();
321 }
322 
323 ////////////////////////////////////////////////////////////////////////////////
324 /// Divide all range of iaxis in range/step cells
325 
326 TGeoVolume *TGeoCompositeShape::Divide(TGeoVolume * /*voldiv*/, const char * /*divname*/, Int_t /*iaxis*/,
327  Int_t /*ndiv*/, Double_t /*start*/, Double_t /*step*/)
328 {
329  Error("Divide", "Composite shapes cannot be divided");
330  return 0;
331 }
332 
333 ////////////////////////////////////////////////////////////////////////////////
334 /// Returns numbers of vertices, segments and polygons composing the shape mesh.
335 
336 void TGeoCompositeShape::GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
337 {
338  nvert = GetNmeshVertices();
339  nsegs = 0;
340  npols = 0;
341 }
342 
343 ////////////////////////////////////////////////////////////////////////////////
344 /// print shape parameters
345 
347 {
348  printf("*** TGeoCompositeShape : %s = %s\n", GetName(), GetTitle());
349  printf(" Bounding box:\n");
351 }
352 
353 ////////////////////////////////////////////////////////////////////////////////
354 /// Make a booleann node according to the top level boolean operation of expression.
355 /// Propagates signal to branches until expression is fully decomposed.
356 /// printf("Making node for : %s\n", expression);
357 
358 void TGeoCompositeShape::MakeNode(const char *expression)
359 {
360  if (fNode) delete fNode;
361  fNode = 0;
362  SetTitle(expression);
363  TString sleft, sright, smat;
364  Int_t boolop;
365  boolop = TGeoManager::Parse(expression, sleft, sright, smat);
366  if (boolop<0) {
367  // fail
368  Error("MakeNode", "parser error");
369  return;
370  }
371  if (smat.Length())
372  Warning("MakeNode", "no geometrical transformation allowed at this level");
373  switch (boolop) {
374  case 0:
375  Error("MakeNode", "Expression has no boolean operation");
376  return;
377  case 1:
378  fNode = new TGeoUnion(sleft.Data(), sright.Data());
379  return;
380  case 2:
381  fNode = new TGeoSubtraction(sleft.Data(), sright.Data());
382  return;
383  case 3:
384  fNode = new TGeoIntersection(sleft.Data(), sright.Data());
385  }
386 }
387 
388 ////////////////////////////////////////////////////////////////////////////////
389 /// Paint this composite shape into the current 3D viewer
390 /// Returns bool flag indicating if the caller should continue to
391 /// paint child objects
392 
394 {
395  Bool_t addChildren = kTRUE;
396 
398  TVirtualViewer3D * viewer = gPad->GetViewer3D();
399  if (!painter || !viewer) return kFALSE;
400 
401  if (fNode) {
402  // Fill out the buffer for the composite shape - nothing extra
403  // over TGeoBBox
404  Bool_t preferLocal = viewer->PreferLocalFrame();
405  if (TBuffer3D::GetCSLevel()) preferLocal = kFALSE;
406  static TBuffer3D buffer(TBuffer3DTypes::kComposite);
408  preferLocal);
409 
410  Bool_t paintComponents = kTRUE;
411 
412  // Start a composite shape, identified by this buffer
413  if (!TBuffer3D::GetCSLevel())
414  paintComponents = viewer->OpenComposite(buffer, &addChildren);
415 
417 
418  // Paint the boolean node - will add more buffers to viewer
420  TGeoHMatrix backup(*matrix);
421  if (preferLocal) matrix->Clear();
422  if (paintComponents) fNode->Paint(option);
423  if (preferLocal) *matrix = backup;
424  // Close the composite shape
425  if (!TBuffer3D::DecCSLevel())
426  viewer->CloseComposite();
427  }
428 
429  return addChildren;
430 }
431 
432 ////////////////////////////////////////////////////////////////////////////////
433 /// Register the shape and all components to TGeoManager class.
434 
436 {
437  if (gGeoManager->GetListOfShapes()->FindObject(this)) return;
438  gGeoManager->AddShape(this);
439  TGeoMatrix *matrix;
440  TGeoShape *shape;
441  TGeoCompositeShape *comp;
442  if (fNode) {
443  matrix = fNode->GetLeftMatrix();
444  if (!matrix->IsRegistered()) matrix->RegisterYourself();
445  else if (!gGeoManager->GetListOfMatrices()->FindObject(matrix)) {
446  gGeoManager->GetListOfMatrices()->Add(matrix);
447  }
448  matrix = fNode->GetRightMatrix();
449  if (!matrix->IsRegistered()) matrix->RegisterYourself();
450  else if (!gGeoManager->GetListOfMatrices()->FindObject(matrix)) {
451  gGeoManager->GetListOfMatrices()->Add(matrix);
452  }
453  shape = fNode->GetLeftShape();
454  if (!gGeoManager->GetListOfShapes()->FindObject(shape)) {
455  if (shape->IsComposite()) {
456  comp = (TGeoCompositeShape*)shape;
457  comp->RegisterYourself();
458  } else {
459  gGeoManager->AddShape(shape);
460  }
461  }
462  shape = fNode->GetRightShape();
463  if (!gGeoManager->GetListOfShapes()->FindObject(shape)) {
464  if (shape->IsComposite()) {
465  comp = (TGeoCompositeShape*)shape;
466  comp->RegisterYourself();
467  } else {
468  gGeoManager->AddShape(shape);
469  }
470  }
471  }
472 }
473 
474 ////////////////////////////////////////////////////////////////////////////////
475 /// computes the closest distance from given point to this shape, according
476 /// to option. The matching point on the shape is stored in spoint.
477 
479 {
480  if (fNode) return fNode->Safety(point,in);
481  return 0.;
482 }
483 
484 ////////////////////////////////////////////////////////////////////////////////
485 /// Save a primitive as a C++ statement(s) on output stream "out".
486 
487 void TGeoCompositeShape::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
488 {
489  if (TObject::TestBit(kGeoSavePrimitive)) return;
490  if (fNode) fNode->SavePrimitive(out,option);
491  out << " // Shape: " << GetName() << " type: " << ClassName() << std::endl;
492  out << " TGeoShape *" << GetPointerName() << " = new TGeoCompositeShape(\"" << GetName() << "\", pBoolNode);" << std::endl;
493  if (strlen(GetTitle())) out << " " << GetPointerName() << "->SetTitle(\"" << GetTitle() << "\");" << std::endl;
495 }
496 
497 ////////////////////////////////////////////////////////////////////////////////
498 /// create points for a composite shape
499 
501 {
502  if (fNode) fNode->SetPoints(points);
503 }
504 
505 ////////////////////////////////////////////////////////////////////////////////
506 /// create points for a composite shape
507 
509 {
510  if (fNode) fNode->SetPoints(points);
511 }
512 
513 ////////////////////////////////////////////////////////////////////////////////
514 /// compute size of this 3D object
515 
517 {
518  if (fNode) fNode->Sizeof3D();
519 }
520 
521 ////////////////////////////////////////////////////////////////////////////////
522 /// Return number of vertices of the mesh representation
523 
525 {
526  if (!fNode) return 0;
527  return fNode->GetNpoints();
528 }
529 
530 ////////////////////////////////////////////////////////////////////////////////
531 /// Check the inside status for each of the points in the array.
532 /// Input: Array of point coordinates + vector size
533 /// Output: Array of Booleans for the inside of each point
534 
535 void TGeoCompositeShape::Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const
536 {
537  for (Int_t i=0; i<vecsize; i++) inside[i] = Contains(&points[3*i]);
538 }
539 
540 ////////////////////////////////////////////////////////////////////////////////
541 /// Compute the normal for an array o points so that norm.dot.dir is positive
542 /// Input: Arrays of point coordinates and directions + vector size
543 /// Output: Array of normal directions
544 
545 void TGeoCompositeShape::ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize)
546 {
547  for (Int_t i=0; i<vecsize; i++) ComputeNormal(&points[3*i], &dirs[3*i], &norms[3*i]);
548 }
549 
550 ////////////////////////////////////////////////////////////////////////////////
551 /// Compute distance from array of input points having directions specisied by dirs. Store output in dists
552 
553 void TGeoCompositeShape::DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t* step) const
554 {
555  for (Int_t i=0; i<vecsize; i++) dists[i] = DistFromInside(&points[3*i], &dirs[3*i], 3, step[i]);
556 }
557 
558 ////////////////////////////////////////////////////////////////////////////////
559 /// Compute distance from array of input points having directions specisied by dirs. Store output in dists
560 
561 void TGeoCompositeShape::DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t* step) const
562 {
563  for (Int_t i=0; i<vecsize; i++) dists[i] = DistFromOutside(&points[3*i], &dirs[3*i], 3, step[i]);
564 }
565 
566 ////////////////////////////////////////////////////////////////////////////////
567 /// Compute safe distance from each of the points in the input array.
568 /// Input: Array of point coordinates, array of statuses for these points, size of the arrays
569 /// Output: Safety values
570 
571 void TGeoCompositeShape::Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const
572 {
573  for (Int_t i=0; i<vecsize; i++) safe[i] = Safety(&points[3*i], inside[i]);
574 }
virtual void CloseComposite()=0
virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const
computes the closest distance from given point to this shape, according to option.
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:52
virtual TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step)
Divide all range of iaxis in range/step cells.
virtual Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
Random number generator class based on M.
Definition: TRandom3.h:29
void MakeNode(const char *expression)
Make a booleann node according to the top level boolean operation of expression.
Ssiz_t Length() const
Definition: TString.h:390
float Float_t
Definition: RtypesCore.h:53
virtual Double_t Rndm(Int_t i=0)
Machine independent random number generator.
Definition: TRandom.cxx:512
const char Option_t
Definition: RtypesCore.h:62
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual Bool_t OpenComposite(const TBuffer3D &buffer, Bool_t *addChildren=0)=0
virtual void SetName(const char *name)
Change (i.e.
Definition: TNamed.cxx:128
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...
virtual Int_t GetNpoints()=0
TGeoShape * GetLeftShape() const
Definition: TGeoBoolNode.h:88
void RegisterYourself()
Register the shape and all components to TGeoManager class.
virtual void Sizeof3D() const
Register size of this 3D object.
Double_t fOrigin[3]
Definition: TGeoBBox.h:36
Basic string class.
Definition: TString.h:137
TObjArray * GetListOfShapes() const
Definition: TGeoManager.h:467
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=0, Double_t *safe=0) const =0
static Int_t Parse(const char *expr, TString &expr1, TString &expr2, TString &expr3)
Parse a string boolean expression and do a syntax check.
virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const
Compute distance from inside point to outside of this composite shape.
virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const
Compute distance from outside point to surface of the box.
Definition: TGeoBBox.cxx:386
static UInt_t GetCSLevel()
Return CS level.
Definition: TBuffer3D.cxx:494
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:732
virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const
Compute distance from outside point to this composite shape.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
const char * Data() const
Definition: TString.h:349
virtual void ClearThreadData() const
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
Definition: TObjArray.cxx:395
Double_t fDZ
Definition: TGeoBBox.h:35
virtual void Paint(Option_t *option)
Special schema for feeding the 3D buffers to the painter client.
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:2334
TGeoMatrix * GetRightMatrix() const
Definition: TGeoBoolNode.h:87
virtual void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const
Compute distance from array of input points having directions specisied by dirs. Store output in dist...
Abstract 3D shapes viewer.
static void IncCSLevel()
Increment CS level.
Definition: TBuffer3D.cxx:502
virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
Returns numbers of vertices, segments and polygons composing the shape mesh.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:918
char * out
Definition: TBase64.cxx:29
point * points
Definition: X3DBuffer.c:20
virtual void SetPoints(Double_t *points) const
create points for a composite shape
virtual void CreateThreadData(Int_t nthreads)
TPaveText * pt
void Clear(Option_t *option="")
clear the data for this matrix
virtual void ComputeBBox(Double_t &dx, Double_t &dy, Double_t &dz, Double_t *origin)=0
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:187
virtual void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize)
Compute the normal for an array o points so that norm.dot.dir is positive Input: Arrays of point coor...
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:173
virtual void RegisterYourself()
Register the matrix in the current manager, which will become the owner.
Definition: TGeoMatrix.cxx:532
virtual void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const
Check the inside status for each of the points in the array.
void CreateThreadData(Int_t nthreads)
Create thread data for n threads max.
Generic 3D primitive description class.
Definition: TBuffer3D.h:19
virtual Bool_t Contains(const Double_t *point) const
Tests if point is inside the shape.
TGeoMatrix * GetLeftMatrix() const
Definition: TGeoBoolNode.h:86
TGeoBoolNode * fNode
virtual void InspectShape() const
print shape parameters
R__EXTERN TRandom * gRandom
Definition: TRandom.h:62
TObjArray * GetListOfMatrices() const
Definition: TGeoManager.h:462
virtual const char * GetName() const
Get the shape name.
Definition: TGeoShape.cxx:247
static UInt_t DecCSLevel()
Decrement CS level.
Definition: TBuffer3D.cxx:510
TGeoShape * GetRightShape() const
Definition: TGeoBoolNode.h:89
virtual Double_t Capacity() const
Computes capacity of this shape [length^3] by sampling with 1% error.
virtual Bool_t Contains(const Double_t *point) const =0
virtual void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const
Compute distance from array of input points having directions specisied by dirs. Store output in dist...
virtual void InspectShape() const
Prints shape parameters.
Definition: TGeoBBox.cxx:749
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Computes normal vector in POINT to the composite shape.
virtual Bool_t PreferLocalFrame() const =0
#define ClassImp(name)
Definition: Rtypes.h:279
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:556
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute closest distance from point px,py to each corner.
double Double_t
Definition: RtypesCore.h:55
virtual void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections, Bool_t localFrame) const
Fills the supplied buffer, with sections in desired frame See TBuffer3D.h for explanation of sections...
Definition: TGeoBBox.cxx:989
virtual void SetPoints(Double_t *points) const
Fill buffer with shape vertices.
TGeoCompositeShape()
Default constructor.
virtual Bool_t IsComposite() const
Definition: TGeoShape.h:140
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
Bool_t IsRegistered() const
Definition: TGeoMatrix.h:87
Int_t ShapeDistancetoPrimitive(Int_t numpoints, Int_t px, Int_t py) const
Returns distance to shape primitive mesh.
Definition: TGeoShape.cxx:258
const char * GetPointerName() const
Provide a pointer name containing uid.
Definition: TGeoShape.cxx:697
static Double_t Big()
Definition: TGeoShape.h:98
Int_t AddShape(const TGeoShape *shape)
Add a shape to the list. Returns index of the shape in list.
Double_t fDY
Definition: TGeoBBox.h:34
#define name(a, b)
Definition: linkTestLib0.cpp:5
virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const =0
static TGeoMatrix * GetTransform()
Returns current transformation matrix that applies to shape.
Definition: TGeoShape.cxx:534
void SetShapeBit(UInt_t f, Bool_t set)
Equivalent of TObject::SetBit.
Definition: TGeoShape.cxx:522
typedef void((*Func_t)())
#define gPad
Definition: TVirtualPad.h:288
Double_t fDX
Definition: TGeoBBox.h:33
void Add(TObject *obj)
Definition: TObjArray.h:75
virtual void Sizeof3D() const
compute size of this 3D object
virtual void ComputeBBox()
compute bounding box of the sphere
string message
Definition: ROOT.py:94
virtual void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const
Compute safe distance from each of the points in the input array.
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
Definition: TNamed.cxx:152
virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=0, Double_t *safe=0) const =0
double norm(double *x, double *p)
Definition: unuranDistr.cxx:40
TVirtualGeoPainter * GetGeomPainter()
Make a default painter if none present. Returns pointer to it.
virtual ~TGeoCompositeShape()
destructor
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)=0
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:904