00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TGeoVoxelFinder
00013 #define ROOT_TGeoVoxelFinder
00014
00015 #ifndef ROOT_TObject
00016 #include "TObject.h"
00017 #endif
00018
00019 class TGeoVolume;
00020
00021
00022
00023
00024
00025
00026 class TGeoVoxelFinder : public TObject
00027 {
00028 public:
00029 enum EVoxelsType {
00030 kGeoInvalidVoxels = BIT(15),
00031 kGeoRebuildVoxels = BIT(16)
00032 };
00033 protected:
00034 TGeoVolume *fVolume;
00035
00036 Int_t fNcandidates;
00037 Int_t fCurrentVoxel;
00038 Int_t fIbx;
00039 Int_t fIby;
00040 Int_t fIbz;
00041 Int_t fNboxes;
00042 Int_t fNox;
00043 Int_t fNoy;
00044 Int_t fNoz;
00045 Int_t fNex;
00046 Int_t fNey;
00047 Int_t fNez;
00048 Int_t fNx;
00049 Int_t fNy;
00050 Int_t fNz;
00051 Int_t fPriority[3];
00052 Int_t fSlices[3];
00053 Int_t fInc[3];
00054 Double_t fInvdir[3];
00055 Double_t fLimits[3];
00056 Double_t *fBoxes;
00057 Double_t *fXb;
00058 Double_t *fYb;
00059 Double_t *fZb;
00060 Int_t *fOBx;
00061 Int_t *fOBy;
00062 Int_t *fOBz;
00063 Int_t *fOEx;
00064 Int_t *fOEy;
00065 Int_t *fOEz;
00066 Int_t *fExtraX;
00067 Int_t *fExtraY;
00068 Int_t *fExtraZ;
00069 Int_t *fNsliceX;
00070 Int_t *fNsliceY;
00071 Int_t *fNsliceZ;
00072 UChar_t *fIndcX;
00073 UChar_t *fIndcY;
00074 UChar_t *fIndcZ;
00075 Int_t *fCheckList;
00076 UChar_t *fBits1;
00077
00078 TGeoVoxelFinder(const TGeoVoxelFinder&);
00079 TGeoVoxelFinder& operator=(const TGeoVoxelFinder&);
00080
00081 void BuildVoxelLimits();
00082 Int_t *GetExtraX(Int_t islice, Bool_t left, Int_t &nextra) const;
00083 Int_t *GetExtraY(Int_t islice, Bool_t left, Int_t &nextra) const;
00084 Int_t *GetExtraZ(Int_t islice, Bool_t left, Int_t &nextra) const;
00085 Bool_t GetIndices(Double_t *point);
00086 Int_t GetPriority(Int_t iaxis) const {return fPriority[iaxis];}
00087 Int_t GetNcandidates() const {return fNcandidates;}
00088 Int_t *GetValidExtra(Int_t *list, Int_t &ncheck);
00089 Int_t *GetValidExtra(Int_t n1, UChar_t *array1, Int_t *list, Int_t &ncheck);
00090 Int_t *GetValidExtra(Int_t n1, UChar_t *array1, Int_t n2, UChar_t *array2, Int_t *list, Int_t &ncheck);
00091 Int_t *GetVoxelCandidates(Int_t i, Int_t j, Int_t k, Int_t &ncheck);
00092
00093
00094 Bool_t Intersect(Int_t n1, UChar_t *array1, Int_t &nf, Int_t *result);
00095 Bool_t Intersect(Int_t n1, UChar_t *array1, Int_t n2, UChar_t *array2,
00096 Int_t &nf, Int_t *result);
00097 Bool_t Intersect(Int_t n1, UChar_t *array1, Int_t n2, UChar_t *array2,
00098 Int_t n3, UChar_t *array3, Int_t &nf, Int_t *result);
00099
00100
00101 Bool_t IntersectAndStore(Int_t n1, UChar_t *array1);
00102 Bool_t IntersectAndStore(Int_t n1, UChar_t *array1, Int_t n2, UChar_t *array2);
00103 Bool_t IntersectAndStore(Int_t n1, UChar_t *array1, Int_t n2, UChar_t *array2,
00104 Int_t n3, UChar_t *array3);
00105 void SortAll(Option_t *option="");
00106
00107
00108 Bool_t Union(Int_t n1, UChar_t *array1);
00109 Bool_t Union(Int_t n1, UChar_t *array1, Int_t n2, UChar_t *array2);
00110 Bool_t Union(Int_t n1, UChar_t *array1, Int_t n2, UChar_t *array2,
00111 Int_t n3, UChar_t *array3);
00112 public :
00113 TGeoVoxelFinder();
00114 TGeoVoxelFinder(TGeoVolume *vol);
00115 virtual ~TGeoVoxelFinder();
00116 virtual void CreateCheckList();
00117 void DaughterToMother(Int_t id, Double_t *local, Double_t *master) const;
00118 virtual Double_t Efficiency();
00119 virtual Int_t *GetCheckList(Double_t *point, Int_t &nelem);
00120 Int_t *GetCheckList(Int_t &nelem) const {nelem=fNcandidates; return fCheckList;}
00121
00122 virtual Int_t *GetNextCandidates(Double_t *point, Int_t &ncheck);
00123 virtual void FindOverlaps(Int_t inode) const;
00124 Bool_t IsInvalid() const {return TObject::TestBit(kGeoInvalidVoxels);}
00125 Bool_t NeedRebuild() const {return TObject::TestBit(kGeoRebuildVoxels);}
00126 Double_t *GetBoxes() const {return fBoxes;}
00127 Bool_t IsSafeVoxel(Double_t *point, Int_t inode, Double_t minsafe) const;
00128 virtual void Print(Option_t *option="") const;
00129 void PrintVoxelLimits(Double_t *point) const;
00130 void SetInvalid(Bool_t flag=kTRUE) {TObject::SetBit(kGeoInvalidVoxels, flag);}
00131 void SetNeedRebuild(Bool_t flag=kTRUE) {TObject::SetBit(kGeoRebuildVoxels, flag);}
00132 virtual Int_t *GetNextVoxel(Double_t *point, Double_t *dir, Int_t &ncheck);
00133 virtual void SortCrossedVoxels(Double_t *point, Double_t *dir);
00134 virtual void Voxelize(Option_t *option="");
00135
00136 ClassDef(TGeoVoxelFinder, 3)
00137 };
00138
00139 #endif