Project
Loading...
Searching...
No Matches
MeanVertexObject.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
12#ifndef MEAN_VERTEX_OBJECT_H_
13#define MEAN_VERTEX_OBJECT_H_
14
15#include <array>
16#include "Framework/Logger.h"
19
20namespace o2
21{
22namespace dataformats
23{
25{
26 public:
27 MeanVertexObject(float x, float y, float z, float sigmax, float sigmay, float sigmaz, float slopeX, float slopeY)
28 {
29 if (!gMVBias) {
31 }
32 setXYZ(x, y, z);
33 setSigma({sigmax, sigmay, sigmaz});
34 mSlopeX = slopeX;
35 mSlopeY = slopeY;
36 }
37
38 MeanVertexObject(std::array<float, 3> pos, std::array<float, 3> sigma, float slopeX, float slopeY)
39 {
40 if (!gMVBias) {
42 }
44 setPos(p);
45 setSigma(sigma);
46 mSlopeX = slopeX;
47 mSlopeY = slopeY;
48 }
49
51 {
52 if (!gMVBias) {
54 }
55 }
56
57 ~MeanVertexObject() = default;
62
63 void set(int icoord, float val);
64 void setSigma(int icoord, float val);
65 void setSigma(std::array<float, 3> val)
66 {
67 setSigmaX(val[0]);
68 setSigmaY(val[1]);
69 setSigmaZ(val[2]);
70 }
71 void setSlopeX(float val) { mSlopeX = val; }
72 void setSlopeY(float val) { mSlopeY = val; }
73
74 // getting the cartesian coordinates and errors
75 float getX() const { return VertexBase::getX() + gMVBias->xyz[0]; }
76 float getY() const
77 {
78 return VertexBase::getY() + gMVBias->xyz[1];
79 ;
80 }
81 float getZ() const
82 {
83 return VertexBase::getZ() + gMVBias->xyz[2];
84 ;
85 }
86 float getR() const { return gpu::CAMath::Hypot(getX(), getY()); }
87
88 math_utils::Point3D<float> getXYZ() const { return {getX(), getY(), getZ()}; }
90
91 float getSlopeX() const { return mSlopeX + gMVBias->slopeX; }
92 float getSlopeY() const { return mSlopeY + gMVBias->slopeY; }
93
94 float getXAtZ(float z) const { return getX() + getSlopeX() * (z - getZ()); }
95 float getYAtZ(float z) const { return getY() + getSlopeY() * (z - getZ()); }
96
97 void print() const;
98 std::string asString() const;
99
102
104 {
105 // set z-dependent x,z, assuming that the cov.matrix is already set
106 VertexBase v = *this;
107 v.setXYZ(getXAtZ(z), getYAtZ(z), z);
108 return v;
109 }
110
111 void setMeanXYVertexAtZ(VertexBase& v, float z) const
112 {
113 v = *this;
114 v.setX(getXAtZ(z));
115 v.setY(getYAtZ(z));
116 v.setZ(z);
117 }
118
120 {
121 return getMeanVertex(getZ());
122 }
123
124 static void checkExternalBias();
125
126 private:
127 float mSlopeX{0.f}; // slope of x = f(z)
128 float mSlopeY{0.f}; // slope of y = f(z)
129
130 static const MeanVertexBiasParam* gMVBias;
131
132 ClassDefNV(MeanVertexObject, 2);
133};
134
135std::ostream& operator<<(std::ostream& os, const o2::dataformats::MeanVertexObject& o);
136
137} // namespace dataformats
138} // namespace o2
139
140#endif
uint16_t pos
Definition RawData.h:3
MeanVertexObject(const MeanVertexObject &other)=default
math_utils::Point3D< float > getXYZ() const
MeanVertexObject & operator=(MeanVertexObject &&other)=default
MeanVertexObject(std::array< float, 3 > pos, std::array< float, 3 > sigma, float slopeX, float slopeY)
void set(int icoord, float val)
VertexBase getMeanVertex(float z) const
const VertexBase getMeanVertex() const
MeanVertexObject(MeanVertexObject &&other)=default
MeanVertexObject & operator=(const MeanVertexObject &other)=default
MeanVertexObject(float x, float y, float z, float sigmax, float sigmay, float sigmaz, float slopeX, float slopeY)
math_utils::Point3D< float > getPos() const
void setSigma(int icoord, float val)
math_utils::Point3D< float > sample() const
sample a vertex from the MeanVertex parameters
void setMeanXYVertexAtZ(VertexBase &v, float z) const
void setSigma(std::array< float, 3 > val)
GLint GLenum GLint x
Definition glcorearb.h:403
const GLdouble * v
Definition glcorearb.h:832
GLuint GLfloat * val
Definition glcorearb.h:1582
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
std::ostream & operator<<(std::ostream &os, const o2::dataformats::MeanVertexObject &o)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
VectorOfTObjectPtrs other