Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:18:19

0001 #ifndef KSHORTRECONSTRUCTION_H
0002 #define KSHORTRECONSTRUCTION_H
0003 
0004 #include <fun4all/SubsysReco.h>
0005 
0006 #include <trackbase/ActsTrackingGeometry.h>
0007 
0008 #include <Eigen/Dense>
0009 
0010 class TFile;
0011 class TH1;
0012 class TNtuple;
0013 
0014 class ActsGeometry;
0015 class PHCompositeNode;
0016 class SvtxTrack;
0017 class SvtxTrackMap;
0018 class SvtxVertexMap;
0019 
0020 class KshortReconstruction : public SubsysReco
0021 {
0022  public:
0023   KshortReconstruction(const std::string& name = "KshortReconstruction");
0024   virtual ~KshortReconstruction() = default;
0025 
0026   int InitRun(PHCompositeNode* topNode) override;
0027   int process_event(PHCompositeNode* topNode) override;
0028   int End(PHCompositeNode* /*topNode*/) override;
0029 
0030   void setPtCut(double ptcut) { invariant_pt_cut = ptcut; }
0031   void setTrackPtCut(double ptcut) { track_pt_cut = ptcut; }
0032   void setTrackQualityCut(double cut) { _qual_cut = cut; }
0033   void setPairDCACut(double cut) { pair_dca_cut = cut; }
0034   void setTrackDCACut(double cut) { track_dca_cut = cut; }
0035   void setRequireMVTX(bool set) { _require_mvtx = set; }
0036   void setDecayMass(float decayMassSet) { decaymass = decayMassSet; }  //(muons decaymass = 0.1057) (pions = 0.13957) (electron = 0.000511)
0037   void set_output_file(const std::string& outputfile) { filepath = outputfile; }
0038   void save_tracks(bool save = true) { m_save_tracks = save; }
0039 
0040  private:
0041   void fillNtp(SvtxTrack* track1, SvtxTrack* track2, Acts::Vector3 dcavals1, Acts::Vector3 dcavals2, Acts::Vector3 pca_rel1, Acts::Vector3 pca_rel2, double pair_dca, double invariantMass, double invariantPt, float invariantPhi, float rapidity, float pseudorapidity, Eigen::Vector3d projected_pos1, Eigen::Vector3d projected_pos2, Eigen::Vector3d projected_mom1, Eigen::Vector3d projected_mom2, Acts::Vector3 pca_rel1_proj, Acts::Vector3 pca_rel2_proj, double pair_dca_proj,unsigned int track1_silicon_cluster_size, unsigned int track2_silicon_cluster_size, unsigned int track1_mvtx_cluster_size, unsigned int track1_mvtx_state_size, unsigned int track1_intt_cluster_size, unsigned int track1_intt_state_size, unsigned int track2_mvtx_cluster_size, unsigned int track2_mvtx_state_size, unsigned int track2_intt_cluster_size, unsigned int track2_intt_state_size, int runNumber, int eventNumber);
0042 
0043   void fillHistogram(Eigen::Vector3d mom1, Eigen::Vector3d mom2, TH1* massreco, double& invariantMass, double& invariantPt, float& invariantPhi, float& rapidity, float& pseudorapidity);
0044 
0045   // void findPcaTwoTracks(SvtxTrack *track1, SvtxTrack *track2, Acts::Vector3& pca1, Acts::Vector3& pca2, double& dca);
0046   void findPcaTwoTracks(const Acts::Vector3& pos1, const Acts::Vector3& pos2, Acts::Vector3 mom1, Acts::Vector3 mom2, Acts::Vector3& pca1, Acts::Vector3& pca2, double& dca) const;
0047 
0048   int getNodes(PHCompositeNode* topNode);
0049 
0050   Acts::Vector3 calculateDca(SvtxTrack* track, const Acts::Vector3& momentum, Acts::Vector3 position);
0051 
0052   bool projectTrackToCylinder(SvtxTrack* track, double Radius, Eigen::Vector3d& pos, Eigen::Vector3d& mom);
0053   bool projectTrackToPoint(SvtxTrack* track, Eigen::Vector3d PCA, Eigen::Vector3d& pos, Eigen::Vector3d& mom);
0054 
0055   Acts::Vector3 getVertex(SvtxTrack* track);
0056   static std::vector<unsigned int> getTrackStates(SvtxTrack *track);
0057   
0058   TNtuple* ntp_reco_info {nullptr};
0059   ActsGeometry* _tGeometry {nullptr};
0060   SvtxTrackMap* m_svtxTrackMap {nullptr};
0061   SvtxVertexMap* m_vertexMap {nullptr};
0062   
0063   std::string filepath {""};
0064   float decaymass {0.13957};  // pion decay mass
0065   bool _require_mvtx {true};
0066   double _qual_cut {1000.0};
0067   double pair_dca_cut {0.05};  // kshort relative cut 500 microns
0068   double track_dca_cut {0.01};
0069   double invariant_pt_cut {0.1};
0070   double track_pt_cut {0.2};
0071   TFile* fout {nullptr};
0072   TH1* recomass {nullptr};
0073 
0074   bool m_save_tracks {false};
0075   SvtxTrackMap *m_output_trackMap {nullptr};
0076   std::string m_output_trackMap_node_name {"KshortReconstruction_SvtxTrackMap"};
0077 };
0078 
0079 #endif  // KSHORTRECONSTRUCTION_H