File indexing completed on 2026-09-22 09:07:43
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TGeoVoxelFinder
0013 #define ROOT_TGeoVoxelFinder
0014
0015 #include "TObject.h"
0016
0017 class TGeoVolume;
0018 struct TGeoStateInfo;
0019
0020 class TGeoVoxelFinder : public TObject {
0021 public:
0022 enum EVoxelsType {
0023 kGeoInvalidVoxels = BIT(15),
0024 kGeoRebuildVoxels = BIT(16)
0025 };
0026
0027 private:
0028 TGeoVoxelFinder(const TGeoVoxelFinder &) = delete;
0029 TGeoVoxelFinder &operator=(const TGeoVoxelFinder &) = delete;
0030
0031 protected:
0032 TGeoVolume *fVolume;
0033
0034 Int_t fIbx;
0035 Int_t fIby;
0036 Int_t fIbz;
0037 Int_t fNboxes;
0038 Int_t fNox;
0039 Int_t fNoy;
0040 Int_t fNoz;
0041 Int_t fNex;
0042 Int_t fNey;
0043 Int_t fNez;
0044 Int_t fNx;
0045 Int_t fNy;
0046 Int_t fNz;
0047 Int_t fPriority[3];
0048 Double_t *fBoxes;
0049 Double_t *fXb;
0050 Double_t *fYb;
0051 Double_t *fZb;
0052 Int_t *fOBx;
0053 Int_t *fOBy;
0054 Int_t *fOBz;
0055 Int_t *fOEx;
0056 Int_t *fOEy;
0057 Int_t *fOEz;
0058 Int_t *fExtraX;
0059 Int_t *fExtraY;
0060 Int_t *fExtraZ;
0061 Int_t *fNsliceX;
0062 Int_t *fNsliceY;
0063 Int_t *fNsliceZ;
0064 UChar_t *fIndcX;
0065 UChar_t *fIndcY;
0066 UChar_t *fIndcZ;
0067
0068 void BuildVoxelLimits();
0069 Int_t *GetExtraX(Int_t islice, Bool_t left, Int_t &nextra) const;
0070 Int_t *GetExtraY(Int_t islice, Bool_t left, Int_t &nextra) const;
0071 Int_t *GetExtraZ(Int_t islice, Bool_t left, Int_t &nextra) const;
0072 Bool_t GetIndices(const Double_t *point, TGeoStateInfo &td);
0073 Int_t GetPriority(Int_t iaxis) const { return fPriority[iaxis]; }
0074 Int_t GetNcandidates(TGeoStateInfo &td) const;
0075 Int_t *GetValidExtra(Int_t *list, Int_t &ncheck, TGeoStateInfo &td);
0076 Int_t *GetValidExtra(Int_t n1, UChar_t *array1, Int_t *list, Int_t &ncheck, TGeoStateInfo &td);
0077 Int_t *
0078 GetValidExtra(Int_t n1, UChar_t *array1, Int_t n2, UChar_t *array2, Int_t *list, Int_t &ncheck, TGeoStateInfo &td);
0079 Int_t *GetVoxelCandidates(Int_t i, Int_t j, Int_t k, Int_t &ncheck, TGeoStateInfo &td);
0080 Bool_t Intersect(Int_t n1, UChar_t *array1, Int_t &nf, Int_t *result);
0081 Bool_t Intersect(Int_t n1, UChar_t *array1, Int_t n2, UChar_t *array2, Int_t &nf, Int_t *result);
0082 Bool_t
0083 Intersect(Int_t n1, UChar_t *array1, Int_t n2, UChar_t *array2, Int_t n3, UChar_t *array3, Int_t &nf, Int_t *result);
0084 Bool_t IntersectAndStore(Int_t n1, UChar_t *array1, TGeoStateInfo &td);
0085 Bool_t IntersectAndStore(Int_t n1, UChar_t *array1, Int_t n2, UChar_t *array2, TGeoStateInfo &td);
0086 Bool_t IntersectAndStore(Int_t n1, UChar_t *array1, Int_t n2, UChar_t *array2, Int_t n3, UChar_t *array3,
0087 TGeoStateInfo &td);
0088 void SortAll(Option_t *option = "");
0089 Bool_t Union(Int_t n1, UChar_t *array1, TGeoStateInfo &td);
0090 Bool_t Union(Int_t n1, UChar_t *array1, Int_t n2, UChar_t *array2, TGeoStateInfo &td);
0091 Bool_t Union(Int_t n1, UChar_t *array1, Int_t n2, UChar_t *array2, Int_t n3, UChar_t *array3, TGeoStateInfo &td);
0092
0093 public:
0094 TGeoVoxelFinder();
0095 TGeoVoxelFinder(TGeoVolume *vol);
0096 ~TGeoVoxelFinder() override;
0097 void DaughterToMother(Int_t id, const Double_t *local, Double_t *master) const;
0098 virtual Double_t Efficiency();
0099 virtual Int_t *GetCheckList(const Double_t *point, Int_t &nelem, TGeoStateInfo &td);
0100 Int_t *GetCheckList(Int_t &nelem, TGeoStateInfo &td) const;
0101 virtual Int_t *GetNextCandidates(const Double_t *point, Int_t &ncheck, TGeoStateInfo &td);
0102 virtual void FindOverlaps(Int_t inode) const;
0103 Bool_t IsInvalid() const { return TObject::TestBit(kGeoInvalidVoxels); }
0104 Bool_t NeedRebuild() const { return TObject::TestBit(kGeoRebuildVoxels); }
0105 Double_t *GetBoxes() const { return fBoxes; }
0106 Bool_t IsSafeVoxel(const Double_t *point, Int_t inode, Double_t minsafe) const;
0107 Bool_t MayOverlap(UInt_t i, UInt_t j) const;
0108 void Print(Option_t *option = "") const override;
0109 void PrintVoxelLimits(const Double_t *point) const;
0110 void SetInvalid(Bool_t flag = kTRUE) { TObject::SetBit(kGeoInvalidVoxels, flag); }
0111 void SetNeedRebuild(Bool_t flag = kTRUE) { TObject::SetBit(kGeoRebuildVoxels, flag); }
0112 virtual Int_t *GetNextVoxel(const Double_t *point, const Double_t *dir, Int_t &ncheck, TGeoStateInfo &td);
0113 virtual void SortCrossedVoxels(const Double_t *point, const Double_t *dir, TGeoStateInfo &td);
0114 virtual void Voxelize(Option_t *option = "");
0115
0116 ClassDefOverride(TGeoVoxelFinder, 4)
0117 };
0118
0119 #endif