TGeoVolume


class description - source file - inheritance tree

class TGeoVolume : public TNamed, public TGeoAtt, public TAttLine, public TAttFill, public TAtt3D


    public:
TGeoVolume() TGeoVolume(const char* name, const TGeoShape* shape, const TGeoMedium* med = 0) TGeoVolume(const TGeoVolume&) virtual ~TGeoVolume() virtual void AddNode(const TGeoVolume* vol, Int_t copy_no, const TGeoMatrix* mat = 0, const Option_t* option) void AddNodeOffset(const TGeoVolume* vol, Int_t copy_no, Double_t offset = 0, const Option_t* option) virtual void AddNodeOverlap(const TGeoVolume* vol, Int_t copy_no, const TGeoMatrix* mat = 0, const Option_t* option) virtual void Browse(TBrowser* b) virtual void cd(Int_t inode) const void CheckGeometry(Int_t nrays = 1, Double_t startx = 0, Double_t starty = 0, Double_t startz = 0) const void CheckOverlaps(Double_t ovlp = 0.1, const Option_t* option) const void CheckShapes() static TClass* Class() void CleanAll() void ClearNodes() void ClearShape() Bool_t Contains(Double_t* point) const Int_t CountNodes(Int_t nlevels = 1000) const virtual Int_t DistancetoPrimitive(Int_t px, Int_t py) virtual TGeoVolume* Divide(const char* divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step, Int_t numed = 0, const Option_t* option) virtual void Draw(const Option_t* option) virtual void DrawOnly(const Option_t* option) virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py) Bool_t FindMatrixOfDaughterVolume(TGeoVolume* vol) const TGeoNode* FindNode(const char* name) const void FindOverlaps() const virtual Int_t GetByteCount() const TObject* GetField() const TGeoPatternFinder* GetFinder() const Int_t GetIndex(const TGeoNode* node) const TGeoMaterial* GetMaterial() const TGeoMedium* GetMedium() const Int_t GetNdaughters() const TGeoNode* GetNode(const char* name) const TGeoNode* GetNode(Int_t i) const Int_t GetNodeIndex(const TGeoNode* node, Int_t* check_list, Int_t ncheck) const TObjArray* GetNodes() Int_t GetNumber() virtual char* GetObjectInfo(Int_t px, Int_t py) const Bool_t GetOptimalVoxels() const virtual Option_t* GetOption() const TGeoShape* GetShape() const TGeoVoxelFinder* GetVoxels() const void GrabFocus() void Gsord(Int_t) void InspectMaterial() const void InspectShape() const void InvisibleAll() virtual TClass* IsA() const Bool_t IsCylVoxels() const virtual Bool_t IsFolder() const Bool_t IsRunTime() const Bool_t IsStyleDefault() const Bool_t IsValid() const virtual Bool_t IsVisible() const Bool_t IsXYZVoxels() const TH2F* LegoPlot(Int_t ntheta = 20, Double_t themin = 0., Double_t themax = 180., Int_t nphi = 60, Double_t phimin = 0., Double_t phimax = 360., Double_t rmin = 0., Double_t rmax = 9999999, const Option_t* option) void* Make3DBuffer() const void MakeCopyNodes(const TGeoVolume* other) virtual TGeoVolume* MakeCopyVolume(TGeoShape* newshape) Bool_t OptimizeVoxels() virtual void Paint(const Option_t* option) void PrintNodes() const void PrintVoxels() const void RandomPoints(Int_t npoints = 1000000, const Option_t* option) void RandomRays(Int_t nrays = 10000, Double_t startx = 0, Double_t starty = 0, Double_t startz = 0) void SetAsTopVolume() void SetCurrentPoint(Double_t x, Double_t y, Double_t z) void SetCylVoxels(Bool_t flag = kTRUE) void SetField(const TObject* field) void SetFinder(const TGeoPatternFinder* finder) void SetInvisible() virtual void SetLineColor(Color_t lcolor) virtual void SetLineStyle(Style_t lstyle) virtual void SetLineWidth(Width_t lwidth) virtual void SetMedium(const TGeoMedium* medium) void SetNodes(TObjArray* nodes) void SetNumber(Int_t number) void SetOption(const char* option) void SetShape(const TGeoShape* shape) virtual void SetVisibility(Bool_t vis = kTRUE) void SetVoxelFinder(const TGeoVoxelFinder* finder) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Sizeof3D() const void SortNodes() virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) Bool_t Valid() const void VisibleDaughters(Bool_t vis = kTRUE) void Voxelize(const Option_t* option) Double_t Weight(Double_t precision = 0.01, const Option_t* option = "v")

