Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-04-02 08:12:46

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef GLOBALVERTEX_SVTXVERTEXV3_H
0004 #define GLOBALVERTEX_SVTXVERTEXV3_H
0005 
0006 #include "SvtxVertex.h"
0007 
0008 #include <cstddef>  // for size_t
0009 #include <iostream>
0010 #include <limits>
0011 #include <set>
0012 
0013 class PHObject;
0014 
0015 class SvtxVertex_v3 : public SvtxVertex
0016 {
0017  public:
0018   SvtxVertex_v3();
0019   ~SvtxVertex_v3() override {}
0020 
0021   // PHObject virtual overloads
0022   void identify(std::ostream& os = std::cout) const override;
0023   void Reset() override { *this = SvtxVertex_v3(); }
0024   int isValid() const override;
0025   PHObject* CloneMe() const override { return new SvtxVertex_v3(*this); }
0026 
0027   // vertex info
0028   unsigned int get_id() const override { return _id; }
0029   void set_id(unsigned int id) override { _id = id; }
0030 
0031   float get_t() const override { return _t0; }
0032   void set_t(float t0) override { _t0 = t0; }
0033 
0034   float get_x() const override { return _pos[0]; }
0035   void set_x(float x) override { _pos[0] = x; }
0036 
0037   float get_y() const override { return _pos[1]; }
0038   void set_y(float y) override { _pos[1] = y; }
0039 
0040   float get_z() const override { return _pos[2]; }
0041   void set_z(float z) override { _pos[2] = z; }
0042 
0043   float get_chisq() const override { return _chisq; }
0044   void set_chisq(float chisq) override { _chisq = chisq; }
0045 
0046   unsigned int get_ndof() const override { return _ndof; }
0047   void set_ndof(unsigned int ndof) override { _ndof = ndof; }
0048 
0049   float get_position(unsigned int coor) const override { return _pos[coor]; }
0050   void set_position(unsigned int coor, float xi) override { _pos[coor] = xi; }
0051 
0052   float get_error(unsigned int i, unsigned int j) const override;        //< get vertex error covar
0053   void set_error(unsigned int i, unsigned int j, float value) override;  //< set vertex error covar
0054 
0055   // v3 uses signed short
0056   short int get_beam_crossing() const override { return _beamcrossing; }
0057   void set_beam_crossing(short int cross) override { _beamcrossing = cross; }
0058 
0059   //
0060   // associated track ids methods
0061   //
0062   void clear_tracks() override { _track_ids.clear(); }
0063   bool empty_tracks() override { return _track_ids.empty(); }
0064   size_t size_tracks() const override { return _track_ids.size(); }
0065   void insert_track(unsigned int trackid) override { _track_ids.insert(trackid); }
0066   size_t erase_track(unsigned int trackid) override { return _track_ids.erase(trackid); }
0067   ConstTrackIter begin_tracks() const override { return _track_ids.begin(); }
0068   ConstTrackIter find_track(unsigned int trackid) const override { return _track_ids.find(trackid); }
0069   ConstTrackIter end_tracks() const override { return _track_ids.end(); }
0070   TrackIter begin_tracks() override { return _track_ids.begin(); }
0071   TrackIter find_track(unsigned int trackid) override { return _track_ids.find(trackid); }
0072   TrackIter end_tracks() override { return _track_ids.end(); }
0073 
0074  private:
0075   unsigned int covar_index(unsigned int i, unsigned int j) const;
0076 
0077   unsigned int _id{std::numeric_limits<unsigned int>::max()};    //< unique identifier within container
0078   float _t0{std::numeric_limits<float>::quiet_NaN()};            //< collision time
0079   float _pos[3]{};                                               //< collision position x,y,z
0080   float _chisq{std::numeric_limits<float>::quiet_NaN()};         //< vertex fit chisq
0081   unsigned int _ndof{std::numeric_limits<unsigned int>::max()};  //< degrees of freedom
0082   float _err[6]{};                                               //< error covariance matrix (packed storage) (+/- cm^2)
0083   std::set<unsigned int> _track_ids;                             //< list of track ids
0084   short int _beamcrossing{std::numeric_limits<short int>::max()};
0085 
0086   ClassDefOverride(SvtxVertex_v3, 3);
0087 };
0088 
0089 #endif