65 SetEltuDimensions(
a,
b, dz);
76 SetEltuDimensions(
a,
b, dz);
128 norm[0] = norm[1] = 0;
133 norm[0] = point[0] *
b *
b;
134 norm[1] = point[1] *
a *
a;
157 const Int_t numPoints = 4 *
n;
172 if (iact < 3 && safe) {
179 Double_t d1 = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0);
180 Double_t d2 = (x2 - x0) * (x2 - x0) + (y2 - y0) * (y2 - y0);
184 for (
Int_t i = 0; i < 8; i++) {
186 x3 = 0.5 * (x1 + x2);
190 y3 = 0.5 * (y1 + y2);
196 d2 = (x2 - x0) * (x2 - x0) + (y2 - y0) * (y2 - y0);
200 d1 = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0);
207 if ((iact == 1) && (*safe > step))
214 snxt = safz1 / dir[2];
217 snxt = -safz2 / dir[2];
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)
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;
233 snxt = (-
v + sd) / u;
249 if (iact < 3 && safe) {
253 if ((x0 * x0 / a2 + y0 * y0 / b2) >= 1) {
258 for (
Int_t i = 0; i < 10; i++) {
259 phi3 = (phi1 + phi2) * 0.5;
262 d = y3 * a2 * (x0 - x3) - x3 * b2 * (y0 - y3);
268 *safe =
TMath::Sqrt((x0 - x3) * (x0 - x3) + (y0 - y3) * (y0 - y3));
271 *safe =
TMath::Sqrt((*safe) * (*safe) + safz * safz);
275 if ((iact == 1) && (step < *safe))
284 if (point[2] * dir[2] > 0)
290 zi = (point[2] > 0) ?
fDz : -
fDz;
292 tau = (zi - point[2]) / dir[2];
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)
304 Double_t u = dir[0] * dir[0] * b2 + dir[1] * dir[1] * a2;
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;
315 tau = (-
v + dsq) / u;
319 tau = (-
v - dsq) / u;
320 zi = point[2] + tau * dir[2];
337 Error(
"Divide",
"Elliptical tubes divisions not implemented");
349 param[1] *= param[1];
363 Error(
"GetMakeRuntimeShape",
"invalid mother");
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");
409 else if (sqdist < onemin)
440 safr = (dx * bct + dy * ast) /
d;
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;
467 if ((
a <= 0) || (
b < 0) || (dz < 0)) {
506 for (j = 0; j <
n; j++) {
515 for (j = 0; j <
n; j++) {
519 r2 = (a2 * b2) / (b2 + (a2 - b2) * sph * sph);
568 for (j = 0; j <
n; j++) {
577 for (j = 0; j <
n; j++) {
581 r2 = (a2 * b2) / (b2 + (a2 - b2) * sph * sph);
607 if (buffer.SetRawSizes(nbPnts, 3 * nbPnts, nbSegs, 3 * nbSegs, nbPols, 6 * nbPols)) {
613 if (!buffer.fLocalFrame) {
630 for (
Int_t i = 0; i < vecsize; i++)
641 for (
Int_t i = 0; i < vecsize; i++)
651 for (
Int_t i = 0; i < vecsize; i++)
661 for (
Int_t i = 0; i < vecsize; i++)
672 for (
Int_t i = 0; i < vecsize; i++)
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
float Float_t
Float 4 bytes (float).
const char Option_t
Option string (const char).
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
externTGeoManager * gGeoManager
Generic 3D primitive description class.
void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections, Bool_t localFrame) const override
Fill the supplied buffer, with sections in desired frame See TBuffer3D.h for explanation of sections,...
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
void InspectShape() const override
void ComputeBBox() override
void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override
void SetDimensions(Double_t *param) override
TGeoEltu(const TGeoEltu &)=delete
void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override
void SetPoints(Double_t *points) const override
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
Double_t Capacity() const override
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Computes distance from point (px,py) to the object.
void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override
TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override
void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
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
void GetBoundingCylinder(Double_t *param) const override
const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override
Stub implementation to avoid forcing implementation at this stage.
Int_t GetNmeshVertices() const override
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) const override
void SetEltuDimensions(Double_t a, Double_t b, Double_t dz)
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
void InspectShape() const override
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
Bool_t Contains(const Double_t *point) const override
void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
Geometrical transformation package.
Base abstract class for all shapes.
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.
static Double_t Tolerance()
Bool_t TestShapeBit(UInt_t f) const
Int_t GetNmeshVertices() const override
void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override
void SetSegsAndPols(TBuffer3D &buff) const override
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Bool_t TestBit(UInt_t f) const
virtual const char * ClassName() const
Returns name of class to which the object belongs.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Float_t Normalize(Float_t v[3])
Normalize a vector v in place.
T1 Sign(T1 a, T2 b)
Returns a value with the magnitude of a and the sign of b.
constexpr Double_t DegToRad()
Conversion from degree to radian: .
Double_t Sqrt(Double_t x)
Returns the square root of x.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.