Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:56

0001 // @(#)root/geom:$Id$
0002 // Author: Andrei Gheata   04/02/02
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
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; // volume to which applies
0030 
0031    Int_t fIbx;         // number of different boundaries on X axis
0032    Int_t fIby;         // number of different boundaries on Y axis
0033    Int_t fIbz;         // number of different boundaries on Z axis
0034    Int_t fNboxes;      // length of boxes array
0035    Int_t fNox;         // length of array of X offsets
0036    Int_t fNoy;         // length of array of Y offsets
0037    Int_t fNoz;         // length of array of Z offsets
0038    Int_t fNex;         // length of array of X extra offsets
0039    Int_t fNey;         // length of array of Y extra offsets
0040    Int_t fNez;         // length of array of Z extra offsets
0041    Int_t fNx;          // length of array of X voxels
0042    Int_t fNy;          // length of array of Y voxels
0043    Int_t fNz;          // length of array of Z voxels
0044    Int_t fPriority[3]; // priority for each axis
0045    Double_t *fBoxes;   //[fNboxes] list of bounding boxes
0046    Double_t *fXb;      //[fIbx] ordered array of X box boundaries
0047    Double_t *fYb;      //[fIby] ordered array of Y box boundaries
0048    Double_t *fZb;      //[fIbz] ordered array of Z box boundaries
0049    Int_t *fOBx;        //[fNox] offsets of daughter indices for slices X
0050    Int_t *fOBy;        //[fNoy] offsets of daughter indices for slices Y
0051    Int_t *fOBz;        //[fNoz] offsets of daughter indices for slices Z
0052    Int_t *fOEx;        //[fNox] offsets of extra indices for slices X
0053    Int_t *fOEy;        //[fNoy] offsets of extra indices for slices Y
0054    Int_t *fOEz;        //[fNoz] offsets of extra indices for slices Z
0055    Int_t *fExtraX;     //[fNex] indices of extra daughters in X slices
0056    Int_t *fExtraY;     //[fNey] indices of extra daughters in Y slices
0057    Int_t *fExtraZ;     //[fNez] indices of extra daughters in Z slices
0058    Int_t *fNsliceX;    //[fNox] number of candidates in X slice
0059    Int_t *fNsliceY;    //[fNoy] number of candidates in Y slice
0060    Int_t *fNsliceZ;    //[fNoz] number of candidates in Z slice
0061    UChar_t *fIndcX;    //[fNx] array of slices bits on X
0062    UChar_t *fIndcY;    //[fNy] array of slices bits on Y
0063    UChar_t *fIndcZ;    //[fNz] array of slices bits on Z
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) // voxel finder class
0113 };
0114 
0115 #endif