Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:19:55

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef GLOBALVERTEX_GLOBALVERTEX_H
0004 #define GLOBALVERTEX_GLOBALVERTEX_H
0005 
0006 #include "Vertex.h"
0007 
0008 #include <phool/PHObject.h>
0009 
0010 #include <iostream>
0011 #include <limits>
0012 #include <map>
0013 
0014 class GlobalVertex : public PHObject
0015 {
0016  public:
0017   // the order matters (best vertex -> highest number), so leave some space in case we want to wedge other vertices in here
0018   enum VTXTYPE
0019   {
0020     UNDEFINED = 0,
0021     TRUTH = 100,
0022     SMEARED = 200,
0023     MBD = 300,
0024     SVTX = 400,
0025     SVTX_MBD = 500,
0026     CALO = 250,
0027     MBD_CALO = 350
0028   };
0029 
0030   typedef std::vector<const Vertex*> VertexVector;
0031   typedef std::map<GlobalVertex::VTXTYPE, VertexVector>::const_iterator ConstVertexIter;
0032   typedef std::map<GlobalVertex::VTXTYPE, VertexVector>::iterator VertexIter;
0033 
0034   // Deprecated as of GlobalVertexv2
0035   typedef std::map<GlobalVertex::VTXTYPE, unsigned int>::const_iterator ConstVtxIter;
0036   typedef std::map<GlobalVertex::VTXTYPE, unsigned int>::iterator VtxIter;
0037 
0038   ~GlobalVertex() override = default;
0039 
0040   // PHObject virtual overloads
0041 
0042   void identify(std::ostream& os = std::cout) const override
0043   {
0044     os << "GlobalVertex base class" << std::endl;
0045   }
0046   int isValid() const override { return 0; }
0047   PHObject* CloneMe() const override { return nullptr; }
0048 
0049   // vertex info
0050 
0051   virtual unsigned int get_id() const { return std::numeric_limits<unsigned int>::max(); }
0052   virtual void set_id(unsigned int) { return; }
0053 
0054   virtual float get_t() const { return std::numeric_limits<float>::quiet_NaN(); }
0055   virtual void set_t(float) { return; }
0056 
0057   virtual float get_t_err() const { return std::numeric_limits<float>::quiet_NaN(); }
0058   virtual void set_t_err(float) { return; }
0059 
0060   virtual float get_x() const { return std::numeric_limits<float>::quiet_NaN(); }
0061   virtual void set_x(float) { return; }
0062 
0063   virtual float get_y() const { return std::numeric_limits<float>::quiet_NaN(); }
0064   virtual void set_y(float) { return; }
0065 
0066   virtual float get_z() const { return std::numeric_limits<float>::quiet_NaN(); }
0067   virtual void set_z(float) { return; }
0068 
0069   virtual float get_chisq() const { return std::numeric_limits<float>::quiet_NaN(); }
0070   virtual void set_chisq(float) { return; }
0071 
0072   virtual unsigned int get_ndof() const { return std::numeric_limits<unsigned int>::max(); }
0073   virtual void set_ndof(unsigned int) { return; }
0074 
0075   virtual float get_position(unsigned int /*coor*/) const { return std::numeric_limits<float>::quiet_NaN(); }
0076   virtual void set_position(unsigned int /*coor*/, float /*xi*/) { return; }
0077 
0078   virtual float get_error(unsigned int /*i*/, unsigned int /*j*/) const { return std::numeric_limits<float>::quiet_NaN(); }
0079   virtual void set_error(unsigned int /*i*/, unsigned int /*j*/, float /*value*/) { return; }
0080 
0081   virtual unsigned int get_beam_crossing() const { return std::numeric_limits<unsigned int>::max(); }
0082   virtual void set_beam_crossing(unsigned int) { return; }
0083 
0084   virtual bool empty_vtxs() const { return true; }
0085   virtual size_t size_vtxs() const { return 0; }
0086   virtual size_t count_vtxs(VTXTYPE) const { return 0; }
0087   virtual void clear_vtxs() { return; }
0088   virtual void insert_vtx(VTXTYPE, const Vertex*) { return; }
0089   virtual void clone_insert_vtx(VTXTYPE, const Vertex*) { return; }
0090   virtual size_t erase_vtxs(VTXTYPE) { return 0; }
0091   virtual void erase_vtxs(VertexIter) { return; }
0092 
0093   virtual ConstVertexIter begin_vertexes() const;
0094   virtual ConstVertexIter find_vertexes(VTXTYPE type) const;
0095   virtual ConstVertexIter end_vertexes() const;
0096 
0097   virtual VertexIter begin_vertexes();
0098   virtual VertexIter find_vertexes(VTXTYPE type);
0099   virtual VertexIter end_vertexes();
0100 
0101   //
0102   // associated vertex ids methods
0103   // vtx id container accessors are deprecated.
0104   // Use actual vertex container accessors instead
0105   //
0106   virtual bool empty_vtxids() const { return true; }
0107   virtual size_t size_vtxids() const { return 0; }
0108   virtual size_t count_vtxids(VTXTYPE /*type*/) const { return 0; }
0109 
0110   virtual void clear_vtxids() { return; }
0111   virtual void insert_vtxids(VTXTYPE /*type*/, unsigned int /*vtxid*/) { return; }
0112   virtual size_t erase_vtxids(VTXTYPE /*type*/) { return 0; }
0113   virtual void erase_vtxids(VtxIter /*iter*/) { return; }
0114   virtual void erase_vtxids(VtxIter /*first*/, VtxIter /*last*/) { return; }
0115 
0116   virtual ConstVtxIter begin_vtxids() const;
0117   virtual ConstVtxIter find_vtxids(VTXTYPE type) const;
0118   virtual ConstVtxIter end_vtxids() const;
0119 
0120   virtual VtxIter begin_vtxids();
0121   virtual VtxIter find_vtxids(VTXTYPE type);
0122   virtual VtxIter end_vtxids();
0123 
0124  protected:
0125   GlobalVertex() = default;
0126 
0127  private:
0128   ClassDefOverride(GlobalVertex, 1);
0129 };
0130 
0131 #endif