Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGeoCompositeShape Class Reference

Class handling Boolean composition of shapes.

Composite shapes are Boolean combination of two or more shape components. The supported boolean operations are union (+), intersection (*) and subtraction. Composite shapes derive from the base TGeoShape class, therefore providing all shape features : computation of bounding box, finding if a given point is inside or outside the combination, as well as computing the distance to entering/exiting. It can be directly used for creating volumes or used in the definition of other composite shapes.

Composite shapes are provided in order to complement and extend the set of basic shape primitives. They have a binary tree internal structure, therefore all shape-related geometry queries are signals propagated from top level down to the final leaves, while the provided answers are assembled and interpreted back at top. This CSG hierarchy is effective for small number of components, while performance drops dramatically for large structures. Building a complete geometry in this style is virtually possible but highly not recommended.

Structure of composite shapes

A composite shape can always be regarded as the result of a Boolean operation between only two shape components. All information identifying these two components as well as their positions with respect to the frame of the composite is represented by an object called Boolean node. A composite shape just have a pointer to such a Boolean node. Since the shape components may also be composites, they will also contain binary Boolean nodes branching other two shapes in the hierarchy. Any such branch ends-up when the final leaves are no longer composite shapes, but basic primitives.

Suppose that A, B, C and D represent basic shapes, we will illustrate how the internal representation of few combinations look like. We do this only for the sake of understanding how to create them in a proper way, since the user interface for this purpose is in fact very simple. We will ignore for the time being the positioning of components. The definition of a composite shape takes an expression where the identifiers are shape names. The expression is parsed and decomposed in 2 sub-expressions and the top-level Boolean operator.

A+B+C

This represent the union of A, B and C. Both union operators are at the same level. Since:

A+B+C = (A+B)+C = A+(B+C)

the first (+) is taken as separator, hence the expression split:

A and B+C

A Boolean node of type TGeoUnion("A", "B+C") is created. This tries to replace the 2 expressions by actual pointers to corresponding shapes. The first expression (A) contains no operators therefore is interpreted as representing a shape. The shape named "A" is searched into the list of shapes handled by the manager class and stored as the "left" shape in the Boolean union node. Since the second expression is not yet fully decomposed, the "right" shape in the combination is created as a new composite shape. This will split at its turn B+C into B and C and create a TGeoUnion("B","C"). The B and C identifiers will be looked for and replaced by the pointers to the actual shapes into the new node. Finally, the composite "A+B+C" will be represented as:

A
|
[A+B+C] = (+) B
| |
[B+C] = (+)
|
C

where [] is a composite shape, (+) is a Boolean node of type union and A, B, C are pointers to the corresponding shapes. Building this composite shapes takes the following line :

TGeoCompositeShape *cs1 = new TGeoCompositeShape("CS1", "A+B+C");
Class handling Boolean composition of shapes.
TGeoCompositeShape()
Default constructor.

(A+B)-(C+D)

This expression means: subtract the union of C and D from the union of A and B. The usage of parenthesis to force operator precedence is always recommended. The representation of the corresponding composite shape looks like:

A
|
[A+B] = (+)
| |
[(A+B)-(C+D)] = (-) C B
| |
[C+D]=(+)
|
D
TGeoCompositeShape *cs2 = new TGeoCompositeShape("CS2", "(A+B)-(C+D)");

Building composite shapes as in the 2 examples above is not always quite useful since we were using un-positioned shapes. When supplying just shape names as identifiers, the created boolean nodes will assume that the shapes are positioned with an identity transformation with respect to the frame of the created composite. In order to provide some positioning of the combination components, we have to attach after each shape identifier the name of an existing transformation, separated by a colon. Obviously all transformations created for this purpose have to be objects with unique names in order to be properly substituted during parsing. Let's look at the code implementing the second example :

TGeoTranslation *t1 = new TGeoTranslation("t1",0,0,-20);
TGeoTranslation *t2 = new TGeoTranslation("t2",0,0, 20);
TGeoRotation *r1 = new TGeoRotation("r1"); // transformations need names
r1->SetAngles(90,30,90,120,0,0); // rotation with 30 degrees about Z
TGeoTube *a = new TGeoTube(0, 10,20);
a->SetName("A"); // shapes need names too
TGeoTube *b = new TGeoTube(0, 20,20);
b->SetName("B");
TGeoBBox *c = new TGeoBBox(10,10,50);
c->SetName("C");
TGeoBBox *d = new TGeoBBox(50,10,10);
d->SetName("D");
cs = new TGeoCompositeShape("CS", "(A:t1+B:t2)-(C+D:r1)");
#define d(i)
Definition RSha256.hxx:102
#define b(i)
Definition RSha256.hxx:100
#define c(i)
Definition RSha256.hxx:101
#define a(i)
Definition RSha256.hxx:99
Box class.
Definition TGeoBBox.h:18
TGeoBBox()
Default constructor.
Definition TGeoBBox.cxx:135
Class describing rotations.
Definition TGeoMatrix.h:175
void SetAngles(Double_t phi, Double_t theta, Double_t psi)
Set matrix elements according to Euler angles.
Class describing translations.
Definition TGeoMatrix.h:122
Cylindrical tube class.
Definition TGeoTube.h:18
auto * t1
Definition textangle.C:20

