Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TGeoChecker.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/geom:$Id$
0002 // Author: Andrei Gheata   01/11/01
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_TGeoChecker
0013 #define ROOT_TGeoChecker
0014 
0015 #include "TObject.h"
0016 
0017 // forward declarations
0018 class TTree;
0019 class TGeoShape;
0020 class TGeoVolume;
0021 class TGeoVoxelFinder;
0022 class TGeoNode;
0023 class TGeoManager;
0024 class TGeoMatrix;
0025 class TGeoOverlap;
0026 class TBuffer3D;
0027 class TH2F;
0028 class TStopwatch;
0029 
0030 ///////////////////////////////////////////////////////////////////////////
0031 // TGeoChecker - A simple checker generating random points inside a      //
0032 //   geometry. Generates a tree of points on the surfaces corresponding  //
0033 //   to the safety of each generated point                               //
0034 //                                                                       //
0035 ///////////////////////////////////////////////////////////////////////////
0036 
0037 class TGeoChecker : public TObject {
0038 private:
0039    // data members
0040    TGeoManager *fGeoManager; // pointer to geometry manager
0041    TGeoVolume *fVsafe;       // volume to which a safety sphere node was added
0042    TBuffer3D *fBuff1;        // Buffer containing mesh vertices for first volume
0043    TBuffer3D *fBuff2;        // Buffer containing mesh vertices for second volume
0044    Bool_t fFullCheck;        // Full overlap checking
0045    Double_t *fVal1;          //! Array of number of crossings per volume.
0046    Double_t *fVal2;          //! Array of timing per volume.
0047    Bool_t *fFlags;           //! Array of flags per volume.
0048    TStopwatch *fTimer;       //! Timer
0049    TGeoNode *fSelectedNode;  //! Selected node for overlap checking
0050    Int_t fNchecks;           //! Number of checks for current volume
0051    Int_t fNmeshPoints;       //! Number of points on mesh to be checked
0052                              // methods
0053    void CleanPoints(Double_t *points, Int_t &numPoints) const;
0054    Int_t NChecksPerVolume(TGeoVolume *vol);
0055    Int_t PropagateInGeom(Double_t *, Double_t *);
0056    void Score(TGeoVolume *, Int_t, Double_t);
0057    Double_t TimingPerVolume(TGeoVolume *);
0058 
0059 public:
0060    // constructors
0061    TGeoChecker();
0062    TGeoChecker(TGeoManager *geom);
0063    // destructor
0064    ~TGeoChecker() override;
0065    // methods
0066    virtual void CheckBoundaryErrors(Int_t ntracks = 1000000, Double_t radius = -1.);
0067    virtual void CheckBoundaryReference(Int_t icheck = -1);
0068    void CheckGeometryFull(Bool_t checkoverlaps = kTRUE, Bool_t checkcrossings = kTRUE, Int_t nrays = 10000,
0069                           const Double_t *vertex = nullptr);
0070    void CheckGeometry(Int_t nrays, Double_t startx, Double_t starty, Double_t startz) const;
0071    void CheckOverlaps(const TGeoVolume *vol, Double_t ovlp = 0.1, Option_t *option = "");
0072    void CheckOverlapsBySampling(TGeoVolume *vol, Double_t ovlp = 0.1, Int_t npoints = 1000000) const;
0073    void CheckPoint(Double_t x = 0, Double_t y = 0, Double_t z = 0, Option_t *option = "", Double_t safety = 0.);
0074    void CheckShape(TGeoShape *shape, Int_t testNo, Int_t nsamples, Option_t *option);
0075    Double_t CheckVoxels(TGeoVolume *vol, TGeoVoxelFinder *voxels, Double_t *xyz, Int_t npoints);
0076    TH2F *LegoPlot(Int_t ntheta = 60, Double_t themin = 0., Double_t themax = 180., Int_t nphi = 90,
0077                   Double_t phimin = 0., Double_t phimax = 360., Double_t rmin = 0., Double_t rmax = 9999999,
0078                   Option_t *option = "");
0079    void PrintOverlaps() const;
0080    void RandomPoints(TGeoVolume *vol, Int_t npoints, Option_t *option);
0081    void RandomRays(Int_t nrays, Double_t startx, Double_t starty, Double_t startz, const char *target_vol = nullptr,
0082                    Bool_t check_norm = kFALSE);
0083    TGeoOverlap *MakeCheckOverlap(const char *name, TGeoVolume *vol1, TGeoVolume *vol2, TGeoMatrix *mat1,
0084                                  TGeoMatrix *mat2, Bool_t isovlp, Double_t ovlp);
0085    void OpProgress(const char *opname, Long64_t current, Long64_t size, TStopwatch *watch = nullptr,
0086                    Bool_t last = kFALSE, Bool_t refresh = kFALSE, const char *msg = "");
0087    TGeoNode *SamplePoints(Int_t npoints, Double_t &dist, Double_t epsil, const char *g3path);
0088    void ShapeDistances(TGeoShape *shape, Int_t nsamples, Option_t *option);
0089    void ShapeSafety(TGeoShape *shape, Int_t nsamples, Option_t *option);
0090    void ShapeNormal(TGeoShape *shape, Int_t nsamples, Option_t *option);
0091    Double_t *ShootRay(Double_t *start, Double_t dirx, Double_t diry, Double_t dirz, Double_t *array, Int_t &nelem,
0092                       Int_t &dim, Double_t *enpoint = nullptr) const;
0093    void SetSelectedNode(TGeoNode *node) { fSelectedNode = node; }
0094    void SetNmeshPoints(Int_t npoints = 1000);
0095    void Test(Int_t npoints, Option_t *option);
0096    void TestOverlaps(const char *path);
0097    Bool_t TestVoxels(TGeoVolume *vol, Int_t npoints = 1000000);
0098    Double_t Weight(Double_t precision = 0.01, Option_t *option = "v");
0099 
0100    ClassDefOverride(TGeoChecker, 2) // a simple geometry checker
0101 };
0102 
0103 #endif