Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGeoEltu.cxx
Go to the documentation of this file.
1// @(#)root/geom:$Id$
2// Author: Mihaela Gheata 05/06/02
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/** \class TGeoEltu
13\ingroup Tubes
14
15An elliptical tube is defined by the two semi-axes `A` and `B`. It ranges
16from `-dZ` to `+dZ` as all other tubes:
17
18~~~ {.cpp}
19TGeoEltu(Double_t a,Double_t b,Double_t dz);
20~~~
21
22Begin_Macro
23{
24 TCanvas *c = new TCanvas("c", "c",0,0,600,600);
25 new TGeoManager("eltu", "poza6");
26 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
27 TGeoMedium *med = new TGeoMedium("MED",1,mat);
28 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
29 gGeoManager->SetTopVolume(top);
30 TGeoVolume *vol = gGeoManager->MakeEltu("ELTU",med, 30,10,40);
31 top->AddNode(vol,1);
32 gGeoManager->CloseGeometry();
33 gGeoManager->SetNsegments(50);
34 top->Draw();
35 TView *view = gPad->GetView();
36 if (view) view->ShowAxis();
37}
38End_Macro
39*/
40
41#include <iostream>
42
43#include "TGeoManager.h"
44#include "TGeoVolume.h"
45#include "TGeoEltu.h"
46#include "TBuffer3D.h"
47#include "TBuffer3DTypes.h"
48#include "TMath.h"
49
50
51////////////////////////////////////////////////////////////////////////////////
52/// Dummy constructor
53
58
59////////////////////////////////////////////////////////////////////////////////
60/// Default constructor specifying X and Y semiaxis length
61
68
69////////////////////////////////////////////////////////////////////////////////
70/// Default constructor specifying X and Y semiaxis length
71
79
80////////////////////////////////////////////////////////////////////////////////
81/// Default constructor specifying minimum and maximum radius
82/// param[0] = A
83/// param[1] = B
84/// param[2] = dz
85
92
93////////////////////////////////////////////////////////////////////////////////
94/// destructor
95
97
98////////////////////////////////////////////////////////////////////////////////
99/// Computes capacity of the shape in [length^3]
100
102{
103 Double_t capacity = 2. * TMath::Pi() * fDz * fRmin * fRmax;
104 return capacity;
105}
106
107////////////////////////////////////////////////////////////////////////////////
108/// compute bounding box of the tube
109
111{
112 fDX = fRmin;
113 fDY = fRmax;
114 fDZ = fDz;
115}
116
117////////////////////////////////////////////////////////////////////////////////
118/// Compute normal to closest surface from POINT.
119
120void TGeoEltu::ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) const
121{
122 Double_t a = fRmin;
123 Double_t b = fRmax;
124 Double_t safr = TMath::Abs(TMath::Sqrt(point[0] * point[0] / (a * a) + point[1] * point[1] / (b * b)) - 1.);
125 safr *= TMath::Min(a, b);
126 Double_t safz = TMath::Abs(fDz - TMath::Abs(point[2]));
127 if (safz < safr) {
128 norm[0] = norm[1] = 0;
129 norm[2] = TMath::Sign(1., dir[2]);
130 return;
131 }
132 norm[2] = 0.;
133 norm[0] = point[0] * b * b;
134 norm[1] = point[1] * a * a;
136}
137
138////////////////////////////////////////////////////////////////////////////////
139/// test if point is inside the elliptical tube
140
142{
143 if (TMath::Abs(point[2]) > fDz)
144 return kFALSE;
145 Double_t r2 = (point[0] * point[0]) / (fRmin * fRmin) + (point[1] * point[1]) / (fRmax * fRmax);
146 if (r2 > 1.)
147 return kFALSE;
148 return kTRUE;
149}
150
151////////////////////////////////////////////////////////////////////////////////
152/// compute closest distance from point px,py to each vertex
153
155{
157 const Int_t numPoints = 4 * n;
158 return ShapeDistancetoPrimitive(numPoints, px, py);
159}
160
161////////////////////////////////////////////////////////////////////////////////
162/// compute distance from inside point to surface of the tube
163
166{
168 Double_t b2 = fRmax * fRmax;
169 Double_t safz1 = fDz - point[2];
170 Double_t safz2 = fDz + point[2];
171
172 if (iact < 3 && safe) {
173 Double_t x0 = TMath::Abs(point[0]);
174 Double_t y0 = TMath::Abs(point[1]);
175 Double_t x1 = x0;
176 Double_t y1 = TMath::Sqrt((fRmin - x0) * (fRmin + x0)) * fRmax / fRmin;
177 Double_t y2 = y0;
178 Double_t x2 = TMath::Sqrt((fRmax - y0) * (fRmax + y0)) * fRmin / fRmax;
179 Double_t d1 = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0);
180 Double_t d2 = (x2 - x0) * (x2 - x0) + (y2 - y0) * (y2 - y0);
181 Double_t x3, y3;
182
184 for (Int_t i = 0; i < 8; i++) {
185 if (fRmax < fRmin) {
186 x3 = 0.5 * (x1 + x2);
187 y3 = TMath::Sqrt((fRmin - x3) * (fRmin + x3)) * fRmax / fRmin;
188 ;
189 } else {
190 y3 = 0.5 * (y1 + y2);
191 x3 = TMath::Sqrt((fRmax - y3) * (fRmax + y3)) * fRmin / fRmax;
192 }
193 if (d1 < d2) {
194 x2 = x3;
195 y2 = y3;
196 d2 = (x2 - x0) * (x2 - x0) + (y2 - y0) * (y2 - y0);
197 } else {
198 x1 = x3;
199 y1 = y3;
200 d1 = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0);
201 }
202 }
203 Double_t safr = TMath::Sqrt(d1) - 1.0E-3;
205 if (iact == 0)
206 return TGeoShape::Big();
207 if ((iact == 1) && (*safe > step))
208 return TGeoShape::Big();
209 }
210 // compute distance to surface
211 // Do Z
213 if (dir[2] > 0) {
214 snxt = safz1 / dir[2];
215 } else {
216 if (dir[2] < 0)
217 snxt = -safz2 / dir[2];
218 }
219 Double_t sz = snxt;
220 Double_t xz = point[0] + dir[0] * sz;
221 Double_t yz = point[1] + dir[1] * sz;
222 if ((xz * xz / a2 + yz * yz / b2) <= 1)
223 return snxt;
224 // do elliptical surface
226 Double_t u = dir[0] * dir[0] * b2 + dir[1] * dir[1] * a2;
227 Double_t v = point[0] * dir[0] * b2 + point[1] * dir[1] * a2;
228 Double_t w = point[0] * point[0] * b2 + point[1] * point[1] * a2 - a2 * b2;
229 Double_t d = v * v - u * w;
230 if (d < 0 || TGeoShape::IsSameWithinTolerance(u, 0))
231 return tolerance;
233 snxt = (-v + sd) / u;
234
235 if (snxt < 0)
236 return tolerance;
237 return snxt;
238}
239
240////////////////////////////////////////////////////////////////////////////////
241/// compute distance from outside point to surface of the tube and safe distance
242
245{
246 Double_t safz = TMath::Abs(point[2]) - fDz;
248 Double_t b2 = fRmax * fRmax;
249 if (iact < 3 && safe) {
250 Double_t x0 = TMath::Abs(point[0]);
251 Double_t y0 = TMath::Abs(point[1]);
252 *safe = 0.;
253 if ((x0 * x0 / a2 + y0 * y0 / b2) >= 1) {
254 Double_t phi1 = 0;
255 Double_t phi2 = 0.5 * TMath::Pi();
257 Double_t x3 = 0., y3 = 0., d;
258 for (Int_t i = 0; i < 10; i++) {
259 phi3 = (phi1 + phi2) * 0.5;
260 x3 = fRmin * TMath::Cos(phi3);
261 y3 = fRmax * TMath::Sin(phi3);
262 d = y3 * a2 * (x0 - x3) - x3 * b2 * (y0 - y3);
263 if (d < 0)
264 phi1 = phi3;
265 else
266 phi2 = phi3;
267 }
268 *safe = TMath::Sqrt((x0 - x3) * (x0 - x3) + (y0 - y3) * (y0 - y3));
269 }
270 if (safz > 0) {
271 *safe = TMath::Sqrt((*safe) * (*safe) + safz * safz);
272 }
273 if (iact == 0)
274 return TGeoShape::Big();
275 if ((iact == 1) && (step < *safe))
276 return TGeoShape::Big();
277 }
278 // compute vector distance
279 Double_t zi, tau;
281 if (safz > -epsil) {
282 // point beyond the z limit (up or down)
283 // Check if direction is outgoing
284 if (point[2] * dir[2] > 0)
285 return TGeoShape::Big();
286 // Check if direction is perpendicular to Z axis
288 return TGeoShape::Big();
289 // select +z or -z depending on the side of the point
290 zi = (point[2] > 0) ? fDz : -fDz;
291 // Distance to zi plane position
292 tau = (zi - point[2]) / dir[2];
293 // Extrapolated coordinates at the z position of the end plane.
294 Double_t xz = point[0] + dir[0] * tau;
295 Double_t yz = point[1] + dir[1] * tau;
296 if ((xz * xz / a2 + yz * yz / b2) < 1)
297 return tau;
298 }
299
300 // Check if the bounding box is crossed within the requested distance
301 Double_t sdist = TGeoBBox::DistFromOutside(point, dir, fDX, fDY, fDZ, fOrigin, step);
302 if (sdist >= step)
303 return TGeoShape::Big();
304 Double_t u = dir[0] * dir[0] * b2 + dir[1] * dir[1] * a2; // positive
306 return TGeoShape::Big();
307 Double_t v = point[0] * dir[0] * b2 + point[1] * dir[1] * a2;
308 Double_t w = point[0] * point[0] * b2 + point[1] * point[1] * a2 - a2 * b2;
309 Double_t d = v * v - u * w;
310 if (d < 0)
311 return TGeoShape::Big();
313 // Biggest solution - if negative, or very close to boundary
314 // no crossing (just exiting, no re-entering possible)
315 tau = (-v + dsq) / u;
316 if (tau < epsil)
317 return TGeoShape::Big();
318 // only entering crossing must be considered (smallest)
319 tau = (-v - dsq) / u;
320 zi = point[2] + tau * dir[2];
321 // If the crossing point is not in the Z range, there is no crossing
322 if ((TMath::Abs(zi) - fDz) > 0)
323 return TGeoShape::Big();
324 // crossing is backwards (point inside the ellipse) in Z range
325 if (tau < 0)
326 return 0.;
327 // Point is outside and crossing the elliptical tube in Z range
328 return tau;
329}
330
331////////////////////////////////////////////////////////////////////////////////
332/// Divide the shape along one axis.
333
334TGeoVolume *TGeoEltu::Divide(TGeoVolume * /*voldiv*/, const char * /*divname*/, Int_t /*iaxis*/, Int_t /*ndiv*/,
335 Double_t /*start*/, Double_t /*step*/)
336{
337 Error("Divide", "Elliptical tubes divisions not implemented");
338 return nullptr;
339}
340
341////////////////////////////////////////////////////////////////////////////////
342/// Fill vector param[4] with the bounding cylinder parameters. The order
343/// is the following : Rmin, Rmax, Phi1, Phi2
344
346{
347 param[0] = 0.; // Rmin
348 param[1] = TMath::Max(fRmin, fRmax); // Rmax
349 param[1] *= param[1];
350 param[2] = 0.; // Phi1
351 param[3] = 360.; // Phi2
352}
353
354////////////////////////////////////////////////////////////////////////////////
355/// in case shape has some negative parameters, these has to be computed
356/// in order to fit the mother
357
359{
361 return nullptr;
362 if (!mother->TestShapeBit(kGeoEltu)) {
363 Error("GetMakeRuntimeShape", "invalid mother");
364 return nullptr;
365 }
366 Double_t a, b, dz;
367 a = fRmin;
368 b = fRmax;
369 dz = fDz;
370 if (fDz < 0)
371 dz = ((TGeoEltu *)mother)->GetDz();
372 if (fRmin < 0)
373 a = ((TGeoEltu *)mother)->GetA();
374 if (fRmax < 0)
375 a = ((TGeoEltu *)mother)->GetB();
376
377 return (new TGeoEltu(a, b, dz));
378}
379
380////////////////////////////////////////////////////////////////////////////////
381/// print shape parameters
382
384{
385 printf("*** Shape %s: TGeoEltu ***\n", GetName());
386 printf(" A = %11.5f\n", fRmin);
387 printf(" B = %11.5f\n", fRmax);
388 printf(" dz = %11.5f\n", fDz);
389 printf(" Bounding box:\n");
391}
392
393////////////////////////////////////////////////////////////////////////////////
394/// computes the closest distance from given point to this shape, according
395/// to option. The matching point on the shape is stored in spoint.
396
397Double_t TGeoEltu::Safety(const Double_t *point, Bool_t /*in*/) const
398{
399 Double_t x0 = TMath::Abs(point[0]);
400 Double_t y0 = TMath::Abs(point[1]);
401 Double_t x1, y1, dx, dy;
405 Double_t sqdist = x0 * x0 / (fRmin * fRmin) + y0 * y0 / (fRmax * fRmax);
406 Bool_t in = kTRUE;
407 if (sqdist > onepls)
408 in = kFALSE;
409 else if (sqdist < onemin)
410 in = kTRUE;
411 else
412 return 0.;
413
414 if (in) {
415 x1 = fRmin * TMath::Sqrt(1. - (y0 * y0) / (fRmax * fRmax));
416 y1 = fRmax * TMath::Sqrt(1. - (x0 * x0) / (fRmin * fRmin));
417 dx = x1 - x0;
418 dy = y1 - y0;
420 return 0;
421 safr = dx * dy / TMath::Sqrt(dx * dx + dy * dy);
422 safz = fDz - TMath::Abs(point[2]);
423 return TMath::Min(safr, safz);
424 }
425
426 if (TMath::Abs(x0) < TGeoShape::Tolerance()) {
427 safr = y0 - fRmax;
428 } else {
430 safr = x0 - fRmin;
431 } else {
432 Double_t f = fRmin * fRmax / TMath::Sqrt(x0 * x0 * fRmax * fRmax + y0 * y0 * fRmin * fRmin);
433 x1 = f * x0;
434 y1 = f * y0;
435 dx = x0 - x1;
436 dy = y0 - y1;
437 Double_t ast = fRmin * y1 / fRmax;
438 Double_t bct = fRmax * x1 / fRmin;
440 safr = (dx * bct + dy * ast) / d;
441 }
442 }
443 safz = TMath::Abs(point[2]) - fDz;
444 return TMath::Max(safr, safz);
445}
446
447////////////////////////////////////////////////////////////////////////////////
448/// Save a primitive as a C++ statement(s) on output stream "out".
449
450void TGeoEltu::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
451{
453 return;
454 out << " // Shape: " << GetName() << " type: " << ClassName() << std::endl;
455 out << " a = " << fRmin << ";" << std::endl;
456 out << " b = " << fRmax << ";" << std::endl;
457 out << " dz = " << fDz << ";" << std::endl;
458 out << " TGeoShape *" << GetPointerName() << " = new TGeoEltu(\"" << GetName() << "\",a,b,dz);" << std::endl;
460}
461
462////////////////////////////////////////////////////////////////////////////////
463/// Set dimensions of the elliptical tube.
464
466{
467 if ((a <= 0) || (b < 0) || (dz < 0)) {
469 }
470 fRmin = a;
471 fRmax = b;
472 fDz = dz;
473}
474
475////////////////////////////////////////////////////////////////////////////////
476/// Set shape dimensions starting from an array.
477
479{
480 Double_t a = param[0];
481 Double_t b = param[1];
482 Double_t dz = param[2];
484}
485
486////////////////////////////////////////////////////////////////////////////////
487/// Create elliptical tube mesh points
488
490{
491 Double_t dz;
492 Int_t j, n;
493
495 Double_t dphi = 360. / n;
496 Double_t phi = 0;
498 dz = fDz;
499
500 Int_t indx = 0;
501 Double_t r2, r;
503 Double_t b2 = fRmax * fRmax;
504
505 if (points) {
506 for (j = 0; j < n; j++) {
507 points[indx + 6 * n] = points[indx] = 0;
508 indx++;
509 points[indx + 6 * n] = points[indx] = 0;
510 indx++;
511 points[indx + 6 * n] = dz;
512 points[indx] = -dz;
513 indx++;
514 }
515 for (j = 0; j < n; j++) {
516 phi = j * dphi * TMath::DegToRad();
517 sph = TMath::Sin(phi);
518 cph = TMath::Cos(phi);
519 r2 = (a2 * b2) / (b2 + (a2 - b2) * sph * sph);
520 r = TMath::Sqrt(r2);
521 points[indx + 6 * n] = points[indx] = r * cph;
522 indx++;
523 points[indx + 6 * n] = points[indx] = r * sph;
524 indx++;
525 points[indx + 6 * n] = dz;
526 points[indx] = -dz;
527 indx++;
528 }
529 }
530}
531
532////////////////////////////////////////////////////////////////////////////////
533/// Returns numbers of vertices, segments and polygons composing the shape mesh.
534
539
540////////////////////////////////////////////////////////////////////////////////
541/// Returns the number of vertices on the mesh.
542
547
548////////////////////////////////////////////////////////////////////////////////
549/// Create elliptical tube mesh points
550
552{
553 Double_t dz;
554 Int_t j, n;
555
557 Double_t dphi = 360. / n;
558 Double_t phi = 0;
560 dz = fDz;
561
562 Int_t indx = 0;
563 Double_t r2, r;
565 Double_t b2 = fRmax * fRmax;
566
567 if (points) {
568 for (j = 0; j < n; j++) {
569 points[indx + 6 * n] = points[indx] = 0;
570 indx++;
571 points[indx + 6 * n] = points[indx] = 0;
572 indx++;
573 points[indx + 6 * n] = dz;
574 points[indx] = -dz;
575 indx++;
576 }
577 for (j = 0; j < n; j++) {
578 phi = j * dphi * TMath::DegToRad();
579 sph = TMath::Sin(phi);
580 cph = TMath::Cos(phi);
581 r2 = (a2 * b2) / (b2 + (a2 - b2) * sph * sph);
582 r = TMath::Sqrt(r2);
583 points[indx + 6 * n] = points[indx] = r * cph;
584 indx++;
585 points[indx + 6 * n] = points[indx] = r * sph;
586 indx++;
587 points[indx + 6 * n] = dz;
588 points[indx] = -dz;
589 indx++;
590 }
591 }
592}
593
594////////////////////////////////////////////////////////////////////////////////
595/// Fills a static 3D buffer and returns a reference.
596
598{
599 static TBuffer3D buffer(TBuffer3DTypes::kGeneric);
601
604 Int_t nbPnts = 4 * n;
605 Int_t nbSegs = 8 * n;
606 Int_t nbPols = 4 * n;
607 if (buffer.SetRawSizes(nbPnts, 3 * nbPnts, nbSegs, 3 * nbSegs, nbPols, 6 * nbPols)) {
609 }
610 }
612 SetPoints(buffer.fPnts);
613 if (!buffer.fLocalFrame) {
614 TransformPoints(buffer.fPnts, buffer.NbPnts());
615 }
616 SetSegsAndPols(buffer);
618 }
619
620 return buffer;
621}
622
623////////////////////////////////////////////////////////////////////////////////
624/// Check the inside status for each of the points in the array.
625/// Input: Array of point coordinates + vector size
626/// Output: Array of Booleans for the inside of each point
627
629{
630 for (Int_t i = 0; i < vecsize; i++)
631 inside[i] = Contains(&points[3 * i]);
632}
633
634////////////////////////////////////////////////////////////////////////////////
635/// Compute the normal for an array o points so that norm.dot.dir is positive
636/// Input: Arrays of point coordinates and directions + vector size
637/// Output: Array of normal directions
638
640{
641 for (Int_t i = 0; i < vecsize; i++)
642 ComputeNormal(&points[3 * i], &dirs[3 * i], &norms[3 * i]);
643}
644
645////////////////////////////////////////////////////////////////////////////////
646/// Compute distance from array of input points having directions specified by dirs. Store output in dists
647
649 Double_t *step) const
650{
651 for (Int_t i = 0; i < vecsize; i++)
652 dists[i] = DistFromInside(&points[3 * i], &dirs[3 * i], 3, step[i]);
653}
654
655////////////////////////////////////////////////////////////////////////////////
656/// Compute distance from array of input points having directions specified by dirs. Store output in dists
657
659 Double_t *step) const
660{
661 for (Int_t i = 0; i < vecsize; i++)
662 dists[i] = DistFromOutside(&points[3 * i], &dirs[3 * i], 3, step[i]);
663}
664
665////////////////////////////////////////////////////////////////////////////////
666/// Compute safe distance from each of the points in the input array.
667/// Input: Array of point coordinates, array of statuses for these points, size of the arrays
668/// Output: Safety values
669
670void TGeoEltu::Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const
671{
672 for (Int_t i = 0; i < vecsize; i++)
673 safe[i] = Safety(&points[3 * i], inside[i]);
674}
#define d(i)
Definition RSha256.hxx:102
#define b(i)
Definition RSha256.hxx:100
#define f(i)
Definition RSha256.hxx:104
#define a(i)
Definition RSha256.hxx:99
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:208
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
Option_t Option_t TPoint TPoint const char y1
char name[80]
Definition TGX11.cxx:110
R__EXTERN TGeoManager * gGeoManager
Generic 3D primitive description class.
Definition TBuffer3D.h:18
UInt_t NbPnts() const
Definition TBuffer3D.h:80
Bool_t SectionsValid(UInt_t mask) const
Definition TBuffer3D.h:67
void SetSectionsValid(UInt_t mask)
Definition TBuffer3D.h:65
Bool_t fLocalFrame
Definition TBuffer3D.h:90
Bool_t SetRawSizes(UInt_t reqPnts, UInt_t reqPntsCapacity, UInt_t reqSegs, UInt_t reqSegsCapacity, UInt_t reqPols, UInt_t reqPolsCapacity)
Set kRaw tessellation section of buffer with supplied sizes.
Double_t * fPnts
Definition TBuffer3D.h:113
void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections, Bool_t localFrame) const override
Fills the supplied buffer, with sections in desired frame See TBuffer3D.h for explanation of sections...
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:432
Double_t fOrigin[3]
Definition TGeoBBox.h:23
void InspectShape() const override
Prints shape parameters.
Definition TGeoBBox.cxx:810
Double_t fDY
Definition TGeoBBox.h:21
Double_t fDZ
Definition TGeoBBox.h:22
An elliptical tube is defined by the two semi-axes A and B.
Definition TGeoEltu.h:17
void ComputeBBox() override
compute bounding box of the tube
Definition TGeoEltu.cxx:110
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.
Definition TGeoEltu.cxx:670
void SetDimensions(Double_t *param) override
Set shape dimensions starting from an array.
Definition TGeoEltu.cxx:478
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...
Definition TGeoEltu.cxx:648
void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override
Returns numbers of vertices, segments and polygons composing the shape mesh.
Definition TGeoEltu.cxx:535
void SetPoints(Double_t *points) const override
Create elliptical tube mesh points.
Definition TGeoEltu.cxx:489
~TGeoEltu() override
destructor
Definition TGeoEltu.cxx:96
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 tube and safe distance
Definition TGeoEltu.cxx:244
Double_t Capacity() const override
Computes capacity of the shape in [length^3].
Definition TGeoEltu.cxx:101
TGeoEltu()
Dummy constructor.
Definition TGeoEltu.cxx:54
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
compute closest distance from point px,py to each vertex
Definition TGeoEltu.cxx:154
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...
Definition TGeoEltu.cxx:639
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
Definition TGeoEltu.cxx:358
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...
Definition TGeoEltu.cxx:658
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 tube
Definition TGeoEltu.cxx:165
void GetBoundingCylinder(Double_t *param) const override
Fill vector param[4] with the bounding cylinder parameters.
Definition TGeoEltu.cxx:345
const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override
Fills a static 3D buffer and returns a reference.
Definition TGeoEltu.cxx:597
Int_t GetNmeshVertices() const override
Returns the number of vertices on the mesh.
Definition TGeoEltu.cxx:543
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) const override
Compute normal to closest surface from POINT.
Definition TGeoEltu.cxx:120
void SetEltuDimensions(Double_t a, Double_t b, Double_t dz)
Set dimensions of the elliptical tube.
Definition TGeoEltu.cxx:465
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
Definition TGeoEltu.cxx:450
void InspectShape() const override
print shape parameters
Definition TGeoEltu.cxx:383
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
Divide the shape along one axis.
Definition TGeoEltu.cxx:334
Bool_t Contains(const Double_t *point) const override
test if point is inside the elliptical tube
Definition TGeoEltu.cxx:141
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.
Definition TGeoEltu.cxx:628
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.
Definition TGeoEltu.cxx:397
Int_t GetNsegments() const
Get number of segments approximating circles.
Geometrical transformation package.
Definition TGeoMatrix.h:38
Base abstract class for all shapes.
Definition TGeoShape.h:25
static Double_t Big()
Definition TGeoShape.h:94
void TransformPoints(Double_t *points, UInt_t NbPoints) const
Tranform a set of points (LocalToMaster)
void SetShapeBit(UInt_t f, Bool_t set)
Equivalent of TObject::SetBit.
static Bool_t IsSameWithinTolerance(Double_t a, Double_t b)
Check if two numbers differ with less than a tolerance.
const char * GetPointerName() const
Provide a pointer name containing uid.
Int_t ShapeDistancetoPrimitive(Int_t numpoints, Int_t px, Int_t py) const
Returns distance to shape primitive mesh.
const char * GetName() const override
Get the shape name.
@ kGeoSavePrimitive
Definition TGeoShape.h:64
@ kGeoRunTimeShape
Definition TGeoShape.h:40
static Double_t Tolerance()
Definition TGeoShape.h:97
Bool_t TestShapeBit(UInt_t f) const
Definition TGeoShape.h:175
Cylindrical tube class.
Definition TGeoTube.h:17
Int_t GetNmeshVertices() const override
Return number of vertices of the mesh representation.
void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override
Returns numbers of vertices, segments and polygons composing the shape mesh.
Double_t fRmin
Definition TGeoTube.h:20
Double_t fDz
Definition TGeoTube.h:22
Double_t fRmax
Definition TGeoTube.h:21
void SetSegsAndPols(TBuffer3D &buff) const override
Fill TBuffer3D structure for segments and polygons.
Definition TGeoTube.cxx:712
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:43
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:149
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:202
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition TObject.cxx:226
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:864
const Int_t n
Definition legend1.C:16
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Definition TMathBase.h:251
Float_t Normalize(Float_t v[3])
Normalize a vector v in place.
Definition TMath.cxx:518
T1 Sign(T1 a, T2 b)
Returns a value with the magnitude of a and the sign of b.
Definition TMathBase.h:176
constexpr Double_t DegToRad()
Conversion from degree to radian: .
Definition TMath.h:82
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:673
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Definition TMathBase.h:199
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Definition TMath.h:605
constexpr Double_t Pi()
Definition TMath.h:40
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition TMath.h:599
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:124