forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlignParam.h
More file actions
151 lines (112 loc) · 5.49 KB
/
AlignParam.h
File metadata and controls
151 lines (112 loc) · 5.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \file AlignParam.h
/// \brief Definition of the base alignment parameters class
/// @author Rafaelle Grosso, Raffaele.Grosso@cern.ch (original code in AliRoot)
/// Ruben Shahoyan, ruben.shahoyan@cern.ch (porting to O2)
#ifndef ALICEO2_BASE_ALIGNPARAM_H_
#define ALICEO2_BASE_ALIGNPARAM_H_
class TGeoMatrix;
class TGeoHMatrix;
#include <string>
namespace o2
{
namespace detectors
{
/// Base class for alignment parameters, containing global delta of rotation and translation
/// For the detail of alignment framework check http://alice-offline.web.cern.ch/Activities/Alignment
class AlignParam
{
public:
AlignParam() = default;
~AlignParam() = default;
AlignParam(const char* symname, int algID, // volume symbolic name and its alignable ID
double x, double y, double z, // delta translation
double psi, double theta, double phi, // delta rotation
bool global = true, // global (preferable) or local delta definition
bool convertLocalToGlobal = true); // if local is provided, convert it to global
AlignParam(const char* symname, int algID, TGeoMatrix& m,
bool global = true, // global (preferable) or local delta definition
bool convertLocalToGlobal = true); // if local is provided, convert it to global
/// return symbolic name of the volume
const std::string& getSymName() const { return mSymName; }
/// iparamater's getters
double getPhi() const { return mPhi; }
double getPsi() const { return mPsi; }
double getTheta() const { return mTheta; }
double getX() const { return mX; }
double getY() const { return mY; }
double getZ() const { return mZ; }
/// apply object to geoemetry
bool applyToGeometry(int printLevel = -1) const;
/// extract global delta matrix
TGeoHMatrix createMatrix() const;
/// extract local delta matrix
bool createLocalMatrix(TGeoHMatrix& m) const;
/// set symbolic name of the volume
void setSymName(const char* m) { mSymName = m; }
/// return alignable entry ID
int getAlignableID() const { return mAlignableID; }
/// set alignable entry ID
void setAlignableID(int id) { mAlignableID = id; }
/// ================ methods for direct setting of delta params
/// set parameters
void setParams(double x, double y, double z, double psi, double theta, double phi);
/// set parameters of global delta
void setGlobalParams(double x, double y, double z, double psi, double theta, double phi);
/// set global delta rotations angles in radian
void setRotation(double psi, double theta, double phi);
/// set global delta displacements in cm
void setTranslation(double x, double y, double z);
/// set params from the matrix of global delta
void setGlobalParams(const TGeoMatrix& m);
/// set translation from the matrix of global delta
void setTranslation(const TGeoMatrix& m);
// set rotation from the matrix of global delta
bool setRotation(const TGeoMatrix& m);
/// ================ methods for setting global delta params from local delta
/// set global delta params from the local delta params
bool setLocalParams(double x, double y, double z, double psi, double theta, double phi);
/// set global delta translation from the local delta translation
bool setLocalTranslation(double x, double y, double z);
/// set global delta rotation from the local delta rotation
bool setLocalRotation(double psi, double theta, double phi);
/// set global delta params from the local delta matrix
bool setLocalParams(const TGeoMatrix& m);
/// set the global delta transformation from translation part of local delta matrix
bool setLocalTranslation(const TGeoMatrix& m);
/// set the global delta rotation from rotation part of local delta matrix
bool setLocalRotation(const TGeoMatrix& m);
int getLevel() const;
void print() const;
int rectify(double zero = 1e-13);
bool isGlobal() const { return mIsGlobal; }
void setIsGlobal(bool v) { mIsGlobal = v; }
protected:
bool matrixToAngles(const double* rot, double& psi, double& theta, double& phi) const;
void anglesToMatrix(double psi, double theta, double phi, double* rot) const;
void setMatrixRotation(double psi, double theta, double phi, TGeoHMatrix& dest) const;
void setMatrixTranslation(double x, double y, double z, TGeoHMatrix& dest) const;
private:
std::string mSymName{};
bool mIsGlobal = true; /// is this global delta?
int mAlignableID = -1; /// alignable ID (set for sensors only)
double mX = 0.; ///< X translation of global delta
double mY = 0.; ///< Y translation of global delta
double mZ = 0.; ///< Z translation of global delta
double mPsi = 0.; ///< "pitch" : Euler angle of rotation around final X axis (radians)
double mTheta = 0.; ///< "roll" : Euler angle of rotation around Y axis after 1st rotation (radians)
double mPhi = 0.; ///< "yaw" : Euler angle of rotation around Z axis (radians)
ClassDefNV(AlignParam, 2);
};
} // namespace detectors
} // namespace o2
#endif