Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:17:38

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef TPCSEEDSQA_H
0004 #define TPCSEEDSQA_H
0005 
0006 #include <fun4all/SubsysReco.h>
0007 #include <tpc/TpcClusterMover.h>
0008 #include <tpc/TpcGlobalPositionWrapper.h>
0009 #include <trackbase/TpcDefs.h>
0010 #include <trackbase/TrkrDefs.h>
0011 
0012 #include <set>
0013 #include <string>
0014 #include <vector>
0015 
0016 class ActsGeometry;
0017 class PHCompositeNode;
0018 class SvtxTrack;
0019 class SvtxTrackMap;
0020 class TH1;
0021 class TH2;
0022 class TrkrClusterContainer;
0023 class TProfile;
0024 class TProfile2D;
0025 class TNtuple;
0026 class SvtxVertexMap;
0027 class TrackSeedContainer;
0028 class PHG4TpcCylinderGeomContainer;
0029 class TrackSeed;
0030 
0031 class TpcSeedsQA : public SubsysReco
0032 {
0033  public:
0034   TpcSeedsQA(const std::string& name = "TpcSeedsQA");
0035 
0036   ~TpcSeedsQA() override = default;
0037 
0038   int InitRun(PHCompositeNode* topNode) override;
0039   int process_event(PHCompositeNode* topNode) override;
0040   int EndRun(const int runnumber) override;
0041   int End(PHCompositeNode* topNode) override;
0042 
0043   void setClusterContainerName(const std::string& name) { m_clusterContainerName = name; }
0044   const std::string& getClusterContainerName() { return m_clusterContainerName; }
0045   void setActsGeomName(const std::string& name) { m_actsGeomName = name; }
0046   const std::string& getActsGeomName() { return m_actsGeomName; }
0047   void setG4GeomName(const std::string& name) { m_g4GeomName = name; }
0048   const std::string& getG4GeomName() { return m_g4GeomName; }
0049   void setTrackMapName(const std::string& name) { m_trackMapName = name; }
0050   const std::string& getTrackMapName() { return m_trackMapName; }
0051   void setVertexMapName(const std::string& name) { m_vertexMapName = name; }
0052   const std::string& gettVertexMapName() { return m_vertexMapName; }
0053   float calc_dedx(TrackSeed* tpcseed);
0054   void setSegment(const int segment) { m_segment = segment; }
0055   void segment(const int seg) { m_segment = seg; }
0056   void setruntype(bool type) { collision_or_cosmics = type; }
0057 
0058  private:
0059   static std::vector<TrkrDefs::cluskey> get_cluster_keys(SvtxTrack* track);
0060   void createHistos();
0061   std::string getHistoPrefix() const;
0062   std::set<int> m_layers;
0063   std::multimap<int, int> m_layerRegionMap;
0064   static std::pair<float, float> cal_tpc_eta_min_max(float vtxz);
0065   static float eta_to_theta(float eta);
0066   float* cal_dedx_cluster(SvtxTrack* track);
0067   float cal_track_length(SvtxTrack* track);
0068 
0069   std::string m_clusterContainerName{"TRKR_CLUSTER"};
0070   std::string m_actsGeomName{"ActsGeometry"};
0071   std::string m_g4GeomName{"CYLINDERCELLGEOM_SVTX"};
0072   std::string m_trackMapName{"SvtxTrackMap"};
0073   std::string m_vertexMapName{"SvtxVertexMap"};
0074 
0075   TrkrClusterContainer* clustermap{nullptr};
0076   ActsGeometry* actsgeom{nullptr};
0077   PHG4TpcCylinderGeomContainer* g4geom{nullptr};
0078   SvtxTrackMap* trackmap{nullptr};
0079   SvtxVertexMap* vertexmap{nullptr};
0080 
0081   TH1* h_ntrack1d{nullptr};
0082   TH1* h_ntrack1d_pos{nullptr};
0083   TH1* h_ntrack1d_neg{nullptr};
0084   TH1* h_ntrack1d_ptg1{nullptr};
0085   TH1* h_ntrack1d_ptg1_pos{nullptr};
0086   TH1* h_ntrack1d_ptg1_neg{nullptr};
0087   TH1* h_pt{nullptr};
0088   TH1* h_pt_pos{nullptr};
0089   TH1* h_pt_neg{nullptr};
0090   TH2* h_ntrack_pos{nullptr};
0091   TH2* h_ntrack_neg{nullptr};
0092   TH1* h_ntpc_fullpt_pos{nullptr};
0093   TH1* h_ntpc_fullpt_neg{nullptr};
0094   TH1* h_ntpc_pos{nullptr};
0095   TH1* h_ntpc_neg{nullptr};
0096   TH2* h_ntpc_quality_pos{nullptr};
0097   TH2* h_ntpc_quality_neg{nullptr};
0098   TH1* h_ntpot_pos{nullptr};
0099   TH1* h_ntpot_neg{nullptr};
0100   TProfile2D* h_avgnclus_eta_phi_pos{nullptr};
0101   TProfile2D* h_avgnclus_eta_phi_neg{nullptr};
0102   // TH1* h_trackcrossing_pos{nullptr};
0103   // TH1* h_trackcrossing_neg{nullptr};
0104   TH2* h_dcaxyorigin_phi_north_pos{nullptr};
0105   TH2* h_dcaxyorigin_phi_south_pos{nullptr};
0106   TH2* h_dcaxyorigin_phi_north_neg{nullptr};
0107   TH2* h_dcaxyorigin_phi_south_neg{nullptr};
0108   TH2* h_dcaxyvtx_phi_pos{nullptr};
0109   TH2* h_dcaxyvtx_phi_neg{nullptr};
0110   TH2* h_dcazorigin_phi_pos{nullptr};
0111   TH2* h_dcazorigin_phi_neg{nullptr};
0112   TH2* h_dcazvtx_phi_pos{nullptr};
0113   TH2* h_dcazvtx_phi_neg{nullptr};
0114   TH1* h_ntrack_isfromvtx_pos{nullptr};
0115   TH1* h_ntrack_isfromvtx_neg{nullptr};
0116   TH1* h_cluster_phisize1_fraction_pos{nullptr};
0117   TH1* h_cluster_phisize1_fraction_neg{nullptr};
0118 
0119   TH1* h_nvertex{nullptr};
0120   TH1* h_vx{nullptr};
0121   TH1* h_vy{nullptr};
0122   TH2* h_vx_vy{nullptr};
0123   TH1* h_vz{nullptr};
0124   TH1* h_vt{nullptr};
0125   // TH1* h_vcrossing{nullptr};
0126   TH1* h_vchi2dof{nullptr};
0127   TH1* h_ntrackpervertex{nullptr};
0128 
0129   TH2* h_dedx{nullptr};
0130   TH1* h_mip_dedx{nullptr};
0131 
0132   TH2* h_dedx_pq_z[10]{nullptr};
0133   TH2* h_dedx_pcaz{nullptr};
0134 
0135   TH2* h_adc_sector[3]{nullptr};
0136   TProfile* h_onepad_frac[3]{nullptr};
0137 
0138   TH1* h_cluster_phisize1_fraction_side0[3]{nullptr};
0139   TH1* h_cluster_phisize1_fraction_side1[3]{nullptr};
0140 
0141   TH1* h_clusphisize1pt_side0[3]{nullptr};
0142   TH1* h_clusphisize1pt_side1[3]{nullptr};
0143   TH1* h_clusphisizegeq1pt_side0[3]{nullptr};
0144   TH1* h_clusphisizegeq1pt_side1[3]{nullptr};
0145 
0146   TH2* h_cluster_phisize1_fraction_pt_side0[3]{nullptr};
0147   TH2* h_cluster_phisize1_fraction_pt_side1[3]{nullptr};
0148 
0149   TH1* h_cluster_phisize1_fraction_mean_side0[3]{nullptr};
0150   TH1* h_cluster_phisize1_fraction_mean_side1[3]{nullptr};
0151 
0152   TH1* h_cluster_phisize1_fraction_mean_numerator_side0[3]{nullptr};
0153   TH1* h_cluster_phisize1_fraction_mean_numerator_side1[3]{nullptr};
0154 
0155   TH1* h_cluster_phisize1_fraction_mean_denominator_side0[3]{nullptr};
0156   TH1* h_cluster_phisize1_fraction_mean_denominator_side1[3]{nullptr};
0157 
0158   TNtuple* nt_sector_event_summary{nullptr};
0159 
0160   int m_bco{0};
0161   int m_event{0};
0162   int m_segment{0};
0163 
0164   double frac_side0_pt[3][4]{{0}};
0165   double frac_side1_pt[3][4]{{0}};
0166 
0167   double num_track_side0_pt[3][4]{{0}};
0168   double num_track_side1_pt[3][4]{{0}};
0169 
0170   //! global position wrapper
0171   TpcGlobalPositionWrapper m_globalPositionWrapper;
0172   TpcClusterMover m_clusterMover;
0173 
0174   float m_px{std::numeric_limits<float>::quiet_NaN()};
0175   float m_py{std::numeric_limits<float>::quiet_NaN()};
0176   float m_pz{std::numeric_limits<float>::quiet_NaN()};
0177   float m_pt{std::numeric_limits<float>::quiet_NaN()};
0178   float m_ptot{std::numeric_limits<float>::quiet_NaN()};
0179   float m_charge{std::numeric_limits<float>::quiet_NaN()};
0180   float m_dedx{std::numeric_limits<float>::quiet_NaN()};
0181 
0182   int m_ntpc{std::numeric_limits<int>::min()};
0183   std::vector<float> m_clusgz;
0184   std::vector<int> m_cluslayer;
0185   std::vector<int> m_clusphisize;
0186   std::vector<int> m_cluszsize;
0187   std::vector<int> m_region;
0188 
0189   struct PhiHistoList
0190   {
0191     TH1* cphisize1pT_side0{nullptr};
0192     TH1* cphisize1pT_side1{nullptr};
0193     TH1* cphisizegeq1pT_side0{nullptr};
0194     TH1* cphisizegeq1pT_side1{nullptr};
0195     int ntpc_side0{0};
0196     int ntpc_side0_phisize1{0};
0197     int ntpc_side1{0};
0198     int ntpc_side1_phisize1{0};
0199 
0200     void Clear()
0201     {
0202       ntpc_side0 = 0;
0203       ntpc_side0_phisize1 = 0;
0204       ntpc_side1 = 0;
0205       ntpc_side1_phisize1 = 0;
0206     }
0207   };
0208 
0209   using PhiHistoMap = std::map<int, PhiHistoList>;
0210   PhiHistoMap phihistos;
0211 
0212   bool collision_or_cosmics{false};  // false: collision, true: cosmics
0213 };
0214 
0215 #endif  // TPCSEEDSQA_H