111 using namespace TMath;
131 if (curr_step >
fMaxStep || enforce_max_step)
256 fFVAtt.SetMarkerSize(1.5);
310 track =
dynamic_cast<TEveTrack*
>(i->first);
365 if (end_point < 0) end_point =
fPoints.size() - 1;
368 for (
Int_t i = start_point; i < end_point; ++i)
382 if ((
v-
fV).Mag() < kStepEps)
471 using namespace TMath;
480 if (
fH.fR >
fH.fDelta )
483 if (ang <
fH.fPhiStep)
489 if (
fH.fRKStep >
fH.fMaxStep || enforce_max_step)
491 fH.fPhiStep *=
fH.fMaxStep /
fH.fRKStep;
492 fH.fRKStep =
fH.fMaxStep;
497 fH.fRKStep =
fH.fMaxStep;
510 fH.Step(
v, p, vOut, pOut);
520 vecRKIn[3] = p.
fX*nm;
521 vecRKIn[4] = p.
fY*nm;
522 vecRKIn[5] = p.
fZ*nm;
523 vecRKIn[6] = p.
Mag();
528 vOut.
fX = vecRKOut[0];
529 vOut.
fY = vecRKOut[1];
530 vOut.
fZ = vecRKOut[2];
531 vOut.
fT =
v.fT +
fH.fRKStep;
533 pOut.
fX = vecRKOut[3]*pm;
534 pOut.
fY = vecRKOut[4]*pm;
535 pOut.
fZ = vecRKOut[5]*pm;
554 while (
fH.fPhi < maxPhi && np<
fNMax)
556 Step(currV, p, forwV, forwP);
559 if (forwV.
Perp2() > maxRsq)
564 Warning(
"HelixToBounds",
"In MaxR crossing expected t>=0 && t<=1: t=%f, r1=%f, r2=%f, MaxR=%f.",
565 t, currV.
R(), forwV.
R(),
fMaxR);
582 Warning(
"HelixToBounds",
"In MaxZ crossing expected t>=0 && t<=1: t=%f, z1=%f, z2=%f, MaxZ=%f.",
615 Int_t np = first_point;
621 Step(currV, p, forwV, forwP);
640 }
while (np <
fNMax);
643 if (np > first_point)
645 if ((
v - currV).Mag() > kStepEps)
647 Double_t step_frac = prod0 / (prod0 - prod1);
653 fH.fMaxStep = step_frac * (forwV - currV).Mag();
655 Step(currV, p, forwV, forwP);
660 fH.fMaxStep = orig_max_step;
666 off *= 1.0f / currV.
fT;
693 Int_t np = first_point;
699 Step(currV, p, forwV, forwP);
709 if (pTPM.
Dot(forwC - forwV) < 0)
725 }
while (np <
fNMax);
732 if (np > first_point)
734 if ((
v - currV).Mag() > kStepEps)
744 fH.fMaxStep = step_frac * (forwV - currV).Mag();
746 Step(currV, p, forwV, forwP);
751 fH.fMaxStep = orig_max_step;
757 off *= 1.0f / currV.fT;
781 for (
Int_t i = first_point; i < np; ++i)
791 tt.SetupFromToVec(lpd0, lpd1);
839 tR = (-
b - sqrtD) / (2.0 *
a);
841 tR = (-
b + sqrtD) / (2.0 *
a);
843 tB = tR < tZ ? tR : tZ;
879 Step(pos4, mom, forwV , forwP);
884 Warning(
"HelixIntersectPlane",
"going away from the plane.");
889 delta = forwV - pos4;
890 itsect = pos4 + delta * ((point - pos4).Dot(
n) / delta.
Dot(
n));
1021 track =
dynamic_cast<TEveTrack*
>(i->first);
1089 Warning(
"SetMinAng",
"This method was mis-named, use SetMaxAng() instead!");
1098 Warning(
"GetMinAng",
"This method was mis-named, use GetMaxAng() instead!");
1267 Double_t secxs[4],secys[4],seczs[4],hxp[3];
1268 Double_t g1, g2, g3, g4, g5, g6, ang2, dxt, dyt, dzt;
1270 Double_t f1, f2, f3, f4, rho, tet, hnorm, hp, rho1, sint, cost;
1281 const Int_t maxit = 500;
1282 const Int_t maxcut = 11;
1291 const Double_t kpisqua = 9.86960440109;
1292 const Int_t kix = 0;
1293 const Int_t kiy = 1;
1294 const Int_t kiz = 2;
1295 const Int_t kipx = 3;
1296 const Int_t kipy = 4;
1297 const Int_t kipz = 5;
1306 for(
Int_t j = 0; j < 7; j++)
1335 secxs[0] = (
b *
f[2] -
c *
f[1]) * ph2;
1336 secys[0] = (
c *
f[0] -
a *
f[2]) * ph2;
1337 seczs[0] = (
a *
f[1] -
b *
f[0]) * ph2;
1338 ang2 = (secxs[0]*secxs[0] + secys[0]*secys[0] + seczs[0]*seczs[0]);
1339 if (ang2 > kpisqua)
break;
1341 dxt = h2 *
a + h4 * secxs[0];
1342 dyt = h2 *
b + h4 * secys[0];
1343 dzt = h2 *
c + h4 * seczs[0];
1351 if (ncut++ > maxcut)
break;
1369 secxs[1] = (bt *
f[2] - ct *
f[1]) * ph2;
1370 secys[1] = (ct *
f[0] - at *
f[2]) * ph2;
1371 seczs[1] = (at *
f[1] - bt *
f[0]) * ph2;
1375 secxs[2] = (bt *
f[2] - ct *
f[1]) * ph2;
1376 secys[2] = (ct *
f[0] - at *
f[2]) * ph2;
1377 seczs[2] = (at *
f[1] - bt *
f[0]) * ph2;
1378 dxt =
h * (
a + secxs[2]);
1379 dyt =
h * (
b + secys[2]);
1380 dzt =
h * (
c + seczs[2]);
1384 at =
a + 2.*secxs[2];
1385 bt =
b + 2.*secys[2];
1386 ct =
c + 2.*seczs[2];
1390 if (ncut++ > maxcut)
break;
1404 z = z + (
c + (seczs[0] + seczs[1] + seczs[2]) * kthird) *
h;
1405 y =
y + (
b + (secys[0] + secys[1] + secys[2]) * kthird) *
h;
1406 x =
x + (
a + (secxs[0] + secxs[1] + secxs[2]) * kthird) *
h;
1408 secxs[3] = (bt*
f[2] - ct*
f[1])* ph2;
1409 secys[3] = (ct*
f[0] - at*
f[2])* ph2;
1410 seczs[3] = (at*
f[1] - bt*
f[0])* ph2;
1411 a =
a+(secxs[0]+secxs[3]+2. * (secxs[1]+secxs[2])) * kthird;
1412 b =
b+(secys[0]+secys[3]+2. * (secys[1]+secys[2])) * kthird;
1413 c =
c+(seczs[0]+seczs[3]+2. * (seczs[1]+seczs[2])) * kthird;
1415 est =
TMath::Abs(secxs[0]+secxs[3] - (secxs[1]+secxs[2]))
1416 +
TMath::Abs(secys[0]+secys[3] - (secys[1]+secys[2]))
1417 +
TMath::Abs(seczs[0]+seczs[3] - (seczs[1]+seczs[2]));
1420 if (ncut++ > maxcut)
break;
1427 if (iter++ > maxit)
break;
1440 if (step < 0.) rest = -rest;
1443 Float_t dot = (vout[3]*vect[3] + vout[4]*vect[4] + vout[5]*vect[5]);
1464 hxp[0] = f2*vect[kipz] - f3*vect[kipy];
1465 hxp[1] = f3*vect[kipx] -
f1*vect[kipz];
1466 hxp[2] =
f1*vect[kipy] - f2*vect[kipx];
1468 hp =
f1*vect[kipx] + f2*vect[kipy] + f3*vect[kipz];
1476 g3 = (tet-sint) * hp*rho1;
1481 vout[kix] = vect[kix] + g1*vect[kipx] + g2*hxp[0] + g3*
f1;
1482 vout[kiy] = vect[kiy] + g1*vect[kipy] + g2*hxp[1] + g3*f2;
1483 vout[kiz] = vect[kiz] + g1*vect[kipz] + g2*hxp[2] + g3*f3;
1485 vout[kipx] = vect[kipx] + g4*vect[kipx] + g5*hxp[0] + g6*
f1;
1486 vout[kipy] = vect[kipy] + g4*vect[kipy] + g5*hxp[1] + g6*f2;
1487 vout[kipz] = vect[kipz] + g4*vect[kipz] + g5*hxp[2] + g6*f3;
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int).
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
float Float_t
Float 4 bytes (float).
TEveVectorT< Float_t > TEveVectorF
TEveVectorT< Double_t > TEveVectorD
TEveVectorT< Float_t > TEveVector
TEveVector4T< Double_t > TEveVector4D
Double_t Dot(const TGLVector3 &v1, const TGLVector3 &v2)
TEveElementList(const char *n="TEveElementList", const char *t="", Bool_t doColor=kFALSE, Bool_t doTransparency=kFALSE)
Constructor.
virtual void CheckReferenceCount(const TEveException &eh="TEveElement::CheckReferenceCount ")
Check external references to this and eventually auto-destruct the render-element.
virtual void ElementChanged(Bool_t update_scenes=kTRUE, Bool_t redraw=kFALSE)
Call this after an element has been changed so that the state can be propagated around the framework.
Exception class thrown by TEve classes and macros.
Implements constant magnetic field, given by a vector fB.
Abstract base-class for interfacing to magnetic field needed by the TEveTrackPropagator.
TEvePointSet is a render-element holding a collection of 3D points with optional per-point TRef and a...
void Reset(Int_t n_points=0, Int_t n_int_ids=0)
Drop all data and set-up the data structures to recive new data.
RefMap_t::iterator RefMap_i
TEveRefBackPtr()
Default constructor.
Double_t GetMaxAng() const
virtual void GoToBounds(TEveVectorD &p)
Propagate particle to bounds.
void SetFitReferences(Bool_t x)
Set track-reference fitting and rebuild tracks.
void SetRnrDecay(Bool_t x)
Set decay rendering and rebuild tracks.
void SetRnrDaughters(Bool_t x)
Set daughter rendering and rebuild tracks.
void SetFitLineSegments(Bool_t x)
Set line segment fitting and rebuild tracks.
void ResetTrack()
Reset cache holding particle trajectory.
void SetMagFieldObj(TEveMagField *field, Bool_t own_field=kTRUE)
Set constant magnetic field and rebuild tracks.
Bool_t HelixIntersectPlane(const TEveVectorD &p, const TEveVectorD &point, const TEveVectorD &normal, TEveVectorD &itsect)
Intersect helix with a plane.
void StepRungeKutta(Double_t step, Double_t *vect, Double_t *vout)
Wrapper to step with method RungeKutta.
void SetDelta(Double_t x)
Set maximum error and rebuild tracks.
Bool_t IntersectPlane(const TEveVectorD &p, const TEveVectorD &point, const TEveVectorD &normal, TEveVectorD &itsect)
Find intersection of currently propagated track with a plane.
void ElementChanged(Bool_t update_scenes=kTRUE, Bool_t redraw=kFALSE) override
Element-change notification.
void DistributeOffset(const TEveVectorD &off, Int_t first_point, Int_t np, TEveVectorD &p)
Distribute offset between first and last point index and rotate momentum.
static Bool_t IsOutsideBounds(const TEveVectorD &point, Double_t maxRsqr, Double_t maxZ)
void ClosestPointFromVertexToLineSegment(const TEveVectorD &v, const TEveVectorD &s, const TEveVectorD &r, Double_t rMagInv, TEveVectorD &c)
Get closest point from given vertex v to line segment defined with s and r.
void Step(const TEveVector4D &v, const TEveVectorD &p, TEveVector4D &vOut, TEveVectorD &pOut)
Wrapper to step helix.
void SetMaxR(Double_t x)
Set maximum radius and rebuild tracks.
Double_t GetTrackLength(Int_t start_point=0, Int_t end_point=-1) const
Calculate track length from start_point to end_point.
void SetFitDaughters(Bool_t x)
Set daughter creation point fitting and rebuild tracks.
TEveTrackPropagator(const TEveTrackPropagator &)
virtual Bool_t GoToVertex(TEveVectorD &v, TEveVectorD &p)
Propagate particle with momentum p to vertex v.
static Double_t fgEditorMaxZ
void LineToBounds(TEveVectorD &p)
Propagate neutral particle with momentum p to bounds.
Int_t GetCurrentPoint() const
Get index of current point on track.
static Double_t fgDefMagField
~TEveTrackPropagator() override
Destructor.
void Update(const TEveVector4D &v, const TEveVectorD &p, Bool_t full_update=kFALSE, Bool_t enforce_max_step=kFALSE)
Update helix / B-field projection state.
void FillPointSet(TEvePointSet *ps) const
Reset ps and populate it with points in propagation cache.
void SetRnrFV(Bool_t x)
Set first-vertex rendering and rebuild tracks.
void SetProjTrackBreaking(UChar_t x)
Set projection break-point mode and rebuild tracks.
Bool_t ClosestPointBetweenLines(const TEveVectorD &, const TEveVectorD &, const TEveVectorD &, const TEveVectorD &, TEveVectorD &out)
Get closest point on line defined with vector p0 and u.
void SetMinAng(Double_t x)
Set maximum step angle and rebuild tracks.
void LoopToBounds(TEveVectorD &p)
Propagate charged particle with momentum p to bounds.
static TEveTrackPropagator fgDefault
Bool_t LineIntersectPlane(const TEveVectorD &p, const TEveVectorD &point, const TEveVectorD &normal, TEveVectorD &itsect)
Intersect line with a plane.
TEveMagField * fMagFieldObj
void SetRnrCluster2Ds(Bool_t x)
Set rendering of 2D-clusters and rebuild tracks.
std::vector< TEveVector4D > fPoints
virtual Bool_t GoToLineSegment(const TEveVectorD &s, const TEveVectorD &r, TEveVectorD &p)
Propagate particle with momentum p to line with start point s and vector r to the second point.
void SetRnrReferences(Bool_t x)
Set track-reference rendering and rebuild tracks.
UChar_t fProjTrackBreaking
void CheckReferenceCount(const TEveException &eh="TEveElement::CheckReferenceCount ") override
Check reference count - virtual from TEveElement.
static Double_t fgEditorMaxR
void SetMaxAng(Double_t x)
Set maximum step angle and rebuild tracks.
Bool_t LineToVertex(TEveVectorD &v)
Propagate neutral particle to vertex v.
void InitTrack(const TEveVectorD &v, Int_t charge)
Initialize internal data-members for given particle parameters.
void OnZeroRefCount() override
Virtual from TEveRefBackPtr - track reference count has reached zero.
static const Double_t fgkB2C
void SetMaxStep(Double_t x)
Set maximum step-size and rebuild tracks.
Bool_t PointOverVertex(const TEveVector4D &v0, const TEveVector4D &v, Double_t *p=nullptr)
void SetFitCluster2Ds(Bool_t x)
Set 2D-cluster fitting and rebuild tracks.
std::vector< TEveVector4D > fLastPoints
Bool_t LoopToLineSegment(const TEveVectorD &s, const TEveVectorD &r, TEveVectorD &p)
Propagate charged particle with momentum p to line segment with point s and vector r to the second po...
Double_t GetMinAng() const
Get maximum step angle.
void PrintMagField(Double_t x, Double_t y, Double_t z) const
void RebuildTracks()
Rebuild all tracks using this render-style.
void SetRnrPTBMarkers(Bool_t x)
Set projection break-point rendering and rebuild tracks.
Bool_t LoopToVertex(TEveVectorD &v, TEveVectorD &p)
Propagate charged particle with momentum p to vertex v.
void SetMaxZ(Double_t x)
Set maximum z and rebuild tracks.
void SetFitDecay(Bool_t x)
Set decay fitting and rebuild tracks.
void SetMaxOrbs(Double_t x)
Set maximum number of orbits and rebuild tracks.
void SetMagField(Double_t bX, Double_t bY, Double_t bZ)
Set constant magnetic field and rebuild tracks.
Visual representation of a track.
virtual void MakeTrack(Bool_t recurse=kTRUE)
Calculate track representation based on track data and current settings of the propagator.
TEveTrans is a 4x4 transformation matrix for homogeneous coordinates stored internally in a column-ma...
TT Normalize(TT length=1)
Normalize the vector to length if current length is non-zero.
TT Dot(const TEveVectorT &a) const
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual Int_t SetNextPoint(Double_t x, Double_t y, Double_t z)
Set point following LastPoint to x, y, z.
Double_t ACos(Double_t)
Returns the principal value of the arc cosine of x, expressed in radians.
Short_t Range(Short_t lb, Short_t ub, Short_t x)
Returns x if lb < x < up, lb if x < lb and ub if x > ub.
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.
T * Cross(const T v1[3], const T v2[3], T out[3])
Calculates the Cross Product of two vectors: out = [v1 x v2].
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
constexpr Double_t TwoPi()
void UpdateRK(const TEveVectorD &p, const TEveVectorD &b)
Update helix for stepper RungeKutta.
void UpdateHelix(const TEveVectorD &p, const TEveVectorD &b, Bool_t full_update, Bool_t enforce_max_step)
Update helix parameters.
Helix_t()
Default constructor.
void Step(const TEveVector4D &v, const TEveVectorD &p, TEveVector4D &vOut, TEveVectorD &pOut)
Step helix for given momentum p from vertex v.
void UpdateCommon(const TEveVectorD &p, const TEveVectorD &b)
Common update code for helix and RK propagation.
static uint64_t sum(uint64_t i)