ATLAS Offline Software
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 
21 namespace Trk
22 {
23 TrkPlanarSurface::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);
42  calculateInverseTransform();
43  m_breakPoint = false;
44 }
45 
47  return m_trkSurface;
48  }
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 
64  const double* TrkPlanarSurface::getCenter() {
65  return &m_Center[0];
66  }
67 
69  return m_Rc;
70  }
71 
72  const double* TrkPlanarSurface::getNormal() {
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 
143  double TrkPlanarSurface::getInput() const {
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 }
Trk::TrkPlanarSurface::m_Center
double m_Center[3]
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkPlanarSurface.h:52
Trk::TrkPlanarSurface::transformPointToLocal
void transformPointToLocal(const double *, double *)
Definition: TrkPlanarSurface.cxx:113
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
Surface.h
Trk::TrkPlanarSurface::transformPointToGlobal
void transformPointToGlobal(const double *, double *)
Definition: TrkPlanarSurface.cxx:122
Trk::TrkPlanarSurface::calculateCombinedMatrix
double calculateCombinedMatrix(int, int, TrkPlanarSurface *)
Definition: TrkPlanarSurface.cxx:92
Trk::TrkPlanarSurface::getRotMatrix
double getRotMatrix(int, int)
Definition: TrkPlanarSurface.cxx:84
Trk::TrkPlanarSurface
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkPlanarSurface.h:25
Trk::TrkPlanarSurface::getTrkSurface
const Surface * getTrkSurface()
Definition: TrkPlanarSurface.cxx:46
Trk::TrkPlanarSurface::getCenter
const double * getCenter()
Definition: TrkPlanarSurface.cxx:64
Trk::TrkPlanarSurface::getInput
double getInput() const
Definition: TrkPlanarSurface.cxx:143
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
Trk::TrkPlanarSurface::m_trkSurface
const Surface * m_trkSurface
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkPlanarSurface.h:60
Trk::TrkPlanarSurface::rotateVectorToLocal
void rotateVectorToLocal(const double *, double *)
Definition: TrkPlanarSurface.cxx:99
lumiFormat.i
int i
Definition: lumiFormat.py:85
Trk::TrkPlanarSurface::m_Rc
double m_Rc
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkPlanarSurface.h:56
Trk::TrkPlanarSurface::getParameters
const double * getParameters()
Definition: TrkPlanarSurface.cxx:76
beamspotman.n
n
Definition: beamspotman.py:731
Trk::TrkPlanarSurface::m_Params
double m_Params[4]
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkPlanarSurface.h:51
Trk::TrkPlanarSurface::TrkPlanarSurface
TrkPlanarSurface(const double Center[3], const double Normal[3], double Transform[3][3], double, const Surface *pS=0)
Definition: TrkPlanarSurface.cxx:23
Trk::TrkPlanarSurface::getPar
double getPar(int)
Definition: TrkPlanarSurface.cxx:80
Trk::TrkPlanarSurface::getInvRotMatrix
double getInvRotMatrix(int, int)
Definition: TrkPlanarSurface.cxx:88
Trk::TrkPlanarSurface::radiusVector
double radiusVector() const
Definition: TrkPlanarSurface.cxx:68
Trk::TrkPlanarSurface::report
void report()
Definition: TrkPlanarSurface.cxx:147
Monitored::Y
@ Y
Definition: HistogramFillerUtils.h:24
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::TrkPlanarSurface::getRadLength
double getRadLength() const
Definition: TrkPlanarSurface.cxx:129
Trk::TrkPlanarSurface::getNormal
const double * getNormal()
Definition: TrkPlanarSurface.cxx:72
Trk::TrkPlanarSurface::m_radLength
double m_radLength
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkPlanarSurface.h:57
PlotCalibFromCool.rl
rl
Definition: PlotCalibFromCool.py:529
Trk::TrkPlanarSurface::calculateInverseTransform
void calculateInverseTransform()
Definition: TrkPlanarSurface.cxx:50
Trk::TrkPlanarSurface::m_breakPoint
bool m_breakPoint
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkPlanarSurface.h:59
Trk::TrkPlanarSurface::setBreakPoint
void setBreakPoint(double)
Definition: TrkPlanarSurface.cxx:134
Trk::TrkPlanarSurface::isBreakPoint
bool isBreakPoint() const
Definition: TrkPlanarSurface.cxx:139
Trk::TrkPlanarSurface::m_M
double m_M[3][3]
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkPlanarSurface.h:54
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:75
python.compressB64.c
def c
Definition: compressB64.py:93
TrkPlanarSurface.h
Trk::TrkPlanarSurface::m_input
double m_input
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkPlanarSurface.h:58
Trk::TrkPlanarSurface::rotateVectorToGlobal
void rotateVectorToGlobal(const double *, double *)
Definition: TrkPlanarSurface.cxx:106
Trk::TrkPlanarSurface::m_L
double m_L[3][3]
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkPlanarSurface.h:55
Trk::TrkPlanarSurface::m_Normal
double m_Normal[3]
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkPlanarSurface.h:53