TGeoVoxelFinder.h

Go to the documentation of this file.
00001 // @(#)root/geom:$Id: TGeoVoxelFinder.h 21497 2007-12-19 16:28:00Z brun $
00002 // Author: Andrei Gheata   04/02/02
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
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  * TGeoVoxelFinder - finder class handling voxels 
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;          // volume to which applies
00035 
00036    Int_t             fNcandidates;    // ! number of candidates
00037    Int_t             fCurrentVoxel;   // ! index of current voxel in sorted list
00038    Int_t             fIbx;            // number of different boundaries on X axis
00039    Int_t             fIby;            // number of different boundaries on Y axis
00040    Int_t             fIbz;            // number of different boundaries on Z axis
00041    Int_t             fNboxes;         // length of boxes array
00042    Int_t             fNox;            // length of array of X offsets
00043    Int_t             fNoy;            // length of array of Y offsets
00044    Int_t             fNoz;            // length of array of Z offsets
00045    Int_t             fNex;            // length of array of X extra offsets
00046    Int_t             fNey;            // length of array of Y extra offsets
00047    Int_t             fNez;            // length of array of Z extra offsets
00048    Int_t             fNx;             // length of array of X voxels
00049    Int_t             fNy;             // length of array of Y voxels
00050    Int_t             fNz;             // length of array of Z voxels
00051    Int_t             fPriority[3];    // priority for each axis
00052    Int_t             fSlices[3];      // ! slice indices for current voxel
00053    Int_t             fInc[3];         // ! slice index increment
00054    Double_t          fInvdir[3];      // ! 1/current director cosines
00055    Double_t          fLimits[3];      // limits on X,Y,Z
00056    Double_t         *fBoxes;          //[fNboxes] list of bounding boxes
00057    Double_t         *fXb;             //[fIbx] ordered array of X box boundaries
00058    Double_t         *fYb;             //[fIby] ordered array of Y box boundaries
00059    Double_t         *fZb;             //[fIbz] ordered array of Z box boundaries
00060    Int_t            *fOBx;            //[fNox] offsets of daughter indices for slices X
00061    Int_t            *fOBy;            //[fNoy] offsets of daughter indices for slices Y
00062    Int_t            *fOBz;            //[fNoz] offsets of daughter indices for slices Z
00063    Int_t            *fOEx;            //[fNox] offsets of extra indices for slices X
00064    Int_t            *fOEy;            //[fNoy] offsets of extra indices for slices Y
00065    Int_t            *fOEz;            //[fNoz] offsets of extra indices for slices Z
00066    Int_t            *fExtraX;         //[fNex] indices of extra daughters in X slices
00067    Int_t            *fExtraY;         //[fNey] indices of extra daughters in Y slices
00068    Int_t            *fExtraZ;         //[fNez] indices of extra daughters in Z slices
00069    Int_t            *fNsliceX;        //[fNox] number of candidates in X slice
00070    Int_t            *fNsliceY;        //[fNoy] number of candidates in Y slice
00071    Int_t            *fNsliceZ;        //[fNoz] number of candidates in Z slice
00072    UChar_t          *fIndcX;          //[fNx] array of slices bits on X
00073    UChar_t          *fIndcY;          //[fNy] array of slices bits on Y
00074    UChar_t          *fIndcZ;          //[fNz] array of slices bits on Z
00075    Int_t            *fCheckList;      //! list of candidates
00076    UChar_t          *fBits1;          //! bits used for list intersection
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 //   Bool_t              Intersect(Int_t n1, Int_t *array1, Int_t n2, Int_t *array2,
00093 //                             Int_t n3, Int_t *array3, Int_t &nf, Int_t *result); 
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 //   void                IntersectAndStore(Int_t n1, Int_t *array1, Int_t n2, Int_t *array2,
00100 //                             Int_t n3, Int_t *array3);
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 //   Bool_t              Union(Int_t n1, Int_t *array1, Int_t n2, Int_t *array2,
00107 //                             Int_t n3, Int_t *array3);
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 //   virtual Bool_t      GetNextIndices(Double_t *point, Double_t *dir);
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)                // voxel finder class
00137 };
00138 
00139 #endif

Generated on Tue Jul 5 14:12:20 2011 for ROOT_528-00b_version by  doxygen 1.5.1