Project
Loading...
Searching...
No Matches
AlignmentPoint.h
Go to the documentation of this file.
1// Copyright 2019-2020 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
16
24#ifndef ALIGNMENTPOINT_H
25#define ALIGNMENTPOINT_H
26
27#include <Rtypes.h>
28#include <TMatrixD.h>
29#include <TVectorD.h>
33#include "Framework/Logger.h"
34#include "Align/utils.h"
35
36namespace o2
37{
38namespace align
39{
40
42{
43 public:
45
46 enum BITS { kMaterialBit = 0x1 << 0, // point contains material
47 kMeasurementBit = 0x1 << 1, // point contains measurement
48 kUpdateFromTrackBit = 0x1 << 2, // point needs to recalculate itself using track info
49 kVaryELossBit = 0x1 << 3, // ELoss variation allowed
50 kUseBzOnly = 0x1 << 4, // use only Bz component (ITS)
51 kInvDir = 0x1 << 5, // propagation via this point is in decreasing X direction (upper cosmic leg)
52 kStatOK = 0x1 << 6, // point is accounted in global statistics
53
54 kOptUMAT = 0x1 << 10,
55 kOptDiag = 0x1 << 11,
56 kOptWSA = 0x1 << 12,
57 kOptWSB = 0x1 << 13
58
59 };
60 enum { kParY = 0, // track parameters
68 enum { kX,
70 kZ };
71 //
72 AlignmentPoint() = default;
73 //
74 void init();
76 //
77 double getAlphaSens() const { return mAlphaSens; }
78 double getXSens() const { return mXSens; }
79 double getXTracking() const { return mXYZTracking[0]; }
80 double getYTracking() const { return mXYZTracking[1]; }
81 double getZTracking() const { return mXYZTracking[2]; }
82 const double* getYZTracking() const { return &mXYZTracking[1]; }
83 const double* getXYZTracking() const { return mXYZTracking; }
84 const double* getYZErrTracking() const { return mErrYZTracking; }
85
86 const AlignableSensor* getSensor() const { return mSensor; }
87 uint32_t getVolID() const { return mSensor->getVolID(); }
89
90 int getDetID() const { return mDetID; }
91 int getSID() const { return mSID; }
92 int getMinLocVarID() const { return mMinLocVarID; }
93 int getMaxLocVarID() const { return mMaxLocVarID; }
94 int getNMatPar() const;
95
96 bool containsMaterial() const { return testBit(kMaterialBit); }
99 bool getELossVaried() const { return testBit(kVaryELossBit); }
100 bool getUseBzOnly() const { return testBit(kUseBzOnly); }
101 bool isInvDir() const { return testBit(kInvDir); }
102 bool isStatOK() const { return testBit(kStatOK); }
103 //
104 void setELossVaried(bool v = true) { setBit(kVaryELossBit, v); }
105 void setContainsMaterial(bool v = true) { setBit(kMaterialBit, v); }
108 void setUseBzOnly(bool v = true) { setBit(kUseBzOnly, v); }
109 void setInvDir(bool v = true) { setBit(kInvDir, v); }
110 void setStatOK(bool v = true) { setBit(kStatOK, v); }
111
112 double getXTimesRho() const { return mXTimesRho; }
113 double getX2X0() const { return mX2X0; }
114 void setXTimesRho(double v) { mXTimesRho = v; }
115 void setX2X0(double v) { mX2X0 = v; }
116 //
117 void setDetID(int id) { mDetID = (char)id; }
118 void setSID(int id) { mSID = (int16_t)id; }
119 //
120 void setMinLocVarID(int id) { mMinLocVarID = id; }
121 void setMaxLocVarID(int id) { mMaxLocVarID = id; }
122 //
123 void getResidualsDiag(const double* pos, double& resU, double& resV) const;
124 void diagonalizeResiduals(double rY, double rZ, double& resU, double& resV) const;
125 //
126 void setAlphaSens(double a) { mAlphaSens = a; }
127 void setXSens(double x) { mXSens = x; }
128 void setXYZTracking(const double r[3])
129 {
130 for (int i = 3; i--;) {
131 mXYZTracking[i] = r[i];
132 }
133 }
134 void setXYZTracking(double x, double y, double z);
135 void setYZErrTracking(double sy2, double syz, double sz2);
136 void setYZErrTracking(const double* err)
137 {
138 for (int i = 3; i--;) {
139 mErrYZTracking[i] = err[i];
140 }
141 }
142 double getErrDiag(int i) const { return mErrDiag[i]; }
143 //
144 double* getTrParamWSA() const { return (double*)mTrParamWSA; }
145 double* getTrParamWSB() const { return (double*)mTrParamWSB; }
146 double getTrParamWSA(int ip) const { return mTrParamWSA[ip]; }
147 double getTrParamWSB(int ip) const { return mTrParamWSB[ip]; }
148 void getTrWSA(trackParam_t& etp) const;
149 void getTrWSB(trackParam_t& etp) const;
150 void setTrParamWSA(const double* param)
151 {
152 for (int i = 5; i--;) {
153 mTrParamWSA[i] = param[i];
154 }
155 }
156 void setTrParamWSB(const double* param)
157 {
158 for (int i = 5; i--;) {
159 mTrParamWSB[i] = param[i];
160 }
161 }
162 double getResidY() const { return getTrParamWSA(kParY) - getYTracking(); }
163 double getResidZ() const { return getTrParamWSA(kParZ) - getZTracking(); }
164 //
165 void setMatCovDiagonalizationMatrix(const TMatrixD& d);
166 void setMatCovDiag(const TVectorD& v);
167 void setMatCovDiagElem(int i, double err2) { mMatCorrCov[i] = err2; }
168 void unDiagMatCorr(const double* diag, double* nodiag) const;
169 void diagMatCorr(const double* nodiag, double* diag) const;
170 void unDiagMatCorr(const float* diag, float* nodiag) const;
171 void diagMatCorr(const float* nodiag, float* diag) const;
172 //
173 void setMatCorrExp(double* p)
174 {
175 for (int i = 5; i--;) {
176 mMatCorrExp[i] = p[i];
177 }
178 }
179 float* getMatCorrExp() const { return (float*)mMatCorrExp; }
180 float* getMatCorrCov() const { return (float*)mMatCorrCov; }
181 //
182 void getXYZGlo(double r[3]) const;
183 double getPhiGlo() const;
184 int getAliceSector() const;
185 //
186 int getNGloDOFs() const { return mNGloDOFs; }
187 int getDGloOffs() const { return mDGloOffs; }
188 void setNGloDOFs(int n) { mNGloDOFs = n; }
189 void setDGloOffs(int n) { mDGloOffs = n; }
190 //
191 void incrementStat();
192 //
193 virtual void dumpCoordinates() const;
194 void print(uint16_t opt = 0) const;
195 void clear();
196 //
197 bool isAfter(const AlignmentPoint& pnt) const;
198
199 protected:
200 //
201 // ---------- dummies ----------
202 void setBit(BITS b, bool v)
203 {
204 if (v) {
205 mBits |= b;
206 } else {
207 mBits &= ~(b & 0xffff);
208 }
209 }
210 bool testBit(BITS b) const
211 {
212 return mBits & b;
213 }
214
215 protected:
216 //
217 int mMinLocVarID = -1; // The residuals/derivatives depend on fNLocExtPar params
218 // and point params>=mMinLocVarID.
219 int mMaxLocVarID = -1; // The residuals/derivatives depend on fNLocExtPar params
220 // and point params<mMaxLocVarID.
221 // If the point contains materials, mMaxLocVarID also marks
222 // the parameters associated with this point
223 DetID mDetID{}; // DetectorID
224 int16_t mSID = -1; // sensor ID in the detector
225 uint16_t mBits = 0; // flags
226 float mAlphaSens = 0; // Alpha of tracking frame
227 float mXSens = 0; // X of tracking frame
228 float mCosDiagErr = 0; // Cos of Phi of rotation in YZ plane which diagonalize errors
229 float mSinDiagErr = 0; // Sin of Phi of rotation in YZ plane which diagonalize errors
230 float mErrDiag[2] = {0}; // diagonalized errors
231 double mXYZTracking[3] = {0}; // X,Y,Z in tracking frame
232 double mErrYZTracking[3] = {0}; // errors in tracking frame
233 //
234 float mX2X0 = 0; // X2X0 seen by the track (including inclination)
235 float mXTimesRho = 0; // signed Density*Length seen by the track (including inclination)
236 //
237 int mNGloDOFs = 0; // number of global DOFs this point depends on
238 int mDGloOffs = 0; // 1st entry slot of d/dGloPar in the AlgTrack fDResDGlo arrays
239 float mMatCorrExp[kNMatDOFs] = {}; // material correction due to ELoss expectation (non-diagonalized)
240 float mMatCorrCov[kNMatDOFs] = {}; // material correction delta covariance (diagonalized)
241 float mMatDiag[kNMatDOFs][kNMatDOFs] = {}; // matrix for diagonalization of material effects errors
242 //
243 double mTrParamWSA[kNMatDOFs] = {}; // workspace for tracks params at this point AFTER material correction
244 double mTrParamWSB[kNMatDOFs] = {}; // workspace for tracks params at this point BEFORE material correction
245
246 AlignableSensor* mSensor = nullptr; // sensor of this point
247
248 ClassDefNV(AlignmentPoint, 1)
249};
250
251//____________________________________________________
252inline void AlignmentPoint::setXYZTracking(double x, double y, double z)
253{
254 // assign tracking coordinates
255 mXYZTracking[0] = x;
256 mXYZTracking[1] = y;
257 mXYZTracking[2] = z;
258}
259
260//____________________________________________________
261inline void AlignmentPoint::setYZErrTracking(double sy2, double syz, double sz2)
262{
263 // assign tracking coordinates
264 mErrYZTracking[0] = sy2;
265 mErrYZTracking[1] = syz;
266 mErrYZTracking[2] = sz2;
267}
268
270{
271 // get number of free params for material descriptoin
273}
274
275//_____________________________________
276inline void AlignmentPoint::diagonalizeResiduals(double rY, double rZ, double& resU, double& resV) const
277{
278 // rotate residuals to frame where their error matrix is diagonal
279 resU = mCosDiagErr * rY - mSinDiagErr * rZ;
280 resV = mSinDiagErr * rY + mCosDiagErr * rZ;
281 //
282}
283
284//_____________________________________
285inline void AlignmentPoint::getResidualsDiag(const double* pos, double& resU, double& resV) const
286{
287 // calculate residuals in the frame where the errors are diagonal, given the position
288 // of the track in the standard tracking frame
289 diagonalizeResiduals(pos[0] - mXYZTracking[1], pos[1] - mXYZTracking[2], resU, resV);
290 //
291}
292
293//__________________________________________________________________
295{
296 // increment statistics for detectors this point depends on
298 setStatOK();
299}
300} // namespace align
301} // namespace o2
302#endif
End-chain alignment volume in detector branch, where the actual measurement is done.
Base track model for the Barrel, params only, w/o covariance.
Collection of auxillary methods.
void print() const
unsigned short int uint16_t
int32_t i
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 s
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
uint16_t pos
Definition RawData.h:3
double getTrParamWSB(int ip) const
void getTrWSA(trackParam_t &etp) const
float * getMatCorrCov() const
virtual void dumpCoordinates() const
void setYZErrTracking(const double *err)
void setStatOK(bool v=true)
void updatePointByTrackInfo(const trackParam_t *t)
double getErrDiag(int i) const
bool testBit(BITS b) const
void setMatCorrExp(double *p)
uint32_t getVolID() const
void setSensor(AlignableSensor *s)
double * getTrParamWSB() const
void diagonalizeResiduals(double rY, double rZ, double &resU, double &resV) const
void setContainsMaterial(bool v=true)
void setBit(BITS b, bool v)
void setTrParamWSA(const double *param)
void setMatCovDiagElem(int i, double err2)
double * getTrParamWSA() const
double mTrParamWSB[kNMatDOFs]
void setMatCovDiag(const TVectorD &v)
const AlignableSensor * getSensor() const
void setContainsMeasurement(bool v=true)
float mMatCorrCov[kNMatDOFs]
void setUseBzOnly(bool v=true)
float * getMatCorrExp() const
void setYZErrTracking(double sy2, double syz, double sz2)
void diagMatCorr(const double *nodiag, double *diag) const
void setInvDir(bool v=true)
void getResidualsDiag(const double *pos, double &resU, double &resV) const
void getXYZGlo(double r[3]) const
void getTrWSB(trackParam_t &etp) const
const double * getXYZTracking() const
const double * getYZErrTracking() const
bool getNeedUpdateFromTrack() const
AlignableSensor * mSensor
double mTrParamWSA[kNMatDOFs]
void setMatCovDiagonalizationMatrix(const TMatrixD &d)
float mMatDiag[kNMatDOFs][kNMatDOFs]
bool isAfter(const AlignmentPoint &pnt) const
void setNeedUpdateFromTrack(bool v=true)
void setELossVaried(bool v=true)
const double * getYZTracking() const
void setTrParamWSB(const double *param)
float mMatCorrExp[kNMatDOFs]
double getTrParamWSA(int ip) const
void setXYZTracking(const double r[3])
void unDiagMatCorr(const double *diag, double *nodiag) const
Static class with identifiers, bitmasks and names for ALICE detectors.
Definition DetID.h:60
GLdouble n
Definition glcorearb.h:1982
GLint GLenum GLint x
Definition glcorearb.h:403
const GLdouble * v
Definition glcorearb.h:832
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLint y
Definition glcorearb.h:270
GLenum GLfloat param
Definition glcorearb.h:271
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
GLuint id
Definition glcorearb.h:650
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
typename track::TrackParametrizationWithError< double > trackParam_t
Definition utils.h:29
void align(gsl::span< ElinkEncoder< BareFormat, CHARGESUM > > elinks)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...