TGeoPhysicalNode.h

Go to the documentation of this file.
00001 // @(#)root/geom:$Id: TGeoPhysicalNode.h 25123 2008-08-12 09:59:46Z brun $
00002 // Author: Andrei Gheata   17/02/04
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TGeoPhysicalNode
00013 #define ROOT_TGeoPhysicalNode
00014 
00015 #ifndef ROOT_TNamed
00016 #include "TNamed.h"
00017 #endif
00018 
00019 #ifndef ROOT_TObjArray
00020 #include "TObjArray.h"
00021 #endif
00022 
00023 #ifndef ROOT_TAttLine
00024 #include "TAttLine.h"
00025 #endif
00026 
00027 // forward declarations
00028 class TGeoHMatrix;
00029 class TGeoMatrix;
00030 class TGeoVolume;
00031 class TGeoNode;
00032 class TGeoShape;
00033 
00034 //////////////////////////////////////////////////////////////////////////////
00035 //                                                                          //
00036 // TGeoPhysicalNode - class representing an unique object associated with a //
00037 //   path.                                                                  //
00038 //                                                                          //
00039 //////////////////////////////////////////////////////////////////////////////
00040 
00041 class TGeoPhysicalNode : public TNamed,
00042                          public TAttLine
00043 {
00044 protected:
00045    Int_t             fLevel;          // depth in the geometry tree
00046    TObjArray        *fMatrices;       // global transformation matrices
00047    TObjArray        *fNodes;          // branch of nodes
00048    TGeoHMatrix      *fMatrixOrig;     // original local matrix of the last node in the path
00049 
00050    TGeoPhysicalNode(const TGeoPhysicalNode&); 
00051    TGeoPhysicalNode& operator=(const TGeoPhysicalNode&);
00052 
00053    void              SetAligned(Bool_t flag=kTRUE) {TObject::SetBit(kGeoPNodeAligned,flag);}
00054    Bool_t            SetPath(const char *path);
00055    void              SetBranchAsState();
00056 
00057 public:
00058    enum {
00059       kGeoPNodeFull    = BIT(10),     // full branch is visible (default only last node)
00060       kGeoPNodeVisible = BIT(11),     // this node is visible (default)
00061       kGeoPNodeVolAtt  = BIT(12),     // preserve volume attributes (default)
00062       kGeoPNodeAligned = BIT(13)      // alignment bit
00063    };
00064 
00065    // constructors
00066    TGeoPhysicalNode();
00067    TGeoPhysicalNode(const char *path);
00068    // destructor
00069    virtual ~TGeoPhysicalNode();
00070 
00071    void              Align(TGeoMatrix *newmat=0, TGeoShape *newshape=0, Bool_t check=kFALSE, Double_t ovlp=0.001);
00072    void              cd() const;
00073    void              Draw(Option_t *option="");
00074    Int_t             GetLevel() const {return fLevel;}
00075    TGeoHMatrix      *GetMatrix(Int_t level=-1) const;
00076    TGeoHMatrix      *GetOriginalMatrix() const {return fMatrixOrig;}
00077    TGeoNode         *GetMother(Int_t levup=1) const;
00078    TGeoNode         *GetNode(Int_t level=-1) const;
00079    TGeoShape        *GetShape(Int_t level=-1) const;
00080    TGeoVolume       *GetVolume(Int_t level=-1) const;
00081    
00082  
00083    Bool_t            IsAligned() const {return TObject::TestBit(kGeoPNodeAligned);}
00084    Bool_t            IsVolAttributes() const {return TObject::TestBit(kGeoPNodeVolAtt);}
00085    Bool_t            IsVisible() const {return TObject::TestBit(kGeoPNodeVisible);}
00086    Bool_t            IsVisibleFull() const {return TObject::TestBit(kGeoPNodeFull);}
00087 
00088    virtual void      Print(Option_t *option="") const;
00089    void              Refresh();
00090 
00091    void              SetMatrixOrig(const TGeoMatrix *local);
00092    void              SetIsVolAtt(Bool_t flag=kTRUE) {TObject::SetBit(kGeoPNodeVolAtt,flag);}
00093    void              SetVisibility(Bool_t flag=kTRUE)  {TObject::SetBit(kGeoPNodeVisible,flag);}
00094    void              SetVisibleFull(Bool_t flag=kTRUE) {TObject::SetBit(kGeoPNodeFull,flag);}
00095    virtual void      Paint(Option_t *option = "");
00096 
00097 
00098    ClassDef(TGeoPhysicalNode, 1)               // base class for physical nodes
00099 };
00100 
00101 ///////////////////////////////////////////////////////////////////////////////
00102 //                                                                           //
00103 // TGeoPNEntry - class representing phisical node entry having a unique name //
00104 //   associated to a path.                                                   //
00105 //                                                                           //
00106 ///////////////////////////////////////////////////////////////////////////////
00107 
00108 class TGeoPNEntry : public TNamed
00109 {
00110 private:
00111    enum EPNEntryFlags {
00112       kPNEntryOwnMatrix = BIT(14)
00113    };   
00114    TGeoPhysicalNode   *fNode;        // Physical node to which this applies
00115    const TGeoHMatrix  *fMatrix;      // Additional matrix
00116    TGeoHMatrix        *fGlobalOrig;  // Original global matrix for the linked physical node
00117 
00118 protected:
00119    TGeoPNEntry(const TGeoPNEntry& pne) 
00120      : TNamed(pne), fNode(pne.fNode), fMatrix(NULL), fGlobalOrig(NULL) { }
00121    TGeoPNEntry& operator=(const TGeoPNEntry& pne)
00122      {if(this!=&pne) {TNamed::operator=(pne); fNode=pne.fNode; fMatrix=pne.fMatrix;}
00123      return *this;}
00124 
00125 public:
00126    TGeoPNEntry();
00127    TGeoPNEntry(const char *unique_name, const char *path);
00128    virtual ~TGeoPNEntry();
00129    
00130    inline const char   *GetPath() const {return GetTitle();}
00131    const TGeoHMatrix   *GetMatrix() const {return fMatrix;}
00132    TGeoHMatrix      *GetMatrixOrig() const {if (fNode) return fNode->GetOriginalMatrix(); else return NULL;};
00133    TGeoHMatrix      *GetGlobalOrig() const {return fGlobalOrig;}
00134    TGeoPhysicalNode *GetPhysicalNode() const {return fNode;}
00135    void              SetMatrix(const TGeoHMatrix *matrix);
00136    void              SetPhysicalNode(TGeoPhysicalNode *node);
00137    
00138    ClassDef(TGeoPNEntry, 4)                  // a physical node entry with unique name
00139 };
00140 
00141 #endif
00142 

Generated on Tue Jul 5 14:12:19 2011 for ROOT_528-00b_version by  doxygen 1.5.1