File indexing completed on 2026-04-02 08:13:41
0001
0002
0003 #ifndef STATECLUSTERRESIDUALSQA_H
0004 #define STATECLUSTERRESIDUALSQA_H
0005
0006 #include <fun4all/SubsysReco.h>
0007
0008 #include <string>
0009 #include <limits>
0010 #include <cmath>
0011 #include <cfloat>
0012 #include <vector>
0013
0014 class PHCompositeNode;
0015 class TH1;
0016 class TH2;
0017
0018 struct ResidualHistConfig
0019 {
0020 std::string name = "h_StateClusterResidualsQA_";
0021 std::string title = ";Residual [cm];Entries";
0022
0023 int min_mvtx_clusters = 0;
0024 int max_mvtx_clusters = 3;
0025 int min_intt_clusters = 0;
0026 int max_intt_clusters = 4;
0027 int min_tpc_clusters = 0;
0028 int max_tpc_clusters = 48;
0029
0030 float phi_min = -M_PI;
0031 float phi_max = M_PI;
0032 float eta_min = -1.1;
0033 float eta_max = 1.1;
0034
0035 float pt_min = 0.0;
0036 float pt_max = FLT_MAX;
0037
0038 int charge = 0;
0039
0040 float rphi_local_lower = -0.5;
0041 float rphi_local_upper = 0.5;
0042 float z_local_lower = -0.5;
0043 float z_local_upper = 0.5;
0044 float x_lower = -0.5;
0045 float x_upper = 0.5;
0046 float y_lower = -0.5;
0047 float y_upper = 0.5;
0048 float z_lower = -0.5;
0049 float z_upper = 0.5;
0050 };
0051
0052 class StateClusterResidualsQA : public SubsysReco
0053 {
0054 public:
0055 StateClusterResidualsQA(const std::string& name = "StateClusterResidualsQA");
0056 ~StateClusterResidualsQA() override = default;
0057
0058
0059 void set_track_map_name(std::string const& track_map_node_name) { m_track_map_node_name = track_map_node_name; }
0060
0061 StateClusterResidualsQA& addHistogram(const std::string& name)
0062 {
0063 ResidualHistConfig cfg;
0064 cfg.name += name;
0065 m_pending.push_back(cfg);
0066 return *this;
0067 }
0068 StateClusterResidualsQA& setNMvtx(int min, int max)
0069 {
0070 m_pending.back().min_mvtx_clusters = min;
0071 m_pending.back().max_mvtx_clusters = max;
0072 return *this;
0073 }
0074 StateClusterResidualsQA& setNIntt(int min, int max)
0075 {
0076 m_pending.back().min_intt_clusters = min;
0077 m_pending.back().max_intt_clusters = max;
0078 return *this;
0079 }
0080 StateClusterResidualsQA& setNTpc(int min, int max)
0081 {
0082 m_pending.back().min_tpc_clusters = min;
0083 m_pending.back().max_tpc_clusters = max;
0084 return *this;
0085 }
0086 StateClusterResidualsQA& setPhiRange(float min, float max)
0087 {
0088 m_pending.back().phi_min = min;
0089 m_pending.back().phi_max = max;
0090 return *this;
0091 }
0092 StateClusterResidualsQA& setEtaRange(float min, float max)
0093 {
0094 m_pending.back().eta_min = min;
0095 m_pending.back().eta_max = max;
0096 return *this;
0097 }
0098 StateClusterResidualsQA& setPtRange(float min, float max)
0099 {
0100 m_pending.back().pt_min = min;
0101 m_pending.back().pt_max = max;
0102 return *this;
0103 }
0104 StateClusterResidualsQA& setXRange(float min, float max)
0105 {
0106 m_pending.back().x_lower = min;
0107 m_pending.back().x_upper = max;
0108 return *this;
0109 }
0110 StateClusterResidualsQA& setYRange(float min, float max)
0111 {
0112 m_pending.back().y_lower = min;
0113 m_pending.back().y_upper = max;
0114 return *this;
0115 }
0116 StateClusterResidualsQA& setZRange(float min, float max)
0117 {
0118 m_pending.back().z_lower = min;
0119 m_pending.back().z_upper = max;
0120 return *this;
0121 }
0122 StateClusterResidualsQA& setLocalRphiRange(float min, float max)
0123 {
0124 m_pending.back().rphi_local_lower = min;
0125 m_pending.back().rphi_local_upper = max;
0126 return *this;
0127 }
0128 StateClusterResidualsQA& setLocalZRange(float min, float max)
0129 {
0130 m_pending.back().z_local_lower = min;
0131 m_pending.back().z_local_upper = max;
0132 return *this;
0133 }
0134 StateClusterResidualsQA& setPositiveTracks()
0135 {
0136 m_pending.back().charge = 1;
0137 return *this;
0138 }
0139 StateClusterResidualsQA& setNegativeTracks()
0140 {
0141 m_pending.back().charge = -1;
0142 return *this;
0143 }
0144
0145 void setUseLocalCoords()
0146 {
0147 m_use_local_coords = true;
0148 }
0149
0150 void createHistos();
0151
0152 int InitRun(PHCompositeNode*) override;
0153
0154 int process_event(PHCompositeNode*) override;
0155
0156 int EndRun(const int runnumber) override;
0157
0158 private:
0159 std::vector<ResidualHistConfig> m_pending;
0160
0161 std::string m_track_map_node_name = "SvtxTrackMap";
0162 std::string m_clusterContainerName = "TRKR_CLUSTER";
0163
0164 int m_nBins = 50;
0165 bool m_use_local_coords = false;
0166
0167 std::vector<TH1*> m_histograms_x{};
0168 std::vector<TH1*> m_histograms_y{};
0169 std::vector<TH1*> m_histograms_z{};
0170 std::vector<TH2*> m_histograms_layer_x{};
0171 std::vector<TH2*> m_histograms_layer_y{};
0172 std::vector<TH2*> m_histograms_layer_z{};
0173 std::vector<TH2*> m_histograms_phi_x{};
0174 std::vector<TH2*> m_histograms_phi_y{};
0175 std::vector<TH2*> m_histograms_phi_z{};
0176 std::vector<TH2*> m_histograms_eta_x{};
0177 std::vector<TH2*> m_histograms_eta_y{};
0178 std::vector<TH2*> m_histograms_eta_z{};
0179 };
0180
0181 #endif