ROOT logo
ROOT » GEOM » GEOM » TGeoVolume

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

   TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly - the volume classes

   Volumes are the basic objects used in building the geometrical hierarchy.
 They represent unpositioned objects but store all information about the
 placement of the other volumes they may contain. Therefore a volume can
 be replicated several times in the geometry. In order to create a volume, one
 has to put together a shape and a medium which are already defined. Volumes
 have to be named by users at creation time. Every different name may represent a
 an unique volume object, but may also represent more general a family (class)
 of volume objects having the same shape type and medium, but possibly
 different shape parameters. It is the user's task to provide different names
 for different volume families in order to avoid ambiguities at tracking time.
 A generic family rather than a single volume is created only in two cases :
 when a generic shape is provided to the volume constructor or when a division
 operation is applied. Each volume in the geometry stores an unique
 ID corresponding to its family. In order to ease-up their creation, the manager
 class is providing an API that allows making a shape and a volume in a single step.

   Volumes are objects that can be visualized, therefore having visibility,
 colour, line and fill attributes that can be defined or modified any time after
 the volume creation. It is advisable however to define these properties just
 after the first creation of a volume namespace, since in case of volume families
 any new member created by the modeler inherits these properties.

    In order to provide navigation features, volumes have to be able to find
 the proper container of any point defined in the local reference frame. This
 can be the volume itself, one of its positioned daughter volumes or none if
 the point is actually outside. On the other hand, volumes have to provide also
 other navigation methods such as finding the distances to its shape boundaries
 or which daughter will be crossed first. The implementation of these features
 is done at shape level, but the local mother-daughters management is handled
 by volumes that builds additional optimisation structures upon geometry closure.
 In order to have navigation features properly working one has to follow the
 general rules for building a valid geometry (see TGeoManager class).

   Now let's make a simple volume representing a copper wire. We suppose that
 a medium is already created (see TGeoMedium class on how to create media).
 We will create a TUBE shape for our wire, having Rmin=0cm, Rmax=0.01cm
 and a half-length dZ=1cm :

   TGeoTube *tube = new TGeoTube("wire_tube", 0, 0.01, 1);

 One may ommit the name for the shape if no retreiving by name is further needed
 during geometry building. The same shape can be shared by different volumes
 having different names and materials. Now let's make the volume for our wire.
 The prototype for volumes constructor looks like :

   TGeoVolume::TGeoVolume(const char *name, TGeoShape *shape, TGeoMedium *med)

 Since TGeoTube derives from the base shape class, we can provide it to the volume
 constructor :

   TGeoVolume *wire_co = new TGeoVolume("WIRE_CO", tube, ptrCOPPER);

 Do not bother to delete neither the media, shapes or volumes that you have
 created since all will be automatically cleaned on exit by the manager class.
 If we would have taken a look inside TGeoManager::MakeTube() method, we would
 have been able to create our wire with a single line :

   TGeoVolume *wire_co = gGeoManager->MakeTube("WIRE_CO", ptrCOPPER, 0, 0.01, 1);

 The same applies for all primitive shapes, for which there can be found
 corresponding MakeSHAPE() methods. Their usage is much more convenient unless
 a shape has to be shared between more volumes. Let's make now an aluminium wire
 having the same shape, supposing that we have created the copper wire with the
 line above :

   TGeoVolume *wire_al = new TGeoVolume("WIRE_AL", wire_co->GetShape(), ptrAL);

 Now that we have learned how to create elementary volumes, let's see how we
 can create a geometrical hierarchy.


   Positioning volumes


   When creating a volume one does not specify if this will contain or not other
 volumes. Adding daughters to a volume implies creating those and adding them
 one by one to the list of daughters. Since the volume has to know the position
 of all its daughters, we will have to supply at the same time a geometrical
 transformation with respect to its local reference frame for each of them.
 The objects referencing a volume and a transformation are called NODES and
 their creation is fully handled by the modeler. They represent the link
 elements in the hierarchy of volumes. Nodes are unique and distinct geometrical
 objects ONLY from their container point of view. Since volumes can be replicated
 in the geometry, the same node may be found on different branches.


