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 43 of file PndCircleTools.h.

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

44 {
45  TVector2 hitV(hit->GetX(), hit->GetY());
46  TVector2 circleCenter(circle.X(), circle.Y());
47  return (hitV - circleCenter).Phi();
48 }

◆ 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 78 of file PndCircleTools.h.

References PhiForHit().

79 {
80 
81  double phiHit = PhiForHit(hit, circle);
82 
83  TVector2 circleCenter(circle.X(), circle.Y());
84  TVector2 result(circle.Z(), 0);
85  result = result.Rotate(phiHit);
86  result += circleCenter;
87  return result;
88 }
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 28 of file PndCircleTools.h.

Referenced by PtOnCircle().

29 {
30  // 0.01 to recalculate [cm] in [m]
31  // 0.3 from constants when setting Lorentz force equal to centrifugal force
32  // pT [GeV/c] = 0.3 * B [T] * abs(r [cm]) * 0.01;
33  return 0.003 * B * abs(r);
34 }

◆ 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 99 of file PndCircleTools.h.

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

100 {
101  TVector2 result(0, PtFromCircle(B, circle.Z()));
102  double phiOnCircle = PhiForHit(hit, circle);
103  if (direction > 0) {
104  phiOnCircle += TMath::Pi();
105  }
106  return result.Rotate(phiOnCircle);
107 }
double PtFromCircle(double B, double r)
Calculates the transverse momentum from a given radius.
static float Pi()
Definition: PndCAMath.h:127
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 60 of file PndCircleTools.h.

References PhiForHit().

61 {
62  double phiFirst = PhiForHit(firstHit, circle);
63  double phiNext = PhiForHit(nextHit, circle);
64 
65  if (phiNext - phiFirst > 0)
66  return -1;
67  else
68  return 1;
69 }
double PhiForHit(FairHit *hit, TVector3 &circle)
Calculates the angle phi for a hit depending on the circle center.