Project
Loading...
Searching...
No Matches
MeanVertexObject.cxx
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
13#include "TRandom.h"
14
15namespace o2
16{
17namespace dataformats
18{
19
20void MeanVertexObject::set(int icoord, float val)
21{
22 if (icoord == 0) {
23 setX(val);
24 } else if (icoord == 1) {
25 setY(val);
26 } else if (icoord == 2) {
27 setZ(val);
28 } else {
29 LOG(fatal) << "Coordinate out of bound to set vtx " << icoord << ", should be in [0, 2]";
30 }
31}
32
33void MeanVertexObject::setSigma(int icoord, float val)
34{
35 if (icoord == 0) {
36 setSigmaX2(val);
37 } else if (icoord == 1) {
39 } else if (icoord == 2) {
41 } else {
42 LOG(fatal) << "Coordinate out of bound to set sigma via MeanVtx " << icoord << ", should be in [0, 2]";
43 }
44}
45
46std::string MeanVertexObject::asString() const
47{
48 return VertexBase::asString() + fmt::format(" Slopes {{{:+.4e},{:+.4e}}}", mSlopeX, mSlopeY);
49}
50
51std::ostream& operator<<(std::ostream& os, const o2::dataformats::MeanVertexObject& o)
52{
53 // stream itself
54 os << o.asString();
55 return os;
56}
57
59{
60 std::cout << *this << std::endl;
61}
62
64{
65 // this assumes gaussian sampling
66 // first determine z; then x and y
67 const auto z = gRandom->Gaus(getZ(), getSigmaZ());
68 const auto x = gRandom->Gaus(getXAtZ(z), getSigmaX());
69 const auto y = gRandom->Gaus(getYAtZ(z), getSigmaY());
71}
72
73} // namespace dataformats
74} // namespace o2
bool o
void set(int icoord, float val)
void setSigma(int icoord, float val)
math_utils::Point3D< float > sample() const
sample a vertex from the MeanVertex parameters
std::string asString() const
Definition Vertex.cxx:25
GLint GLenum GLint x
Definition glcorearb.h:403
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 ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"