Data Members


    protected:
TObjArray* fNodes array of nodes inside this volume TGeoShape* fShape shape TGeoMedium* fMedium tracking medium TGeoPatternFinder* fFinder finder object for divisions TGeoVoxelFinder* fVoxels finder object for bounding boxes TObject* fField ! just a hook for now TString fOption ! option - if any Int_t fNumber volume serial number in the list of volumes public:
static const TGeoVolume::EGeoVolumeTypes kVolumeDiv static const TGeoVolume::EGeoVolumeTypes kVolumeOverlap static const TGeoVolume::EGeoVolumeTypes kVolumeImportNodes static const TGeoVolume::EGeoVolumeTypes kVolumeMulti static const TGeoVolume::EGeoVolumeTypes kVoxelsXYZ static const TGeoVolume::EGeoVolumeTypes kVoxelsCyl


See also

TGeoVolumeMulti

Class Description

   TGeoVolume - class containing the full description of a geometrical object.

   A volume is a geometrical container possibly including other objects inside.
 The volume does not store any information about his own position/transformation
 nor any link to the upper level in the geometry tree. Therefore, the same
 volume can be referenced several times in the geometry.

   Positioned volumes are called nodes (see class TGeoNode) and can be placed
 only inside other volume. In order to define a correct geometry, nodes should
 not extend beyond the boundaries of their mother volume and must not overlap
 between each other. These conditions can become critical when tracking a
 geometry, so the package is provided with a simple but efficient checking
 tool (class TGeoChecker). Note that the nodes representing the daughters of
 a volume does NOT overlap with their mother - any point belonging to the
 daughter will automatically NOT belong to the mother any more. The geometry
 tree built in this fashion is a CSG tree with constraints.


/*

*/


   A volume is referencing a shape and a medium. These have to built BEFORE the
 volume itself - see TGeoMaterial::TGeoMaterial() , TGeoShape::TGeoShape() .
 Volumes must have unique names and any positioned volume (node) will append a
 copy number to the volume's name. For instance if a volume named PAD is
 referenced in several nodes, their names will become : PAD_1, PAD_2, ...

   A volume can be created with the sequence :

        TGeoSphere   *sph = new TGeoSphere("sph1", 10.0, 11.0);
        TGeoMedium   *med = gGeoManager->GetMedium("lead");
        TGeoVolume   *vol = new TGeoVolume("shield", sph, med);

   The volume is registering itself to the current TGeoManager and can be
 retrieved at any time with :

        TGeoVolume *vol = gGeoManager->GetVolume("shield");

 Deletion of volumes is also handled by TGeoManager class.
   Positioning of other geometry nodes inside a volume is done by :
        TGeoVolume::AddNode() method. The node to be placed does not have to
 be created before :

        TGeoVolume      *vol_in = ...;
        TGeoTranslation *tr     = new TGeoTranslation(x, y, z);
        TGeoNodeMatrix  *node   = vol->AddNodeMatrix (vol_in, tr, copy_number);

   A volume can be divided according a pattern. The most simple division can
 be done along an axis, in cartesian, cylindrical or spherical coordinates.
 For each division type there are corresponding TGeoVolume::AddNodeOffset() and
 TGeoVolume::Divide() methods. The option argument passed tothese methods can
 be :

        X, Y, Z - for cartesian axis divisions;
        CylR, CylPhi - for cylindrical divisions;
        SphR, SphPhi, SphTheta - for spherical divisions;
        honeycomb - for honeycomb structures

 For instance, dividing a volume in N segments along X axis, starting from Xmin
 up to Xmax can be done with :
        TGeoVolume::Divide(N, Xmin, Xmax, "X");

   The GEANT3 option MANY is supported by TGeoVolumeOverlap class. An overlapping
 volume is in fact a virtual container that does not represent a physical object.
 It contains a list of nodes that are not his daughters but that must be checked
 always before the container itself. This list must be defined by users and it
 is checked and resolved in a priority order. Note that the feature is non-standard
 to geometrical modelers and it was introduced just to support conversions of
 GEANT3 geometries, therefore its extensive usage should be avoided.

   The following picture represent how a simple geometry tree is built in
 memory.

