Analysis Software
Documentation for sPHENIX simulation 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 
29 {
30  public:
31 
32  PHSimpleVertexFinder(const std::string &name = "PHSimpleVertexFinder");
33 
34  ~PHSimpleVertexFinder() override;
35 
36  int InitRun(PHCompositeNode *topNode) override;
37  int process_event(PHCompositeNode *topNode) override;
38  int End(PHCompositeNode *topNode) override;
39  void setBeamLineCut(const double cut) {_beamline_xy_cut = cut;}
40  void setDcaCut(const double cut) {_base_dcacut = cut;}
41  void setTrackQualityCut(double cut) {_qual_cut = cut;}
42  void setRequireMVTX(bool set) {_require_mvtx = set;}
43  void setNmvtxRequired(unsigned int n) {_nmvtx_required = n;}
44  // void setUseTrackCovariance(bool set) {_use_track_covariance = set;}
45  void setOutlierPairCut(const double cut) {_outlier_cut = cut;}
46 
47  private:
48 
49  int GetNodes(PHCompositeNode* topNode);
50  int CreateNodes(PHCompositeNode* topNode);
51 
52  void checkDCAs();
53 
54  void findDcaTwoTracks(SvtxTrack *tr1, SvtxTrack *tr2);
55  double dcaTwoLines(const Eigen::Vector3d &p1, const Eigen::Vector3d &v1,
56  const Eigen::Vector3d &p2, const Eigen::Vector3d &v2,
57  Eigen::Vector3d &PCA1, Eigen::Vector3d &PCA2);
58  std::vector<std::set<unsigned int>> findConnectedTracks();
60  double getMedian(std::vector<double> &v);
61  double getAverage(std::vector<double> &v);
62 
64  SvtxTrack *_track{nullptr};
66 
67  double _base_dcacut = 0.0080; // 80 microns
68  double _active_dcacut = 0.080;
69  double _beamline_xy_cut = 0.2; // must be within 2 mm of beam line
70  double _qual_cut = 10.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