/* */

   An important observation is that volume objects are owned by the TGeoManager
 class. This stores a list of all volumes in the geometry, that is cleaned
 upon destruction.

   Let's consider positioning now our wire in the middle of a gas chamber. We
 need first to define the gas chamber :

   TGeoVolume *chamber = gGeoManager->MakeTube("CHAMBER", ptrGAS, 0, 1, 1);

 Now we can put the wire inside :

   chamber->AddNode(wire_co, 1);

 If we inspect now the chamber volume in a browser, we will notice that it has
 one daughter. Of course the gas has some container also, but let's keep it like
 that for the sake of simplicity. The full prototype of AddNode() is :

   TGeoVolume::AddNode(TGeoVolume *daughter, Int_t usernumber,
                       TGeoMatrix *matrix=gGeoIdentity)

 Since we did not supplied the third argument, the wire will be positioned with
 an identity transformation inside the chamber. One will notice that the inner
 radii of the wire and chamber are both zero - therefore, aren't the two volumes
 overlapping ? The answer is no, the modeler is even relaying on the fact that
 any daughter is fully contained by its mother. On the other hand, neither of
 the nodes positioned inside a volume should overlap with each other. We will
 see that there are allowed some exceptions to those rules.

 Overlapping volumes


   Positioning volumes that does not overlap their neighbours nor extrude
 their container is sometimes quite strong constraint. Some parts of the geometry
 might overlap naturally, e.g. two crossing tubes. The modeller supports such
 cases only if the overlapping nodes are declared by the user. In order to do
 that, one should use TGeoVolume::AddNodeOverlap() instead of TGeoVolume::AddNode().
   When 2 or more positioned volumes are overlapping, not all of them have to
 be declared so, but at least one. A point inside an overlapping region equally
 belongs to all overlapping nodes, but the way these are defined can enforce
 the modeler to give priorities.
   The general rule is that the deepest node in the hierarchy containing a point
 have the highest priority. For the same geometry level, non-overlapping is
 prioritized over overlapping. In order to illustrate this, we will consider
 few examples. We will designate non-overlapping nodes as ONLY and the others
 MANY as in GEANT3, where this concept was introduced:
   1. The part of a MANY node B extruding its container A will never be "seen"
 during navigation, as if B was in fact the result of the intersection of A and B.
   2. If we have two nodes A (ONLY) and B (MANY) inside the same container, all
 points in the overlapping region of A and B will be designated as belonging to A.
   3. If A an B in the above case were both MANY, points in the overlapping
 part will be designated to the one defined first. Both nodes must have the
 same medium.
   4. The slices of a divided MANY will be as well MANY.

 One needs to know that navigation inside geometry parts MANY nodes is much
 slower. Any overlapping part can be defined based on composite shapes - this
 is always recommended.

   Replicating volumes


   What can we do if our chamber contains two identical wires instead of one ?
 What if then we would need 1000 chambers in our detector ? Should we create
 2000 wires and 1000 chamber volumes ? No, we will just need to replicate the
 ones that we have already created.

   chamber->AddNode(wire_co, 1, new TGeoTranslation(-0.2,0,0));
   chamber->AddNode(wire_co, 2, new TGeoTranslation(0.2,0,0));

   The 2 nodes that we have created inside chamber will both point to a wire_co
 object, but will be completely distinct : WIRE_CO_1 and WIRE_CO_2. We will
 want now to place symetrically 1000 chambers on a pad, following a pattern
 of 20 rows and 50 columns. One way to do this will be to replicate our chamber
 by positioning it 1000 times in different positions of the pad. Unfortunatelly,
 this is far from being the optimal way of doing what we want.
 Imagine that we would like to find out which of the 1000 chambers is containing
 a (x,y,z) point defined in the pad reference. You will never have to do that,
 since the modeller will take care of it for you, but let's guess what it has
 to do. The most simple algorithm will just loop over all daughters, convert
 the point from mother to local reference and check if the current chamber
 contains the point or not. This might be efficient for pads with few chambers,
 but definitely not for 1000. Fortunately the modeler is smarter than that and
 create for each volume some optimization structures called voxels (see Voxelization)
 to minimize the penalty having too many daughters, but if you have 100 pads like
 this in your geometry you will anyway loose a lot in your tracking performance.

   The way out when volumes can be arranged according to simple patterns is the
 usage of divisions. We will describe them in detail later on. Let's think now
 at a different situation : instead of 1000 chambers of the same type, we may
 have several types of chambers. Let's say all chambers are cylindrical and have
 a wire inside, but their dimensions are different. However, we would like all
 to be represented by a single volume family, since they have the same properties.

   Volume families (TGeoVolumeMulti)

 A volume family is represented by the class TGeoVolumeMulti. It represents
 a class of volumes having the same shape type and each member will be
 identified by the same name and volume ID. Any operation applied to a
 TGeoVolume equally affects all volumes in that family. The creation of a
 family is generally not a user task, but can be forced in particular cases:

      TGeoManager::Volume(const char *vname, const char *shape, Int_t nmed);

 where VNAME is the family name, NMED is the medium number and SHAPE is the
 shape type that can be:
   box    - for TGeoBBox
   trd1   - for TGeoTrd1
   trd2   - for TGeoTrd2
   trap   - for TGeoTrap
   gtra   - for TGeoGtra
   para   - for TGeoPara
   tube, tubs - for TGeoTube, TGeoTubeSeg
   cone, cons - for TGeoCone, TgeoCons
   eltu   - for TGeoEltu
   ctub   - for TGeoCtub
   pcon   - for TGeoPcon
   pgon   - for TGeoPgon

 Volumes are then added to a given family upon adding the generic name as node
 inside other volume:
   TGeoVolume *box_family = gGeoManager->Volume("BOXES", "box", nmed);

   gGeoManager->Node("BOXES", Int_t copy_no, "mother_name",
                     Double_t x, Double_t y, Double_t z, Int_t rot_index,
                     Bool_t is_only, Double_t *upar, Int_t npar);
 here:
   BOXES   - name of the family of boxes
   copy_no - user node number for the created node
   mother_name - name of the volume to which we want to add the node
   x,y,z   - translation components
   rot_index   - indx of a rotation matrix in the list of matrices
   upar    - array of actual shape parameters
   npar    - number of parameters
 The parameters order and number are the same as in the corresponding shape
 constructors.

   Another particular case where volume families are used is when we want
 that a volume positioned inside a container to match one ore more container
 limits. Suppose we want to position the same box inside 2 different volumes
 and we want the Z size to match the one of each container:

   TGeoVolume *container1 = gGeoManager->MakeBox("C1", imed, 10,10,30);
   TGeoVolume *container2 = gGeoManager->MakeBox("C2", imed, 10,10,20);
   TGeoVolume *pvol       = gGeoManager->MakeBox("PVOL", jmed, 3,3,-1);
   container1->AddNode(pvol, 1);
   container2->AddNode(pvol, 1);

   Note that the third parameter of PVOL is negative, which does not make sense
 as half-length on Z. This is interpreted as: when positioned, create a box
 replacing all invalid parameters with the corresponding dimensions of the
 container. This is also internally handled by the TGeoVolumeMulti class, which
 does not need to be instantiated by users.

   Dividing volumes


   Volumes can be divided according a pattern. The most simple division can
 be done along one axis, that can be: X, Y, Z, Phi, Rxy or Rxyz. Let's take
 the most simple case: we would like to divide a box in N equal slices along X
 coordinate, representing a new volume family. Supposing we already have created
 the initial box, this can be done like:

      TGeoVolume *slicex = box->Divide("SLICEX", 1, N);

 where SLICE is the name of the new family representing all slices and 1 is the
 slicing axis. The meaning of the axis index is the following: for all volumes
 having shapes like box, trd1, trd2, trap, gtra or para - 1,2,3 means X,Y,Z; for
 tube, tubs, cone, cons - 1 means Rxy, 2 means phi and 3 means Z; for pcon and
 pgon - 2 means phi and 3 means Z; for spheres 1 means R and 2 means phi.
   In fact, the division operation has the same effect as positioning volumes
 in a given order inside the divided container - the advantage being that the
 navigation in such a structure is much faster. When a volume is divided, a
 volume family corresponding to the slices is created. In case all slices can
 be represented by a single shape, only one volume is added to the family and
 positioned N times inside the divided volume, otherwise, each slice will be
 represented by a distinct volume in the family.
   Divisions can be also performed in a given range of one axis. For that, one
 have to specify also the starting coordinate value and the step:

      TGeoVolume *slicex = box->Divide("SLICEX", 1, N, start, step);

 A check is always done on the resulting division range : if not fitting into
 the container limits, an error message is posted. If we will browse the divided
 volume we will notice that it will contain N nodes starting with index 1 upto
 N. The first one has the lower X limit at START position, while the last one
 will have the upper X limit at START+N*STEP. The resulting slices cannot
 be positioned inside an other volume (they are by default positioned inside the
 divided one) but can be further divided and may contain other volumes:

      TGeoVolume *slicey = slicex->Divide("SLICEY", 2, N1);
      slicey->AddNode(other_vol, index, some_matrix);

   When doing that, we have to remember that SLICEY represents a family, therefore
 all members of the family will be divided on Y and the other volume will be
 added as node inside all.
   In the example above all the resulting slices had the same shape as the
 divided volume (box). This is not always the case. For instance, dividing a
 volume with TUBE shape on PHI axis will create equal slices having TUBESEG
 shape. Other divisions can alsoo create slices having shapes with different
 dimensins, e.g. the division of a TRD1 volume on Z.
   When positioning volumes inside slices, one can do it using the generic
 volume family (e.g. slicey). This should be done as if the coordinate system
 of the generic slice was the same as the one of the divided volume. The generic
 slice in case of PHI divisioned is centered with respect to X axis. If the
 family contains slices of different sizes, any volume positioned inside should
 fit into the smallest one.
    Examples for specific divisions according to shape types can be found inside
 shape classes.

        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.

   Volume assemblies (TGeoVolumeAssembly)


 Assemblies a volumes that have neither a shape or a material/medium. Assemblies
 behave exactly like normal volumes grouping several daughters together, but
 the daughters can never extrude the assembly since this has no shape. However,
 a bounding box and a voxelization structure are built for assemblies as for
 normal volumes, so that navigation is still optimized. Assemblies are useful
 for grouping hierarchically volumes which are otherwise defined in a flat
 manner, but also to avoid clashes between container shapes.
 To define an assembly one should just input a name, then start adding other
 volumes (or volume assemblies) as content.

