ATLAS Offline Software
Loading...
Searching...
No Matches
TrkPlanarSurface.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4
6// TrkPlanarSurface.cpp
7// Implementation of class TrkPlanarSurface
9// (c) ATLAS Detector software
11// Author: Dmitry Emeliyanov, RAL
12// D.Emeliyanov@rl.ac.uk
14
16#include "TrkSurfaces/Surface.h"
17#include <cmath>
18#include <cstdio>
19#include <cstdlib>
20
21namespace Trk
22{
23TrkPlanarSurface::TrkPlanarSurface(const double c[3], const double n[3],
24 double m[3][3], double rl, const Surface* pS)
25 : m_Rc(0.0), m_radLength(rl), m_input{}, m_trkSurface(pS) {
26 int i, j;
27
28 m_Params[3] = 0.0;
29
30 for (i = 0; i < 3; i++) {
31 m_Center[i] = c[i];
32 m_Normal[i] = n[i];
33 m_Params[i] = n[i];
34 m_Params[3] -= n[i] * c[i];
35 m_Rc += c[i] * c[i];
36 }
37 for (i = 0; i < 3; i++) {
38 for (j = 0; j < 3; j++)
39 m_L[i][j] = m[i][j];
40 }
41 m_Rc = sqrt(m_Rc);
43 m_breakPoint = false;
44}
45
49
51 m_M[0][0] = m_L[1][1] * m_L[2][2] - m_L[1][2] * m_L[2][1];
52 m_M[1][0] = -m_L[1][0] * m_L[2][2] + m_L[1][2] * m_L[2][0];
53 m_M[2][0] = m_L[1][0] * m_L[2][1] - m_L[1][1] * m_L[2][0];
54 m_M[0][1] = -m_L[0][1] * m_L[2][2] + m_L[0][2] * m_L[2][1];
55 m_M[1][1] = m_L[0][0] * m_L[2][2] - m_L[0][2] * m_L[2][0];
56 m_M[2][1] = -m_L[0][0] * m_L[2][1] + m_L[0][1] * m_L[2][0];
57 m_M[0][2] = m_L[0][1] * m_L[1][2] - m_L[0][2] * m_L[1][1];
58 m_M[1][2] = -m_L[0][0] * m_L[1][2] + m_L[0][2] * m_L[1][0];
59 m_M[2][2] = m_L[0][0] * m_L[1][1] - m_L[0][1] * m_L[1][0];
60 }
61
62
63
65 return &m_Center[0];
66 }
67
69 return m_Rc;
70 }
71
73 return &m_Normal[0];
74 }
75
77 return &m_Params[0];
78 }
79
81 return m_Params[i];
82 }
83
84 double TrkPlanarSurface::getRotMatrix(int i, int j) {
85 return m_M[i][j];
86 }
87
88 double TrkPlanarSurface::getInvRotMatrix(int i, int j) {
89 return m_L[i][j];
90 }
91
93 double rc = 0;
94
95 for (int m = 0; m < 3; m++) rc += pS->m_M[i][m] * m_L[m][j];
96 return rc;
97 }
98
99 void TrkPlanarSurface::rotateVectorToLocal(const double* X, double* Y) {
100 int i;
101
102 for (i = 0; i < 3; i++)
103 Y[i] = m_M[i][0] * X[0] + m_M[i][1] * X[1] + m_M[i][2] * X[2];
104 }
105
106 void TrkPlanarSurface::rotateVectorToGlobal(const double* X, double* Y) {
107 int i;
108
109 for (i = 0; i < 3; i++)
110 Y[i] = m_L[i][0] * X[0] + m_L[i][1] * X[1] + m_L[i][2] * X[2];
111 }
112
113 void TrkPlanarSurface::transformPointToLocal(const double* X, double* Y) {
114 int i;
115
116 for (i = 0; i < 3; i++)
117 Y[i] = m_M[i][0] * (X[0] - m_Center[0]) +
118 m_M[i][1] * (X[1] - m_Center[1]) +
119 m_M[i][2] * (X[2] - m_Center[2]);
120 }
121
122 void TrkPlanarSurface::transformPointToGlobal(const double* X, double* Y) {
123 int i;
124
125 for (i = 0; i < 3; i++)
126 Y[i] = m_Center[i] + m_L[i][0] * X[0] + m_L[i][1] * X[1] + m_L[i][2] * X[2];
127 }
128
130 //return 0.022;
131 return m_radLength;
132 }
133
135 m_breakPoint = true;
136 m_input = u;
137 }
138
140 return m_breakPoint;
141 }
142
144 return m_input;
145 }
146
148 printf("SURFACE: CENTER x=%f y=%f z=%f R=%f\n", m_Center[0], m_Center[1], m_Center[2], m_Rc);
149 printf(" NORMAL nx=%f ny=%f nz=%f\n", m_Normal[0], m_Normal[1], m_Normal[2]);
150 printf("EQUATION: (%f)x+(%f)y+(%f)z+(%f)=0\n", m_Params[0], m_Params[1], m_Params[2], m_Params[3]);
151 for (auto & i : m_M) {
152 for (double j : i) printf("%f ", j);
153 printf("\n");
154 }
155 }
156}
static Double_t rc
Abstract Base Class for tracking surfaces.
const double * getNormal()
void transformPointToLocal(const double *, double *)
void rotateVectorToLocal(const double *, double *)
double calculateCombinedMatrix(int, int, TrkPlanarSurface *)
void rotateVectorToGlobal(const double *, double *)
void transformPointToGlobal(const double *, double *)
double getInvRotMatrix(int, int)
const double * getParameters()
const double * getCenter()
double getRotMatrix(int, int)
const Surface * getTrkSurface()
TrkPlanarSurface(const double Center[3], const double Normal[3], double Transform[3][3], double, const Surface *pS=0)
Ensure that the ATLAS eigen extensions are properly loaded.
@ u
Enums for curvilinear frames.
Definition ParamDefs.h:77