ROOT » GRAF3D » G3D » TGeometry

class TGeometry: public TNamed

                    T G E O M E T R Y  description


    The Geometry class describes the geometry of a detector.
    The current implementation supports the GEANT3 style description.
    A special program provided in the ROOT utilities (toroot) can be used
    to automatically translate a GEANT detector geometry into a ROOT geometry.

   a Geometry object is entered into the list of geometries into the
     ROOT main object (see TROOT description) when the TGeometry
     constructor is invoked.
   Several geometries may coexist in memory.

   A Geometry object consist of the following linked lists:
        - the TMaterial list (material definition only).
        - the TRotmatrix list (Rotation matrices definition only).
        - the TShape list (volume definition only).
        - the TNode list assembling all detector elements.

   Only the Build and Draw functions for a geometry are currently supported.


  The conversion program from Geant to Root has been added in the list
  of utilities in utils directory.(see g2root)
  The executable module of g2root can be found in $ROOTSYS/bin/g2root.

  To use this conversion program, type the shell command:
        g2root  geant_rzfile macro_name

  for example
        g2root na49.geom na49.C
  will convert the GEANT RZ file na49.geom into a ROOT macro na49.C

  To generate the Geometry structure within Root, do:
    Root > .x na49.C
    Root > na49.Draw()
    Root > wh.x3d()    (this invokes the 3-d Root viewver)
    Root > TFile gna49("na49.root","NEW")  //open a new root file
    Root > na49.Write()                    //Write the na49 geometry structure
    Root > gna49.Write()                   //Write all keys (in this case only one)
  Note: all keys are also written on closing of the file, gna49.Close or
  when the program exits, Root closes all open files correctly.
  Once this file has been written, in a subsequent session, simply do:
    Root > TFile gna49("na49.root")
    Root > na49.Draw()

  The figure below shows the geometry above using the x3d viewer.
  This x3d viewver is invoked by selecting "View x3d" in the View menu
  of a canvas (See example of this tool bar in TCanvas).

/* */

Function Members (Methods)

public:
virtual~TGeometry()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidBrowse(TBrowser* b)
virtual voidcd(const char* path = 0)
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 voidTNamed::Copy(TObject& named) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidDraw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
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 voidTObject::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*FindObject(const char* name) const
virtual TObject*FindObject(const TObject* obj) const
Int_tGeomLevel() const
static TObjArray*Get(const char* name)
Float_tGetBomb() const
TRotMatrix*GetCurrentMatrix() const
TNode*GetCurrentNode() const
TRotMatrix*GetCurrentPosition(Double_t* x, Double_t* y, Double_t* z) const
TRotMatrix*GetCurrentPosition(Float_t* x, Float_t* y, Float_t* z) const
Bool_tGetCurrentReflection() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
THashList*GetListOfMaterials() const
THashList*GetListOfMatrices() const
TList*GetListOfNodes() const
THashList*GetListOfShapes() const
TMaterial*GetMaterial(const char* name) const
TMaterial*GetMaterialByNumber(Int_t number) const
virtual const char*TNamed::GetName() const
TNode*GetNode(const char* name) const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
TRotMatrix*GetRotMatrix(const char* name) const
TRotMatrix*GetRotMatrixByNumber(Int_t number) const
TShape*GetShape(const char* name) const
TShape*GetShapeByNumber(Int_t number) const
virtual const char*TNamed::GetTitle() const
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
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tIsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidLocal2Master(Double_t* local, Double_t* master)
virtual voidLocal2Master(Float_t* local, Float_t* master)
virtual voidls(Option_t* option = "rsn2") const
virtual voidMaster2Local(Double_t* master, Double_t* local)
virtual voidMaster2Local(Float_t* master, Float_t* local)
voidTObject::MayNotUse(const char* method) const
virtual voidNode(const char* name, const char* title, const char* shapename, Double_t x = 0, Double_t y = 0, Double_t z = 0, const char* matrixname = "", Option_t* option = "")
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
voidTObject::operator delete(void* ptr)
voidTObject::operator delete(void* ptr, void* vp)
voidTObject::operator delete[](void* ptr)
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)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual Int_tPopLevel()
virtual voidTNamed::Print(Option_t* option = "") const
virtual Int_tPushLevel()
virtual Int_tTObject::Read(const char* name)
virtual voidRecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidSetBomb(Float_t bomb = 1.3999999999999999)
virtual voidSetCurrentNode(TNode* node)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidSetGeomLevel(Int_t level = 0)
virtual voidSetMatrix(TRotMatrix* matrix = 0)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetPosition(Double_t x, Double_t y, Double_t z)
virtual voidSetPosition(Float_t x, Float_t y, Float_t z)
virtual voidSetPosition(TRotMatrix* matrix, Double_t x = 0, Double_t y = 0, Double_t z = 0)
virtual voidSetPosition(TRotMatrix* matrix, Float_t x, Float_t y, Float_t z)
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp) const
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_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
TGeometry()
TGeometry(const char* name, const char* title)
virtual voidUpdateMatrix(TNode* node)
virtual voidUpdateTempMatrix(Double_t x = 0, Double_t y = 0, Double_t z = 0, TRotMatrix* matrix = 0)
virtual voidUpdateTempMatrix(Double_t x, Double_t y, Double_t z, Double_t* matrix, Bool_t isReflection = kFALSE)
static voidUpdateTempMatrix(Double_t* dx1, Double_t* rmat1, Double_t x, Double_t y, Double_t z, Double_t* matrix, Double_t* dxnew, Double_t* rmatnew)
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
voidTObject::MakeZombie()
TGeometry&operator=(const TGeometry&)
TGeometry(const TGeometry&)