Function Members (Methods)

public:
TGeoVolume()
TGeoVolume(const char* name, const TGeoShape* shape, const TGeoMedium* med = 0)
virtual~TGeoVolume()
voidTObject::AbstractMethod(const char* method) const
virtual voidAddNode(TGeoVolume* vol, Int_t copy_no, TGeoMatrix* mat = 0, Option_t* option = "")
voidAddNodeOffset(TGeoVolume* vol, Int_t copy_no, Double_t offset = 0, Option_t* option = "")
virtual voidAddNodeOverlap(TGeoVolume* vol, Int_t copy_no, TGeoMatrix* mat = 0, Option_t* option = "")
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidBrowse(TBrowser* b)
Double_tCapacity() const
virtual voidcd(Int_t inode) const
voidCheckGeometry(Int_t nrays = 1, Double_t startx = 0, Double_t starty = 0, Double_t startz = 0) const
voidCheckOverlaps(Double_t ovlp = 0.1, Option_t* option = "") constMENU
voidCheckShape(Int_t testNo, Int_t nsamples = 10000, Option_t* option = "")MENU
voidCheckShapes()
static TClass*Class()
virtual const char*TObject::ClassName() const
voidCleanAll()
virtual voidTNamed::Clear(Option_t* option = "")
voidClearNodes()
voidClearShape()
virtual voidClearThreadData() const
virtual TObject*TNamed::Clone(const char* newname = "") const
voidCloneNodesAndConnect(TGeoVolume* newmother) const
virtual TGeoVolume*CloneVolume() const
virtual Int_tTNamed::Compare(const TObject* obj) const
Bool_tContains(const Double_t* point) const
virtual voidTNamed::Copy(TObject& named) const
Int_tCountNodes(Int_t nlevels = 1000, Int_t option = 0)
static voidCreateDummyMedium()
virtual voidCreateThreadData(Int_t nthreads)
virtual voidTObject::Delete(Option_t* option = "")MENU
Int_tTAttLine::DistancetoLine(Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
virtual Int_tDistancetoPrimitive(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, Option_t* option = "")
virtual voidDraw(Option_t* option = "")MENU
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidDrawOnly(Option_t* option = "")MENU
static TGeoMedium*DummyMedium()
virtual voidTObject::Dump() constMENU
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 voidExecuteEvent(Int_t event, Int_t px, Int_t py)
Int_tExport(const char* filename, const char* name = "", Option_t* option = "")
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
Bool_tFindMatrixOfDaughterVolume(TGeoVolume* vol) const
TGeoNode*FindNode(const char* name) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
voidFindOverlaps() const
virtual Int_tGetByteCount() const
virtual Int_tGetCurrentNodeIndex() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
TObject*GetField() const
virtual Color_tTAttFill::GetFillColor() const
virtual Style_tTAttFill::GetFillStyle() const
TGeoPatternFinder*GetFinder() const
TGeoExtension*GetFWExtension() const
TGeoManager*GetGeoManager() const
virtual const char*GetIconName() const
Int_tGetIndex(const TGeoNode* node) const
virtual Color_tTAttLine::GetLineColor() const
virtual Style_tTAttLine::GetLineStyle() const
virtual Width_tTAttLine::GetLineWidth() const
TGeoMaterial*GetMaterial() const
TGeoMedium*GetMedium() const
virtual const char*TNamed::GetName() const
Int_tGetNdaughters() const
virtual Int_tGetNextNodeIndex() const
TGeoNode*GetNode(const char* name) const
TGeoNode*GetNode(Int_t i) const
Int_tGetNodeIndex(const TGeoNode* node, Int_t* check_list, Int_t ncheck) const
TObjArray*GetNodes()
Int_tGetNtotal() const
Int_tGetNumber() const
virtual char*GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
Bool_tGetOptimalVoxels() const
virtual Option_t*GetOption() const
char*GetPointerName() const
Int_tGetRefCount() const
TGeoShape*GetShape() const
virtual const char*TNamed::GetTitle() const
Char_tGetTransparency() const
virtual UInt_tTObject::GetUniqueID() const
TGeoExtension*GetUserExtension() const
TGeoVoxelFinder*GetVoxels() const
voidGrab()
voidGrabFocus()MENU
TGeoExtension*GrabFWExtension() const
TGeoExtension*GrabUserExtension() const
voidGsord(Int_t)
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
static TGeoVolume*Import(const char* filename, const char* name = "", Option_t* option = "")
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
voidInspectMaterial() constMENU
voidInspectShape() constMENU
voidTObject::InvertBit(UInt_t f)
voidInvisibleAll(Bool_t flag = kTRUE)TOGGLE GETTER
virtual TClass*IsA() const
Bool_tIsActive() const
Bool_tIsActiveDaughters() const
Bool_tIsAdded() const
Bool_tIsAllInvisible() const
virtual Bool_tIsAssembly() const
Bool_tIsCylVoxels() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tIsFolder() const
Bool_tTObject::IsOnHeap() const
Bool_tIsOverlappingCandidate() const
Bool_tIsRaytracing() const
Bool_tIsReplicated() const
Bool_tIsRunTime() const
Bool_tIsSelected() const
virtual Bool_tTNamed::IsSortable() const
Bool_tIsStyleDefault() const
Bool_tIsTopVolume() const
virtual Bool_tTAttFill::IsTransparent() const
Bool_tIsValid() const
Bool_tTGeoAtt::IsVisBranch() const
Bool_tIsVisContainers() const
Bool_tTGeoAtt::IsVisDaughters() const
virtual Bool_tIsVisible() const
Bool_tIsVisibleDaughters() const
Bool_tIsVisLeaves() const
Bool_tIsVisOnly() const
Bool_tTGeoAtt::IsVisRaytrace() const
Bool_tTGeoAtt::IsVisStreamed() const
Bool_tTGeoAtt::IsVisTouched() const
virtual Bool_tIsVolumeMulti() const
Bool_tIsXYZVoxels() const
Bool_tTObject::IsZombie() 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, Option_t* option = "")MENU
virtual voidTNamed::ls(Option_t* option = "") const
voidMakeCopyNodes(const TGeoVolume* other)
virtual TGeoVolume*MakeCopyVolume(TGeoShape* newshape)
TGeoVolume*MakeReflectedVolume(const char* newname = "") const
voidTObject::MayNotUse(const char* method) const
virtual voidTAttLine::Modify()
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
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)
Bool_tOptimizeVoxels()MENU
virtual voidPaint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidPrint(Option_t* option = "") constMENU
voidPrintNodes() const
voidPrintVoxels() constMENU
voidRandomPoints(Int_t npoints = 1000000, Option_t* option = "")MENU
voidRandomRays(Int_t nrays = 10000, Double_t startx = 0, Double_t starty = 0, Double_t startz = 0, const char* target_vol = 0, Bool_t check_norm = kFALSE)MENU
voidRaytrace(Bool_t flag = kTRUE)TOGGLE GETTER
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidRegisterYourself(Option_t* option = "")
voidRelease()
voidRemoveNode(TGeoNode* node)
TGeoNode*ReplaceNode(TGeoNode* nodeorig, TGeoShape* newshape = 0, TGeoMatrix* newpos = 0, TGeoMedium* newmed = 0)
voidReplayCreation(const TGeoVolume* other)
voidTGeoAtt::ResetAttBit(UInt_t f)
virtual voidTAttFill::ResetAttFill(Option_t* option = "")
virtual voidTAttLine::ResetAttLine(Option_t* option = "")
voidTObject::ResetBit(UInt_t f)
virtual voidSaveAs(const char* filename, Option_t* option = "") constMENU
virtual voidTAttFill::SaveFillAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1001)
virtual voidTAttLine::SaveLineAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1, Int_t widdef = 1)
virtual voidSavePrimitive(ostream& out, Option_t* option = "")
voidSelectVolume(Bool_t clear = kFALSE)
voidSetActiveDaughters(Bool_t flag = kTRUE)
voidSetActivity(Bool_t flag = kTRUE)
voidSetAdded()
voidSetAsTopVolume()TOGGLE GETTER
voidTGeoAtt::SetAttBit(UInt_t f)
voidTGeoAtt::SetAttBit(UInt_t f, Bool_t set)
voidSetAttVisibility(Bool_t vis)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidSetCurrentPoint(Double_t x, Double_t y, Double_t z)
voidSetCylVoxels(Bool_t flag = kTRUE)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
voidSetField(TObject* field)
virtual voidTAttFill::SetFillAttributes()MENU
virtual voidTAttFill::SetFillColor(Color_t fcolor)
virtual voidTAttFill::SetFillColorAlpha(Color_t fcolor, Float_t falpha)
virtual voidTAttFill::SetFillStyle(Style_t fstyle)
voidSetFinder(TGeoPatternFinder* finder)
voidSetFWExtension(TGeoExtension* ext)
voidSetInvisible()
virtual voidTAttLine::SetLineAttributes()MENU
virtual voidSetLineColor(Color_t lcolor)
virtual voidTAttLine::SetLineColorAlpha(Color_t lcolor, Float_t lalpha)
virtual voidSetLineStyle(Style_t lstyle)
virtual voidSetLineWidth(Width_t lwidth)
virtual voidSetMedium(TGeoMedium* medium)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
voidSetNodes(TObjArray* nodes)
voidSetNtotal(Int_t ntotal)
voidSetNumber(Int_t number)
static voidTObject::SetObjectStat(Bool_t stat)
voidTGeoAtt::SetOptimization(Option_t* option)
voidSetOption(const char* option)
voidSetOverlappingCandidate(Bool_t flag)
voidSetReplicated()
voidSetShape(const TGeoShape* shape)
virtual voidTNamed::SetTitle(const char* title = "")MENU
voidSetTransparency(Char_t transparency = 0)MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
voidSetUserExtension(TGeoExtension* ext)
voidTGeoAtt::SetVisBranch()
virtual voidSetVisContainers(Bool_t flag = kTRUE)TOGGLE GETTER
voidTGeoAtt::SetVisDaughters(Bool_t vis = kTRUE)
virtual voidSetVisibility(Bool_t vis = kTRUE)TOGGLE GETTER
virtual voidSetVisLeaves(Bool_t flag = kTRUE)TOGGLE GETTER
virtual voidSetVisOnly(Bool_t flag = kTRUE)TOGGLE GETTER
voidTGeoAtt::SetVisRaytrace(Bool_t flag = kTRUE)
voidTGeoAtt::SetVisStreamed(Bool_t vis = kTRUE)
voidTGeoAtt::SetVisTouched(Bool_t vis = kTRUE)
voidSetVoxelFinder(TGeoVoxelFinder* finder)
virtual voidShowMembers(TMemberInspector&)
virtual Int_tTNamed::Sizeof() const
virtual voidTAtt3D::Sizeof3D() const
voidSortNodes()
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTGeoAtt::TestAttBit(UInt_t f) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
voidUnmarkSaved()
virtual voidTObject::UseCurrentStyle()
Bool_tValid() const
voidVisibleDaughters(Bool_t vis = kTRUE)TOGGLE GETTER
voidVoxelize(Option_t* option)
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
Double_tWeight(Double_t precision = 0.01, Option_t* option = "va")MENU
Double_tWeightA() 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:
TGeoVolume(const TGeoVolume&)
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
TGeoVolume&operator=(const TGeoVolume&)

