Project
Loading...
Searching...
No Matches
AlignmentMath.cxx
Go to the documentation of this file.
1// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
13
14#include <cmath>
15
16#include <TMath.h>
17
18#include "ITS3Base/SpecsV2.h"
19#include "MathUtils/Utils.h"
20
21namespace o2::its3::align
22{
23
24double getSensorPhiWidth(int sensorID, double radius)
25{
26 const bool isTop = sensorID % 2 == 0;
27 const double phiBorder1 = o2::math_utils::to02Pid(((isTop ? 0. : 1.) * TMath::Pi()) + std::asin(constants::equatorialGap / 2. / radius));
28 const double phiBorder2 = o2::math_utils::to02Pid(((isTop ? 1. : 2.) * TMath::Pi()) - std::asin(constants::equatorialGap / 2. / radius));
29 const double width = phiBorder2 - phiBorder1;
30 return (width < 0.) ? width + TMath::TwoPi() : width;
31}
32
33std::pair<double, double> computeUV(double gloX, double gloY, double gloZ, int sensorID, double radius)
34{
35 const bool isTop = sensorID % 2 == 0;
36 const double phi = o2::math_utils::to02Pid(std::atan2(gloY, gloX));
37 const double phiBorder1 = o2::math_utils::to02Pid(((isTop ? 0. : 1.) * TMath::Pi()) + std::asin(constants::equatorialGap / 2. / radius));
38 const double phiBorder2 = o2::math_utils::to02Pid(((isTop ? 1. : 2.) * TMath::Pi()) - std::asin(constants::equatorialGap / 2. / radius));
39 const double u = (((phi - phiBorder1) * 2.) / (phiBorder2 - phiBorder1)) - 1.;
40 const double v = ((2. * gloZ + constants::segment::lengthSensitive) / constants::segment::lengthSensitive) - 1.;
41 return {u, v};
42}
43
44TrackSlopes computeTrackSlopes(double snp, double tgl)
45{
46 const double csci = 1. / std::sqrt(1. - (snp * snp));
47 return {.dydx = snp * csci, .dzdx = tgl * csci};
48}
49
50std::vector<double> legendrePols(int order, double x)
51{
52 std::vector<double> p(order + 1);
53 p[0] = 1.;
54 if (order > 0) {
55 p[1] = x;
56 }
57 for (int n = 1; n < order; ++n) {
58 p[n + 1] = ((2 * n + 1) * x * p[n] - n * p[n - 1]) / (n + 1);
59 }
60 return p;
61}
62
63} // namespace o2::its3::align
General auxilliary methods.
GLdouble n
Definition glcorearb.h:1982
GLint GLenum GLint x
Definition glcorearb.h:403
const GLdouble * v
Definition glcorearb.h:832
GLint GLsizei width
Definition glcorearb.h:270
double getSensorPhiWidth(int sensorID, double radius)
TrackSlopes computeTrackSlopes(double snp, double tgl)
std::vector< double > legendrePols(int order, double x)
std::pair< double, double > computeUV(double gloX, double gloY, double gloZ, int sensorID, double radius)
constexpr double equatorialGap
Definition SpecsV2.h:131