Data Members

public:
static TObject::<anonymous>TObject::kBitMask
static TObject::EStatusBitsTObject::kCanDelete
static TObject::EStatusBitsTObject::kCannotPick
static TObject::EStatusBitsTObject::kHasUUID
static TObject::EStatusBitsTObject::kInvalidObject
static TObject::<anonymous>TObject::kIsOnHeap
static TObject::EStatusBitsTObject::kIsReferenced
static TObject::EStatusBitsTObject::kMustCleanup
static TObject::EStatusBitsTObject::kNoContextMenu
static TObject::<anonymous>TObject::kNotDeleted
static TObject::EStatusBitsTObject::kObjInCanvas
static TObject::<anonymous>TObject::kOverwrite
static TObject::<anonymous>TObject::kSingleKey
static TObject::<anonymous>TObject::kWriteDelete
static TObject::<anonymous>TObject::kZombie
protected:
TStringTNamed::fNameobject identifier
TStringTNamed::fTitleobject title
private:
Float_tfBombBomb factor for exploded geometry
TNode*fCurrentNode!Pointer to current node
Int_tfGeomLevel!
Bool_tfIsReflection[20]!
TMaterial**fMaterialPointer!Pointers to materials
THashList*fMaterials->Collection of materials
THashList*fMatrices->Collection of rotation matrices
TRotMatrix*fMatrix!Pointers to current rotation matrices
TRotMatrix**fMatrixPointer!Pointers to rotation matrices
TList*fNodes->Collection of nodes
Double_tfRotMatrix[20][9]!
TShape**fShapePointer!Pointers to shapes
THashList*fShapes->Collection of shapes
Double_tfTranslation[20][3]!
Double_tfX!
Double_tfY! The global translation of the current node
Double_tfZ!

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TGeometry()
 Geometry default constructor.
TGeometry(const char* name, const char* title)
 Geometry normal constructor.
TGeometry(const TGeometry& )
copy constructor
TGeometry& operator=(const TGeometry& )
assignement operator
~TGeometry()
 Geometry default destructor.
void Browse(TBrowser* b)
void cd(const char* path = 0)
 Change Current Geometry to this.
void Draw(Option_t* option = "")
 Draw this Geometry.
TObject * FindObject(const TObject* obj) const
 Find object in a geometry node, material, etc
TObject * FindObject(const char* name) const
 Search object identified by name in the geometry tree
TObjArray * Get(const char* name)
 Static function called by TROOT to search name in the geometry.
 Returns a TObjArray containing a pointer to the found object
 and a pointer to the container where the object was found.
TMaterial * GetMaterial(const char* name) const
 Return pointer to Material with name.
TMaterial * GetMaterialByNumber(Int_t number) const
 Return pointer to Material with number.
TNode * GetNode(const char* name) const
 Return pointer to node with name in the geometry tree.
TRotMatrix * GetRotMatrix(const char* name) const
 Return pointer to RotMatrix with name.