The newly created composite looks like 2 cylinders of different radii sitting one on top of the other and having 2 rectangular holes : a longitudinal one along Z axis corresponding to C and an other one in the XY plane due to D. One should have in mind that the same shape or matrix identifier can be used many times in the same expression. For instance:

(A:t1-A:t2)*B:t1

is a valid expression. Expressions that cannot be parsed or identifiers that cannot be substituted by existing objects generate error messages. Composite shapes can be subsequently used for defining volumes. Moreover, these volumes may have daughters but these have to obey overlapping/extruding rules (see TGeoVolume). Volumes created based on composite shapes cannot be divided. Visualization of such volumes is currently not implemented.

Definition at line 27 of file TGeoCompositeShape.h.

Public Member Functions

 TGeoCompositeShape ()
 Default constructor.
 
 TGeoCompositeShape (const char *expression)
 Default constructor.
 
 TGeoCompositeShape (const char *name, const char *expression)
 Default constructor.
 
 TGeoCompositeShape (const char *name, TGeoBoolNode *node)
 Constructor with a Boolean node.
 
virtual ~TGeoCompositeShape ()
 destructor
 
virtual Double_t Capacity () const
 Computes capacity of this shape [length^3] by sampling with 1% error.
 
virtual void ClearThreadData () const
 Needed just for cleanup.
 
virtual void ComputeBBox ()
 compute bounding box of the sphere
 
virtual void ComputeNormal (const Double_t *point, const Double_t *dir, Double_t *norm)
 Computes normal vector in POINT to the composite shape.
 
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 coordinates and directions + vector size Output: Array of normal directions.
 
virtual Bool_t Contains (const Double_t *point) const
 Tests if point is inside the shape.
 
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.
 
virtual void CreateThreadData (Int_t nthreads)
 Needed just for cleanup.
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 Compute closest distance from point px,py to each corner.
 
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 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 specified by dirs. Store output in dists.
 
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 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 specified by dirs. Store output in dists.
 
