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"
18
19namespace o2
20{
21namespace dataformats
22{
24{
25
26 public:
27 MeanVertexObject(float x, float y, float z, float sigmax, float sigmay, float sigmaz, float slopeX, float slopeY)
28 {
29 setXYZ(x, y, z);
30 setSigma({sigmax, sigmay, sigmaz});
31 mSlopeX = slopeX;
32 mSlopeY = slopeY;
33 }
34 MeanVertexObject(std::array<float, 3> pos, std::array<float, 3> sigma, float slopeX, float slopeY)
35 {
37 setPos(p);
38 setSigma(sigma);
39 mSlopeX = slopeX;
40 mSlopeY = slopeY;
41 }
42 MeanVertexObject() = default;
43 ~MeanVertexObject() = default;
48
49 void set(int icoord, float val);
50 void setSigma(int icoord, float val);
51 void setSigma(std::array<float, 3> val)
52 {
53 setSigmaX(val[0]);
54 setSigmaY(val[1]);
55 setSigmaZ(val[2]);
56 }
57 void setSlopeX(float val) { mSlopeX = val; }
58 void setSlopeY(float val) { mSlopeY = val; }
59
60 math_utils::Point3D<float>& getPos() { return getXYZ(); }
61 math_utils::Point3D<float> getPos() const { return getXYZ(); }
62
63 float getSlopeX() const { return mSlopeX; }
64 float getSlopeY() const { return mSlopeY; }
65
66 float getXAtZ(float z) const { return getX() + mSlopeX * (z - getZ()); }
67 float getYAtZ(float z) const { return getY() + mSlopeY * (z - getZ()); }
68
69 void print() const;
70 std::string asString() const;
71
74
76 {
77 // set z-dependent x,z, assuming that the cov.matrix is already set
78 VertexBase v = *this;
79 v.setXYZ(getXAtZ(z), getYAtZ(z), z);
80 return v;
81 }
82
83 void setMeanXYVertexAtZ(VertexBase& v, float z) const
84 {
85 float dz = z - getZ();
86 v.setX(getX() + mSlopeX * dz);
87 v.setY(getY() + mSlopeY * dz);
88 v.setZ(z);
89 }
90
92 {
93 return (const VertexBase&)(*this);
94 }
95
96 private:
97 float mSlopeX{0.f}; // slope of x = f(z)
98 float mSlopeY{0.f}; // slope of y = f(z)
99
100 ClassDefNV(MeanVertexObject, 2);
101};
102
103std::ostream& operator<<(std::ostream& os, const o2::dataformats::MeanVertexObject& o);
104
105} // namespace dataformats
106} // namespace o2
107
108#endif
bool o
uint16_t pos
Definition RawData.h:3
MeanVertexObject(const MeanVertexObject &other)=default
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)
math_utils::Point3D< float > & getPos()
const VertexBase & getMeanVertex() const
VertexBase getMeanVertex(float z) 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