TRotMatrix * GetRotMatrixByNumber(Int_t number) const
 Return pointer to RotMatrix with number.
TShape * GetShape(const char* name) const
 Return pointer to Shape with name.
TShape * GetShapeByNumber(Int_t number) const
 Return pointer to Shape with number.
void Local2Master(Double_t* local, Double_t* master)
 Convert one point from local system to master reference system.

  Note that before invoking this function, the global rotation matrix
  and translation vector for this node must have been computed.
  This is automatically done by the Paint functions.
  Otherwise TNode::UpdateMatrix should be called before.
void Local2Master(Float_t* local, Float_t* master)
 Convert one point from local system to master reference system.

  Note that before invoking this function, the global rotation matrix
  and translation vector for this node must have been computed.
  This is automatically done by the Paint functions.
  Otherwise TNode::UpdateMatrix should be called before.
void ls(Option_t* option = "rsn2") const
 List this geometry.
void Master2Local(Double_t* master, Double_t* local)
 Convert one point from master system to local reference system.

  Note that before invoking this function, the global rotation matrix
  and translation vector for this node must have been computed.
  This is automatically done by the Paint functions.
  Otherwise TNode::UpdateMatrix should be called before.
void Master2Local(Float_t* master, Float_t* local)
 Convert one point from master system to local reference system.

  Note that before invoking this function, the global rotation matrix
  and translation vector for this node must have been computed.
  This is automatically done by the Paint functions.
  Otherwise TNode::UpdateMatrix should be called before.
void Node(const char* name, const char* title, const char* shapename, Double_t x = 0, Double_t y = 0, Double_t z = 0, const char* matrixname = "", Option_t* option = "")
 Add a node to the current node in this geometry.
void RecursiveRemove(TObject* obj)
 Recursively remove object from a Geometry list.
void Streamer(TBuffer& )
 Stream a class object.
void UpdateMatrix(TNode* node)
 Update global rotation matrix/translation vector for this node
 this function must be called before invoking Local2Master
void UpdateTempMatrix(Double_t x = 0, Double_t y = 0, Double_t z = 0, TRotMatrix* matrix = 0)
 Update temp matrix.
void UpdateTempMatrix(Double_t x, Double_t y, Double_t z, Double_t* matrix, Bool_t isReflection = kFALSE)
 Update temp matrix.
void UpdateTempMatrix(Double_t* dx1, Double_t* rmat1, Double_t x, Double_t y, Double_t z, Double_t* matrix, Double_t* dxnew, Double_t* rmatnew)
 Compute new translation vector and global matrix.

  dx      old translation vector
  rmat    old global matrix
  x,y,z   offset of new local system with respect to mother
  dxnew   new translation vector
  rmatnew new global rotation matrix
TRotMatrix * GetCurrentMatrix() const
TRotMatrix * GetCurrentPosition(Double_t* x, Double_t* y, Double_t* z) const
TRotMatrix * GetCurrentPosition(Float_t* x, Float_t* y, Float_t* z) const
Bool_t GetCurrentReflection() const
void SetPosition(Double_t x, Double_t y, Double_t z)
void SetPosition(Float_t x, Float_t y, Float_t z)
void SetPosition(TRotMatrix* matrix, Double_t x = 0, Double_t y = 0, Double_t z = 0)
void SetPosition(TRotMatrix* matrix, Float_t x, Float_t y, Float_t z)
Float_t GetBomb() const
{return fBomb;}
Int_t GeomLevel() const
{return fGeomLevel;}
THashList * GetListOfShapes() const
{return fShapes;}
TList * GetListOfNodes() const
{return fNodes;}
THashList * GetListOfMaterials() const
{return fMaterials;}
THashList * GetListOfMatrices() const
{return fMatrices;}
TNode * GetCurrentNode() const
{return fCurrentNode;}
Bool_t IsFolder() const
{return kTRUE;}
Int_t PushLevel()
{return fGeomLevel++;}
Int_t PopLevel()
{return fGeomLevel>0?fGeomLevel--:0;}
void SetBomb(Float_t bomb = 1.3999999999999999)
{fBomb = bomb;}
void SetCurrentNode(TNode* node)
{fCurrentNode = node;}
void SetGeomLevel(Int_t level = 0)
{fGeomLevel=level;}
void SetMatrix(TRotMatrix* matrix = 0)
{fMatrix = matrix;}