ATLAS Offline Software
Loading...
Searching...
No Matches
MuonHoughMathUtils.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef MUONHOUGHPATTERNEVENT_MUONHOUGHMATHUTILS_H
6#define MUONHOUGHPATTERNEVENT_MUONHOUGHMATHUTILS_H
7
8#include <cmath>
9#include <string>
10#include <vector>
11
14
15namespace MuonHough {
16 constexpr double two_Pi = 2 * M_PI;
17 constexpr double degree_rad_conversion_factor = M_PI / 180.;
18 constexpr double rad_degree_conversion_factor = 180. / M_PI;
19
20 // Geometry for curved Hough extrapolation
22 constexpr double tan_barrel = 11430. / 14000.;
24 constexpr double radius_cylinder = 4000.;
26 constexpr double z_cylinder = 6000.;
28 constexpr double z_end = 15000.;
30 constexpr double z_magnetic_range = z_end - z_cylinder;
33} // namespace MuonHough
34
36public:
40 virtual ~MuonHoughMathUtils() = default;
41
43 static int sgn(double d);
45 static int step(double d, double x0 = 0);
46
48 static double signedDistanceToLine(double x0, double y0, double r0, double phi);
50 static double distanceToLine(double x0, double y0, double r0, double phi);
52 static double incrementTillAbove0(double x, double inc, double zero = 0);
54 static double angleFrom0To360(double angle);
56 static double angleFrom0To180(double angle);
58 static double angleFrom0ToPi(double angle);
60 static double angleFromMinusPiToPi(double angle);
62 double angleFromRadialToGrad(double angle) const;
64 double angleFromGradToRadial(double angle) const;
65
67 static std::string intToString(int i);
68
70 static double distanceToLine2D(double x0, double y0, double r, double phi) ;
72 static double distanceToLine3D(const Amg::Vector3D& point, const Amg::Vector3D& l_trans, double phi, double theta);
73
75 static double distanceOfLineToOrigin2D(double a, double b);
77 static double signedDistanceOfLineToOrigin2D(double x, double y, double phi);
78
80 static double thetaForCurvedHit(double invcurvature, MuonHoughHit* hit);
82 static void thetasForCurvedHit(double ratio, MuonHoughHit* hit, double& theta1, double& theta2);
84 static double signedDistanceCurvedToHit(double z0, double theta, double invcurvature, const Amg::Vector3D& hit);
85
94
95 static void extrapolateCurvedRoad(const Amg::Vector3D& roadpos, const Amg::Vector3D& roadmom, const Amg::Vector3D& pos,
96 Amg::Vector3D& roadpose, Amg::Vector3D& roaddire);
97
100
103
105 static bool lineThroughCylinder(const Amg::Vector3D& vec, double phi, double theta, double r_0, double z_0);
106
107};
108
111} // angle in radial
114} // angle in grad
115
116#endif // MUONHOUGHPATTERNEVENT_MUONHOUGHMATHUTILS_H
#define M_PI
Scalar phi() const
phi method
Scalar theta() const
theta method
std::vector< size_t > vec
static Double_t a
double angle(const GeoTrf::Vector2D &a, const GeoTrf::Vector2D &b)
#define y
#define x
static std::string intToString(int i)
converts integer to string
static int step(double d, double x0=0)
step function at place x0
static double incrementTillAbove0(double x, double inc, double zero=0)
increments x with inc till above x
static double distanceOfLineToOrigin2D(double a, double b)
distance of line y = ax + b to origin
virtual ~MuonHoughMathUtils()=default
destructor
static double angleFrom0ToPi(double angle)
computes angle in rad between 0 and Pi
static void thetasForCurvedHit(double ratio, MuonHoughHit *hit, double &theta1, double &theta2)
calculates theta at (x,y,z) for curved track model, for positive and negative curvature
static double angleFrom0To360(double angle)
computes angle in degrees between 0 and 360
static bool lineThroughCylinder(const Amg::Vector3D &vec, double phi, double theta, double r_0, double z_0)
calculates if line (x,y,z,phi,theta) crosses cylinder (r_0,z_0) around origin
static double signedDistanceOfLineToOrigin2D(double x, double y, double phi)
signed distance of line with point (x,y) and angle phi to origin
static double angleFromMinusPiToPi(double angle)
computes angle in rad between -Pi and Pi
static Amg::Vector3D shortestPointOfLineToOrigin3D(const Amg::Vector3D &vec, double phi, double theta)
calculates the 3d-point closest to origin in xy-plane
static double thetaForCurvedHit(double invcurvature, MuonHoughHit *hit)
calculates theta at (x,y,z) for curved track model
double angleFromRadialToGrad(double angle) const
converts angle in rad to degrees
double angleFromGradToRadial(double angle) const
converts angle in degrees to rad
MuonHoughMathUtils()
default constructor
static Amg::Vector3D shortestPointOfLineToOrigin(const Amg::Vector3D &vec, double phi, double theta)
calculates the 3d-point closest to origin
static int sgn(double d)
sign (-1 or 1) of a double
static double distanceToLine2D(double x0, double y0, double r, double phi)
distance from (x0,y0) to line (r,phi)
static double signedDistanceCurvedToHit(double z0, double theta, double invcurvature, const Amg::Vector3D &hit)
calculates distance of point (x,y,z) to curved track with z0, theta and invcurvature for curved track...
static double distanceToLine(double x0, double y0, double r0, double phi)
distance from (x0,y0) to the line (r0,phi), phi in rad
static double angleFrom0To180(double angle)
computes angle in degrees between 0 and 180
static double signedDistanceToLine(double x0, double y0, double r0, double phi)
distance from (x0,y0) to the line (r0,phi), phi in rad
static void extrapolateCurvedRoad(const Amg::Vector3D &roadpos, const Amg::Vector3D &roadmom, const Amg::Vector3D &pos, Amg::Vector3D &roadpose, Amg::Vector3D &roaddire)
extrapolates road to global position
static double distanceToLine3D(const Amg::Vector3D &point, const Amg::Vector3D &l_trans, double phi, double theta)
distance from (x0,y0,z0) to line (x,y,z,phi,theta)
void zero(TH2 *h)
zero the contents of a 2d histogram
int r
Definition globals.cxx:22
Eigen::Matrix< double, 3, 1 > Vector3D
constexpr double tan_barrel
relation for transition between endcap and barrel 11.43 m (r) / 14m (z)
constexpr double radius_cylinder
radius of cylinder
constexpr double two_Pi
constexpr double z_cylinder
length of cylinder
constexpr double degree_rad_conversion_factor
constexpr double z_magnetic_range_squared
range where hit is curved in endcap region ('squared')
constexpr double z_end
z value whereafter no magnetic field / curvature
constexpr double z_magnetic_range
range where hit is curved in endcap region
constexpr double rad_degree_conversion_factor