Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SecondaryVertexFinder.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SecondaryVertexFinder.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 
10 #ifndef SECONDARYVERTEXFINDER_H
11 #define SECONDARYVERTEXFINDER_H
12 
13 #include <ActsPropagator.h>
14 
15 #include <fun4all/SubsysReco.h>
16 
17 #include <trackbase/TrkrDefs.h>
18 #include <trackbase/TpcDefs.h>
19 
22 
24 
25 #pragma GCC diagnostic push
26 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
28 #pragma GCC diagnostic pop
29 
34 
35 #include <string>
36 #include <vector>
37 #include <map>
38 #include <set>
39 
40 #include <Eigen/Dense>
41 
42 class PHCompositeNode;
43 class SvtxTrack;
44 class SvtxTrackMap;
45 class SvtxVertexMap;
46 class TrkrCluster;
47 class TrackSeed;
48 class ActsGeometry;
50 class TNtuple;
51 class TH2D;
52 class TH1D;
53 class TFile;
54 class TLorentzVector;
55 
58 using SurfacePtr = std::shared_ptr<const Acts::Surface>;
60 
62 {
63  public:
64 
65  SecondaryVertexFinder(const std::string &name = "SecondaryVertexFinder");
66 
67  ~SecondaryVertexFinder() override;
68 
69  int InitRun(PHCompositeNode *topNode) override;
70  int process_event(PHCompositeNode *topNode) override;
71  int End(PHCompositeNode *topNode) override;
72 
73  void setTrackDcaCut(const double cutxy, const double cutz) {_track_dcaxy_cut = cutxy; _track_dcaz_cut = cutz;}
74  void setTwoTrackDcaCut(const double cut) {_two_track_dcacut = cut;}
75  void setMinPathCut(const double cut) {_min_path_cut = cut;}
76  void setTrackQualityCut(double cut) {_qual_cut = cut;}
77  void setRequireMVTX(bool set) {_require_mvtx = set;}
81  void set_write_ntuple(bool flag) {_write_ntuple = flag;}
82 
83  private:
84 
85  int GetNodes(PHCompositeNode* topNode);
86  int CreateOutputNode(PHCompositeNode* topNode);
87 
88 bool passConversionElectronCuts(TLorentzVector tsum,
89  SvtxTrack* tr1, SvtxTrack* tr2, float pair_dca,
90  Eigen::Vector3d PCA, Eigen::Vector3d VTX);
91 
92  bool hasSiliconSeed(SvtxTrack* tr);
93  void outputTrackDetails(SvtxTrack *tr);
94  void get_dca(SvtxTrack* track, float& dca3dxy, float& dca3dz, float& dca3dxysigma, float& dca3dzsigma);
95  bool circle_circle_intersection(double r0, double x0, double y0, double r1, double x1, double y1, std::vector<double>& intersectionXY);
96 
97  void findPcaTwoLines(Eigen::Vector3d pos1, Eigen::Vector3d mom1, Eigen::Vector3d pos2, Eigen::Vector3d mom2,
98  double &dca, Eigen::Vector3d &PCA1, Eigen::Vector3d &PCA2);
99  void getCircleXYTrack(SvtxTrack *track, double& R, Eigen::Vector2d& center);
100  double getZFromIntersectionXY(SvtxTrack *track, double& R, Eigen::Vector2d& center, Eigen::Vector2d intersection);
101  bool projectTrackToPoint(SvtxTrack* track, Eigen::Vector3d& PCA, Eigen::Vector3d& pos, Eigen::Vector3d& mom);
102 
103  void fillNtp(SvtxTrack *track1, SvtxTrack *track2, double dca3dxy1, double dca3dz1, double dca3dxy2, double dca3dz2, Eigen::Vector3d vpos1, Eigen::Vector3d vmom1, Eigen::Vector3d vpos2, Eigen::Vector3d vmom2, Acts::Vector3 pca_rel1, Acts::Vector3 pca_rel2, double pair_dca, double invariantMass, double invariantPt, double path, int has_silicon_1, int has_siilicon_2);
104 
107  SvtxTrack *_track{nullptr};
110 
111  bool _require_mvtx = false;
113  bool _write_ntuple = false;
114 
115  double _decaymass = 0.000511; // conversion electrons, default
116 
117  // these are minimal cuts used to make the ntuple
118  // They can be tightened later when analyzing the ntuple
119 
120  // single track cuts
121  double _track_dcaxy_cut = 0.020;
122  double _track_dcaz_cut = 0.020;
123  double _qual_cut = 4.0;
124 
125  //track_pair cuts
126  double _two_track_dcacut = 0.5; // 5000 microns
127  double _max_intersection_radius = 40.0; // discard intersections at greater than 40 cm radius
129 
130  // decay vertex cuts
131  double _min_path_cut = 0.2;
132  double _costheta_cut = 0.9985;
133 
134  // specific conversion electron cuts
135  double _conversion_pair_dcacut = 0.2; // 2000 microns
136  unsigned int _min_tpc_clusters = 40;
137  double _deta_cut = 0.05;
138  double _invariant_pt_cut = 0.1;
139  double _max_mass_cut = 0.03;
140 
141  TH2D *recomass{nullptr};
142  TH2D *hdecaypos{nullptr};
143  TH1D *hdecay_radius{nullptr};
144  TNtuple *ntp{nullptr};
146 
147 };
148 
149 #endif //SECONDARYVERTEXFINDER_H