virtual TGeoVolumeDivide (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.
 
TGeoBoolNodeGetBoolNode () const
 
virtual void GetBoundingCylinder (Double_t *) const
 Fill vector param[4] with the bounding cylinder parameters.
 
virtual TGeoShapeGetMakeRuntimeShape (TGeoShape *, TGeoMatrix *) const
 In case shape has some negative parameters, these has to be computed in order to fit the mother.
 
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 Int_t GetNmeshVertices () const
 Return number of vertices of the mesh representation.
 
virtual Bool_t GetPointsOnSegments (Int_t, Double_t *) const
 Fills array with n random points located on the line segments of the shape mesh.
 
virtual void InspectShape () const
 print shape parameters
 
virtual Bool_t IsComposite () const
 
virtual Bool_t IsCylType () const
 
void MakeNode (const char *expression)
 Make a boolean node according to the top level boolean operation of expression.
 
virtual Bool_t PaintComposite (Option_t *option="") const
 Paint this composite shape into the current 3D viewer Returns bool flag indicating if the caller should continue to paint child objects.
 
void RegisterYourself ()
 Register the shape and all components to TGeoManager class.
 
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 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.
 
virtual void SavePrimitive (std::ostream &out, Option_t *option="")
 Save a primitive as a C++ statement(s) on output stream "out".
 
virtual void SetDimensions (Double_t *)
 Set dimensions based on the array of parameters param[0] - half-length in x param[1] - half-length in y param[2] - half-length in z.
 
virtual void SetPoints (Double_t *points) const
 create points for a composite shape
 
virtual void SetPoints (Float_t *points) const
 create points for a composite shape
 
virtual void Sizeof3D () const
 compute size of this 3D object
 
- Public Member Functions inherited from TGeoBBox
 TGeoBBox ()
 Default constructor.
 
 TGeoBBox (const char *name, Double_t dx, Double_t dy, Double_t dz, Double_t *origin=0)
 Constructor with shape name.
 
 TGeoBBox (Double_t *param)
 Constructor based on the array of parameters.
 
 TGeoBBox (Double_t dx, Double_t dy, Double_t dz, Double_t *origin=0)
 Constructor where half-lengths are provided.
 
virtual ~TGeoBBox ()
 Destructor.
 
virtual Bool_t CouldBeCrossed (const Double_t *point, const Double_t *dir) const
 Decides fast if the bounding box could be crossed by a vector.
 
virtual const char * GetAxisName (Int_t iaxis) const
 Returns name of axis IAXIS.
 
virtual Double_t GetAxisRange (Int_t iaxis, Double_t &xlo, Double_t &xhi) const
 Get range of shape for a given axis.
 
virtual const TBuffer3DGetBuffer3D (Int_t reqSections, Bool_t localFrame) const
 Fills a static 3D buffer and returns a reference.
 
virtual Int_t GetByteCount () const
 
virtual Double_t GetDX () const
 
virtual Double_t GetDY () const
 
virtual Double_t GetDZ () const
 
virtual Double_t GetFacetArea (Int_t index=0) const
 Get area in internal units of the facet with a given index.
 
virtual Int_t GetFittingBox (const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz) const
 Fills real parameters of a positioned box inside this one. Returns 0 if successful.
 
virtual const Double_tGetOrigin () const
 
virtual Bool_t GetPointsOnFacet (Int_t index, Int_t npoints, Double_t *array) const
 Fills array with n random points located on the surface of indexed facet.
 
virtual Bool_t IsNullBox () const
 
virtual Bool_t IsValidBox () const
 
virtual TBuffer3DMakeBuffer3D () const
 Creates a TBuffer3D describing this shape.
 
void SetBoxDimensions (Double_t dx, Double_t dy, Double_t dz, Double_t *origin=0)
 Set parameters of the box.
 
void SetBoxPoints (Double_t *points) const
 Fill box vertices to an array.
 
virtual void SetSegsAndPols (TBuffer3D &buffer) const
 Fills TBuffer3D structure for segments and polygons.
 
- Public Member Functions inherited from TGeoShape
 TGeoShape ()
 Default constructor.
 
 TGeoShape (const char *name)
 Default constructor.
 
virtual ~TGeoShape ()
 Destructor.
 
virtual void AfterStreamer ()
 
void CheckShape (Int_t testNo, Int_t nsamples=10000, Option_t *option="")
 Test for shape navigation methods.
 
virtual void Draw (Option_t *option="")
 Draw this shape.
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 Execute mouse actions on this shape.
 
Int_t GetId () const
 
virtual const char * GetName () const
 Get the shape name.
 
const char * GetPointerName () const
 Provide a pointer name containing uid.
 
void InvertShapeBit (UInt_t f)
 
virtual Bool_t IsAssembly () const
 
virtual Bool_t IsReflected () const
 
Bool_t IsRunTimeShape () const
 
Bool_t IsValid () const
 
virtual Bool_t IsVecGeom () const
 
virtual void Paint (Option_t *option="")
 Paint this shape.
 
void ResetShapeBit (UInt_t f)
 
void SetId (Int_t id)
 
void SetRuntime (Bool_t flag=kTRUE)
 
void SetShapeBit (UInt_t f)
 
void SetShapeBit (UInt_t f, Bool_t set)
 Equivalent of TObject::SetBit.
 
Int_t ShapeDistancetoPrimitive (Int_t numpoints, Int_t px, Int_t py) const
 Returns distance to shape primitive mesh.
 
Bool_t TestShapeBit (UInt_t f) const
 
Int_t TestShapeBits (UInt_t f) const
 
- Public Member Functions inherited from TNamed
 TNamed ()
 
 TNamed (const char *name, const char *title)
 
 TNamed (const TNamed &named)
 TNamed copy ctor.
 
 TNamed (const TString &name, const TString &title)
 
virtual ~TNamed ()
 TNamed destructor.
 
virtual void Clear (Option_t *option="")
 Set name and title to empty strings ("").
 
virtual TObjectClone (const char *newname="") const
 Make a clone of an object using the Streamer facility.
 
virtual Int_t Compare (const TObject *obj) const
 Compare two TNamed objects.
 
virtual void Copy (TObject &named) const
 Copy this to obj.
 
virtual void FillBuffer (char *&buffer)
 Encode TNamed into output buffer.
 
virtual const char * GetTitle () const
 Returns title of object.
 
virtual ULong_t Hash () const
 Return hash value for this object.
 
virtual Bool_t IsSortable () const
 
virtual void ls (Option_t *option="") const
 List TNamed name and title.
 
TNamedoperator= (const TNamed &rhs)
 TNamed assignment operator.
 
virtual void Print (Option_t *option="") const
 Print TNamed name and title.
 
virtual void SetName (const char *name)
 Set the name of the TNamed.
 
virtual void SetNameTitle (const char *name, const char *title)
 Set all the TNamed parameters (name and title).
 
virtual void SetTitle (const char *title="")
 Set the title of the TNamed.
 
virtual Int_t Sizeof () const
 Return size of the TNamed part of the TObject.
 
- Public Member Functions inherited from TObject
 TObject ()
 TObject constructor.
 
 TObject (const TObject &object)
 TObject copy ctor.
 
virtual ~TObject ()
 TObject destructor.
 
void AbstractMethod (const char *method) const
 Use this method to implement an "abstract" method that you don't want to leave purely abstract.
 
virtual void AppendPad (Option_t *option="")
 Append graphics object to current pad.
 
virtual void Browse (TBrowser *b)
 Browse object. May be overridden for another default action.
 
ULong_t CheckedHash ()
 Check and record whether this class has a consistent Hash/RecursiveRemove setup (*) and then return the regular Hash value for this object.
 
virtual const char * ClassName () const
 Returns name of class to which the object belongs.
 
virtual void Delete (Option_t *option="")
 Delete this object.
 
virtual void DrawClass () const
 Draw class inheritance tree of the class to which this object belongs.
 
virtual TObjectDrawClone (Option_t *option="") const
 Draw a clone of this object in the current selected pad for instance with: gROOT->SetSelectedPad(gPad).
 
virtual void Dump () const
 Dump contents of object on stdout.
 
virtual void Error (const char *method, const char *msgfmt,...) const
 Issue error message.
 
virtual void Execute (const char *method, const char *params, Int_t *error=0)
 Execute method on this object with the given parameter string, e.g.
 
virtual void Execute (TMethod *method, TObjArray *params, Int_t *error=0)
 Execute method on this object with parameters stored in the TObjArray.
 
virtual void Fatal (const char *method, const char *msgfmt,...) const
 Issue fatal error message.
 
virtual TObjectFindObject (const char *name) const
 Must be redefined in derived classes.
 
virtual TObjectFindObject (const TObject *obj) const
 Must be redefined in derived classes.
 
virtual Option_tGetDrawOption () const
 Get option used by the graphics system to draw this object.
 
virtual const char * GetIconName () const
 Returns mime type name of object.
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 Returns string containing info about the object at position (px,py).
 
virtual Option_tGetOption () const
 
virtual UInt_t GetUniqueID () const
 Return the unique object id.
 
virtual Bool_t HandleTimer (TTimer *timer)
 Execute action in response of a timer timing out.
 
Bool_t HasInconsistentHash () const
 Return true is the type of this object is known to have an inconsistent setup for Hash and RecursiveRemove (i.e.
 
virtual void Info (const char *method, const char *msgfmt,...) const
 Issue info message.
 
virtual Bool_t InheritsFrom (const char *classname) const
 Returns kTRUE if object inherits from class "classname".
 
virtual Bool_t InheritsFrom (const TClass *cl) const
 Returns kTRUE if object inherits from TClass cl.
 
virtual void Inspect () const
 Dump contents of this object in a graphics canvas.
 
void InvertBit (UInt_t f)
 
virtual Bool_t IsEqual (const TObject *obj) const
 Default equal comparison (objects are equal if they have the same address in memory).
 
virtual Bool_t IsFolder () const
 Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
 
R__ALWAYS_INLINE Bool_t IsOnHeap () const
 
R__ALWAYS_INLINE Bool_t IsZombie () const
 
void MayNotUse (const char *method) const
 Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary).
 
virtual Bool_t Notify ()
 This method must be overridden to handle object notification.
 
void Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const
 Use this method to declare a method obsolete.
 
void operator delete (void *ptr)
 Operator delete.
 
void operator delete[] (void *ptr)
 Operator delete [].
 
voidoperator new (size_t sz)
 
voidoperator new (size_t sz, void *vp)
 
voidoperator new[] (size_t sz)
 
voidoperator new[] (size_t sz, void *vp)
 
TObjectoperator= (const TObject &rhs)
 TObject assignment operator.
 
virtual void Pop ()
 Pop on object drawn in a pad to the top of the display list.
 
virtual Int_t Read (const char *name)
 Read contents of object with specified name from the current directory.
 
virtual void RecursiveRemove (TObject *obj)
 Recursively remove this object from a list.
 
void ResetBit (UInt_t f)
 
virtual void SaveAs (const char *filename="", Option_t *option="") const
 Save this object in the file specified by filename.
 
void SetBit (UInt_t f)
 
void SetBit (UInt_t f, Bool_t set)
 Set or unset the user status bits as specified in f.
 
virtual void SetDrawOption (Option_t *option="")
 Set drawing option for object.
 
virtual void SetUniqueID (UInt_t uid)
 Set the unique object id.
 
virtual void SysError (const char *method, const char *msgfmt,...) const
 Issue system error message.
 
R__ALWAYS_INLINE Bool_t TestBit (UInt_t f) const
 
Int_t TestBits (UInt_t f) const
 
virtual void UseCurrentStyle ()
 Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked.
 
virtual void Warning (const char *method, const char *msgfmt,...) const
 Issue warning message.
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0)
 Write this object to the current directory.
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const
 Write this object to the current directory.
 