Data Members

public:
enum EGeoVolumeTypes { kVolumeReplicated
kVolumeSelected
kVolumeDiv
kVolumeOverlap
kVolumeImportNodes
kVolumeMulti
kVoxelsXYZ
kVoxelsCyl
kVolumeClone
kVolumeAdded
kVolumeOC
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
enum TGeoAtt::[unnamed] { kBitMask
};
enum TGeoAtt::EGeoVisibilityAtt { kVisOverride
kVisNone
kVisThis
kVisDaughters
kVisOneLevel
kVisStreamed
kVisTouched
kVisOnScreen
kVisContainers
kVisOnly
kVisBranch
kVisRaytrace
};
enum TGeoAtt::EGeoActivityAtt { kActOverride
kActNone
kActThis
kActDaughters
};
enum TGeoAtt::EGeoOptimizationAtt { kUseBoundingBox
kUseVoxels
kUseGsord
};
enum TGeoAtt::EGeoSavePrimitiveAtt { kSavePrimitiveAtt
kSaveNodesAtt
};
protected:
TGeoExtension*fFWExtension! Transient framework-defined extension to volumes
TObject*fField! just a hook for now
Color_tTAttFill::fFillColorfill area color
Style_tTAttFill::fFillStylefill area style
TGeoPatternFinder*fFinderfinder object for divisions
UInt_tTGeoAtt::fGeoAttoption flags
TGeoManager*fGeoManager! pointer to TGeoManager owning this volume
Color_tTAttLine::fLineColorline color
Style_tTAttLine::fLineStyleline style
Width_tTAttLine::fLineWidthline width
TGeoMedium*fMediumtracking medium
TStringTNamed::fNameobject identifier
TObjArray*fNodesarray of nodes inside this volume
Int_tfNtotaltotal number of physical nodes
Int_tfNumbervolume serial number in the list of volumes
TStringfOption! option - if any
Int_tfRefCountreference counter
TGeoShape*fShapeshape
TStringTNamed::fTitleobject title
TGeoExtension*fUserExtension! Transient user-defined extension to volumes
TGeoVoxelFinder*fVoxelsfinder object for bounding boxes
static TGeoMedium*fgDummyMedium! dummy medium

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

void CreateDummyMedium()
 Create a dummy medium
void ClearThreadData() const
void CreateThreadData(Int_t nthreads)
TGeoMedium * DummyMedium()
TGeoVolume()
 dummy constructor
TGeoVolume(const char* name, const TGeoShape* shape, const TGeoMedium* med = 0)
 default constructor
TGeoVolume(const TGeoVolume& )
copy constructor
TGeoVolume& operator=(const TGeoVolume& )
assignment operator
~TGeoVolume()
 Destructor
void Browse(TBrowser* b)
 How to browse a volume
Double_t Capacity() const
 Computes the capacity of this [cm^3] as the capacity of its shape.
 In case of assemblies, the capacity is computed as the sum of daughter's capacities.
void CheckGeometry(Int_t nrays = 1, Double_t startx = 0, Double_t starty = 0, Double_t startz = 0) 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 = 0.1, Option_t* option = "") const
 Overlap checking tool. Check for illegal overlaps within a limit OVLP.
 Use option="s[number]" to force overlap checking by sampling volume with
 [number] points.
 Ex: myVol->CheckOverlaps(0.01, "s10000000"); // shoot 10000000 points
     myVol->CheckOverlaps(0.01, "s"); // shoot the default value of 1e6 points
