Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GlobalVertexv1.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GlobalVertexv1.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef G4VERTEX_GLOBALVERTEXV1_H
4 #define G4VERTEX_GLOBALVERTEXV1_H
5 
6 #include "GlobalVertex.h"
7 
8 #include <cstddef> // for size_t
9 #include <iostream>
10 #include <limits>
11 #include <map>
12 #include <utility> // for pair, make_pair
13 
14 class PHObject;
15 
17 {
18  public:
20  ~GlobalVertexv1() override = default;
21 
22  // PHObject virtual overloads
23 
24  void identify(std::ostream& os = std::cout) const override;
25  void Reset() override { *this = GlobalVertexv1(); }
26  int isValid() const override;
27  PHObject* CloneMe() const override { return new GlobalVertexv1(*this); }
28 
29  // vertex info
30 
31  unsigned int get_id() const override { return _id; }
32  void set_id(unsigned int id) override { _id = id; }
33 
34  float get_t() const override { return _t; }
35  void set_t(float t) override { _t = t; }
36 
37  float get_t_err() const override { return _t_err; }
38  void set_t_err(float t_err) override { _t_err = t_err; }
39 
40  float get_x() const override { return _pos[0]; }
41  void set_x(float x) override { _pos[0] = x; }
42 
43  float get_y() const override { return _pos[1]; }
44  void set_y(float y) override { _pos[1] = y; }
45 
46  float get_z() const override { return _pos[2]; }
47  void set_z(float z) override { _pos[2] = z; }
48 
49  float get_chisq() const override { return _chisq; }
50  void set_chisq(float chisq) override { _chisq = chisq; }
51 
52  unsigned int get_ndof() const override { return _ndof; }
53  void set_ndof(unsigned int ndof) override { _ndof = ndof; }
54 
55  float get_position(unsigned int coor) const override { return _pos[coor]; }
56  void set_position(unsigned int coor, float xi) override { _pos[coor] = xi; }
57 
58  float get_error(unsigned int i, unsigned int j) const override; //< get vertex error covar
59  void set_error(unsigned int i, unsigned int j, float value) override; //< set vertex error covar
60 
61  //
62  // associated vertex ids methods
63  //
64 
65  bool empty_vtxids() const override { return _vtx_ids.empty(); }
66  size_t size_vtxids() const override { return _vtx_ids.size(); }
67  size_t count_vtxids(GlobalVertex::VTXTYPE type) const override { return _vtx_ids.count(type); }
68 
69  void clear_vtxids() override { _vtx_ids.clear(); }
70  void insert_vtxids(GlobalVertex::VTXTYPE type, unsigned int vtxid) override { _vtx_ids.insert(std::make_pair(type, vtxid)); }
71  size_t erase_vtxids(GlobalVertex::VTXTYPE type) override { return _vtx_ids.erase(type); }
72  void erase_vtxids(GlobalVertex::VtxIter iter) override { _vtx_ids.erase(iter); }
73  void erase_vtxids(GlobalVertex::VtxIter first, GlobalVertex::VtxIter last) override { _vtx_ids.erase(first, last); }
74 
75  GlobalVertex::ConstVtxIter begin_vtxids() const override { return _vtx_ids.begin(); }
77  GlobalVertex::ConstVtxIter end_vtxids() const override { return _vtx_ids.end(); }
78 
79  GlobalVertex::VtxIter begin_vtxids() override { return _vtx_ids.begin(); }
81  GlobalVertex::VtxIter end_vtxids() override { return _vtx_ids.end(); }
82 
83  private:
84  unsigned int covar_index(unsigned int i, unsigned int j) const;
85 
86  unsigned int _id = std::numeric_limits<unsigned int>::max(); //< unique identifier within container
87  float _t = std::numeric_limits<float>::quiet_NaN(); //< collision time
88  float _t_err = std::numeric_limits<float>::quiet_NaN(); //< collision time uncertainty
89  float _pos[3] = {}; //< collision position x,y,z
90  float _chisq = std::numeric_limits<float>::quiet_NaN(); //< vertex fit chisq
91  unsigned int _ndof = std::numeric_limits<unsigned int>::max();
92  float _err[6] = {}; //< error covariance matrix (+/- cm^2)
93  std::map<GlobalVertex::VTXTYPE, unsigned int> _vtx_ids; //< list of vtx ids
94 
96 };
97 
98 #endif