Protected Member Functions

 TGeoCompositeShape (const TGeoCompositeShape &gcs)
 
TGeoCompositeShapeoperator= (const TGeoCompositeShape &gcs)
 
- Protected Member Functions inherited from TGeoBBox
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, frame etc.
 
- Protected Member Functions inherited from TGeoShape
Int_t GetBasicColor () const
 Get the basic color (0-7).
 
void SetOnBoundary (Bool_t)
 
void TransformPoints (Double_t *points, UInt_t NbPoints) const
 Tranform a set of points (LocalToMaster)
 
- Protected Member Functions inherited from TObject
virtual void DoError (int level, const char *location, const char *fmt, va_list va) const
 Interface to ErrorHandler (protected).
 
void MakeZombie ()
 

Private Attributes

TGeoBoolNodefNode
 

Additional Inherited Members

- Public Types inherited from TGeoShape
enum  EShapeType {
  kBitMask32 = 0xffffffff , kGeoNoShape = 0 , kGeoBad = BIT(0) , kGeoRSeg = BIT(1) ,
  kGeoPhiSeg = BIT(2) , kGeoThetaSeg = BIT(3) , kGeoVisX = BIT(4) , kGeoVisY = BIT(5) ,
  kGeoVisZ = BIT(6) , kGeoRunTimeShape = BIT(7) , kGeoInvalidShape = BIT(8) , kGeoTorus = BIT(9) ,
  kGeoBox = BIT(10) , kGeoPara = BIT(11) , kGeoSph = BIT(12) , kGeoTube = BIT(13) ,
  kGeoTubeSeg = BIT(14) , kGeoCone = BIT(15) , kGeoConeSeg = BIT(16) , kGeoPcon = BIT(17) ,
  kGeoPgon = BIT(18) , kGeoArb8 = BIT(19) , kGeoEltu = BIT(20) , kGeoTrap = BIT(21) ,
  kGeoCtub = BIT(22) , kGeoTrd1 = BIT(23) , kGeoTrd2 = BIT(24) , kGeoComb = BIT(25) ,
  kGeoClosedShape = BIT(26) , kGeoXtru = BIT(27) , kGeoParaboloid = BIT(28) , kGeoHalfSpace = BIT(29) ,
  kGeoHype = BIT(30) , kGeoSavePrimitive = BIT(20)
}
 
