Warning, file /include/root/TGeoBranchArray.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TGeoBranchArray
0013 #define ROOT_TGeoBranchArray
0014
0015 #include "TObject.h"
0016
0017 #include "TGeoMatrix.h"
0018
0019 class TGeoNavigator;
0020 class TGeoNode;
0021
0022 class TGeoBranchArray : public TObject {
0023 protected:
0024 Int_t fLevel;
0025 Int_t fMaxLevel;
0026 TGeoHMatrix fMatrix;
0027 TGeoNode **fArray;
0028 TGeoNode *fRealArray[1];
0029
0030 private:
0031 TGeoBranchArray(Int_t level);
0032 TGeoBranchArray(const TGeoBranchArray &);
0033 public:
0034 enum EGeoBATypes {
0035 kBASelfAlloc = BIT(14)
0036 };
0037
0038
0039 TGeoBranchArray(TRootIOCtor *) : TObject(), fLevel(0), fMaxLevel(0), fMatrix(), fArray(nullptr)
0040 {
0041 fRealArray[0] = nullptr;
0042 }
0043
0044
0045 static TGeoBranchArray *MakeInstance(size_t maxlevel);
0046
0047
0048 static TGeoBranchArray *MakeInstanceAt(size_t maxlevel, void *addr);
0049
0050
0051 static TGeoBranchArray *MakeCopy(const TGeoBranchArray &other);
0052
0053
0054 static TGeoBranchArray *MakeCopyAt(const TGeoBranchArray &other, void *addr);
0055
0056
0057 static void ReleaseInstance(TGeoBranchArray *obj);
0058
0059
0060 TGeoBranchArray &operator=(const TGeoBranchArray &);
0061
0062
0063 void CopyTo(TGeoBranchArray *dest);
0064
0065
0066 static size_t SizeOf(size_t maxlevel) { return (sizeof(TGeoBranchArray) + sizeof(TGeoBranchArray *) * (maxlevel)); }
0067
0068
0069 static size_t SizeOfInstance(size_t maxlevel)
0070 {
0071 return (sizeof(TGeoBranchArray) + sizeof(TGeoBranchArray *) * (maxlevel));
0072 }
0073
0074 inline size_t SizeOf() const { return (sizeof(TGeoBranchArray) + sizeof(TGeoBranchArray *) * (fMaxLevel)); }
0075
0076
0077
0078 void *DataStart() const { return (void *)&fLevel; }
0079
0080
0081 size_t DataSize() const { return SizeOf() - size_t(&fLevel) + (size_t)this; }
0082
0083
0084
0085 void UpdateArray(size_t nobj);
0086
0087
0088 ~TGeoBranchArray() override {}
0089
0090 Bool_t operator==(const TGeoBranchArray &other) const;
0091 Bool_t operator!=(const TGeoBranchArray &other) const;
0092 Bool_t operator>(const TGeoBranchArray &other) const;
0093 Bool_t operator<(const TGeoBranchArray &other) const;
0094 Bool_t operator>=(const TGeoBranchArray &other) const;
0095 Bool_t operator<=(const TGeoBranchArray &other) const;
0096
0097 void AddLevel(Int_t dindex);
0098 static Long64_t BinarySearch(Long64_t n, const TGeoBranchArray **array, TGeoBranchArray *value);
0099 Int_t Compare(const TObject *obj) const override;
0100 void CleanMatrix();
0101 TGeoNode **GetArray() const { return fArray; }
0102 size_t GetLevel() const { return fLevel; }
0103 size_t GetMaxLevel() const { return fMaxLevel; }
0104 const TGeoHMatrix *GetMatrix() const { return &fMatrix; }
0105 TGeoNode *GetNode(Int_t level) const { return fArray[level]; }
0106 TGeoNode *GetCurrentNode() const { return fArray[fLevel]; }
0107 void GetPath(TString &path) const;
0108 void Init(TGeoNode **branch, TGeoMatrix *global, Int_t level);
0109 void InitFromNavigator(TGeoNavigator *nav);
0110 Bool_t IsSortable() const override { return kTRUE; }
0111 Bool_t IsOutside() const { return (fLevel < 0) ? kTRUE : kFALSE; }
0112 void Print(Option_t *option = "") const override;
0113 static void Sort(Int_t n, TGeoBranchArray **array, Int_t *index, Bool_t down = kTRUE);
0114 void UpdateNavigator(TGeoNavigator *nav) const;
0115
0116 ClassDefOverride(TGeoBranchArray, 4)
0117 };
0118
0119 struct compareBAasc {
0120 compareBAasc(TGeoBranchArray **d) : fData(d) {}
0121 bool operator()(Int_t i1, Int_t i2) { return **(fData + i1) < **(fData + i2); }
0122 TGeoBranchArray **fData;
0123 };
0124
0125 struct compareBAdesc {
0126 compareBAdesc(TGeoBranchArray **d) : fData(d) {}
0127 bool operator()(Int_t i1, Int_t i2) { return **(fData + i1) > **(fData + i2); }
0128 TGeoBranchArray **fData;
0129 };
0130
0131 #endif