EIC 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 <map>
11 #include <utility> // for pair, make_pair
12 
13 class PHObject;
14 
16 {
17  public:
19  ~GlobalVertexv1() override;
20 
21  // PHObject virtual overloads
22 
23  void identify(std::ostream& os = std::cout) const override;
24  void Reset() override { *this = GlobalVertexv1(); }
25  int isValid() const override;
26  PHObject* CloneMe() const override { return new GlobalVertexv1(*this); }
27 
28  // vertex info
29 
30  unsigned int get_id() const override { return _id; }
31  void set_id(unsigned int id) override { _id = id; }
32 
33  float get_t() const override { return _t; }
34  void set_t(float t) override { _t = t; }
35 
36  float get_t_err() const override { return _t_err; }
37  void set_t_err(float t_err) override { _t_err = t_err; }
38 
39  float get_x() const override { return _pos[0]; }
40  void set_x(float x) override { _pos[0] = x; }
41 
42  float get_y() const override { return _pos[1]; }
43  void set_y(float y) override { _pos[1] = y; }
44 
45  float get_z() const override { return _pos[2]; }
46  void set_z(float z) override { _pos[2] = z; }
47 
48  float get_chisq() const override { return _chisq; }
49  void set_chisq(float chisq) override { _chisq = chisq; }
50 
51  unsigned int get_ndof() const override { return _ndof; }
52  void set_ndof(unsigned int ndof) override { _ndof = ndof; }
53 
54  float get_position(unsigned int coor) const override { return _pos[coor]; }
55  void set_position(unsigned int coor, float xi) override { _pos[coor] = xi; }
56 
57  float get_error(unsigned int i, unsigned int j) const override; //< get vertex error covar
58  void set_error(unsigned int i, unsigned int j, float value) override; //< set vertex error covar
59 
60  //
61  // associated vertex ids methods
62  //
63 
64  bool empty_vtxids() const override { return _vtx_ids.empty(); }
65  size_t size_vtxids() const override { return _vtx_ids.size(); }
66  size_t count_vtxids(GlobalVertex::VTXTYPE type) const override { return _vtx_ids.count(type); }
67 
68  void clear_vtxids() override { _vtx_ids.clear(); }
69  void insert_vtxids(GlobalVertex::VTXTYPE type, unsigned int vtxid) override { _vtx_ids.insert(std::make_pair(type, vtxid)); }
70  size_t erase_vtxids(GlobalVertex::VTXTYPE type) override { return _vtx_ids.erase(type); }
71  void erase_vtxids(GlobalVertex::VtxIter iter) override { _vtx_ids.erase(iter); }
72  void erase_vtxids(GlobalVertex::VtxIter first, GlobalVertex::VtxIter last) override { _vtx_ids.erase(first, last); }
73 
74  GlobalVertex::ConstVtxIter begin_vtxids() const override { return _vtx_ids.begin(); }
75  GlobalVertex::ConstVtxIter find_vtxids(GlobalVertex::VTXTYPE type) const override { return _vtx_ids.find(type); }
76  GlobalVertex::ConstVtxIter end_vtxids() const override { return _vtx_ids.end(); }
77 
78  GlobalVertex::VtxIter begin_vtxids() override { return _vtx_ids.begin(); }
79  GlobalVertex::VtxIter find_vtxids(GlobalVertex::VTXTYPE type) override { return _vtx_ids.find(type); }
80  GlobalVertex::VtxIter end_vtxids() override { return _vtx_ids.end(); }
81 
82  private:
83  unsigned int covar_index(unsigned int i, unsigned int j) const;
84 
85  unsigned int _id; //< unique identifier within container
86  float _t; //< collision time
87  float _t_err; //< collision time uncertainty
88  float _pos[3]; //< collision position x,y,z
89  float _chisq; //< vertex fit chisq
90  unsigned int _ndof; //< degrees of freedom
91  float _err[6]; //< error covariance matrix (+/- cm^2)
92  std::map<GlobalVertex::VTXTYPE, unsigned int> _vtx_ids; //< list of vtx ids
93 
95 };
96 
97 #endif