/*

*/


TGeoVolume()
 dummy constructor

TGeoVolume(const char *name, const TGeoShape *shape, const TGeoMedium *med) :TNamed(name, "")
 default constructor

~TGeoVolume()
 Destructor

void Browse(TBrowser *b)
 How to browse a volume

void CheckGeometry(Int_t nrays, Double_t startx, Double_t starty, Double_t startz) const
 Shoot nrays with random directions from starting point (startx, starty, startz)
 in the reference frame of this volume. Track each ray until exiting geometry, then
 shoot backwards from exiting point and compare boundary crossing points.

void CheckOverlaps(Double_t ovlp, Option_t *option) const
 Overlap checking tool. Check for illegal overlaps within a limit OVLP.

void CleanAll()

void ClearShape()

void CheckShapes()
 check for negative parameters in shapes.
 THIS METHOD LEAVES SOME GARBAGE NODES -> memory leak, to be fixed
   printf("---Checking daughters of volume %sn", GetName());

Int_t CountNodes(Int_t nlevels) const
 count total number of subnodes starting from this volume, nlevels down

Bool_t IsFolder() const
 Return TRUE if volume contains nodes

Bool_t IsStyleDefault() const
 check if the visibility and attributes are the default ones

void InspectMaterial() const

void cd(Int_t inode) const
 Actualize matrix of node indexed <inode>

void AddNode(const TGeoVolume *vol, Int_t copy_no, const TGeoMatrix *mat, Option_t * /*option*/)
 Add a TGeoNode to the list of nodes. This is the usual method for adding
 daughters inside the container volume.

void AddNodeOffset(const TGeoVolume *vol, Int_t copy_no, Double_t offset, Option_t * /*option*/)
 Add a division node to the list of nodes. The method is called by
 TGeoVolume::Divide() for creating the division nodes.

void AddNodeOverlap(const TGeoVolume *vol, Int_t copy_no, const TGeoMatrix *mat, Option_t * /*option*/)
 Add a TGeoNode to the list of nodes. This is the usual method for adding
 daughters inside the container volume.

TGeoVolume* Divide(const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step, Int_t numed, Option_t *option)
 Division a la G3. The volume will be divided along IAXIS (see shape classes), in NDIV
 slices, from START with given STEP. The division volumes will have medium number NUMED.
 If NUMED=0 they will get the medium number of the divided volume (this). If NDIV<=0,
 all range of IAXIS will be divided and the resulting number of divisions will be centered on
 IAXIS. If STEP<=0, the real STEP will be computed as the full range of IAXIS divided by NDIV.
 Options (case insensitive):
  N  - divide all range in NDIV cells (same effect as STEP<=0) (GSDVN in G3)
  NX - divide range starting with START in NDIV cells          (GSDVN2 in G3)
  S  - divide all range with given STEP. NDIV is computed and divisions will be centered
         in full range (same effect as NDIV<=0)                (GSDVS, GSDVT in G3)
  SX - same as DVS, but from START position.                   (GSDVS2, GSDVT2 in G3)

Int_t DistancetoPrimitive(Int_t px, Int_t py)
 compute the closest distance of approach from point px,py to this volume

void Draw(Option_t *option)
 draw top volume according to option

void DrawOnly(Option_t *option)
 draw only this volume

Bool_t OptimizeVoxels()
 Perform an exensive sampling to find which type of voxelization is
 most efficient.

void Paint(Option_t *option)
 paint volume

void PrintVoxels() const

void PrintNodes() const
 print nodes

TH2F* LegoPlot(Int_t ntheta, Double_t themin, Double_t themax, Int_t nphi, Double_t phimin, Double_t phimax, Double_t rmin, Double_t rmax, Option_t *option)
 Generate a lego plot fot the top volume, according to option.

void RandomPoints(Int_t npoints, Option_t *option)
 Draw random points in the bounding box of this volume.