void CheckShape(Int_t testNo, Int_t nsamples = 10000, Option_t* option = "")
 Tests for checking the shape navigation algorithms. See TGeoShape::CheckShape()
void CleanAll()
 Clean data of the volume.
void ClearShape()
 Clear the shape of this volume from the list held by the current manager.
void CheckShapes()
 check for negative parameters in shapes.
 THIS METHOD LEAVES SOME GARBAGE NODES -> memory leak, to be fixed
   printf("---Checking daughters of volume %s\n", GetName());
Int_t CountNodes(Int_t nlevels = 1000, Int_t option = 0)
 Count total number of subnodes starting from this volume, nlevels down
 option = 0 (default) - count only once per volume
 option = 1           - count every time
 option = 2           - count volumes on visible branches
 option = 3           - return maximum level counted already with option = 0
Bool_t IsAllInvisible() const
 Return TRUE if volume and all daughters are invisible.
void InvisibleAll(Bool_t flag = kTRUE)
 Make volume and each of it daughters (in)visible.
Bool_t IsFolder() const
 Return TRUE if volume contains nodes
   return (GetNdaughters()?kTRUE:kFALSE);
Bool_t IsStyleDefault() const
 check if the visibility and attributes are the default ones
Bool_t IsTopVolume() const
 True if this is the top volume of the geometry
