File indexing completed on 2025-01-18 10:11:54
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
0030
0031
0032
0033
0034
0035 class TGeoPhysicalNode : public TNamed, public TAttLine {
0036 protected:
0037 Int_t fLevel;
0038 TObjArray *fMatrices;
0039 TObjArray *fNodes;
0040 TGeoHMatrix *fMatrixOrig;
0041
0042 TGeoPhysicalNode(const TGeoPhysicalNode &) = delete;
0043 TGeoPhysicalNode &operator=(const TGeoPhysicalNode &) = delete;
0044
0045 void SetAligned(Bool_t flag = kTRUE) { TObject::SetBit(kGeoPNodeAligned, flag); }
0046 Bool_t SetPath(const char *path);
0047 void SetBranchAsState();
0048
0049 public:
0050 enum {
0051 kGeoPNodeFull = BIT(10),
0052 kGeoPNodeVisible = BIT(11),
0053 kGeoPNodeVolAtt = BIT(12),
0054 kGeoPNodeAligned = BIT(13)
0055 };
0056
0057
0058 TGeoPhysicalNode();
0059 TGeoPhysicalNode(const char *path);
0060
0061 ~TGeoPhysicalNode() override;
0062
0063 Bool_t
0064 Align(TGeoMatrix *newmat = nullptr, TGeoShape *newshape = nullptr, Bool_t check = kFALSE, Double_t ovlp = 0.001);
0065 void cd() const;
0066 void Draw(Option_t *option = "") override;
0067 Int_t GetLevel() const { return fLevel; }
0068 TGeoHMatrix *GetMatrix(Int_t level = -1) const;
0069 TGeoHMatrix *GetOriginalMatrix() const { return fMatrixOrig; }
0070 TGeoNode *GetMother(Int_t levup = 1) const;
0071 TGeoNode *GetNode(Int_t level = -1) const;
0072 TGeoShape *GetShape(Int_t level = -1) const;
0073 TGeoVolume *GetVolume(Int_t level = -1) const;
0074
0075 Bool_t IsAligned() const { return TObject::TestBit(kGeoPNodeAligned); }
0076 Bool_t IsMatchingState(TGeoNavigator *nav) const;
0077 Bool_t IsVolAttributes() const { return TObject::TestBit(kGeoPNodeVolAtt); }
0078 Bool_t IsVisible() const { return TObject::TestBit(kGeoPNodeVisible); }
0079 Bool_t IsVisibleFull() const { return TObject::TestBit(kGeoPNodeFull); }
0080
0081 void Print(Option_t *option = "") const override;
0082 void Refresh();
0083
0084 void SetMatrixOrig(const TGeoMatrix *local);
0085 void SetIsVolAtt(Bool_t flag = kTRUE) { TObject::SetBit(kGeoPNodeVolAtt, flag); }
0086 void SetVisibility(Bool_t flag = kTRUE) { TObject::SetBit(kGeoPNodeVisible, flag); }
0087 void SetVisibleFull(Bool_t flag = kTRUE) { TObject::SetBit(kGeoPNodeFull, flag); }
0088 void Paint(Option_t *option = "") override;
0089
0090 ClassDefOverride(TGeoPhysicalNode, 1)
0091 };
0092
0093
0094
0095
0096
0097
0098
0099
0100 class TGeoPNEntry : public TNamed {
0101 private:
0102 enum EPNEntryFlags { kPNEntryOwnMatrix = BIT(14) };
0103 TGeoPhysicalNode *fNode;
0104 const TGeoHMatrix *fMatrix;
0105 TGeoHMatrix *fGlobalOrig;
0106
0107 protected:
0108 TGeoPNEntry(const TGeoPNEntry &pne) : TNamed(pne), fNode(pne.fNode), fMatrix(nullptr), fGlobalOrig(nullptr) {}
0109 TGeoPNEntry &operator=(const TGeoPNEntry &pne)
0110 {
0111 if (this != &pne) {
0112 TNamed::operator=(pne);
0113 fNode = pne.fNode;
0114 fMatrix = pne.fMatrix;
0115 }
0116 return *this;
0117 }
0118
0119 public:
0120 TGeoPNEntry();
0121 TGeoPNEntry(const char *unique_name, const char *path);
0122 ~TGeoPNEntry() override;
0123
0124 inline const char *GetPath() const { return GetTitle(); }
0125 const TGeoHMatrix *GetMatrix() const { return fMatrix; }
0126 TGeoHMatrix *GetMatrixOrig() const
0127 {
0128 if (fNode)
0129 return fNode->GetOriginalMatrix();
0130 else
0131 return nullptr;
0132 };
0133 TGeoHMatrix *GetGlobalOrig() const { return fGlobalOrig; }
0134 TGeoPhysicalNode *GetPhysicalNode() const { return fNode; }
0135 void SetMatrix(const TGeoHMatrix *matrix);
0136 void SetPhysicalNode(TGeoPhysicalNode *node);
0137
0138 ClassDefOverride(TGeoPNEntry, 4)
0139 };
0140
0141 #endif