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 = nullptr;
38}
39
40////////////////////////////////////////////////////////////////////////////////
41/// Constructor specifying hyperboloid parameters.
42
44{
45 fVolume = vol;
47}
48
49////////////////////////////////////////////////////////////////////////////////
50/// destructor
51
53
54////////////////////////////////////////////////////////////////////////////////
55/// Compute bounding box of the assembly
56
58{
59 if (!fVolume) {
60 Fatal("ComputeBBox", "Assembly shape %s without volume", GetName());
61 return;
62 }
63 // Make sure bbox is computed only once or recomputed only if invalidated (by alignment)
64 if (fBBoxOK)
65 return;
67 if (!nd) {
68 fBBoxOK = kTRUE;
69 return;
70 }
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())
82 node->GetVolume()->GetShape()->ComputeBBox();
83 box = (TGeoBBox *)node->GetVolume()->GetShape();
84 box->SetBoxPoints(vert);
85 for (Int_t ipt = 0; ipt < 8; ipt++) {
86 node->LocalToMaster(&vert[3 * ipt], pt);
87 if (pt[0] < xmin)
88 xmin = pt[0];
89 if (pt[0] > xmax)
90 xmax = pt[0];
91 if (pt[1] < ymin)
92 ymin = pt[1];
93 if (pt[1] > ymax)
94 ymax = pt[1];
95 if (pt[2] < zmin)
96 zmin = pt[2];
97 if (pt[2] > zmax)
98 zmax = pt[2];
99 }
100 }
101 fDX = 0.5 * (xmax - xmin);
102 fOrigin[0] = 0.5 * (xmin + xmax);
103 fDY = 0.5 * (ymax - ymin);
104 fOrigin[1] = 0.5 * (ymin + ymax);
105 fDZ = 0.5 * (zmax - zmin);
106 fOrigin[2] = 0.5 * (zmin + zmax);
107 if (fDX > 0 && fDY > 0 && fDZ > 0)
108 fBBoxOK = kTRUE;
109}
110
111////////////////////////////////////////////////////////////////////////////////
112/// Recompute bounding box of the assembly after adding a node.
113
115{
117 if (!nd) {
118 Warning("RecomputeBoxLast", "No daughters for volume %s yet", fVolume->GetName());
119 return;
120 }
121 TGeoNode *node = fVolume->GetNode(nd - 1);
122 Double_t xmin, xmax, ymin, ymax, zmin, zmax;
123 if (nd == 1) {
124 xmin = ymin = zmin = TGeoShape::Big();
125 xmax = ymax = zmax = -TGeoShape::Big();
126 } else {
127 xmin = fOrigin[0] - fDX;
128 xmax = fOrigin[0] + fDX;
129 ymin = fOrigin[1] - fDY;
130 ymax = fOrigin[1] + fDY;
131 zmin = fOrigin[2] - fDZ;
132 zmax = fOrigin[2] + fDZ;
133 }
134 Double_t vert[24];
135 Double_t pt[3];
136 TGeoBBox *box = (TGeoBBox *)node->GetVolume()->GetShape();
137 if (TGeoShape::IsSameWithinTolerance(box->GetDX(), 0) || node->GetVolume()->IsAssembly())
138 node->GetVolume()->GetShape()->ComputeBBox();
139 box->SetBoxPoints(vert);
140 for (Int_t ipt = 0; ipt < 8; ipt++) {
141 node->LocalToMaster(&vert[3 * ipt], pt);
142 if (pt[0] < xmin)
143 xmin = pt[0];
144 if (pt[0] > xmax)
145 xmax = pt[0];
146 if (pt[1] < ymin)
147 ymin = pt[1];
148 if (pt[1] > ymax)
149 ymax = pt[1];
150 if (pt[2] < zmin)
151 zmin = pt[2];
152 if (pt[2] > zmax)
153 zmax = pt[2];
154 }
155 fDX = 0.5 * (xmax - xmin);
156 fOrigin[0] = 0.5 * (xmin + xmax);
157 fDY = 0.5 * (ymax - ymin);
158 fOrigin[1] = 0.5 * (ymin + ymax);
159 fDZ = 0.5 * (zmax - zmin);
160 fOrigin[2] = 0.5 * (zmin + zmax);
161 fBBoxOK = kTRUE;
162}
163
164////////////////////////////////////////////////////////////////////////////////
165/// Compute normal to closest surface from POINT. Should not be called.
166
167void TGeoShapeAssembly::ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
168{
169 if (!fBBoxOK)
170 ((TGeoShapeAssembly *)this)->ComputeBBox();
171 Int_t inext = fVolume->GetNextNodeIndex();
172 if (inext < 0) {
173 DistFromOutside(point, dir, 3);
174 inext = fVolume->GetNextNodeIndex();
175 if (inext < 0) {
176 Error("ComputeNormal", "Invalid inext=%i (Ncomponents=%i)", inext, fVolume->GetNdaughters());
177 return;
178 }
179 }
180 TGeoNode *node = fVolume->GetNode(inext);
181 Double_t local[3], ldir[3], lnorm[3];
182 node->MasterToLocal(point, local);
183 node->MasterToLocalVect(dir, ldir);
184 node->GetVolume()->GetShape()->ComputeNormal(local, ldir, lnorm);
185 node->LocalToMasterVect(lnorm, norm);
186}
187
188////////////////////////////////////////////////////////////////////////////////
189/// Test if point is inside the assembly
190
192{
193 if (!fBBoxOK)
194 ((TGeoShapeAssembly *)this)->ComputeBBox();
195 if (!TGeoBBox::Contains(point))
196 return kFALSE;
197 TGeoVoxelFinder *voxels = fVolume->GetVoxels();
198 TGeoNode *node;
199 TGeoShape *shape;
200 Int_t *check_list = nullptr;
201 Int_t ncheck, id;
202 Double_t local[3];
203 if (voxels) {
204 // get the list of nodes passing thorough the current voxel
206 TGeoStateInfo &td = *nav->GetCache()->GetInfo();
207 check_list = voxels->GetCheckList(point, ncheck, td);
208 if (!check_list) {
209 nav->GetCache()->ReleaseInfo();
210 return kFALSE;
211 }
212 for (id = 0; id < ncheck; id++) {
213 node = fVolume->GetNode(check_list[id]);
214 shape = node->GetVolume()->GetShape();
215 node->MasterToLocal(point, local);
216 if (shape->Contains(local)) {
217 fVolume->SetCurrentNodeIndex(check_list[id]);
218 fVolume->SetNextNodeIndex(check_list[id]);
219 nav->GetCache()->ReleaseInfo();
220 return kTRUE;
221 }
222 }
223 nav->GetCache()->ReleaseInfo();
224 return kFALSE;
225 }
227 for (id = 0; id < nd; id++) {
228 node = fVolume->GetNode(id);
229 shape = node->GetVolume()->GetShape();
230 node->MasterToLocal(point, local);
231 if (shape->Contains(local)) {
234 return kTRUE;
235 }
236 }
237 return kFALSE;
238}
239
240////////////////////////////////////////////////////////////////////////////////
241/// compute closest distance from point px,py to each vertex. Should not be called.
242
244{
245 return 9999;
246}
247
248////////////////////////////////////////////////////////////////////////////////
249/// Compute distance from inside point to surface of the hyperboloid.
250
251Double_t TGeoShapeAssembly::DistFromInside(const Double_t * /*point*/, const Double_t * /*dir*/, Int_t /*iact*/,
252 Double_t /*step*/, Double_t * /*safe*/) const
253{
254 Info("DistFromInside", "Cannot compute distance from inside the assembly (but from a component)");
255 return TGeoShape::Big();
256}
257
258////////////////////////////////////////////////////////////////////////////////
259/// compute distance from outside point to surface of the hyperboloid.
260/// fVolume->SetNextNodeIndex(-1);
261
263 Double_t *safe) const
264{
265#ifdef TGEO_DEBUG
266 static int indent = 0;
267 indent++;
268 TString sindent = "";
269 for (Int_t k = 0; k < indent; k++)
270 sindent += " ";
272#endif
273 if (!fBBoxOK)
274 ((TGeoShapeAssembly *)this)->ComputeBBox();
275 if (iact < 3 && safe) {
276 *safe = Safety(point, kFALSE);
277#ifdef TGEO_DEBUG
278 indent--;
279#endif
280 if (iact == 0)
281 return TGeoShape::Big();
282 if ((iact == 1) && (step <= *safe))
283 return TGeoShape::Big();
284#ifdef TGEO_DEBUG
285 indent++;
286#endif
287 }
288 // find distance to assembly
289 Double_t snext = 0.0;
290 Double_t dist;
291 Double_t stepmax = step;
292 Double_t pt[3];
293 Int_t i;
294 Bool_t found = kFALSE;
295 memcpy(pt, point, 3 * sizeof(Double_t));
296#ifdef TGEO_DEBUG
297 if (idebug > 4)
298 printf("%s[%d] assembly %s checking distance to %d daughters...\n", sindent.Data(), indent, fVolume->GetName(),
300#endif
301
302 if (!TGeoBBox::Contains(point)) {
303 snext = TGeoBBox::DistFromOutside(point, dir, 3, stepmax);
304 // Approach bounding box to minimize errors
305 snext = TMath::Min(0.01 * snext, 1.E-6);
306#ifdef TGEO_DEBUG
307 if (idebug > 4 && snext > stepmax)
308 printf("%s[%d] %s: bbox not crossed\n", sindent.Data(), indent, fVolume->GetName());
309 indent--;
310#endif
311 if (snext > stepmax)
312 return TGeoShape::Big();
313#ifdef TGEO_DEBUG
314 indent++;
315#endif
316 for (i = 0; i < 3; i++)
317 pt[i] += snext * dir[i];
318// if (Contains(pt)) {
319#ifdef TGEO_DEBUG
320// if (idebug>4) printf("%s[%d] Propagation to BBox of %s entered the component %s at %f\n", sindent.Data(),
321// indent, fVolume->GetName(), fVolume->GetNode(fVolume->GetCurrentNodeIndex())->GetName(), snext); indent--;
322#endif
323 // fVolume->SetNextNodeIndex(fVolume->GetCurrentNodeIndex());
324 // return snext;
325 // }
326 // snext += TGeoShape::Tolerance();
327 stepmax -= snext;
328 }
329 // Point represented by pt is now inside the bounding box - find distance to components
331 TGeoNode *node;
332 Double_t lpoint[3], ldir[3];
333 TGeoVoxelFinder *voxels = fVolume->GetVoxels();
334 if (nd < 5 || !voxels) {
335 for (i = 0; i < nd; i++) {
336 node = fVolume->GetNode(i);
337 if (voxels && voxels->IsSafeVoxel(pt, i, stepmax))
338 continue;
339 node->MasterToLocal(pt, lpoint);
340 node->MasterToLocalVect(dir, ldir);
341#ifdef TGEO_DEBUG
342 if (idebug > 4)
343 printf("%s[%d] distance to %s ...\n", sindent.Data(), indent, node->GetName());
344#endif
345 dist = node->GetVolume()->GetShape()->DistFromOutside(lpoint, ldir, 3, stepmax);
346 if (dist < stepmax) {
347#ifdef TGEO_DEBUG
348 if (idebug > 4) {
349 printf("%s[%d] %s -> from local=(%19.16f, %19.16f, %19.16f, %19.16f, %19.16f, %19.16f)\n",
350 sindent.Data(), indent, fVolume->GetName(), lpoint[0], lpoint[1], lpoint[2], ldir[0], ldir[1],
351 ldir[2]);
352 printf("%s[%d] -> (l)to: %s shape %s snext=%g\n", sindent.Data(), indent, node->GetName(),
353 node->GetVolume()->GetShape()->ClassName(), dist);
354 }
355#endif
356
357 stepmax = dist;
359 found = kTRUE;
360 }
361 }
362 if (found) {
363 snext += stepmax;
364#ifdef TGEO_DEBUG
365 if (idebug > 4)
366 printf("%s[%d] %s: found %s at %f\n", sindent.Data(), indent, fVolume->GetName(),
368 indent--;
369#endif
370 return snext;
371 }
372#ifdef TGEO_DEBUG
373 if (idebug > 4)
374 printf("%s[%d] %s: no daughter crossed\n", sindent.Data(), indent, fVolume->GetName());
375 indent--;
376#endif
377 return TGeoShape::Big();
378 }
379 // current volume is voxelized, first get current voxel
380 Int_t ncheck = 0;
381 Int_t *vlist = nullptr;
383 TGeoStateInfo &td = *nav->GetCache()->GetInfo();
384
385 voxels->SortCrossedVoxels(pt, dir, td);
386 while ((vlist = voxels->GetNextVoxel(pt, dir, ncheck, td))) {
387 for (i = 0; i < ncheck; i++) {
388 node = fVolume->GetNode(vlist[i]);
389 node->MasterToLocal(pt, lpoint);
390 node->MasterToLocalVect(dir, ldir);
391#ifdef TGEO_DEBUG
392 if (idebug > 4)
393 printf("%s[%d] distance to %s ...\n", sindent.Data(), indent, node->GetName());
394#endif
395 dist = node->GetVolume()->GetShape()->DistFromOutside(lpoint, ldir, 3, stepmax);
396 if (dist < stepmax) {
397#ifdef TGEO_DEBUG
398 if (idebug > 4) {
399 printf("%s[%d] %s -> from local=(%19.16f, %19.16f, %19.16f, %19.16f, %19.16f, %19.16f)\n",
400 sindent.Data(), indent, fVolume->GetName(), lpoint[0], lpoint[1], lpoint[2], ldir[0], ldir[1],
401 ldir[2]);
402 printf("%s[%d] -> to: %s shape %s snext=%g\n", sindent.Data(), indent, node->GetName(),
403 node->GetVolume()->GetShape()->ClassName(), dist);
404 }
405#endif
406 stepmax = dist;
407 fVolume->SetNextNodeIndex(vlist[i]);
408 found = kTRUE;
409 }
410 }
411 }
412 nav->GetCache()->ReleaseInfo();
413 if (found) {
414 snext += stepmax;
415#ifdef TGEO_DEBUG
416 if (idebug > 4)
417 printf("%s[%d] %s: found %s at %f\n", sindent.Data(), indent, fVolume->GetName(),
419 indent--;
420#endif
421 return snext;
422 }
423#ifdef TGEO_DEBUG
424 if (idebug > 4)
425 printf("%s[%d] %s: no daughter crossed\n", sindent.Data(), indent, fVolume->GetName());
426 indent--;
427#endif
428 return TGeoShape::Big();
429}
430
431////////////////////////////////////////////////////////////////////////////////
432/// Cannot divide assemblies.
433
434TGeoVolume *TGeoShapeAssembly::Divide(TGeoVolume * /*voldiv*/, const char *divname, Int_t /*iaxis*/, Int_t /*ndiv*/,
435 Double_t /*start*/, Double_t /*step*/)
436{
437 Error("Divide", "Assemblies cannot be divided. Division volume %s not created", divname);
438 return nullptr;
439}
440
441////////////////////////////////////////////////////////////////////////////////
442/// in case shape has some negative parameters, these has to be computed
443/// in order to fit the mother
444
446{
447 Error("GetMakeRuntimeShape", "Assemblies cannot be parametrized.");
448 return nullptr;
449}
450
451////////////////////////////////////////////////////////////////////////////////
452/// print shape parameters
453
455{
456 printf("*** Shape %s: TGeoShapeAssembly ***\n", GetName());
457 printf(" Volume assembly %s with %i nodes\n", fVolume->GetName(), fVolume->GetNdaughters());
458 printf(" Bounding box:\n");
459 if (!fBBoxOK)
460 ((TGeoShapeAssembly *)this)->ComputeBBox();
462}
463
464////////////////////////////////////////////////////////////////////////////////
465/// Fill TBuffer3D structure for segments and polygons.
466
468{
469 Error("SetSegsAndPols", "Drawing functions should not be called for assemblies, but rather for their content");
470}
471
472////////////////////////////////////////////////////////////////////////////////
473/// computes the closest distance from given point to this shape, according
474/// to option. The matching point on the shape is stored in spoint.
475
477{
478 Double_t safety = TGeoShape::Big();
479 Double_t pt[3], loc[3];
480 if (!fBBoxOK)
481 ((TGeoShapeAssembly *)this)->ComputeBBox();
482 if (in) {
484 TGeoVolume *vol = fVolume;
485 TGeoNode *node;
486 memcpy(loc, point, 3 * sizeof(Double_t));
487 while (index >= 0) {
488 memcpy(pt, loc, 3 * sizeof(Double_t));
489 node = vol->GetNode(index);
490 node->GetMatrix()->MasterToLocal(pt, loc);
491 vol = node->GetVolume();
492 index = vol->GetCurrentNodeIndex();
493 if (index < 0) {
494 safety = vol->GetShape()->Safety(loc, in);
495 return safety;
496 }
497 }
498 return TGeoShape::Big();
499 }
500 Double_t safe;
501 TGeoVoxelFinder *voxels = fVolume->GetVoxels();
503 Double_t *boxes = nullptr;
504 if (voxels)
505 boxes = voxels->GetBoxes();
506 TGeoNode *node;
507 for (Int_t id = 0; id < nd; id++) {
508 if (boxes && id > 0) {
509 Int_t ist = 6 * id;
510 Double_t dxyz = 0.;
511 Double_t dxyz0 = TMath::Abs(point[0] - boxes[ist + 3]) - boxes[ist];
512 if (dxyz0 > safety)
513 continue;
514 Double_t dxyz1 = TMath::Abs(point[1] - boxes[ist + 4]) - boxes[ist + 1];
515 if (dxyz1 > safety)
516 continue;
517 Double_t dxyz2 = TMath::Abs(point[2] - boxes[ist + 5]) - boxes[ist + 2];
518 if (dxyz2 > safety)
519 continue;
520 if (dxyz0 > 0)
521 dxyz += dxyz0 * dxyz0;
522 if (dxyz1 > 0)
523 dxyz += dxyz1 * dxyz1;
524 if (dxyz2 > 0)
525 dxyz += dxyz2 * dxyz2;
526 if (dxyz >= safety * safety)
527 continue;
528 }
529 node = fVolume->GetNode(id);
530 safe = node->Safety(point, kFALSE);
531 if (safe <= 0.0)
532 return 0.0;
533 if (safe < safety)
534 safety = safe;
535 }
536 return safety;
537}
538
539////////////////////////////////////////////////////////////////////////////////
540/// Save a primitive as a C++ statement(s) on output stream "out".
541
542void TGeoShapeAssembly::SavePrimitive(std::ostream & /*out*/, Option_t * /*option*/ /*= ""*/) {}
543
544////////////////////////////////////////////////////////////////////////////////
545/// No mesh for assemblies.
546
548{
549 Error("SetPoints", "Drawing functions should not be called for assemblies, but rather for their content");
550}
551
552////////////////////////////////////////////////////////////////////////////////
553/// No mesh for assemblies.
554
555void TGeoShapeAssembly::SetPoints(Float_t * /*points*/) const
556{
557 Error("SetPoints", "Drawing functions should not be called for assemblies, but rather for their content");
558}
559
560////////////////////////////////////////////////////////////////////////////////
561/// Returns numbers of vertices, segments and polygons composing the shape mesh.
562
563void TGeoShapeAssembly::GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
564{
565 nvert = 0;
566 nsegs = 0;
567 npols = 0;
568}
569
570////////////////////////////////////////////////////////////////////////////////
571/// Check the inside status for each of the points in the array.
572/// Input: Array of point coordinates + vector size
573/// Output: Array of Booleans for the inside of each point
574
575void TGeoShapeAssembly::Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const
576{
577 for (Int_t i = 0; i < vecsize; i++)
578 inside[i] = Contains(&points[3 * i]);
579}
580
581////////////////////////////////////////////////////////////////////////////////
582/// Compute the normal for an array o points so that norm.dot.dir is positive
583/// Input: Arrays of point coordinates and directions + vector size
584/// Output: Array of normal directions
585
587{
588 for (Int_t i = 0; i < vecsize; i++)
589 ComputeNormal(&points[3 * i], &dirs[3 * i], &norms[3 * i]);
590}
591
592////////////////////////////////////////////////////////////////////////////////
593/// Compute distance from array of input points having directions specified by dirs. Store output in dists
594
596 Double_t *step) const
597{
598 for (Int_t i = 0; i < vecsize; i++)
599 dists[i] = DistFromInside(&points[3 * i], &dirs[3 * i], 3, step[i]);
600}
601
602////////////////////////////////////////////////////////////////////////////////
603/// Compute distance from array of input points having directions specified by dirs. Store output in dists
604
606 Double_t *step) const
607{
608 for (Int_t i = 0; i < vecsize; i++)
609 dists[i] = DistFromOutside(&points[3 * i], &dirs[3 * i], 3, step[i]);
610}
611
612////////////////////////////////////////////////////////////////////////////////
613/// Compute safe distance from each of the points in the input array.
614/// Input: Array of point coordinates, array of statuses for these points, size of the arrays
615/// Output: Safety values
616
617void TGeoShapeAssembly::Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const
618{
619 for (Int_t i = 0; i < vecsize; i++)
620 safe[i] = Safety(&points[3 * i], inside[i]);
621}
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:377
static void indent(ostringstream &buf, int indent_level)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
R__EXTERN TGeoManager * gGeoManager
float xmin
float ymin
float xmax
float ymax
Generic 3D primitive description class.
Definition TBuffer3D.h:18
Box class.
Definition TGeoBBox.h:17
Double_t fDX
Definition TGeoBBox.h:20
Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
Compute distance from outside point to surface of the box.
Definition TGeoBBox.cxx:477
Double_t fOrigin[3]
Definition TGeoBBox.h:23
void InspectShape() const override
Prints shape parameters.
Definition TGeoBBox.cxx:855
Bool_t Contains(const Double_t *point) const override
Test if point is inside this shape.
Definition TGeoBBox.cxx:368
Double_t fDY
Definition TGeoBBox.h:21
Double_t fDZ
Definition TGeoBBox.h:22
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:38
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:39
TGeoVolume * GetVolume() const
Definition TGeoNode.h:99
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:590
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:582
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:566
virtual void MasterToLocalVect(const Double_t *master, Double_t *local) const
Convert a vector from mother reference to local reference system.
Definition TGeoNode.cxx:574
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:682
The shape encapsulating an assembly (union) of volumes.
Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
compute distance from outside point to surface of the hyperboloid.
~TGeoShapeAssembly() override
destructor
void SetPoints(Double_t *points) const override
No mesh for assemblies.
void InspectShape() const override
print shape parameters
TGeoShapeAssembly()
Default constructor.
TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override
in case shape has some negative parameters, these has to be computed in order to fit the mother
void ComputeBBox() override
Compute bounding box of the assembly.
void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Compute distance from array of input points having directions specified by dirs. Store output in dist...
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
compute closest distance from point px,py to each vertex. Should not be called.
TGeoVolumeAssembly * fVolume
void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override
Check the inside status for each of the points in the array.
void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override
Compute safe distance from each of the points in the input array.
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override
Compute normal to closest surface from POINT. Should not be called.
void RecomputeBoxLast()
Recompute bounding box of the assembly after adding a node.
Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
Compute distance from inside point to surface of the hyperboloid.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
computes the closest distance from given point to this shape, according to option.
Bool_t Contains(const Double_t *point) const override
Test if point is inside the assembly.
void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Compute distance from array of input points having directions specified by dirs. Store output in dist...
void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override
Compute the normal for an array o points so that norm.dot.dir is positive Input: Arrays of point coor...
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
Cannot divide assemblies.
void SetSegsAndPols(TBuffer3D &buff) const override
Fill TBuffer3D structure for segments and polygons.
void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override
Returns numbers of vertices, segments and polygons composing the shape mesh.
Base abstract class for all shapes.
Definition TGeoShape.h:25
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)=0
static Double_t Big()
Definition TGeoShape.h:87
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 Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const =0
const char * GetName() const override
Get the shape name.
virtual void ComputeBBox()=0
virtual Bool_t Contains(const Double_t *point) const =0
Volume assemblies.
Definition TGeoVolume.h:316
Int_t GetNextNodeIndex() const override
void SetNextNodeIndex(Int_t index)
Int_t GetCurrentNodeIndex() const override
void SetCurrentNodeIndex(Int_t index)
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:43
Int_t GetNdaughters() const
Definition TGeoVolume.h:362
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:190
virtual Int_t GetCurrentNodeIndex() const
Definition TGeoVolume.h:167
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
const char * GetName() const override
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:207
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:973
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:987
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition TObject.cxx:1015
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition TObject.cxx:961
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
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)
Returns the smallest of a and b.
Definition TMathBase.h:198
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:123
Statefull info for the current geometry level.