PandaRoot
PndCircleTools.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "FairHit.h"
4 #include "TVector2.h"
5 
6 namespace PANDA {
7 namespace CircleTools {
8 
16 double PtFromCircle(double B, double r)
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 }
23 
31 double PhiForHit(FairHit *hit, TVector3 &circle)
32 {
33  TVector2 hitV(hit->GetX(), hit->GetY());
34  TVector2 circleCenter(circle.X(), circle.Y());
35  return (hitV - circleCenter).Phi();
36 }
37 
48 int RotationDirection(FairHit *firstHit, FairHit *nextHit, TVector3 &circle)
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 }
58 
66 TVector2 PositionOnCircle(FairHit *hit, TVector3 &circle)
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 }
77 
87 TVector2 PtOnCircle(FairHit *hit, TVector3 &circle, int direction, double B)
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 }
96 
97 } // namespace CircleTools
98 } // namespace PANDA
double PtFromCircle(double B, double r)
Calculates the transverse momentum from a given radius.
TVector2 PositionOnCircle(FairHit *hit, TVector3 &circle)
Determins the position on the circle for a given hit.
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...
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.
int RotationDirection(FairHit *firstHit, FairHit *nextHit, TVector3 &circle)
Determines the rotation direction of the particle If the particle rotates anticlockwise it returns -1...