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