- Public Types inherited from TObject
enum  {
  kIsOnHeap = 0x01000000 , kNotDeleted = 0x02000000 , kZombie = 0x04000000 , kInconsistent = 0x08000000 ,
  kBitMask = 0x00ffffff
}
 
enum  { kSingleKey = BIT(0) , kOverwrite = BIT(1) , kWriteDelete = BIT(2) }
 
enum  EDeprecatedStatusBits { kObjInCanvas = BIT(3) }
 
enum  EStatusBits {
  kCanDelete = BIT(0) , kMustCleanup = BIT(3) , kIsReferenced = BIT(4) , kHasUUID = BIT(5) ,
  kCannotPick = BIT(6) , kNoContextMenu = BIT(8) , kInvalidObject = BIT(13)
}
 
- Static Public Member Functions inherited from TGeoBBox
static Bool_t AreOverlapping (const TGeoBBox *box1, const TGeoMatrix *mat1, const TGeoBBox *box2, const TGeoMatrix *mat2)
 Check if 2 positioned boxes overlap.
 
static Bool_t Contains (const Double_t *point, Double_t dx, Double_t dy, Double_t dz, const Double_t *origin)
 Static method to check if point[3] is located inside a box of having dx, dy, dz as half-lengths.
 
static Double_t DistFromInside (const Double_t *point, const Double_t *dir, Double_t dx, Double_t dy, Double_t dz, const Double_t *origin, Double_t stepmax=TGeoShape::Big())
 Compute distance from inside point to surface of the box.
 
static Double_t DistFromOutside (const Double_t *point, const Double_t *dir, Double_t dx, Double_t dy, Double_t dz, const Double_t *origin, Double_t stepmax=TGeoShape::Big())
 Compute distance from outside point to surface of the box.
 
- Static Public Member Functions inherited from TGeoShape
static Double_t Big ()
 
static Double_t ComputeEpsMch ()
 Compute machine round-off double precision error as the smallest number that if added to 1.0 is different than 1.0.
 
static Double_t DistToPhiMin (const Double_t *point, const Double_t *dir, Double_t s1, Double_t c1, Double_t s2, Double_t c2, Double_t sm, Double_t cm, Bool_t in=kTRUE)
 compute distance from point (inside phi) to both phi planes. Return minimum.
 
static Double_t EpsMch ()
 static function returning the machine round-off error
 
static TGeoMatrixGetTransform ()
 Returns current transformation matrix that applies to shape.
 
