PandaRoot
PndCircleTools.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 #pragma once
14 
15 #include "FairHit.h"
16 #include "TVector2.h"
17 
18 namespace PANDA {
19 namespace CircleTools {
20 
28 double PtFromCircle(double B, double r)
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 }
35 
43 double PhiForHit(FairHit *hit, TVector3 &circle)
44 {
45  TVector2 hitV(hit->GetX(), hit->GetY());
46  TVector2 circleCenter(circle.X(), circle.Y());
47  return (hitV - circleCenter).Phi();
48 }
49 
60 int RotationDirection(FairHit *firstHit, FairHit *nextHit, TVector3 &circle)
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 }
70 
78 TVector2 PositionOnCircle(FairHit *hit, TVector3 &circle)
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 }
89 
99 TVector2 PtOnCircle(FairHit *hit, TVector3 &circle, int direction, double B)
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 }
108 
109 } // namespace CircleTools
110 } // 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:127
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...