Bool_t IsRaytracing() const
 Check if the painter is currently ray-tracing the content of this volume.
void InspectMaterial() const
 Inspect the material for this volume.
TGeoVolume * Import(const char* filename, const char* name = "", Option_t* option = "")
 Import a volume from a file.
Int_t Export(const char* filename, const char* name = "", Option_t* option = "")
 Export this volume to a file.

 -Case 1: root file or root/xml file
  if filename end with ".root". The key will be named name
  if filename end with ".xml" a root/xml file is produced.

 -Case 2: C++ script
  if filename end with ".C"

 -Case 3: gdml file
  if filename end with ".gdml"
  NOTE that to use this option, the PYTHONPATH must be defined like
      export PYTHONPATH=$ROOTSYS/lib:$ROOTSYS/gdml

void cd(Int_t inode) const
 Actualize matrix of node indexed <inode>
void AddNode(TGeoVolume* vol, Int_t copy_no, TGeoMatrix* mat = 0, 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(TGeoVolume* vol, Int_t copy_no, Double_t offset = 0, 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(TGeoVolume* vol, Int_t copy_no, TGeoMatrix* mat = 0, 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 = 0, 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 Print(Option_t* option = "") const
 Print volume info
void Paint(Option_t* option = "")
 paint volume
void PrintVoxels() const
 Print the voxels for this volume.
void ReplayCreation(const TGeoVolume* other)
 Recreate the content of the other volume without pointer copying. Voxels are
 ignored and supposed to be created in a later step via Voxelize.
void PrintNodes() const
 print nodes
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, Option_t* option = "")
 Generate a lego plot fot the top volume, according to option.
void RegisterYourself(Option_t* option = "")
 Register the volume and all materials/media/matrices/shapes to the manager.
void RandomPoints(Int_t npoints = 1000000, Option_t* option = "")
 Draw random points in the bounding box of this volume.
void RandomRays(Int_t nrays = 10000, Double_t startx = 0, Double_t starty = 0, Double_t startz = 0, const char* target_vol = 0, Bool_t check_norm = kFALSE)
 Random raytracing method.
void Raytrace(Bool_t flag = kTRUE)
 Draw this volume with current settings and perform raytracing in the pad.
void SaveAs(const char* filename, Option_t* option = "") const
  Save geometry having this as top volume as a C++ macro.
void SetUserExtension(TGeoExtension* ext)
 Connect user-defined extension to the volume. The volume "grabs" a copy, so
 the original object can be released by the producer. Release the previously
 connected extension if any.

 NOTE: This interface is intended for user extensions and is guaranteed not
 to be used by TGeo

void SetFWExtension(TGeoExtension* ext)
 Connect framework defined extension to the volume. The volume "grabs" a copy,
 so the original object can be released by the producer. Release the previously
 connected extension if any.

 NOTE: This interface is intended for the use by TGeo and the users should
       NOT connect extensions using this method

TGeoExtension * GrabUserExtension() const
 Get a copy of the user extension pointer. The user must call Release() on
 the copy pointer once this pointer is not needed anymore (equivalent to
 delete() after calling new())
TGeoExtension * GrabFWExtension() const
 Get a copy of the framework extension pointer. The user must call Release() on
 the copy pointer once this pointer is not needed anymore (equivalent to
 delete() after calling new())
void SavePrimitive(ostream& out, Option_t* option = "")
 Save a primitive as a C++ statement(s) on output stream "out".
void UnmarkSaved()
 Reset SavePrimitive bits.
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
 Get the index of a daugther within check_list by providing the node pointer.
Int_t GetIndex(const TGeoNode* node) const
 get index number for a given daughter
char * GetObjectInfo(Int_t px, Int_t py) const
 Get volume info for the browser.
Bool_t GetOptimalVoxels() const
--- Returns true if cylindrical voxelization is optimal.
char * GetPointerName() const
 Provide a pointer name containing uid.
TGeoVoxelFinder * GetVoxels() const
 Getter for optimization structure.
void GrabFocus()
 Move perspective view focus to this volume
Bool_t IsAssembly() const
 Returns true if the volume is an assembly or a scaled assembly.
TGeoVolume * CloneVolume() const
 Clone this volume.
 build a volume with same name, shape and medium
void CloneNodesAndConnect(TGeoVolume* newmother) const
 Clone the array of nodes.
void MakeCopyNodes(const TGeoVolume* other)
 make a new list of nodes and copy all nodes of other volume inside
TGeoVolume * MakeCopyVolume(TGeoShape* newshape)
 make a copy of this volume
 build a volume with same name, shape and medium
TGeoVolume * MakeReflectedVolume(const char* newname = "") const
 Make a copy of this volume which is reflected with respect to XY plane.
void SetAsTopVolume()
 Set this volume as the TOP one (the whole geometry starts from here)
void SetCurrentPoint(Double_t x, Double_t y, Double_t z)
 Set the current tracking point.
void SetShape(const TGeoShape* shape)
 set the shape associated with this volume
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& )
 Stream an object of class TGeoVolume.
void SetOption(const char* option)
 Set the current options (none implemented)
void SetLineColor(Color_t lcolor)
 Set the line color.
void SetLineStyle(Style_t lstyle)
 Set the line style.
void SetLineWidth(Width_t lwidth)
 Set the line width.
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 RemoveNode(TGeoNode* node)
 Remove an existing daughter.
TGeoNode * ReplaceNode(TGeoNode* nodeorig, TGeoShape* newshape = 0, TGeoMatrix* newpos = 0, TGeoMedium* newmed = 0)
 Replace an existing daughter with a new volume having the same name but
 possibly a new shape, position or medium. Not allowed for positioned assemblies.
 For division cells, the new shape/matrix are ignored.
void SelectVolume(Bool_t clear = kFALSE)
 Select this volume as matching an arbitrary criteria. The volume is added to
 a static list and the flag TGeoVolume::kVolumeSelected is set. All flags need
 to be reset at the end by calling the method with CLEAR=true. This will also clear
 the list.
void SetVisibility(Bool_t vis = kTRUE)
 set visibility of this volume
void SetVisContainers(Bool_t flag = kTRUE)
 Set visibility for containers.
void SetVisLeaves(Bool_t flag = kTRUE)
 Set visibility for leaves.
void SetVisOnly(Bool_t flag = kTRUE)
 Set visibility for leaves.
Bool_t Valid() const
 Check if the shape of this volume is valid.
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 = kTRUE)
 set visibility for daughters