static Bool_t IsCloseToPhi (Double_t epsil, const Double_t *point, Double_t c1, Double_t s1, Double_t c2, Double_t s2)
 True if point is closer than epsil to one of the phi planes defined by c1,s1 or c2,s2.
 
static Bool_t IsCrossingSemiplane (const Double_t *point, const Double_t *dir, Double_t cphi, Double_t sphi, Double_t &snext, Double_t &rxy)
 Compute distance from POINT to semiplane defined by PHI angle along DIR.
 
static Bool_t IsInPhiRange (const Double_t *point, Double_t phi1, Double_t phi2)
 Static method to check if a point is in the phi range (phi1, phi2) [degrees].
 
static Bool_t IsSameWithinTolerance (Double_t a, Double_t b)
 Check if two numbers differ with less than a tolerance.
 
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)
 Check if segments (A,B) and (C,D) are crossing, where: A(x1,y1), B(x2,y2), C(x3,y3), D(x4,y4)
 
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)
 Static method to compute normal to phi planes.
 
static Double_t SafetyPhi (const Double_t *point, Bool_t in, Double_t phi1, Double_t phi2)
 Static method to compute safety w.r.t a phi corner defined by cosines/sines of the angles phi1, phi2.
 
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)
 Compute distance from point of coordinates (r,z) to segment (r1,z1):(r2,z2)
 
static void SetTransform (TGeoMatrix *matrix)
 Set current transformation matrix that applies to shape.
 
static Double_t Tolerance ()
 
- Static Public Member Functions inherited from TObject
static Long_t GetDtorOnly ()
 Return destructor only flag.
 
static Bool_t GetObjectStat ()
 Get status of object stat flag.
 
static void SetDtorOnly (void *obj)
 Set destructor only flag.
 
static void SetObjectStat (Bool_t stat)
 Turn on/off tracking of objects in the TObjectTable.
 
- Protected Types inherited from TObject
enum  { kOnlyPrepStep = BIT(3) }
 
- Protected Attributes inherited from TGeoBBox
Double_t fDX
 
Double_t fDY
 
Double_t fDZ
 
Double_t fOrigin [3]
 
- Protected Attributes inherited from TGeoShape
UInt_t fShapeBits
 
Int_t fShapeId
 
- Protected Attributes inherited from TNamed
TString fName
 
TString fTitle
 

#include <TGeoCompositeShape.h>

Inheritance diagram for TGeoCompositeShape:
[legend]

Constructor & Destructor Documentation

◆ TGeoCompositeShape() [1/5]

TGeoCompositeShape::TGeoCompositeShape ( const TGeoCompositeShape gcs)
inlineprotected

Definition at line 34 of file TGeoCompositeShape.h.

◆ TGeoCompositeShape() [2/5]

TGeoCompositeShape::TGeoCompositeShape ( )

Default constructor.

Definition at line 201 of file TGeoCompositeShape.cxx.

◆ TGeoCompositeShape() [3/5]

TGeoCompositeShape::TGeoCompositeShape ( const char *  name,
const char *  expression 
)

Default constructor.

Definition at line 211 of file TGeoCompositeShape.cxx.

◆ TGeoCompositeShape() [4/5]

TGeoCompositeShape::TGeoCompositeShape ( const char *  expression)

Default constructor.

Definition at line 228 of file TGeoCompositeShape.cxx.

◆ TGeoCompositeShape() [5/5]

TGeoCompositeShape::TGeoCompositeShape ( const char *  name,
TGeoBoolNode node 
)

Constructor with a Boolean node.

Definition at line 245 of file TGeoCompositeShape.cxx.

◆ ~TGeoCompositeShape()

TGeoCompositeShape::~TGeoCompositeShape ( )
virtual

destructor

Definition at line 260 of file TGeoCompositeShape.cxx.

Member Function Documentation

◆ Capacity()

Double_t TGeoCompositeShape::Capacity ( ) const
virtual

Computes capacity of this shape [length^3] by sampling with 1% error.

Reimplemented from TGeoBBox.

Definition at line 268 of file TGeoCompositeShape.cxx.

◆ ClearThreadData()

void TGeoCompositeShape::ClearThreadData ( ) const
virtual

Needed just for cleanup.

Reimplemented from TGeoShape.

Definition at line 185 of file TGeoCompositeShape.cxx.

◆ ComputeBBox()

void TGeoCompositeShape::ComputeBBox ( )
virtual

compute bounding box of the sphere

Reimplemented from TGeoBBox.

Definition at line 289 of file TGeoCompositeShape.cxx.

◆ ComputeNormal()

void TGeoCompositeShape::ComputeNormal ( const Double_t point,
const Double_t dir,
Double_t norm 
)
virtual

Computes normal vector in POINT to the composite shape.

Reimplemented from TGeoBBox.

Definition at line 297 of file TGeoCompositeShape.cxx.

◆ ComputeNormal_v()

