Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGeoShapeAssembly.cxx
Go to the documentation of this file.
1// @(#)root/geom:$Id$
2// Author: Andrei Gheata 02/06/05
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#include "TGeoManager.h"
13#include "TGeoVoxelFinder.h"
14#include "TGeoMatrix.h"
15#include "TGeoVolume.h"
16#include "TGeoNode.h"
17#include "TGeoShapeAssembly.h"
18#include "TBuffer3D.h"
19#include "TBuffer3DTypes.h"
20#include "TMath.h"
21
22/** \class TGeoShapeAssembly
23\ingroup Shapes_classes
24
25The shape encapsulating an assembly (union) of volumes.
26Automatically created by TGeoVolumeAssembly class
27*/
28
30
31////////////////////////////////////////////////////////////////////////////////
32/// Default constructor
33
35{
36 fVolume = 0;
38}
39
40
41////////////////////////////////////////////////////////////////////////////////
42/// Constructor specifying hyperboloid parameters.
43
45{
46 fVolume = vol;
48}
49
50
51////////////////////////////////////////////////////////////////////////////////
52/// destructor
53
55{
56}
57
58////////////////////////////////////////////////////////////////////////////////
59/// Compute bounding box of the assembly
60
62{
63 if (!fVolume) {
64 Fatal("ComputeBBox", "Assembly shape %s without volume", GetName());
65 return;
66 }
67 // Make sure bbox is computed only once or recomputed only if invalidated (by alignment)
68 if (fBBoxOK) return;
70 if (!nd) {fBBoxOK = kTRUE; return;}
71 TGeoNode *node;
73 Double_t xmin, xmax, ymin, ymax, zmin, zmax;
74 xmin = ymin = zmin = TGeoShape::Big();
75 xmax = ymax = zmax = -TGeoShape::Big();
76 Double_t vert[24];
77 Double_t pt[3];
78 for (Int_t i=0; i<nd; i++) {
79 node = fVolume->GetNode(i);
80 // Make sure that all assembly daughters have computed their bboxes
81 if (node->GetVolume()->IsAssembly()) node->GetVolume()->GetShape()->ComputeBBox();
82 box = (TGeoBBox*)node->GetVolume()->GetShape();
83 box->SetBoxPoints(vert);
84 for (Int_t ipt=0; ipt<8; ipt++) {
85 node->LocalToMaster(&vert[3*ipt], pt);
86 if (pt[0]<xmin) xmin=pt[0];
87 if (pt[0]>xmax) xmax=pt[0];
88 if (pt[1]<ymin) ymin=pt[1];
89 if (pt[1]>ymax) ymax=pt[1];
90 if (pt[2]<zmin) zmin=pt[2];
91 if (pt[2]>zmax) zmax=pt[2];
92 }
93 }
94 fDX = 0.5*(xmax-xmin);
95 fOrigin[0] = 0.5*(xmin+xmax);
96 fDY = 0.5*(ymax-ymin);
97 fOrigin[1] = 0.5*(ymin+ymax);
98 fDZ = 0.5*(zmax-zmin);
99 fOrigin[2] = 0.5*(zmin+zmax);
100 if (fDX>0 && fDY>0 && fDZ>0) fBBoxOK = kTRUE;
101}
102
103////////////////////////////////////////////////////////////////////////////////
104/// Recompute bounding box of the assembly after adding a node.
105
107{
109 if (!nd) {
110 Warning("RecomputeBoxLast", "No daughters for volume %s yet", fVolume->GetName());
111 return;
112 }
113 TGeoNode *node = fVolume->GetNode(nd-1);
114 Double_t xmin, xmax, ymin, ymax, zmin, zmax;
115 if (nd==1) {
116 xmin = ymin = zmin = TGeoShape::Big();
117 xmax = ymax = zmax = -TGeoShape::Big();
118 } else {
119 xmin = fOrigin[0]-fDX;
120 xmax = fOrigin[0]+fDX;
121 ymin = fOrigin[1]-fDY;
122 ymax = fOrigin[1]+fDY;
123 zmin = fOrigin[2]-fDZ;
124 zmax = fOrigin[2]+fDZ;
125 }
126 Double_t vert[24];
127 Double_t pt[3];
128 TGeoBBox *box = (TGeoBBox*)node->GetVolume()->GetShape();
129 if (TGeoShape::IsSameWithinTolerance(box->GetDX(), 0) ||
130 node->GetVolume()->IsAssembly()) node->GetVolume()->GetShape()->ComputeBBox();
131 box->SetBoxPoints(vert);
132 for (Int_t ipt=0; ipt<8; ipt++) {
133 node->LocalToMaster(&vert[3*ipt], pt);
134 if (pt[0]<xmin) xmin=pt[0];
135 if (pt[0]>xmax) xmax=pt[0];
136 if (pt[1]<ymin) ymin=pt[1];
137 if (pt[1]>ymax) ymax=pt[1];
138 if (pt[2]<zmin) zmin=pt[2];
139 if (pt[2]>zmax) zmax=pt[2];
140 }
141 fDX = 0.5*(xmax-xmin);
142 fOrigin[0] = 0.5*(xmin+xmax);
143 fDY = 0.5*(ymax-ymin);
144 fOrigin[1] = 0.5*(ymin+ymax);
145 fDZ = 0.5*(zmax-zmin);
146 fOrigin[2] = 0.5*(zmin+zmax);
147 fBBoxOK = kTRUE;
148}
149
150////////////////////////////////////////////////////////////////////////////////
151/// Compute normal to closest surface from POINT. Should not be called.
152
153void TGeoShapeAssembly::ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
154{
155 if (!fBBoxOK) ((TGeoShapeAssembly*)this)->ComputeBBox();
156 Int_t inext = fVolume->GetNextNodeIndex();
157 if (inext<0) {
158 DistFromOutside(point,dir,3);
159 inext = fVolume->GetNextNodeIndex();
160 if (inext<0) {
161 Error("ComputeNormal","Invalid inext=%i (Ncomponents=%i)",inext,fVolume->GetNdaughters());
162 return;
163 }
164 }
165 TGeoNode *node = fVolume->GetNode(inext);
166 Double_t local[3],ldir[3],lnorm[3];
167 node->MasterToLocal(point,local);
168 node->MasterToLocalVect(dir,ldir);
169 node->GetVolume()->GetShape()->ComputeNormal(local,ldir,lnorm);
170 node->LocalToMasterVect(lnorm,norm);
171}
172
173////////////////////////////////////////////////////////////////////////////////
174/// Test if point is inside the assembly
175
177{
178 if (!fBBoxOK) ((TGeoShapeAssembly*)this)->ComputeBBox();
179 if (!TGeoBBox::Contains(point)) return kFALSE;
180 TGeoVoxelFinder *voxels = fVolume->GetVoxels();
181 TGeoNode *node;
182 TGeoShape *shape;
183 Int_t *check_list = 0;
184 Int_t ncheck, id;
185 Double_t local[3];
186 if (voxels) {
187 // get the list of nodes passing thorough the current voxel
189 TGeoStateInfo &td = *nav->GetCache()->GetInfo();
190 check_list = voxels->GetCheckList(point, ncheck, td);
191 if (!check_list) {
192 nav->GetCache()->ReleaseInfo();
193 return kFALSE;
194 }
195 for (id=0; id<ncheck; id++) {
196 node = fVolume->GetNode(check_list[id]);
197 shape = node->GetVolume()->GetShape();
198 node->MasterToLocal(point,local);
199 if (shape->Contains(local)) {
200 fVolume->SetCurrentNodeIndex(check_list[id]);
201 fVolume->SetNextNodeIndex(check_list[id]);
202 nav->GetCache()->ReleaseInfo();
203 return kTRUE;
204 }
205 }
206 nav->GetCache()->ReleaseInfo();
207 return kFALSE;
208 }
210 for (id=0; id<nd; id++) {
211 node = fVolume->GetNode(id);
212 shape = node->GetVolume()->GetShape();
213 node->MasterToLocal(point,local);
214 if (shape->Contains(local)) {
217 return kTRUE;
218 }
219 }
220 return kFALSE;
221}
222
223////////////////////////////////////////////////////////////////////////////////
224/// compute closest distance from point px,py to each vertex. Should not be called.
225
227{
228 return 9999;
229}
230
231////////////////////////////////////////////////////////////////////////////////
232/// Compute distance from inside point to surface of the hyperboloid.
233
234Double_t TGeoShapeAssembly::DistFromInside(const Double_t * /*point*/, const Double_t * /*dir*/, Int_t /*iact*/, Double_t /*step*/, Double_t * /*safe*/) const
235{
236 Info("DistFromInside", "Cannot compute distance from inside the assembly (but from a component)");
237 return TGeoShape::Big();
238}
239
240
241////////////////////////////////////////////////////////////////////////////////
242/// compute distance from outside point to surface of the hyperboloid.
243/// fVolume->SetNextNodeIndex(-1);
244
245Double_t TGeoShapeAssembly::DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact, Double_t step, Double_t *safe) const
246{
247#ifdef TGEO_DEBUG
248 static int indent=0;
249 indent++;
250 TString sindent = "";
251 for (Int_t k=0; k<indent; k++) sindent += " ";
253#endif
254 if (!fBBoxOK) ((TGeoShapeAssembly*)this)->ComputeBBox();
255 if (iact<3 && safe) {
256 *safe = Safety(point, kFALSE);
257#ifdef TGEO_DEBUG
258 indent--;
259#endif
260 if (iact==0) return TGeoShape::Big();
261 if ((iact==1) && (step<=*safe)) return TGeoShape::Big();
262#ifdef TGEO_DEBUG
263 indent++;
264#endif
265 }
266 // find distance to assembly
267 Double_t snext = 0.0;
268 Double_t dist;
269 Double_t stepmax = step;
270 Double_t pt[3];
271 Int_t i;
272 Bool_t found = kFALSE;
273 memcpy(pt,point,3*sizeof(Double_t));
274#ifdef TGEO_DEBUG
275 if (idebug>4) printf("%s[%d] assembly %s checking distance to %d daughters...\n", sindent.Data(), indent, fVolume->GetName(), fVolume->GetNdaughters());
276#endif
277
278 if (!TGeoBBox::Contains(point)) {
279 snext = TGeoBBox::DistFromOutside(point, dir, 3, stepmax);
280 // Approach bounding box to minimize errors
281 snext = TMath::Min(0.01*snext, 1.E-6);
282#ifdef TGEO_DEBUG
283 if (idebug>4 && snext > stepmax) printf("%s[%d] %s: bbox not crossed\n",sindent.Data(), indent, fVolume->GetName());
284 indent--;
285#endif
286 if (snext > stepmax) return TGeoShape::Big();
287#ifdef TGEO_DEBUG
288 indent++;
289#endif
290 for (i=0; i<3; i++) pt[i] += snext*dir[i];
291// if (Contains(pt)) {
292#ifdef TGEO_DEBUG
293// if (idebug>4) printf("%s[%d] Propagation to BBox of %s entered the component %s at %f\n", sindent.Data(), indent, fVolume->GetName(), fVolume->GetNode(fVolume->GetCurrentNodeIndex())->GetName(), snext);
294// indent--;
295#endif
296// fVolume->SetNextNodeIndex(fVolume->GetCurrentNodeIndex());
297// return snext;
298// }
299// snext += TGeoShape::Tolerance();
300 stepmax -= snext;
301 }
302 // Point represented by pt is now inside the bounding box - find distance to components
304 TGeoNode *node;
305 Double_t lpoint[3],ldir[3];
306 TGeoVoxelFinder *voxels = fVolume->GetVoxels();
307 if (nd<5 || !voxels) {
308 for (i=0; i<nd; i++) {
309 node = fVolume->GetNode(i);
310 if (voxels && voxels->IsSafeVoxel(pt, i, stepmax)) continue;
311 node->MasterToLocal(pt, lpoint);
312 node->MasterToLocalVect(dir, ldir);
313#ifdef TGEO_DEBUG
314 if (idebug>4) printf("%s[%d] distance to %s ...\n", sindent.Data(), indent, node->GetName());
315#endif
316 dist = node->GetVolume()->GetShape()->DistFromOutside(lpoint, ldir, 3, stepmax);
317 if (dist<stepmax) {
318#ifdef TGEO_DEBUG
319 if (idebug>4) {
320 printf("%s[%d] %s -> from local=(%19.16f, %19.16f, %19.16f, %19.16f, %19.16f, %19.16f)\n",
321 sindent.Data(), indent, fVolume->GetName(), lpoint[0],lpoint[1],lpoint[2],ldir[0],ldir[1],ldir[2]);
322 printf("%s[%d] -> (l)to: %s shape %s snext=%g\n", sindent.Data(), indent, node->GetName(),
323 node->GetVolume()->GetShape()->ClassName(), dist);
324 }
325#endif
326
327 stepmax = dist;
329 found = kTRUE;
330 }
331 }
332 if (found) {
333 snext += stepmax;
334#ifdef TGEO_DEBUG
335 if (idebug>4) printf("%s[%d] %s: found %s at %f\n", sindent.Data(), indent, fVolume->GetName(), fVolume->GetNode(fVolume->GetNextNodeIndex())->GetName(), snext);
336 indent--;
337#endif
338 return snext;
339 }
340#ifdef TGEO_DEBUG
341 if (idebug>4) printf("%s[%d] %s: no daughter crossed\n", sindent.Data(), indent, fVolume->GetName());
342 indent--;
343#endif
344 return TGeoShape::Big();
345 }
346 // current volume is voxelized, first get current voxel
347 Int_t ncheck = 0;
348 Int_t *vlist = 0;
350 TGeoStateInfo &td = *nav->GetCache()->GetInfo();
351
352 voxels->SortCrossedVoxels(pt, dir, td);
353 while ((vlist=voxels->GetNextVoxel(pt, dir, ncheck, td))) {
354 for (i=0; i<ncheck; i++) {
355 node = fVolume->GetNode(vlist[i]);
356 node->MasterToLocal(pt, lpoint);
357 node->MasterToLocalVect(dir, ldir);
358#ifdef TGEO_DEBUG
359 if (idebug>4) printf("%s[%d] distance to %s ...\n", sindent.Data(), indent, node->GetName());
360#endif
361 dist = node->GetVolume()->GetShape()->DistFromOutside(lpoint, ldir, 3, stepmax);
362 if (dist<stepmax) {
363#ifdef TGEO_DEBUG
364 if (idebug>4) {
365 printf("%s[%d] %s -> from local=(%19.16f, %19.16f, %19.16f, %19.16f, %19.16f, %19.16f)\n",
366 sindent.Data(), indent, fVolume->GetName(), lpoint[0],lpoint[1],lpoint[2], ldir[0],ldir[1],ldir[2]);
367 printf("%s[%d] -> to: %s shape %s snext=%g\n", sindent.Data(), indent, node->GetName(),
368 node->GetVolume()->GetShape()->ClassName(), dist);
369 }
370#endif
371 stepmax = dist;
372 fVolume->SetNextNodeIndex(vlist[i]);
373 found = kTRUE;
374 }
375 }
376 }
377 nav->GetCache()->ReleaseInfo();
378 if (found) {
379 snext += stepmax;
380#ifdef TGEO_DEBUG
381 if (idebug>4) printf("%s[%d] %s: found %s at %f\n", sindent.Data(), indent, fVolume->GetName(), fVolume->GetNode(fVolume->GetNextNodeIndex())->GetName(), snext);
382 indent--;
383#endif
384 return snext;
385 }
386#ifdef TGEO_DEBUG
387 if (idebug>4) printf("%s[%d] %s: no daughter crossed\n", sindent.Data(), indent, fVolume->GetName());
388 indent--;
389#endif
390 return TGeoShape::Big();
391}
392
393////////////////////////////////////////////////////////////////////////////////
394/// Cannot divide assemblies.
395
396TGeoVolume *TGeoShapeAssembly::Divide(TGeoVolume * /*voldiv*/, const char *divname, Int_t /*iaxis*/, Int_t /*ndiv*/,
397 Double_t /*start*/, Double_t /*step*/)
398{
399 Error("Divide", "Assemblies cannot be divided. Division volume %s not created", divname);
400 return 0;
401}
402
403////////////////////////////////////////////////////////////////////////////////
404/// in case shape has some negative parameters, these has to be computed
405/// in order to fit the mother
406
408{
409 Error("GetMakeRuntimeShape", "Assemblies cannot be parametrized.");
410 return NULL;
411}
412
413////////////////////////////////////////////////////////////////////////////////
414/// print shape parameters
415
417{
418 printf("*** Shape %s: TGeoShapeAssembly ***\n", GetName());
419 printf(" Volume assembly %s with %i nodes\n", fVolume->GetName(), fVolume->GetNdaughters());
420 printf(" Bounding box:\n");
421 if (!fBBoxOK) ((TGeoShapeAssembly*)this)->ComputeBBox();
423}
424
425////////////////////////////////////////////////////////////////////////////////
426/// Fill TBuffer3D structure for segments and polygons.
427
429{
430 Error("SetSegsAndPols", "Drawing functions should not be called for assemblies, but rather for their content");
431}
432
433////////////////////////////////////////////////////////////////////////////////
434/// computes the closest distance from given point to this shape, according
435/// to option. The matching point on the shape is stored in spoint.
436
438{
439 Double_t safety = TGeoShape::Big();
440 Double_t pt[3], loc[3];
441 if (!fBBoxOK) ((TGeoShapeAssembly*)this)->ComputeBBox();
442 if (in) {
444 TGeoVolume *vol = fVolume;
445 TGeoNode *node;
446 memcpy(loc, point, 3*sizeof(Double_t));
447 while (index>=0) {
448 memcpy(pt, loc, 3*sizeof(Double_t));
449 node = vol->GetNode(index);
450 node->GetMatrix()->MasterToLocal(pt,loc);
451 vol = node->GetVolume();
452 index = vol->GetCurrentNodeIndex();
453 if (index<0) {
454 safety = vol->GetShape()->Safety(loc, in);
455 return safety;
456 }
457 }
458 return TGeoShape::Big();
459 }
460 Double_t safe;
461 TGeoVoxelFinder *voxels = fVolume->GetVoxels();
463 Double_t *boxes = 0;
464 if (voxels) boxes = voxels->GetBoxes();
465 TGeoNode *node;
466 for (Int_t id=0; id<nd; id++) {
467 if (boxes && id>0) {
468 Int_t ist = 6*id;
469 Double_t dxyz = 0.;
470 Double_t dxyz0 = TMath::Abs(point[0]-boxes[ist+3])-boxes[ist];
471 if (dxyz0 > safety) continue;
472 Double_t dxyz1 = TMath::Abs(point[1]-boxes[ist+4])-boxes[ist+1];
473 if (dxyz1 > safety) continue;
474 Double_t dxyz2 = TMath::Abs(point[2]-boxes[ist+5])-boxes[ist+2];
475 if (dxyz2 > safety) continue;
476 if (dxyz0>0) dxyz+=dxyz0*dxyz0;
477 if (dxyz1>0) dxyz+=dxyz1*dxyz1;
478 if (dxyz2>0) dxyz+=dxyz2*dxyz2;
479 if (dxyz >= safety*safety) continue;
480 }
481 node = fVolume->GetNode(id);
482 safe = node->Safety(point, kFALSE);
483 if (safe<=0.0) return 0.0;
484 if (safe<safety) safety = safe;
485 }
486 return safety;
487}
488
489////////////////////////////////////////////////////////////////////////////////
490/// Save a primitive as a C++ statement(s) on output stream "out".
491
492void TGeoShapeAssembly::SavePrimitive(std::ostream & /*out*/, Option_t * /*option*/ /*= ""*/)
493{
494}
495
496////////////////////////////////////////////////////////////////////////////////
497/// No mesh for assemblies.
498
500{
501 Error("SetPoints", "Drawing functions should not be called for assemblies, but rather for their content");
502}
503
504////////////////////////////////////////////////////////////////////////////////
505/// No mesh for assemblies.
506
507void TGeoShapeAssembly::SetPoints(Float_t * /*points*/) const
508{
509 Error("SetPoints", "Drawing functions should not be called for assemblies, but rather for their content");
510}
511
512////////////////////////////////////////////////////////////////////////////////
513/// Returns numbers of vertices, segments and polygons composing the shape mesh.
514
515void TGeoShapeAssembly::GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
516{
517 nvert = 0;
518 nsegs = 0;
519 npols = 0;
520}
521
522////////////////////////////////////////////////////////////////////////////////
523/// Check the inside status for each of the points in the array.
524/// Input: Array of point coordinates + vector size
525/// Output: Array of Booleans for the inside of each point
526
527void TGeoShapeAssembly::Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const
528{
529 for (Int_t i=0; i<vecsize; i++) inside[i] = Contains(&points[3*i]);
530}
531
532////////////////////////////////////////////////////////////////////////////////
533/// Compute the normal for an array o points so that norm.dot.dir is positive
534/// Input: Arrays of point coordinates and directions + vector size
535/// Output: Array of normal directions
536
538{
539 for (Int_t i=0; i<vecsize; i++) ComputeNormal(&points[3*i], &dirs[3*i], &norms[3*i]);
540}
541
542////////////////////////////////////////////////////////////////////////////////
543/// Compute distance from array of input points having directions specified by dirs. Store output in dists
544
545void TGeoShapeAssembly::DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t* step) const
546{
547 for (Int_t i=0; i<vecsize; i++) dists[i] = DistFromInside(&points[3*i], &dirs[3*i], 3, step[i]);
548}
549
550////////////////////////////////////////////////////////////////////////////////
551/// Compute distance from array of input points having directions specified by dirs. Store output in dists
552
553void TGeoShapeAssembly::DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t* step) const
554{
555 for (Int_t i=0; i<vecsize; i++) dists[i] = DistFromOutside(&points[3*i], &dirs[3*i], 3, step[i]);
556}
557
558////////////////////////////////////////////////////////////////////////////////
559/// Compute safe distance from each of the points in the input array.
560/// Input: Array of point coordinates, array of statuses for these points, size of the arrays
561/// Output: Safety values
562
563void TGeoShapeAssembly::Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const
564{
565 for (Int_t i=0; i<vecsize; i++) safe[i] = Safety(&points[3*i], inside[i]);
566}
const Bool_t kFALSE
Definition RtypesCore.h:101
double Double_t
Definition RtypesCore.h:59
float Float_t
Definition RtypesCore.h:57
const Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
static void indent(ostringstream &buf, int indent_level)
XFontStruct * id
Definition TGX11.cxx:109
R__EXTERN TGeoManager * gGeoManager
float xmin
float ymin
float xmax
float ymax
point * points
Definition X3DBuffer.c:22
Generic 3D primitive description class.
Definition TBuffer3D.h:18
Box class.
Definition TGeoBBox.h:18
Double_t fDX
Definition TGeoBBox.h:21
virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const
Compute distance from outside point to surface of the box.
Definition TGeoBBox.cxx:458
virtual void InspectShape() const
Prints shape parameters.
Definition TGeoBBox.cxx:819
Double_t fOrigin[3]
Definition TGeoBBox.h:24
Double_t fDY
Definition TGeoBBox.h:22
virtual Bool_t Contains(const Double_t *point) const
Test if point is inside this shape.
Definition TGeoBBox.cxx:368
Double_t fDZ
Definition TGeoBBox.h:23
TGeoNavigator * GetCurrentNavigator() const
Returns current navigator for the calling thread.
static Int_t GetVerboseLevel()
Set verbosity level (static function).
Geometrical transformation package.
Definition TGeoMatrix.h:41
virtual void MasterToLocal(const Double_t *master, Double_t *local) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix
Class providing navigation API for TGeo geometries.
TGeoNodeCache * GetCache() const
TGeoStateInfo * GetInfo()
Get next state info pointer.
void ReleaseInfo()
Release last used state info pointer.
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition TGeoNode.h:41
TGeoVolume * GetVolume() const
Definition TGeoNode.h:97
virtual TGeoMatrix * GetMatrix() const =0
virtual void LocalToMasterVect(const Double_t *local, Double_t *master) const
Convert a vector from local reference system to mother reference.
Definition TGeoNode.cxx:542
virtual void LocalToMaster(const Double_t *local, Double_t *master) const
Convert the point coordinates from local reference system to mother reference.
Definition TGeoNode.cxx:534
virtual void MasterToLocal(const Double_t *master, Double_t *local) const
Convert the point coordinates from mother reference to local reference system.
Definition TGeoNode.cxx:518
virtual void MasterToLocalVect(const Double_t *master, Double_t *local) const
Convert a vector from mother reference to local reference system.
Definition TGeoNode.cxx:526
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const
computes the closest distance from given point to this shape
Definition TGeoNode.cxx:630
The shape encapsulating an assembly (union) of volumes.
virtual void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const
Check the inside status for each of the points in the array.
virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
Returns numbers of vertices, segments and polygons composing the shape mesh.
virtual void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize)
Compute the normal for an array o points so that norm.dot.dir is positive Input: Arrays of point coor...
virtual void ComputeBBox()
Compute bounding box of the assembly.
virtual void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const
Compute safe distance from each of the points in the input array.
TGeoShapeAssembly()
Default constructor.
virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const
compute distance from outside point to surface of the hyperboloid.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const
in case shape has some negative parameters, these has to be computed in order to fit the mother
TGeoVolumeAssembly * fVolume
virtual void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const
Compute distance from array of input points having directions specified by dirs. Store output in dist...
virtual Bool_t Contains(const Double_t *point) const
Test if point is inside the assembly.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
compute closest distance from point px,py to each vertex. Should not be called.
virtual TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step)
Cannot divide assemblies.
virtual ~TGeoShapeAssembly()
destructor
virtual void SetPoints(Double_t *points) const
No mesh for assemblies.
virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const
Compute distance from inside point to surface of the hyperboloid.
void RecomputeBoxLast()
Recompute bounding box of the assembly after adding a node.
virtual void SetSegsAndPols(TBuffer3D &buff) const
Fill TBuffer3D structure for segments and polygons.
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Compute normal to closest surface from POINT. Should not be called.
virtual void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const
Compute distance from array of input points having directions specified by dirs. Store output in dist...
virtual void InspectShape() const
print shape parameters
virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const
computes the closest distance from given point to this shape, according to option.
Base abstract class for all shapes.
Definition TGeoShape.h:26
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)=0
static Double_t Big()
Definition TGeoShape.h:88
static Bool_t IsSameWithinTolerance(Double_t a, Double_t b)
Check if two numbers differ with less than a tolerance.
virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const =0
virtual const char * GetName() const
Get the shape name.
virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const =0
virtual void ComputeBBox()=0
virtual Bool_t Contains(const Double_t *point) const =0
Volume assemblies.
Definition TGeoVolume.h:305
virtual Int_t GetCurrentNodeIndex() const
virtual Int_t GetNextNodeIndex() const
void SetNextNodeIndex(Int_t index)
void SetCurrentNodeIndex(Int_t index)
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:49
Int_t GetNdaughters() const
Definition TGeoVolume.h:351
TGeoNode * GetNode(const char *name) const
get the pointer to a daughter node
TGeoVoxelFinder * GetVoxels() const
Getter for optimization structure.
TGeoShape * GetShape() const
Definition TGeoVolume.h:189
virtual Int_t GetCurrentNodeIndex() const
Definition TGeoVolume.h:166
virtual Bool_t IsAssembly() const
Returns true if the volume is an assembly or a scaled assembly.
Finder class handling voxels.
Double_t * GetBoxes() const
virtual Int_t * GetCheckList(const Double_t *point, Int_t &nelem, TGeoStateInfo &td)
get the list of daughter indices for which point is inside their bbox
virtual Int_t * GetNextVoxel(const Double_t *point, const Double_t *dir, Int_t &ncheck, TGeoStateInfo &td)
get the list of new candidates for the next voxel crossed by current ray printf("### GetNextVoxel\n")...
Bool_t IsSafeVoxel(const Double_t *point, Int_t inode, Double_t minsafe) const
Computes squared distance from POINT to the voxel(s) containing node INODE.
virtual void SortCrossedVoxels(const Double_t *point, const Double_t *dir, TGeoStateInfo &td)
get the list in the next voxel crossed by a ray
virtual const char * GetName() const
Returns name of object.
Definition TNamed.h:47
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition TObject.cxx:200
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:949
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:963
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition TObject.cxx:991
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition TObject.cxx:937
Basic string class.
Definition TString.h:136
const char * Data() const
Definition TString.h:369
TPaveText * pt
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition fillpatterns.C:1
Short_t Min(Short_t a, Short_t b)
Definition TMathBase.h:176
Short_t Abs(Short_t d)
Definition TMathBase.h:120
Statefull info for the current geometry level.
#define snext(osub1, osub2)
Definition triangle.c:1168