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