void TGeoCompositeShape::ComputeNormal_v ( const Double_t points,
const Double_t dirs,
Double_t norms,
Int_t  vecsize 
)
virtual

Compute the normal for an array o points so that norm.dot.dir is positive Input: Arrays of point coordinates and directions + vector size Output: Array of normal directions.

Reimplemented from TGeoBBox.

Definition at line 565 of file TGeoCompositeShape.cxx.

◆ Contains()

Bool_t TGeoCompositeShape::Contains ( const Double_t point) const
virtual

Tests if point is inside the shape.

Reimplemented from TGeoBBox.

Definition at line 305 of file TGeoCompositeShape.cxx.

◆ Contains_v()

void TGeoCompositeShape::Contains_v ( const Double_t points,
Bool_t inside,
Int_t  vecsize 
) const
virtual

Check the inside status for each of the points in the array.

Input: Array of point coordinates + vector size Output: Array of Booleans for the inside of each point

Reimplemented from TGeoBBox.

Definition at line 555 of file TGeoCompositeShape.cxx.

◆ CreateThreadData()

void TGeoCompositeShape::CreateThreadData ( Int_t  nthreads)
virtual

Needed just for cleanup.

Reimplemented from TGeoShape.

Definition at line 193 of file TGeoCompositeShape.cxx.

◆ DistancetoPrimitive()

Int_t TGeoCompositeShape::DistancetoPrimitive ( Int_t  px,
Int_t  py 
)
virtual

Compute closest distance from point px,py to each corner.

Reimplemented from TGeoBBox.

Definition at line 314 of file TGeoCompositeShape.cxx.

◆ DistFromInside()

Double_t TGeoCompositeShape::DistFromInside ( const Double_t point,
const Double_t dir,
Int_t  iact = 1,
Double_t  step = TGeoShape::Big(),
Double_t safe = 0 
) const
virtual

Compute distance from inside point to outside of this composite shape.

Reimplemented from TGeoBBox.

Definition at line 336 of file TGeoCompositeShape.cxx.

◆ DistFromInside_v()

void TGeoCompositeShape::DistFromInside_v ( const Double_t points,
const Double_t dirs,
Double_t dists,
Int_t  vecsize,
Double_t step 
) const
virtual

Compute distance from array of input points having directions specified by dirs. Store output in dists.

Reimplemented from TGeoBBox.

Definition at line 573 of file TGeoCompositeShape.cxx.

◆ DistFromOutside()

Double_t TGeoCompositeShape::DistFromOutside ( const Double_t point,
const Double_t dir,
Int_t  iact = 1,
Double_t  step = TGeoShape::Big(),
Double_t safe = 0 
) const
virtual

Compute distance from outside point to this composite shape.

Check if the bounding box is crossed within the requested distance

Reimplemented from TGeoBBox.

Definition at line 324 of file TGeoCompositeShape.cxx.

◆ DistFromOutside_v()

void TGeoCompositeShape::DistFromOutside_v ( const Double_t points,
const Double_t dirs,
Double_t dists,
Int_t  vecsize,
Double_t step 
) const
virtual

Compute distance from array of input points having directions specified by dirs. Store output in dists.

Reimplemented from TGeoBBox.

Definition at line 581 of file TGeoCompositeShape.cxx.

◆ Divide()

TGeoVolume * TGeoCompositeShape::Divide ( TGeoVolume voldiv,
const char *  divname,
Int_t  iaxis,
Int_t  ndiv,
Double_t  start,
Double_t  step 
)
virtual

Divide all range of iaxis in range/step cells.

Reimplemented from TGeoBBox.

Definition at line 346 of file TGeoCompositeShape.cxx.

◆ GetBoolNode()

TGeoBoolNode * TGeoCompositeShape::GetBoolNode ( ) const
inline

Definition at line 65 of file TGeoCompositeShape.h.

◆ GetBoundingCylinder()

virtual void TGeoCompositeShape::GetBoundingCylinder ( Double_t param) const
inlinevirtual

Fill vector param[4] with the bounding cylinder parameters.

The order is the following : Rmin, Rmax, Phi1, Phi2

Reimplemented from TGeoBBox.

Definition at line 66 of file TGeoCompositeShape.h.

◆ GetMakeRuntimeShape()

virtual TGeoShape * TGeoCompositeShape::GetMakeRuntimeShape ( TGeoShape mother,
TGeoMatrix mat 
) const
inlinevirtual

In case shape has some negative parameters, these has to be computed in order to fit the mother.

Reimplemented from TGeoBBox.

Definition at line 67 of file TGeoCompositeShape.h.

◆ GetMeshNumbers()

void TGeoCompositeShape::GetMeshNumbers ( Int_t nvert,
Int_t nsegs,
Int_t npols 
) const
virtual

Returns numbers of vertices, segments and polygons composing the shape mesh.

Reimplemented from TGeoBBox.

