EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHSimpleVertexFinder.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHSimpleVertexFinder.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 
10 #ifndef PHSIMPLEVERTEXFINDER_H
11 #define PHSIMPLEVERTEXFINDER_H
12 
13 #include <fun4all/SubsysReco.h>
14 
15 #include <string>
16 #include <vector>
17 #include <map>
18 #include <set>
19 
20 #include <Eigen/Dense>
21 
22 class PHCompositeNode;
23 class SvtxTrack;
24 class SvtxTrackMap;
25 class SvtxVertexMap;
26 class TrkrCluster;
27 class TpcSeedTrackMap;
28 
30 {
31  public:
32 
33  PHSimpleVertexFinder(const std::string &name = "PHSimpleVertexFinder");
34 
35  ~PHSimpleVertexFinder() override;
36 
37  int InitRun(PHCompositeNode *topNode) override;
38  int process_event(PHCompositeNode *topNode) override;
39  int End(PHCompositeNode *topNode) override;
40  void setBeamLineCut(const double cut) {_beamline_xy_cut = cut;}
41  void setDcaCut(const double cut) {_dcacut = cut;}
42  void setTrackQualityCut(double cut) {_qual_cut = cut;}
43  void setRequireMVTX(bool set) {_require_mvtx = set;}
44  void setNmvtxRequired(unsigned int n) {_nmvtx_required = n;}
45  // void setUseTrackCovariance(bool set) {_use_track_covariance = set;}
46  void setOutlierPairCut(const double cut) {_outlier_cut = cut;}
47 
48  private:
49 
50  int GetNodes(PHCompositeNode* topNode);
51  int CreateNodes(PHCompositeNode* topNode);
52 
53  void checkDCAs();
54 
55  void findDcaTwoTracks(SvtxTrack *tr1, SvtxTrack *tr2);
56  double dcaTwoLines(const Eigen::Vector3d &p1, const Eigen::Vector3d &v1,
57  const Eigen::Vector3d &p2, const Eigen::Vector3d &v2,
58  Eigen::Vector3d &PCA1, Eigen::Vector3d &PCA2);
59  std::vector<std::set<unsigned int>> findConnectedTracks();
61  double getMedian(std::vector<double> &v);
62  double getAverage(std::vector<double> &v);
63 
65  SvtxTrack *_track{nullptr};
67 
68  double _dcacut = 0.0080; // 80 microns
69  double _beamline_xy_cut = 0.2; // must be within 2 mm of beam line
70  double _qual_cut = 5.0;
71  bool _require_mvtx = true;
72  unsigned int _nmvtx_required = 3;
73  double _track_pt_cut = 0.0;
74  double _outlier_cut = 0.015;
75 
76  std::multimap<unsigned int, unsigned int> _vertex_track_map;
77  using matrix_t = Eigen::Matrix<double,3,3>;
78  std::multimap<unsigned int, std::pair<unsigned int, double>> _track_pair_map;
79  // Eigen::Vector3d is an Eigen::Matrix<double,3,1>
80  std::multimap<unsigned int, std::pair<unsigned int, std::pair<Eigen::Vector3d,
81  Eigen::Vector3d>>> _track_pair_pca_map;
82  std::map<unsigned int, Eigen::Vector3d> _vertex_position_map;
83  std::map<unsigned int, matrix_t> _vertex_covariance_map;
84  std::set<unsigned int> _vertex_set;
85 
86 };
87 
88 #endif // PHSIMPLEVERTEXFINDER_H