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
54std::vector<double> legendrePolsD1(int order, double x)
55{
56 // P'_0 = 0, P'_1 = 1, P'_{n+1} = (2n+1) P_n + P'_{n-1}
57 const auto p = legendrePols(order, x);
58 std::vector<double> d(order + 1, 0.);
59 if (order > 0) {
60 d[1] = 1.;
61 }
62 for (int n = 1; n < order; ++n) {
63 d[n + 1] = ((2 * n + 1) * p[n]) + d[n - 1];
64 }
65 return d;
66}
67
68std::vector<double> legendrePolsD2(int order, double x)
69{
70 // P''_0 = P''_1 = 0, P''_{n+1} = (2n+1) P'_n + P''_{n-1}
71 const auto d1 = legendrePolsD1(order, x);
72 std::vector<double> d(order + 1, 0.);
73 for (int n = 1; n < order; ++n) {
74 d[n + 1] = ((2 * n + 1) * d1[n]) + d[n - 1];
75 }
76 return d;
77}
78
79double phiScale(double radius)
80{
81 // computeUV maps [phiBorder1, phiBorder2] -> [-1, 1]; the span is the same
82 // for the top and bottom half-shells: pi - 2 asin(gap / 2r).
83 const double span = TMath::Pi() - (2. * std::asin(constants::equatorialGap / 2. / radius));
84 return 2. / span;
85}
86
87} // namespace o2::its3::align
General auxilliary methods.
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events d
double radius
GLdouble n
Definition glcorearb.h:1982
GLint GLenum GLint x
Definition glcorearb.h:403
const GLdouble * v
Definition glcorearb.h:832
std::vector< double > legendrePolsD2(int order, double x)
std::vector< double > legendrePolsD1(int order, double x)
TrackSlopes computeTrackSlopes(double snp, double tgl)
double phiScale(double radius)
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