void Voxelize(Option_t* option)
 build the voxels for this volume
Double_t Weight(Double_t precision = 0.01, Option_t* option = "va")
 Estimate the weight of a volume (in kg) with SIGMA(M)/M better than PRECISION.
 Option can contain : v - verbose, a - analytical  (default)
Double_t WeightA() const
 Analytical computation of the weight.
Int_t GetNdaughters() const
{if (!fNodes) return 0; return (fNodes->GetEntriesFast());}
void ClearNodes()
{fNodes = 0;}
Bool_t Contains(const Double_t* point) const
{return fShape->Contains(point);}
Bool_t IsRunTime() const
{return fShape->IsRunTimeShape();}
Bool_t IsVolumeMulti() const
{return kFALSE;}
Int_t GetRefCount() const
{return fRefCount;}
TGeoExtension * GetUserExtension() const
{return fUserExtension;}
TGeoExtension * GetFWExtension() const
{return fFWExtension;}
void Grab()
void Release()
{fRefCount--; if (fRefCount==0) delete this;}
Bool_t IsActive() const
{return TGeoAtt::IsActive();}
Bool_t IsActiveDaughters() const
Bool_t IsAdded() const
Bool_t IsOverlappingCandidate() const
Bool_t IsReplicated() const
Bool_t IsSelected() const
Bool_t IsCylVoxels() const
Bool_t IsXYZVoxels() const
Bool_t IsValid() const
{return fShape->IsValid();}
Bool_t IsVisible() const
{return TGeoAtt::IsVisible();}
Bool_t IsVisibleDaughters() const
{return TGeoAtt::IsVisDaughters();}
Bool_t IsVisContainers() const
Bool_t IsVisLeaves() const
{return TGeoAtt::IsVisLeaves();}
Bool_t IsVisOnly() const
{return TGeoAtt::IsVisOnly();}
Int_t GetCurrentNodeIndex() const
{return -1;}
Int_t GetNextNodeIndex() const
{return -1;}
TObjArray * GetNodes()
{return fNodes;}
Int_t GetNtotal() const
{return fNtotal;}
TGeoManager * GetGeoManager() const
{return fGeoManager;}
TGeoMaterial * GetMaterial() const
{return GetMedium()->GetMaterial();}
TGeoMedium * GetMedium() const
TObject * GetField() const
{return fField;}
TGeoPatternFinder * GetFinder() const
{return fFinder;}
const char * GetIconName() const
{return fShape->GetName();}
TGeoNode * GetNode(const char* name) const
Int_t GetNumber() const
{return fNumber;}
Option_t * GetOption() const
{ return fOption.Data(); }
Char_t GetTransparency() const
{return (fMedium==0)?0:(fMedium->GetMaterial()->GetTransparency());}
TGeoShape * GetShape() const
{return fShape;}
void Gsord(Int_t )
{;}
void InspectShape() const
void SetActivity(Bool_t flag = kTRUE)
void SetActiveDaughters(Bool_t flag = kTRUE)
void SetAdded()
void SetReplicated()
void SetCylVoxels(Bool_t flag = kTRUE)
void SetNodes(TObjArray* nodes)
void SetOverlappingCandidate(Bool_t flag)
void SetTransparency(Char_t transparency = 0)
{if (fMedium) fMedium->GetMaterial()->SetTransparency(transparency);}
void SetField(TObject* field)
{fField = field;}
void SetAttVisibility(Bool_t vis)
void SetInvisible()
void SetMedium(TGeoMedium* medium)
{fMedium = medium;}
void SetVoxelFinder(TGeoVoxelFinder* finder)
{fVoxels = finder;}
void SetFinder(TGeoPatternFinder* finder)
{fFinder = finder;}
void SetNumber(Int_t number)
{fNumber = number;}
void SetNtotal(Int_t ntotal)
{fNtotal = ntotal;}