Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:17:24

0001 /*!
0002  *  \file       PHTruthVertexing.h
0003  *  \brief      Vertexing using truth info
0004  *  \author     Haiwang Yu <yuhw@nmsu.edu>
0005  */
0006 
0007 #ifndef TRACKRECO_PHTRUTHVERTEXING_H
0008 #define TRACKRECO_PHTRUTHVERTEXING_H
0009 
0010 #include "PHInitVertexing.h"
0011 
0012 #include <gsl/gsl_rng.h>
0013 
0014 #include <string>             // for string
0015 #include <vector>
0016 
0017 // forward declarations
0018 class PHCompositeNode;
0019 class PHG4TruthInfoContainer;
0020 
0021 /// \class PHTruthVertexing
0022 ///
0023 /// \brief Vertexing using truth info
0024 ///
0025 
0026 class PHTruthVertexing : public PHInitVertexing
0027 {
0028  public:
0029   PHTruthVertexing(const std::string &name = "PHTruthVertexing");
0030   ~PHTruthVertexing() override;
0031 
0032   void set_vertex_error(const float &x_err, const float &y_err, const float &z_err)
0033   {
0034     _vertex_error.resize(3);
0035     _vertex_error[0] = x_err;
0036     _vertex_error[1] = y_err;
0037     _vertex_error[2] = z_err;
0038   }
0039 
0040   const std::vector<float> &get_vertex_error() const
0041   {
0042     return _vertex_error;
0043   }
0044   void associate_tracks(bool associate_tracks)
0045   {
0046     _associate_tracks = associate_tracks;
0047   }
0048   void set_embed_only(bool embed_only)
0049   {
0050     _embed_only = embed_only;
0051   }
0052   void set_track_map_name(std::string& name)
0053   { _track_map_name = name; }
0054  protected:
0055 
0056   int Setup(PHCompositeNode *topNode) override;
0057 
0058   int Process(PHCompositeNode *topNode) override;
0059 
0060   int End(PHCompositeNode * /*topNode*/) override;
0061 
0062  private:
0063   /// fetch node pointers
0064   int GetNodes(PHCompositeNode *topNode);
0065 
0066   void assignTracksVertices(PHCompositeNode *topNode);
0067 
0068   PHG4TruthInfoContainer *_g4truth_container;
0069 
0070   /// manually assigned vertex error (standard dev), cm
0071   std::vector<float> _vertex_error;
0072 
0073   bool _embed_only;
0074   bool _associate_tracks = false;
0075   std::string _track_map_name = "SvtxTrackMap";
0076   gsl_rng *m_RandomGenerator;
0077 };
0078 
0079 #endif