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
24std::pair<double, double> computeUV(double gloX, double gloY, double gloZ, int sensorID, double radius)
25{
26 const bool isTop = sensorID % 2 == 0;
27 const double phi = o2::math_utils::to02Pid(std::atan2(gloY, gloX));
28 const double phiBorder1 = o2::math_utils::to02Pid(((isTop ? 0. : 1.) * TMath::Pi()) + std::asin(constants::equatorialGap / 2. / radius));
29 const double phiBorder2 = o2::math_utils::to02Pid(((isTop ? 1. : 2.) * TMath::Pi()) - std::asin(constants::equatorialGap / 2. / radius));
30 const double u = (((phi - phiBorder1) * 2.) / (phiBorder2 - phiBorder1)) - 1.;
31 const double v = ((2. * gloZ + constants::segment::lengthSensitive) / constants::segment::lengthSensitive) - 1.;
32 return {u, v};
33}
34
35TrackSlopes computeTrackSlopes(double snp, double tgl)
36{
37 const double csci = 1. / std::sqrt(1. - (snp * snp));
38 return {.dydx = snp * csci, .dzdx = tgl * csci};
39}
40
41std::vector<double> legendrePols(int order, double x)
42{
43 std::vector<double> p(order + 1);
44 p[0] = 1.;
45 if (order > 0) {
46 p[1] = x;
47 }
48 for (int n = 1; n < order; ++n) {
49 p[n + 1] = ((2 * n + 1) * x * p[n] - n * p[n - 1]) / (n + 1);
50 }
51 return p;
52}
53
54} // 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
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