File indexing completed on 2025-08-06 08:17:38
0001
0002
0003 #ifndef GLOBALVERTEX_GLOBALVERTEXV1_H
0004 #define GLOBALVERTEX_GLOBALVERTEXV1_H
0005
0006 #include "GlobalVertex.h"
0007
0008 #include <cstddef> // for size_t
0009 #include <iostream>
0010 #include <limits>
0011 #include <map>
0012 #include <utility> // for pair, make_pair
0013
0014 class PHObject;
0015
0016 class GlobalVertexv1 : public GlobalVertex
0017 {
0018 public:
0019 GlobalVertexv1(const GlobalVertex::VTXTYPE id = GlobalVertex::UNDEFINED);
0020 ~GlobalVertexv1() override = default;
0021
0022
0023
0024 void identify(std::ostream& os = std::cout) const override;
0025 void Reset() override { *this = GlobalVertexv1(); }
0026 int isValid() const override;
0027 PHObject* CloneMe() const override { return new GlobalVertexv1(*this); }
0028
0029
0030
0031 unsigned int get_id() const override { return _id; }
0032 void set_id(unsigned int id) override { _id = id; }
0033
0034 float get_t() const override { return _t; }
0035 void set_t(float t) override { _t = t; }
0036
0037 float get_t_err() const override { return _t_err; }
0038 void set_t_err(float t_err) override { _t_err = t_err; }
0039
0040 float get_x() const override { return _pos[0]; }
0041 void set_x(float x) override { _pos[0] = x; }
0042
0043 float get_y() const override { return _pos[1]; }
0044 void set_y(float y) override { _pos[1] = y; }
0045
0046 float get_z() const override { return _pos[2]; }
0047 void set_z(float z) override { _pos[2] = z; }
0048
0049 float get_chisq() const override { return _chisq; }
0050 void set_chisq(float chisq) override { _chisq = chisq; }
0051
0052 unsigned int get_ndof() const override { return _ndof; }
0053 void set_ndof(unsigned int ndof) override { _ndof = ndof; }
0054
0055 float get_position(unsigned int coor) const override { return _pos[coor]; }
0056 void set_position(unsigned int coor, float xi) override { _pos[coor] = xi; }
0057
0058 float get_error(unsigned int i, unsigned int j) const override;
0059 void set_error(unsigned int i, unsigned int j, float value) override;
0060
0061
0062
0063
0064
0065 bool empty_vtxids() const override { return _vtx_ids.empty(); }
0066 size_t size_vtxids() const override { return _vtx_ids.size(); }
0067 size_t count_vtxids(GlobalVertex::VTXTYPE type) const override { return _vtx_ids.count(type); }
0068
0069 void clear_vtxids() override { _vtx_ids.clear(); }
0070 void insert_vtxids(GlobalVertex::VTXTYPE type, unsigned int vtxid) override { _vtx_ids.insert(std::make_pair(type, vtxid)); }
0071 size_t erase_vtxids(GlobalVertex::VTXTYPE type) override { return _vtx_ids.erase(type); }
0072 void erase_vtxids(GlobalVertex::VtxIter iter) override { _vtx_ids.erase(iter); }
0073 void erase_vtxids(GlobalVertex::VtxIter first, GlobalVertex::VtxIter last) override { _vtx_ids.erase(first, last); }
0074
0075 GlobalVertex::ConstVtxIter begin_vtxids() const override { return _vtx_ids.begin(); }
0076 GlobalVertex::ConstVtxIter find_vtxids(GlobalVertex::VTXTYPE type) const override { return _vtx_ids.find(type); }
0077 GlobalVertex::ConstVtxIter end_vtxids() const override { return _vtx_ids.end(); }
0078
0079 GlobalVertex::VtxIter begin_vtxids() override { return _vtx_ids.begin(); }
0080 GlobalVertex::VtxIter find_vtxids(GlobalVertex::VTXTYPE type) override { return _vtx_ids.find(type); }
0081 GlobalVertex::VtxIter end_vtxids() override { return _vtx_ids.end(); }
0082
0083 private:
0084 unsigned int covar_index(unsigned int i, unsigned int j) const;
0085
0086 unsigned int _id = std::numeric_limits<unsigned int>::max();
0087 float _t = std::numeric_limits<float>::quiet_NaN();
0088 float _t_err = std::numeric_limits<float>::quiet_NaN();
0089 float _pos[3] = {};
0090 float _chisq = std::numeric_limits<float>::quiet_NaN();
0091 unsigned int _ndof = std::numeric_limits<unsigned int>::max();
0092 float _err[6] = {};
0093 std::map<GlobalVertex::VTXTYPE, unsigned int> _vtx_ids;
0094
0095 ClassDefOverride(GlobalVertexv1, 1);
0096 };
0097
0098 #endif