Definition at line 356 of file TGeoCompositeShape.cxx.

◆ GetNmeshVertices()

Int_t TGeoCompositeShape::GetNmeshVertices ( ) const
virtual

Return number of vertices of the mesh representation.

Reimplemented from TGeoBBox.

Definition at line 544 of file TGeoCompositeShape.cxx.

◆ GetPointsOnSegments()

virtual Bool_t TGeoCompositeShape::GetPointsOnSegments ( Int_t  npoints,
Double_t array 
) const
inlinevirtual

Fills array with n random points located on the line segments of the shape mesh.

The output array must be provided with a length of minimum 3*npoints. Returns true if operation is implemented.

Reimplemented from TGeoBBox.

Definition at line 70 of file TGeoCompositeShape.h.

◆ InspectShape()

void TGeoCompositeShape::InspectShape ( ) const
virtual

print shape parameters

Reimplemented from TGeoBBox.

Definition at line 366 of file TGeoCompositeShape.cxx.

◆ IsComposite()

virtual Bool_t TGeoCompositeShape::IsComposite ( ) const
inlinevirtual

Reimplemented from TGeoShape.

Definition at line 72 of file TGeoCompositeShape.h.

◆ IsCylType()

virtual Bool_t TGeoCompositeShape::IsCylType ( ) const
inlinevirtual

Reimplemented from TGeoBBox.

Definition at line 73 of file TGeoCompositeShape.h.

◆ MakeNode()

void TGeoCompositeShape::MakeNode ( const char *  expression)

Make a boolean node according to the top level boolean operation of expression.

Propagates signal to branches until expression is fully decomposed. printf("Making node for : %s\n", expression);

Definition at line 378 of file TGeoCompositeShape.cxx.

◆ operator=()

TGeoCompositeShape & TGeoCompositeShape::operator= ( const TGeoCompositeShape gcs)
inlineprotected

Definition at line 36 of file TGeoCompositeShape.h.

◆ PaintComposite()

Bool_t TGeoCompositeShape::PaintComposite ( Option_t option = "") const
virtual

Paint this composite shape into the current 3D viewer Returns bool flag indicating if the caller should continue to paint child objects.

Definition at line 413 of file TGeoCompositeShape.cxx.

◆ RegisterYourself()

void TGeoCompositeShape::RegisterYourself ( )

Register the shape and all components to TGeoManager class.

Definition at line 455 of file TGeoCompositeShape.cxx.

◆ Safety()

Double_t TGeoCompositeShape::Safety ( const Double_t point,
Bool_t  in = kTRUE 
) const
virtual

computes the closest distance from given point to this shape, according to option.

The matching point on the shape is stored in spoint.

Reimplemented from TGeoBBox.

Definition at line 498 of file TGeoCompositeShape.cxx.

◆ Safety_v()

void TGeoCompositeShape::Safety_v ( const Double_t points,
const Bool_t inside,
Double_t safe,
Int_t  vecsize 
) const
virtual

Compute safe distance from each of the points in the input array.

Input: Array of point coordinates, array of statuses for these points, size of the arrays Output: Safety values

Reimplemented from TGeoBBox.

Definition at line 591 of file TGeoCompositeShape.cxx.

◆ SavePrimitive()

void TGeoCompositeShape::SavePrimitive ( std::ostream &  out,
Option_t option = "" 
)
virtual

Save a primitive as a C++ statement(s) on output stream "out".

Reimplemented from TGeoBBox.

Definition at line 507 of file TGeoCompositeShape.cxx.

◆ SetDimensions()

virtual void TGeoCompositeShape::SetDimensions ( Double_t param)
inlinevirtual

Set dimensions based on the array of parameters param[0] - half-length in x param[1] - half-length in y param[2] - half-length in z.

Reimplemented from TGeoBBox.

Definition at line 80 of file TGeoCompositeShape.h.

◆ SetPoints() [1/2]

void TGeoCompositeShape::SetPoints ( Double_t points) const
virtual

create points for a composite shape

Reimplemented from TGeoBBox.

Definition at line 520 of file TGeoCompositeShape.cxx.

◆ SetPoints() [2/2]

void TGeoCompositeShape::SetPoints ( Float_t points) const
virtual

create points for a composite shape

Reimplemented from TGeoBBox.

Definition at line 528 of file TGeoCompositeShape.cxx.

◆ Sizeof3D()

void TGeoCompositeShape::Sizeof3D ( ) const
virtual

compute size of this 3D object

Reimplemented from TGeoBBox.

Definition at line 536 of file TGeoCompositeShape.cxx.

Member Data Documentation

◆ fNode

TGeoBoolNode* TGeoCompositeShape::fNode
private

Definition at line 31 of file TGeoCompositeShape.h.

Libraries for TGeoCompositeShape:

The documentation for this class was generated from the following files: