Logo ROOT   6.08/07
Reference Guide
TGeoChecker.h
Go to the documentation of this file.
1 // @(#)root/geom:$Id$
2 // Author: Andrei Gheata 01/11/01
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGeoChecker
13 #define ROOT_TGeoChecker
14 
15 #ifndef ROOT_TObject
16 #include "TObject.h"
17 #endif
18 
19 // forward declarations
20 class TTree;
21 class TGeoShape;
22 class TGeoVolume;
23 class TGeoVoxelFinder;
24 class TGeoNode;
25 class TGeoManager;
26 class TGeoMatrix;
27 class TGeoOverlap;
28 class TBuffer3D;
29 class TH2F;
30 class TStopwatch;
31 
32 ///////////////////////////////////////////////////////////////////////////
33 // TGeoChecker - A simple checker generating random points inside a //
34 // geometry. Generates a tree of points on the surfaces coresponding //
35 // to the safety of each generated point //
36 // //
37 ///////////////////////////////////////////////////////////////////////////
38 
39 class TGeoChecker : public TObject
40 {
41 private :
42 // data members
43  TGeoManager *fGeoManager; // pointer to geometry manager
44  TGeoVolume *fVsafe; // volume to which a safety sphere node was added
45  TBuffer3D *fBuff1; // Buffer containing mesh vertices for first volume
46  TBuffer3D *fBuff2; // Buffer containing mesh vertices for second volume
47  Bool_t fFullCheck; // Full overlap checking
48  Double_t *fVal1; //! Array of number of crossings per volume.
49  Double_t *fVal2; //! Array of timing per volume.
50  Bool_t *fFlags; //! Array of flags per volume.
51  TStopwatch *fTimer; //! Timer
52  TGeoNode *fSelectedNode; //! Selected node for overlap checking
53  Int_t fNchecks; //! Number of checks for current volume
54  Int_t fNmeshPoints; //! Number of points on mesh to be checked
55 // methods
56  void CleanPoints(Double_t *points, Int_t &numPoints) const;
59  void Score(TGeoVolume *, Int_t, Double_t);
61 public:
62  // constructors
63  TGeoChecker();
64  TGeoChecker(TGeoManager *geom);
65  // destructor
66  virtual ~TGeoChecker();
67  // methods
68  virtual void CheckBoundaryErrors(Int_t ntracks=1000000, Double_t radius=-1.);
69  virtual void CheckBoundaryReference(Int_t icheck=-1);
70  void CheckGeometryFull(Bool_t checkoverlaps=kTRUE, Bool_t checkcrossings=kTRUE, Int_t nrays=10000, const Double_t *vertex=NULL);
71  void CheckGeometry(Int_t nrays, Double_t startx, Double_t starty, Double_t startz) const;
72  void CheckOverlaps(const TGeoVolume *vol, Double_t ovlp=0.1, Option_t *option="");
73  void CheckOverlapsBySampling(TGeoVolume *vol, Double_t ovlp=0.1, Int_t npoints=1000000) const;
74  void CheckPoint(Double_t x=0, Double_t y=0, Double_t z=0, Option_t *option="");
75  void CheckShape(TGeoShape *shape, Int_t testNo, Int_t nsamples, Option_t *option);
76  Double_t CheckVoxels(TGeoVolume *vol, TGeoVoxelFinder *voxels, Double_t *xyz, Int_t npoints);
77  TH2F *LegoPlot(Int_t ntheta=60, Double_t themin=0., Double_t themax=180.,
78  Int_t nphi=90, Double_t phimin=0., Double_t phimax=360.,
79  Double_t rmin=0., Double_t rmax=9999999, Option_t *option="");
80  void PrintOverlaps() const;
81  void RandomPoints(TGeoVolume *vol, Int_t npoints, Option_t *option);
82  void RandomRays(Int_t nrays, Double_t startx, Double_t starty, Double_t startz, const char *target_vol=0, Bool_t check_norm=kFALSE);
83  TGeoOverlap *MakeCheckOverlap(const char *name, TGeoVolume *vol1, TGeoVolume *vol2, TGeoMatrix *mat1, TGeoMatrix *mat2, Bool_t isovlp, Double_t ovlp);
84  void OpProgress(const char *opname, Long64_t current, Long64_t size, TStopwatch *watch=0, Bool_t last=kFALSE, Bool_t refresh=kFALSE, const char *msg="");
85  TGeoNode *SamplePoints(Int_t npoints, Double_t &dist, Double_t epsil, const char* g3path);
86  void ShapeDistances(TGeoShape *shape, Int_t nsamples, Option_t *option);
87  void ShapeSafety(TGeoShape *shape, Int_t nsamples, Option_t *option);
88  void ShapeNormal(TGeoShape *shape, Int_t nsamples, Option_t *option);
89  Double_t *ShootRay(Double_t *start, Double_t dirx, Double_t diry, Double_t dirz, Double_t *array, Int_t &nelem, Int_t &dim, Double_t *enpoint=0) const;
90  void SetSelectedNode(TGeoNode *node) {fSelectedNode=node;}
91  void SetNmeshPoints(Int_t npoints=1000);
92  void Test(Int_t npoints, Option_t *option);
93  void TestOverlaps(const char *path);
94  Bool_t TestVoxels(TGeoVolume *vol, Int_t npoints=1000000);
95  Double_t Weight(Double_t precision=0.01, Option_t *option="v");
96 
97  ClassDef(TGeoChecker, 2) // a simple geometry checker
98 };
99 
100 #endif
101 
virtual ~TGeoChecker()
Destructor.
void TestOverlaps(const char *path)
— Geometry overlap checker based on sampling.
double dist(Rotation3D const &r1, Rotation3D const &r2)
Definition: 3DDistances.cxx:48
The manager class for any TGeo geometry.
Definition: TGeoManager.h:38
Double_t * ShootRay(Double_t *start, Double_t dirx, Double_t diry, Double_t dirz, Double_t *array, Int_t &nelem, Int_t &dim, Double_t *enpoint=0) const
Shoot one ray from start point with direction (dirx,diry,dirz).
long long Long64_t
Definition: RtypesCore.h:69
Double_t * fVal2
Array of number of crossings per volume.
Definition: TGeoChecker.h:49
TGeoOverlap * MakeCheckOverlap(const char *name, TGeoVolume *vol1, TGeoVolume *vol2, TGeoMatrix *mat1, TGeoMatrix *mat2, Bool_t isovlp, Double_t ovlp)
Check if the 2 non-assembly volume candidates overlap/extrude. Returns overlap object.
TGeoNode * fSelectedNode
Timer.
Definition: TGeoChecker.h:52
const char Option_t
Definition: RtypesCore.h:62
Geometrical transformation package.
Definition: TGeoMatrix.h:40
TBuffer3D * fBuff1
Definition: TGeoChecker.h:45
void ShapeNormal(TGeoShape *shape, Int_t nsamples, Option_t *option)
Check of validity of the normal for a given shape.
void CleanPoints(Double_t *points, Int_t &numPoints) const
Number of points on mesh to be checked.
virtual void CheckBoundaryErrors(Int_t ntracks=1000000, Double_t radius=-1.)
Check pushes and pulls needed to cross the next boundary with respect to the position given by FindNe...
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:61
TGeoVolume * fVsafe
Definition: TGeoChecker.h:44
TH2F * LegoPlot(Int_t ntheta=60, Double_t themin=0., Double_t themax=180., Int_t nphi=90, Double_t phimin=0., Double_t phimax=360., Double_t rmin=0., Double_t rmax=9999999, Option_t *option="")
Generate a lego plot fot the top volume, according to option.
void SetSelectedNode(TGeoNode *node)
Definition: TGeoChecker.h:90
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
void Score(TGeoVolume *, Int_t, Double_t)
Score a hit for VOL.
Int_t PropagateInGeom(Double_t *, Double_t *)
Propagate from START along DIR from boundary to boundary until exiting geometry.
Int_t fNmeshPoints
Number of checks for current volume.
Definition: TGeoChecker.h:54
Double_t TimingPerVolume(TGeoVolume *)
Compute timing per "FindNextBoundary" + "Safety" call.
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
void CheckOverlaps(const TGeoVolume *vol, Double_t ovlp=0.1, Option_t *option="")
Check illegal overlaps for volume VOL within a limit OVLP.
void CheckOverlapsBySampling(TGeoVolume *vol, Double_t ovlp=0.1, Int_t npoints=1000000) const
Check illegal overlaps for volume VOL within a limit OVLP by sampling npoints inside the volume shape...
void Test(Int_t npoints, Option_t *option)
Check time of finding "Where am I" for n points.
void RandomRays(Int_t nrays, Double_t startx, Double_t starty, Double_t startz, const char *target_vol=0, Bool_t check_norm=kFALSE)
Randomly shoot nrays from point (startx,starty,startz) and plot intersections with surfaces for curre...
void SetNmeshPoints(Int_t npoints=1000)
Set number of points to be generated on the shape outline when checking for overlaps.
REAL * vertex
Definition: triangle.c:512
Int_t fNchecks
Selected node for overlap checking.
Definition: TGeoChecker.h:53
point * points
Definition: X3DBuffer.c:20
Double_t * fVal1
Definition: TGeoChecker.h:48
Double_t CheckVoxels(TGeoVolume *vol, TGeoVoxelFinder *voxels, Double_t *xyz, Int_t npoints)
count voxel timing
Bool_t TestVoxels(TGeoVolume *vol, Int_t npoints=1000000)
Returns optimal voxelization type for volume vol.
Base abstract class for all shapes.
Definition: TGeoShape.h:27
void ShapeSafety(TGeoShape *shape, Int_t nsamples, Option_t *option)
Check of validity of safe distance for a given shape.
Bool_t * fFlags
Array of timing per volume.
Definition: TGeoChecker.h:50
tomato 2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:255
void RandomPoints(TGeoVolume *vol, Int_t npoints, Option_t *option)
Draw random points in the bounding box of a volume.
virtual void CheckBoundaryReference(Int_t icheck=-1)
Check the boundary errors reference file created by CheckBoundaryErrors method.
TGeoManager * fGeoManager
Definition: TGeoChecker.h:43
Generic 3D primitive description class.
Definition: TBuffer3D.h:19
TBuffer3D * fBuff2
Definition: TGeoChecker.h:46
void OpProgress(const char *opname, Long64_t current, Long64_t size, TStopwatch *watch=0, Bool_t last=kFALSE, Bool_t refresh=kFALSE, const char *msg="")
Print current operation progress.
double Double_t
Definition: RtypesCore.h:55
void CheckShape(TGeoShape *shape, Int_t testNo, Int_t nsamples, Option_t *option)
Test for shape navigation methods.
void CheckGeometry(Int_t nrays, Double_t startx, Double_t starty, Double_t startz) const
Shoot nrays with random directions from starting point (startx, starty, startz) in the reference fram...
void CheckPoint(Double_t x=0, Double_t y=0, Double_t z=0, Option_t *option="")
— Draw point (x,y,z) over the picture of the daughers of the volume containing this point...
Double_t y[n]
Definition: legend1.C:17
Finder class handling voxels.
void PrintOverlaps() const
Print the current list of overlaps held by the manager class.
Mother of all ROOT objects.
Definition: TObject.h:37
Double_t Weight(Double_t precision=0.01, Option_t *option="v")
Estimate weight of top level volume with a precision SIGMA(W)/W better than PRECISION.
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
TGeoNode * SamplePoints(Int_t npoints, Double_t &dist, Double_t epsil, const char *g3path)
shoot npoints randomly in a box of 1E-5 arround current point.
void CheckGeometryFull(Bool_t checkoverlaps=kTRUE, Bool_t checkcrossings=kTRUE, Int_t nrays=10000, const Double_t *vertex=NULL)
Geometry checking.
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition: TGeoNode.h:51
void ShapeDistances(TGeoShape *shape, Int_t nsamples, Option_t *option)
Test TGeoShape::DistFromInside/Outside.
#define NULL
Definition: Rtypes.h:82
A TTree object has a header with a name and a title.
Definition: TTree.h:98
TStopwatch * fTimer
Array of flags per volume.
Definition: TGeoChecker.h:51
const Bool_t kTRUE
Definition: Rtypes.h:91
TGeoChecker()
Default constructor.
char name[80]
Definition: TGX11.cxx:109
Int_t NChecksPerVolume(TGeoVolume *vol)
Compute number of overlaps combinations to check per volume.
Bool_t fFullCheck
Definition: TGeoChecker.h:47
Stopwatch class.
Definition: TStopwatch.h:30