ROOT logo
ROOT » GEOM » GEOM » TGeoBBox

class TGeoBBox: public TGeoShape

 TGeoBBox - box class. All shape primitives inherit from this, their
   constructor filling automatically the parameters of the box that bounds
   the given shape. Defined by 6 parameters :
      fDX, fDY, fDZ - half lengths on X, Y and Z axis
      fOrigin[3]    - position of box origin




--- Building boxes

  Normally a box has to be build only with 3 parameters : dx, dy, dz
 representing the half lengths on X, Y and Z axis. In this case, the origin
 of the box will match the one of its reference frame. The translation of the
 origin is used only by the constructors of all other shapes in order to
 define their own bounding boxes. Users should be aware that building a
 translated box that will represent a physical shape by itself will affect any
 further positioning of other shapes inside. Therefore in order to build a
 positioned box one should follow the recipe described in class TGeoNode.

 Creation of boxes
 1.   TGeoBBox *box = new TGeoBBox("BOX", 20, 30, 40);

/* */

 2. A volume having a box shape can be built in one step:
      TGeoVolume *vbox = gGeoManager->MakeBox("vbox", ptrMed, 20,30,40);

 Divisions of boxes.

   Volumes having box shape can be divided with equal-length slices on
 X, Y or Z axis. The following options are supported:
 a) Dividing the full range of one axis in N slices
      TGeoVolume *divx = vbox->Divide("SLICEX", 1, N);
   - here 1 stands for the division axis (1-X, 2-Y, 3-Z)

/* */

 b) Dividing in a limited range - general case.
      TGeoVolume *divy = vbox->Divide("SLICEY",2,N,start,step);
   - start = starting offset within (-fDY, fDY)
   - step  = slicing step


/* */

 Both cases are supported by all shapes.
   See also class TGeoShape for utility methods provided by any particular
 shape.

Function Members (Methods)

