File indexing completed on 2025-10-31 09:17:00
0001 
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 
0010 
0011 
0012 #ifndef ROOT_TGeoPhysicalNode
0013 #define ROOT_TGeoPhysicalNode
0014 
0015 #include "TNamed.h"
0016 
0017 #include "TAttLine.h"
0018 
0019 
0020 class TGeoHMatrix;
0021 class TGeoMatrix;
0022 class TGeoVolume;
0023 class TGeoNode;
0024 class TGeoShape;
0025 class TGeoNavigator;
0026 class TObjArray;
0027 
0028 
0029 class TGeoPhysicalNode : public TNamed, public TAttLine {
0030 protected:
0031    Int_t fLevel;             
0032    TObjArray *fMatrices;     
0033    TObjArray *fNodes;        
0034    TGeoHMatrix *fMatrixOrig; 
0035 
0036    TGeoPhysicalNode(const TGeoPhysicalNode &) = delete;
0037    TGeoPhysicalNode &operator=(const TGeoPhysicalNode &) = delete;
0038 
0039    void SetAligned(Bool_t flag = kTRUE) { TObject::SetBit(kGeoPNodeAligned, flag); }
0040    Bool_t SetPath(const char *path);
0041    void SetBranchAsState();
0042 
0043 public:
0044    enum {
0045       kGeoPNodeFull = BIT(10),    
0046       kGeoPNodeVisible = BIT(11), 
0047       kGeoPNodeVolAtt = BIT(12),  
0048       kGeoPNodeAligned = BIT(13)  
0049    };
0050 
0051    
0052    TGeoPhysicalNode();
0053    TGeoPhysicalNode(const char *path);
0054    
0055    ~TGeoPhysicalNode() override;
0056 
0057    Bool_t
0058    Align(TGeoMatrix *newmat = nullptr, TGeoShape *newshape = nullptr, Bool_t check = kFALSE, Double_t ovlp = 0.001);
0059    void cd() const;
0060    void Draw(Option_t *option = "") override;
0061    Int_t GetLevel() const { return fLevel; }
0062    TGeoHMatrix *GetMatrix(Int_t level = -1) const;
0063    TGeoHMatrix *GetOriginalMatrix() const { return fMatrixOrig; }
0064    TGeoNode *GetMother(Int_t levup = 1) const;
0065    TGeoNode *GetNode(Int_t level = -1) const;
0066    TGeoShape *GetShape(Int_t level = -1) const;
0067    TGeoVolume *GetVolume(Int_t level = -1) const;
0068 
0069    Bool_t IsAligned() const { return TObject::TestBit(kGeoPNodeAligned); }
0070    Bool_t IsMatchingState(TGeoNavigator *nav) const;
0071    Bool_t IsVolAttributes() const { return TObject::TestBit(kGeoPNodeVolAtt); }
0072    Bool_t IsVisible() const { return TObject::TestBit(kGeoPNodeVisible); }
0073    Bool_t IsVisibleFull() const { return TObject::TestBit(kGeoPNodeFull); }
0074 
0075    void Print(Option_t *option = "") const override;
0076    void Refresh();
0077 
0078    void SetMatrixOrig(const TGeoMatrix *local);
0079    void SetIsVolAtt(Bool_t flag = kTRUE) { TObject::SetBit(kGeoPNodeVolAtt, flag); }
0080    void SetVisibility(Bool_t flag = kTRUE) { TObject::SetBit(kGeoPNodeVisible, flag); }
0081    void SetVisibleFull(Bool_t flag = kTRUE) { TObject::SetBit(kGeoPNodeFull, flag); }
0082    void Paint(Option_t *option = "") override;
0083 
0084    ClassDefOverride(TGeoPhysicalNode, 1) 
0085 };
0086 
0087 
0088 class TGeoPNEntry : public TNamed {
0089 private:
0090    enum EPNEntryFlags { kPNEntryOwnMatrix = BIT(14) };
0091    TGeoPhysicalNode *fNode;    
0092    const TGeoHMatrix *fMatrix; 
0093    TGeoHMatrix *fGlobalOrig;   
0094 
0095 protected:
0096    TGeoPNEntry(const TGeoPNEntry &pne) : TNamed(pne), fNode(pne.fNode), fMatrix(nullptr), fGlobalOrig(nullptr) {}
0097    TGeoPNEntry &operator=(const TGeoPNEntry &pne)
0098    {
0099       if (this != &pne) {
0100          TNamed::operator=(pne);
0101          fNode = pne.fNode;
0102          fMatrix = pne.fMatrix;
0103       }
0104       return *this;
0105    }
0106 
0107 public:
0108    TGeoPNEntry();
0109    TGeoPNEntry(const char *unique_name, const char *path);
0110    ~TGeoPNEntry() override;
0111 
0112    inline const char *GetPath() const { return GetTitle(); }
0113    const TGeoHMatrix *GetMatrix() const { return fMatrix; }
0114    TGeoHMatrix *GetMatrixOrig() const
0115    {
0116       if (fNode)
0117          return fNode->GetOriginalMatrix();
0118       else
0119          return nullptr;
0120    };
0121    TGeoHMatrix *GetGlobalOrig() const { return fGlobalOrig; }
0122    TGeoPhysicalNode *GetPhysicalNode() const { return fNode; }
0123    void SetMatrix(const TGeoHMatrix *matrix);
0124    void SetPhysicalNode(TGeoPhysicalNode *node);
0125 
0126    ClassDefOverride(TGeoPNEntry, 4) 
0127 };
0128 
0129 #endif