Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GlobalVertex.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GlobalVertex.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef G4VERTEX_GLOBALVERTEX_H
4 #define G4VERTEX_GLOBALVERTEX_H
5 
6 #include <phool/PHObject.h>
7 #include "Vertex.h"
8 #include <cmath>
9 #include <iostream>
10 #include <map>
11 
12 class GlobalVertex : public PHObject
13 {
14  public:
15  // the order matters (best vertex -> highest number), so leave some space in case we want to wedge other vertices in here
16  enum VTXTYPE
17  {
18  UNDEFINED = 0,
19  TRUTH = 100,
20  SMEARED = 200,
21  MBD = 300,
22  SVTX = 400,
23  SVTX_MBD = 500
24  };
25 
26  typedef std::vector<const Vertex*> VertexVector;
27  typedef std::map<GlobalVertex::VTXTYPE, VertexVector>::const_iterator ConstVertexIter;
28  typedef std::map<GlobalVertex::VTXTYPE, VertexVector>::iterator VertexIter;
29 
30  // Deprecated as of GlobalVertexv2
31  typedef std::map<GlobalVertex::VTXTYPE, unsigned int>::const_iterator ConstVtxIter;
32  typedef std::map<GlobalVertex::VTXTYPE, unsigned int>::iterator VtxIter;
33 
34 
35 
36  ~GlobalVertex() override {}
37 
38  // PHObject virtual overloads
39 
40  void identify(std::ostream& os = std::cout) const override
41  {
42  os << "GlobalVertex base class" << std::endl;
43  }
44  int isValid() const override { return 0; }
45  PHObject* CloneMe() const override { return nullptr; }
46 
47  // vertex info
48 
49  virtual unsigned int get_id() const { return 0xFFFFFFFF; }
50  virtual void set_id(unsigned int) {}
51 
52  virtual float get_t() const { return NAN; }
53  virtual void set_t(float) {}
54 
55  virtual float get_t_err() const { return NAN; }
56  virtual void set_t_err(float) {}
57 
58  virtual float get_x() const { return NAN; }
59  virtual void set_x(float) {}
60 
61  virtual float get_y() const { return NAN; }
62  virtual void set_y(float) {}
63 
64  virtual float get_z() const { return NAN; }
65  virtual void set_z(float) {}
66 
67  virtual float get_chisq() const { return NAN; }
68  virtual void set_chisq(float) {}
69 
70  virtual unsigned int get_ndof() const { return 0xFFFFFFFF; }
71  virtual void set_ndof(unsigned int) {}
72 
73  virtual float get_position(unsigned int /*coor*/) const { return NAN; }
74  virtual void set_position(unsigned int /*coor*/, float /*xi*/) {}
75 
76  virtual float get_error(unsigned int /*i*/, unsigned int /*j*/) const { return NAN; }
77  virtual void set_error(unsigned int /*i*/, unsigned int /*j*/, float /*value*/) {}
78 
79  virtual unsigned int get_beam_crossing() const { return std::numeric_limits<unsigned int>::max(); }
80  virtual void set_beam_crossing(unsigned int) {}
81 
82  virtual bool empty_vtxs() const { return true; }
83  virtual size_t size_vtxs() const { return 0; }
84  virtual size_t count_vtxs(VTXTYPE) const { return 0; }
85  virtual void clear_vtxs() {}
86  virtual void insert_vtx(VTXTYPE, const Vertex*) {}
87  virtual size_t erase_vtxs(VTXTYPE) { return 0; }
88  virtual void erase_vtxs(VertexIter) {}
89 
90  virtual ConstVertexIter begin_vertexes() const;
92  virtual ConstVertexIter end_vertexes() const;
93 
94  virtual VertexIter begin_vertexes();
96  virtual VertexIter end_vertexes();
97 
98  //
99  // associated vertex ids methods
100  // vtx id container accessors are deprecated.
101  // Use actual vertex container accessors instead
102  //
103  virtual bool empty_vtxids() const { return true; }
104  virtual size_t size_vtxids() const { return 0; }
105  virtual size_t count_vtxids(VTXTYPE /*type*/) const { return 0; }
106 
107  virtual void clear_vtxids() {}
108  virtual void insert_vtxids(VTXTYPE /*type*/, unsigned int /*vtxid*/) {}
109  virtual size_t erase_vtxids(VTXTYPE /*type*/) { return 0; }
110  virtual void erase_vtxids(VtxIter /*iter*/) {}
111  virtual void erase_vtxids(VtxIter /*first*/, VtxIter /*last*/) {}
112 
113  virtual ConstVtxIter begin_vtxids() const;
114  virtual ConstVtxIter find_vtxids(VTXTYPE type) const;
115  virtual ConstVtxIter end_vtxids() const;
116 
117  virtual VtxIter begin_vtxids();
118  virtual VtxIter find_vtxids(VTXTYPE type);
119  virtual VtxIter end_vtxids();
120 
121  protected:
123 
124  private:
126 };
127 
128 #endif