void RandomRays(Int_t nrays, Double_t startx, Double_t starty, Double_t startz)
 Random raytracing method.

void ExecuteEvent(Int_t event, Int_t px, Int_t py)
 Execute mouse actions on this volume.

TGeoNode* FindNode(const char *name) const
 search a daughter inside the list of nodes

Int_t GetNodeIndex(const TGeoNode *node, Int_t *check_list, Int_t ncheck) const

Int_t GetIndex(const TGeoNode *node) const
 get index number for a given daughter

char* GetObjectInfo(Int_t px, Int_t py) const

Bool_t GetOptimalVoxels() const
--- Returns true if cylindrical voxelization is optimal.

void MakeCopyNodes(const TGeoVolume *other)
 make a new list of nodes and copy all nodes of other volume inside

void GrabFocus()
 Move perspective view focus to this volume

TGeoVolume* MakeCopyVolume(TGeoShape *newshape)
 make a copy of this volume
    printf("   Making a copy of %sn", GetName());

void SetAsTopVolume()

void SetCurrentPoint(Double_t x, Double_t y, Double_t z)

void SetShape(const TGeoShape *shape)
 set the shape associated with this volume

void Sizeof3D() const
   Compute size of this 3d object.

void SortNodes()
 sort nodes by decreasing volume of the bounding box. ONLY nodes comes first,
 then overlapping nodes and finally division nodes.

void Streamer(TBuffer &R__b)
 Stream an object of class TGeoVolume.

void SetOption(const char * /*option*/)
 set the current options

void SetLineColor(Color_t lcolor)

void SetLineStyle(Style_t lstyle)

void SetLineWidth(Style_t lwidth)

TGeoNode* GetNode(const char *name) const
 get the pointer to a daughter node

Int_t GetByteCount() const
 get the total size in bytes for this volume

void FindOverlaps() const
 loop all nodes marked as overlaps and find overlaping brothers

void SetVisibility(Bool_t vis)
 set visibility of this volume

Bool_t Valid() const

Bool_t FindMatrixOfDaughterVolume(TGeoVolume *vol) const
 Find a daughter node having VOL as volume and fill TGeoManager::fHMatrix
 with its global matrix.

void VisibleDaughters(Bool_t vis)
 set visibility for daughters

void Voxelize(Option_t *option)
 build the voxels for this volume

Double_t Weight(Double_t precision, Option_t *option)
 Estimate the weight of a volume with SIGMA(M)/M better than PRECISION.
 Option can be : v - verbose (default)



Inline Functions


                      void ClearNodes()
                    Bool_t Contains(Double_t* point) const
                    Bool_t IsRunTime() const
                    Bool_t IsCylVoxels() const
                    Bool_t IsXYZVoxels() const
                    Bool_t IsValid() const
                    Bool_t IsVisible() const
                TObjArray* GetNodes()
                     Int_t GetNdaughters() const
             TGeoMaterial* GetMaterial() const
               TGeoMedium* GetMedium() const
                  TObject* GetField() const
        TGeoPatternFinder* GetFinder() const
          TGeoVoxelFinder* GetVoxels() const
                 TGeoNode* GetNode(Int_t i) const
                     Int_t GetNumber()
                 Option_t* GetOption() const
                TGeoShape* GetShape() const
                      void Gsord(Int_t)
                      void InspectShape() const
                     void* Make3DBuffer() const
                      void SetCylVoxels(Bool_t flag = kTRUE)
                      void SetNodes(TObjArray* nodes)
                      void SetField(const TObject* field)
                      void SetInvisible()
                      void SetMedium(const TGeoMedium* medium)
                      void SetVoxelFinder(const TGeoVoxelFinder* finder)
                      void SetFinder(const TGeoPatternFinder* finder)
                      void SetNumber(Int_t number)
                      void InvisibleAll()
                   TClass* Class()
                   TClass* IsA() const
                      void ShowMembers(TMemberInspector& insp, char* parent)
                      void StreamerNVirtual(TBuffer& b)
                TGeoVolume TGeoVolume(const TGeoVolume&)


Author: Andrei Gheata 30/05/02
Last update: root/geom:$Name: $:$Id: TGeoVolume.cxx,v 1.32 2003/05/07 13:32:39 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.