Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:15:37

0001 #ifndef TAGANDPROBE_TAGANDPROBE_H
0002 #define TAGANDPROBE_TAGANDPROBE_H
0003 
0004 // sPHENIX stuff
0005 #include <fun4all/SubsysReco.h>
0006 
0007 #include <algorithm>  // for max
0008 #include <memory>     // for allocator_traits<>::valu...
0009 #include <string>
0010 #include <utility>  // for pair
0011 #include <vector>   // for vector
0012 
0013 #include <trackbase/ActsTrackingGeometry.h>
0014 #include <globalvertex/SvtxVertexMap.h>
0015 
0016 //#include <KFParticle.h>
0017 #include <trackbase_historic/SvtxTrack.h>
0018 
0019 #include <trackreco/ActsPropagator.h>
0020 #include <Eigen/Dense>
0021 
0022 #include <Acts/Definitions/Algebra.hpp>
0023 
0024 #include <Acts/EventData/TrackParameters.hpp>
0025 #include <Acts/Surfaces/CylinderSurface.hpp>
0026 #include <Acts/Utilities/Result.hpp>
0027 
0028 class PHCompositeNode;
0029 class TFile;
0030 class TTree;
0031 
0032 class TagAndProbe : public SubsysReco
0033 {
0034  public:
0035   TagAndProbe();
0036 
0037   explicit TagAndProbe(const std::string &name, const float run, const float seg);
0038 
0039   ~TagAndProbe() override = default;
0040 
0041   int Init(PHCompositeNode *topNode) override;
0042 
0043   int InitRun(PHCompositeNode *topNode) override;
0044 
0045   int process_event(PHCompositeNode *topNode) override;
0046 
0047   int End(PHCompositeNode *topNode) override;
0048   
0049   void initializeBranches();
0050 
0051   void clearValues();
0052 
0053   void set_nTPC_cut (int nClus_tag, int nClus_passprobe)
0054   {
0055     m_nTPC_tag = nClus_tag; 
0056     m_nTPC_passprobe = nClus_passprobe; 
0057   }
0058   
0059   void set_nINTT_cut (int nClus_tag, int nClus_passprobe)
0060   {
0061     m_nINTT_tag = nClus_tag; 
0062     m_nINTT_passprobe = nClus_passprobe; 
0063   }
0064   
0065   void set_nMVTX_cut (int nClus_tag, int nClus_passprobe)
0066   {
0067     m_nMVTX_tag = nClus_tag; 
0068     m_nMVTX_passprobe = nClus_passprobe; 
0069   }
0070 
0071   void set_nTPOT_cut (int nClus_tag, int nClus_passprobe)
0072   {
0073     m_nTPOT_tag = nClus_tag; 
0074     m_nTPOT_passprobe = nClus_passprobe; 
0075   }
0076   
0077   void set_quality_cut (float quality_tag, float quality_passprobe)
0078   {
0079     m_quality_tag = quality_tag; 
0080     m_quality_passprobe = quality_passprobe; 
0081   } 
0082   
0083   void set_include_PV_info (bool include = false)
0084   {
0085     m_include_pv_info = include; 
0086   } 
0087 
0088   void saveOutput(bool save = true) { m_save_output = save; }
0089 
0090   void setOutputName(const std::string &name) { m_outfile_name = name; }
0091  
0092  private:
0093   void findPcaTwoTracks(const Acts::Vector3& pos1, const Acts::Vector3& pos2, Acts::Vector3 mom1, Acts::Vector3 mom2, Acts::Vector3& pca1, Acts::Vector3& pca2, double& dca);
0094 
0095   bool projectTrackToPoint(SvtxTrack* track, Eigen::Vector3d PCA, Eigen::Vector3d& pos, Eigen::Vector3d& mom);  
0096   
0097   //void getField();
0098 
0099   //KFParticle makeParticle(SvtxTrack* track_kfp); 
0100 
0101   bool m_save_output;
0102   std::string m_outfile_name;
0103   TFile *m_outfile;
0104   
0105   float m_run;
0106   float m_segment;
0107   float m_event;
0108 
0109   float m_trackID_1, m_trackID_2;
0110   float m_crossing_1, m_crossing_2;
0111   float m_px_1, m_px_2;  
0112   float m_py_1, m_py_2;  
0113   float m_pz_1, m_pz_2;  
0114   float m_pt_1, m_pt_2;  
0115   float m_px_proj_1, m_px_proj_2;  
0116   float m_py_proj_1, m_py_proj_2;  
0117   float m_pz_proj_1, m_pz_proj_2;  
0118   //float m_px_proj_kfp_1, m_px_proj_kfp_2;  
0119   //float m_py_proj_kfp_1, m_py_proj_kfp_2;  
0120   //float m_pz_proj_kfp_1, m_pz_proj_kfp_2;  
0121   float m_x_proj_1, m_x_proj_2;  
0122   float m_y_proj_1, m_y_proj_2;  
0123   float m_z_proj_1, m_z_proj_2;  
0124   float m_eta_1, m_eta_2;  
0125   float m_phi_1, m_phi_2;  
0126   float m_charge_1, m_charge_2;  
0127   float m_quality_1, m_quality_2;
0128   float m_chisq_1, m_chisq_2;
0129   float m_ndf_1, m_ndf_2;
0130   float m_nhits_1, m_nhits_2;
0131   float m_nlayers_1, m_nlayers_2;
0132   float m_nmaps_1, m_nmaps_2;
0133   float m_nintt_1, m_nintt_2;
0134   float m_ntpc_1, m_ntpc_2;
0135   float m_nmms_1, m_nmms_2;
0136   float m_mapsstates_1, m_mapsstates_2;
0137   float m_inttstates_1, m_inttstates_2;
0138   float m_tpcstates_1, m_tpcstates_2;
0139   float m_mmsstates_1, m_mmsstates_2;
0140   float m_pca_x_1, m_pca_x_2;  
0141   float m_pca_y_1, m_pca_y_2;  
0142   float m_pca_z_1, m_pca_z_2;  
0143   float m_tagpass_1, m_tagpass_2;  
0144   float m_probepass_1, m_probepass_2;  
0145 
0146   float m_invM;
0147   //float m_invM_kfp;
0148   float m_dca;
0149   float m_vx;
0150   float m_vy;
0151   float m_vz;
0152    
0153   float m_nTPC_tag = 0;
0154   float m_nTPC_passprobe = 0; 
0155   float m_nMVTX_tag = 0;
0156   float m_nMVTX_passprobe = 0; 
0157   float m_nINTT_tag = 0;
0158   float m_nINTT_passprobe = 0; 
0159   float m_nTPOT_tag = 0;
0160   float m_nTPOT_passprobe = 0; 
0161   float m_quality_tag = FLT_MAX;
0162   float m_quality_passprobe = FLT_MAX; 
0163 
0164   bool m_include_pv_info;
0165   
0166   ActsGeometry* m_tGeometry = nullptr;
0167   SvtxVertexMap* m_vertexMap = nullptr;
0168 
0169   unsigned int _nlayers_maps = 3;
0170   unsigned int _nlayers_intt = 4;
0171   unsigned int _nlayers_tpc = 48;
0172   unsigned int _nlayers_mms = 2;
0173 
0174   float _pionMass = 0.13957; //GeV/c^2
0175  
0176   TTree *m_cutInfoTree {nullptr};
0177   TTree *m_TAPTree {nullptr};
0178 
0179   std::string m_magField = "FIELDMAP_TRACKING";
0180   std::string m_trk_map_node_name = "SvtxTrackMap";
0181   std::string m_vtx_map_node_name = "SvtxVertexMap";
0182 };
0183 
0184 #endif  // TAGANDPROBE_TAGANDPROBE_H