public:
TGeoBBox()
TGeoBBox(Double_t* param)
TGeoBBox(const TGeoBBox&)
TGeoBBox(Double_t dx, Double_t dy, Double_t dz, Double_t* origin = 0)
TGeoBBox(const char* name, Double_t dx, Double_t dy, Double_t dz, Double_t* origin = 0)
virtual~TGeoBBox()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
static Bool_tAreOverlapping(const TGeoBBox* box1, const TGeoMatrix* mat1, const TGeoBBox* box2, const TGeoMatrix* mat2)
static Double_tTGeoShape::Big()
virtual voidTObject::Browse(TBrowser* b)
virtual Double_tCapacity() const
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidComputeBBox()
static Double_tTGeoShape::ComputeEpsMch()
virtual voidComputeNormal(Double_t* point, Double_t* dir, Double_t* norm)
virtual Bool_tContains(Double_t* point) const
static Bool_tContains(const Double_t* point, Double_t dx, Double_t dy, Double_t dz, const Double_t* origin)
virtual voidTNamed::Copy(TObject& named) const
virtual Bool_tCouldBeCrossed(Double_t* point, Double_t* dir) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tDistancetoPrimitive(Int_t px, Int_t py)
virtual Double_tDistFromInside(Double_t* point, Double_t* dir, Int_t iact = 1, Double_t step = TGeoShape::Big(), Double_t* safe = 0) const
static Double_tDistFromInside(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())
virtual Double_tDistFromOutside(Double_t* point, Double_t* dir, Int_t iact = 1, Double_t step = TGeoShape::Big(), Double_t* safe = 0) const
static Double_tDistFromOutside(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())
static Double_tTGeoShape::DistToPhiMin(Double_t* point, 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)
virtual TGeoVolume*Divide(TGeoVolume* voldiv, const char* divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step)
virtual voidTGeoShape::Draw(Option_t* option = "")MENU
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
static Double_tTGeoShape::EpsMch()
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTGeoShape::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual const char*GetAxisName(Int_t iaxis) const
virtual Double_tGetAxisRange(Int_t iaxis, Double_t& xlo, Double_t& xhi) const
virtual voidGetBoundingCylinder(Double_t* param) const
virtual const TBuffer3D&GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
virtual Int_tGetByteCount() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual Double_tGetDX() const
virtual Double_tGetDY() const
virtual Double_tGetDZ() const
virtual Double_tGetFacetArea(Int_t index = 0) const
virtual Int_tGetFittingBox(const TGeoBBox* parambox, TGeoMatrix* mat, Double_t& dx, Double_t& dy, Double_t& dz) const
virtual const char*TObject::GetIconName() const
Int_tTGeoShape::GetId() const
virtual TGeoShape*GetMakeRuntimeShape(TGeoShape* mother, TGeoMatrix* mat) const
virtual voidGetMeshNumbers(Int_t& nvert, Int_t& nsegs, Int_t& npols) const
virtual const char*TGeoShape::GetName() const
virtual Int_tGetNmeshVertices() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual const Double_t*GetOrigin() const
char*TGeoShape::GetPointerName() const
virtual Bool_tGetPointsOnFacet(Int_t index, Int_t npoints, Double_t* array) const
virtual Bool_tGetPointsOnSegments(Int_t npoints, Double_t* array) const
virtual const char*TNamed::GetTitle() const
static TGeoMatrix*TGeoShape::GetTransform()
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
virtual voidInspectShape() const
voidTObject::InvertBit(UInt_t f)
voidTGeoShape::InvertShapeBit(UInt_t f)
virtual TClass*IsA() const
static Bool_tTGeoShape::IsCloseToPhi(Double_t epsil, Double_t* point, Double_t c1, Double_t s1, Double_t c2, Double_t s2)
virtual Bool_tTGeoShape::IsComposite() const
static Bool_tTGeoShape::IsCrossingSemiplane(Double_t* point, Double_t* dir, Double_t cphi, Double_t sphi, Double_t& snext, Double_t& rxy)
virtual Bool_tIsCylType() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
static Bool_tTGeoShape::IsInPhiRange(Double_t* point, Double_t phi1, Double_t phi2)
virtual Bool_tIsNullBox() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTGeoShape::IsReflected() const
Bool_tTGeoShape::IsRunTimeShape() const
static Bool_tTGeoShape::IsSameWithinTolerance(Double_t a, Double_t b)
static Bool_tTGeoShape::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)
virtual Bool_tTNamed::IsSortable() const
Bool_tTGeoShape::IsValid() const
virtual Bool_tIsValidBox() const
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
virtual TBuffer3D*MakeBuffer3D() const
voidTObject::MayNotUse(const char* method) const
static voidTGeoShape::NormalPhi(Double_t* point, Double_t* dir, Double_t* norm, Double_t c1, Double_t s1, Double_t c2, Double_t s2)
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TGeoBBox&operator=(const TGeoBBox&)
virtual voidTGeoShape::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
voidTGeoShape::ResetShapeBit(UInt_t f)
virtual Double_tSafety(Double_t* point, Bool_t in = kTRUE) const
static Double_tTGeoShape::SafetyPhi(Double_t* point, Bool_t in, Double_t phi1, Double_t phi2)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidSavePrimitive(ostream& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidSetBoxDimensions(Double_t dx, Double_t dy, Double_t dz, Double_t* origin = 0)
voidSetBoxPoints(Double_t* points) const
virtual voidSetDimensions(Double_t* param)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
voidTGeoShape::SetId(Int_t id)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetPoints(Double_t* points) const
virtual voidSetPoints(Float_t* points) const
voidTGeoShape::SetRuntime(Bool_t flag = kTRUE)
virtual voidSetSegsAndPols(TBuffer3D& buffer) const
voidTGeoShape::SetShapeBit(UInt_t f)
voidTGeoShape::SetShapeBit(UInt_t f, Bool_t set)
virtual voidTNamed::SetTitle(const char* title = "")MENU
static voidTGeoShape::SetTransform(TGeoMatrix* matrix)
virtual voidTObject::SetUniqueID(UInt_t uid)
Int_tTGeoShape::ShapeDistancetoPrimitive(Int_t numpoints, Int_t px, Int_t py) const
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual Int_tTNamed::Sizeof() const
virtual voidSizeof3D() const
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
Bool_tTGeoShape::TestShapeBit(UInt_t f) const
Int_tTGeoShape::TestShapeBits(UInt_t f) const
static Double_tTGeoShape::Tolerance()
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
virtual voidFillBuffer3D(TBuffer3D& buffer, Int_t reqSections, Bool_t localFrame) const
Int_tTGeoShape::GetBasicColor() const
voidTObject::MakeZombie()
voidTGeoShape::SetOnBoundary(Bool_t)
voidTGeoShape::TransformPoints(Double_t* points, UInt_t NbPoints) const

Data Members

protected:
Double_tfDXX half-length
Double_tfDYY half-length
Double_tfDZZ half-length
TStringTNamed::fNameobject identifier
Double_tfOrigin[3]box origin
UInt_tTGeoShape::fShapeBitsshape bits
Int_tTGeoShape::fShapeIdshape id
TStringTNamed::fTitleobject title

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TGeoBBox()
 Default constructor
TGeoBBox(Double_t dx, Double_t dy, Double_t dz, Double_t* origin = 0)
 Constructor where half-lengths are provided.
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
 param[0] - half-length in x
 param[1] - half-length in y
 param[2] - half-length in z
~TGeoBBox()
 Destructor
Bool_t AreOverlapping(const TGeoBBox* box1, const TGeoMatrix* mat1, const TGeoBBox* box2, const TGeoMatrix* mat2)
 Check if 2 positioned boxes overlap.
Double_t Capacity() const
 Computes capacity of the shape in [length^3].
void ComputeNormal(Double_t* point, Double_t* dir, Double_t* norm)
 Computes normal to closest surface from POINT.
Bool_t CouldBeCrossed(Double_t* point, Double_t* dir) const
 Decides fast if the bounding box could be crossed by a vector.
Int_t DistancetoPrimitive(Int_t px, Int_t py)
 Compute closest distance from point px,py to each corner.
TGeoVolume * Divide(TGeoVolume* voldiv, const char* divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step)
--- Divide this box shape belonging to volume "voldiv" into ndiv equal volumes
 called divname, from start position with the given step. Returns pointer
 to created division cell volume. In case a wrong division axis is supplied,
 returns pointer to volume to be divided.
void ComputeBBox()
 Compute bounding box - nothing to do in this case.
Bool_t Contains(Double_t* point) const
 Test if point is inside this shape.
Bool_t Contains(const Double_t* point, Double_t dx, Double_t dy, Double_t dz, const Double_t* origin)
 Test if point is inside this shape.
Double_t DistFromInside(Double_t* point, Double_t* dir, Int_t iact = 1, Double_t step = TGeoShape::Big(), Double_t* safe = 0) const
 Compute distance from inside point to surface of the box.
 Boundary safe algorithm.
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.
 Boundary safe algorithm.
Double_t DistFromOutside(Double_t* point, 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.
 Boundary safe algorithm.
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.
 Boundary safe algorithm.
const char * GetAxisName(Int_t iaxis) const
 Returns name of axis IAXIS.
Double_t GetAxisRange(Int_t iaxis, Double_t& xlo, Double_t& xhi) const
 Get range of shape for a given axis.
void GetBoundingCylinder(Double_t* param) const
 Fill vector param[4] with the bounding cylinder parameters. The order
 is the following : Rmin, Rmax, Phi1, Phi2
Double_t GetFacetArea(Int_t index = 0) const
 Get area in internal units of the facet with a given index.
 Possible index values:
    0 - all facets togeather
    1 to 6 - facet index from bottom to top Z
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.
 The output array must be provided with a length of minimum 3*npoints. Returns
 true if operation succeeded.
 Possible index values:
    0 - all facets togeather
    1 to 6 - facet index from bottom to top Z
Bool_t GetPointsOnSegments(Int_t npoints, Double_t* array) const
 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.
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 successfull.
TGeoShape * GetMakeRuntimeShape(TGeoShape* mother, TGeoMatrix* mat) const
 In case shape has some negative parameters, these has to be computed
 in order to fit the mother
void GetMeshNumbers(Int_t& nvert, Int_t& nsegs, Int_t& npols) const
 Returns numbers of vertices, segments and polygons composing the shape mesh.
void InspectShape() const
 Prints shape parameters
TBuffer3D * MakeBuffer3D() const
 Creates a TBuffer3D describing *this* shape.
 Coordinates are in local reference frame.
void SetSegsAndPols(TBuffer3D& buffer) const
 Fills TBuffer3D structure for segments and polygons.
Double_t Safety(Double_t* point, Bool_t in = kTRUE) const
 Computes the closest distance from given point to this shape.
void SavePrimitive(ostream& out, Option_t* option = "")
 Save a primitive as a C++ statement(s) on output stream "out".
void SetBoxDimensions(Double_t dx, Double_t dy, Double_t dz, Double_t* origin = 0)
 Set parameters of the box.
void SetDimensions(Double_t* param)
 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
void SetBoxPoints(Double_t* points) const
 Fill box vertices to an array.
void SetPoints(Double_t *points)
 Fill box points.
void SetPoints(Float_t *points)
 Fill box points.
void Sizeof3D() const
 fill size of this 3-D object
    TVirtualGeoPainter *painter = gGeoManager->GetGeomPainter();
    if (painter) painter->AddSize3D(8, 12, 6);
const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
 Fills a static 3D buffer and returns a reference.
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.
TGeoBBox()
 constructors
Int_t GetByteCount() const
{return 36;}
Int_t GetNmeshVertices() const
{return 8;}
Double_t GetDX() const
{return fDX;}
Double_t GetDY() const
{return fDY;}
Double_t GetDZ() const
{return fDZ;}
const Double_t * GetOrigin() const
{return fOrigin;}
Bool_t IsCylType() const
{return kFALSE;}
Bool_t IsValidBox() const
{return ((fDX<0)||(fDY<0)||(fDZ<0))?kFALSE:kTRUE;}
Bool_t IsNullBox() const
{return ((fDX<1.E-16)&&(fDY<1.E-16)&&(fDZ<1.E-16))?kTRUE:kFALSE;}