PandaRoot
PANDA::CircleTools Namespace Reference

Functions

double PtFromCircle (double B, double r)
 Calculates the transverse momentum from a given radius. More...
 
double PhiForHit (FairHit *hit, TVector3 &circle)
 Calculates the angle phi for a hit depending on the circle center. More...
 
int RotationDirection (FairHit *firstHit, FairHit *nextHit, TVector3 &circle)
 Determines the rotation direction of the particle If the particle rotates anticlockwise it returns -1, alse it returns +1. More...
 
TVector2 PositionOnCircle (FairHit *hit, TVector3 &circle)
 Determins the position on the circle for a given hit. More...
 
TVector2 PtOnCircle (FairHit *hit, TVector3 &circle, int direction, double B)
 Rotates the transverse momentum by phi to determine the track's momentum direction at a hit point. More...
 

Function Documentation

◆ PhiForHit()

double PANDA::CircleTools::PhiForHit ( FairHit *  hit,
TVector3 &  circle 
)

Calculates the angle phi for a hit depending on the circle center.

Parameters
[in]hitA hit
[in]circleThe parameters of the circle given in a TVector3 as circle Center and radius (X, Y, R)
[out]Phiin [rad]

Definition at line 31 of file PndCircleTools.h.

Referenced by PositionOnCircle(), PtOnCircle(), and RotationDirection().

32 {
33  TVector2 hitV(hit->GetX(), hit->GetY());
34  TVector2 circleCenter(circle.X(), circle.Y());
35  return (hitV - circleCenter).Phi();
36 }

◆ PositionOnCircle()

TVector2 PANDA::CircleTools::PositionOnCircle ( FairHit *  hit,
TVector3 &  circle 
)

Determins the position on the circle for a given hit.

Parameters
[in]hitA hit of the track
[in]circleThe circle parameters that describe the track
[out]resultThe position on the circle for a given hit

Definition at line 66 of file PndCircleTools.h.

References PhiForHit().

67 {
68 
69  double phiHit = PhiForHit(hit, circle);
70 
71  TVector2 circleCenter(circle.X(), circle.Y());
72  TVector2 result(circle.Z(), 0);
73  result = result.Rotate(phiHit);
74  result += circleCenter;
75  return result;
76 }
double PhiForHit(FairHit *hit, TVector3 &circle)
Calculates the angle phi for a hit depending on the circle center.

◆ PtFromCircle()

double PANDA::CircleTools::PtFromCircle ( double  B,
double  r 
)

Calculates the transverse momentum from a given radius.

Parameters
[in]BThe magnetic field in [T]
[in]rThe radius of the circle in [cm]
[out]Thetransverse momentum in [GeV/c]

Definition at line 16 of file PndCircleTools.h.

Referenced by PtOnCircle().

17 {
18  // 0.01 to recalculate [cm] in [m]
19  // 0.3 from constants when setting Lorentz force equal to centrifugal force
20  // pT [GeV/c] = 0.3 * B [T] * abs(r [cm]) * 0.01;
21  return 0.003 * B * abs(r);
22 }

◆ PtOnCircle()

TVector2 PANDA::CircleTools::PtOnCircle ( FairHit *  hit,
TVector3 &  circle,
int  direction,
double  B 
)

Rotates the transverse momentum by phi to determine the track's momentum direction at a hit point.

Parameters
[in]hitA hit of the track
[in]circleThe circle parameters that describe the track
[in]directionThe moving direction of the particle (similar to charge)
[in]BThe magnetic field
[out]resultMomentum direction at the given hit point

Definition at line 87 of file PndCircleTools.h.

References PhiForHit(), CAMath::Pi(), and PtFromCircle().

88 {
89  TVector2 result(0, PtFromCircle(B, circle.Z()));
90  double phiOnCircle = PhiForHit(hit, circle);
91  if (direction > 0) {
92  phiOnCircle += TMath::Pi();
93  }
94  return result.Rotate(phiOnCircle);
95 }
double PtFromCircle(double B, double r)
Calculates the transverse momentum from a given radius.
static float Pi()
Definition: PndCAMath.h:115
double PhiForHit(FairHit *hit, TVector3 &circle)
Calculates the angle phi for a hit depending on the circle center.

◆ RotationDirection()

int PANDA::CircleTools::RotationDirection ( FairHit *  firstHit,
FairHit *  nextHit,
TVector3 &  circle 
)

Determines the rotation direction of the particle If the particle rotates anticlockwise it returns -1, alse it returns +1.

Parameters
[in]firstHitA first hit of the track
[in]nextHitA hit of the track occuring after the first hit
[in]circleThe track parameters as circle approximation (X, Y, R)
[out]Ifthe particle rotates anticlockwise it returns -1, alse it returns +1

Definition at line 48 of file PndCircleTools.h.

References PhiForHit().

49 {
50  double phiFirst = PhiForHit(firstHit, circle);
51  double phiNext = PhiForHit(nextHit, circle);
52 
53  if (phiNext - phiFirst > 0)
54  return -1;
55  else
56  return 1;
57 }
double PhiForHit(FairHit *hit, TVector3 &circle)
Calculates the angle phi for a hit depending on the circle center.