File indexing completed on 2026-08-31 08:21:24
0001
0002
0003 #ifndef TPCTRACKRECO_TPCPOLYTRACKVERTEXER_H
0004 #define TPCTRACKRECO_TPCPOLYTRACKVERTEXER_H
0005
0006 #include <fun4all/SubsysReco.h>
0007
0008 #include <string>
0009 #include <vector>
0010
0011 class Tpc_PolyTrack;
0012 class Tpc_PolyTrackContainer;
0013 class Tpc_PolyTrackVertexContainer;
0014 class PHCompositeNode;
0015
0016 class Tpc_PolyTrackVertexer : public SubsysReco
0017 {
0018 public:
0019 explicit Tpc_PolyTrackVertexer(const std::string& name = "Tpc_PolyTrackVertexer");
0020 ~Tpc_PolyTrackVertexer() override = default;
0021
0022 int InitRun(PHCompositeNode* topNode) override;
0023 int process_event(PHCompositeNode* topNode) override;
0024
0025 void setInputNodeName(const std::string& n) { m_inputNodeName = n; }
0026 void setOutputNodeName(const std::string& n) { m_outputNodeName = n; }
0027 void setCollisionMinClusters(unsigned int v) { m_collisionMinClusters = v; }
0028 void setCollisionZSeparation(double v) { m_collisionZSeparation = v; }
0029 void setMagneticFieldTesla(double v) { m_magneticFieldTesla = v; }
0030
0031 private:
0032 struct TrackVertexFit
0033 {
0034 bool ok{false};
0035 unsigned int track_id{0};
0036 unsigned int source_assembled_track_id{0};
0037 unsigned int nclusters{0};
0038 double dca2d{0.0};
0039 double z0{0.0};
0040 double pca_x{0.0};
0041 double pca_y{0.0};
0042 double pca_z{0.0};
0043 double pca_radius{0.0};
0044 double pca_phi{0.0};
0045 };
0046
0047 struct CollisionFit
0048 {
0049 bool ok{false};
0050 double x{0.0};
0051 double y{0.0};
0052 double z{0.0};
0053 double z_rms{0.0};
0054 unsigned int ntracks{0};
0055 };
0056
0057 bool getNodes(PHCompositeNode* topNode);
0058 bool createNodes(PHCompositeNode* topNode);
0059 TrackVertexFit fitTrack(const Tpc_PolyTrack* trk) const;
0060 CollisionFit fitCollision(const std::vector<TrackVertexFit>& tracks) const;
0061 std::vector<CollisionFit> fitCollisions(std::vector<TrackVertexFit> tracks) const;
0062
0063 std::string m_inputNodeName;
0064 std::string m_outputNodeName;
0065 Tpc_PolyTrackContainer* m_polyTracks{nullptr};
0066 Tpc_PolyTrackVertexContainer* m_vertices{nullptr};
0067 unsigned int m_collisionMinClusters{3};
0068 double m_collisionZSeparation{10.0};
0069 double m_magneticFieldTesla{1.4};
0070 };
0071 #endif