File indexing completed on 2025-08-06 08:18:06
0001 #ifndef TPCCALIB_TpcSpaceChargeMatrixContainerv2_H
0002 #define TPCCALIB_TpcSpaceChargeMatrixContainerv2_H
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include "TpcSpaceChargeMatrixContainer.h"
0012
0013 #include <array>
0014
0015
0016
0017
0018 class TpcSpaceChargeMatrixContainerv2 : public TpcSpaceChargeMatrixContainer
0019 {
0020 public:
0021
0022 TpcSpaceChargeMatrixContainerv2();
0023
0024
0025 ~TpcSpaceChargeMatrixContainerv2() override = default;
0026
0027
0028
0029
0030
0031 void identify(std::ostream& os = std::cout) const override;
0032
0033
0034 void get_grid_dimensions(int& phibins, int& rbins, int& zbins) const override;
0035
0036
0037 int get_grid_size() const override;
0038
0039
0040 int get_cell_index(int iphibin, int irbin, int izbin) const override;
0041
0042
0043 int get_entries(int cell_index) const override;
0044
0045
0046 float get_lhs(int cell_index, int i, int j) const override;
0047
0048
0049 float get_rhs(int cell_index, int i) const override;
0050
0051
0052 float get_lhs_rphi(int cell_index, int i, int j) const override;
0053
0054
0055 float get_rhs_rphi(int cell_index, int i) const override;
0056
0057
0058 float get_lhs_z(int cell_index, int i, int j) const override;
0059
0060
0061 float get_rhs_z(int cell_index, int i) const override;
0062
0063
0064
0065
0066
0067
0068
0069 void Reset() override;
0070
0071
0072
0073
0074
0075
0076 void set_grid_dimensions(int phibins, int rbins, int zbins) override;
0077
0078
0079 void add_to_entries(int cell_index) override
0080 {
0081 add_to_entries(cell_index, 1);
0082 }
0083
0084
0085 void add_to_entries(int cell_index, int value) override;
0086
0087
0088 void add_to_lhs(int cell_index, int i, int j, float value) override;
0089
0090
0091 void add_to_rhs(int cell_index, int i, float value) override;
0092
0093
0094 void add_to_lhs_rphi(int cell_index, int i, int j, float value) override;
0095
0096
0097 void add_to_rhs_rphi(int cell_index, int i, float value) override;
0098
0099
0100 void add_to_lhs_z(int cell_index, int i, int j, float value) override;
0101
0102
0103 void add_to_rhs_z(int cell_index, int i, float value) override;
0104
0105
0106 bool add(const TpcSpaceChargeMatrixContainer& other) override;
0107
0108
0109
0110 private:
0111
0112 bool bound_check(int cell_index) const;
0113
0114
0115 bool bound_check(int cell_index, int i) const;
0116
0117
0118 bool bound_check(int cell_index, int i, int j) const;
0119
0120
0121 int get_flat_index(int i, int j) const;
0122
0123
0124 bool bound_check_reduced(int cell_index, int i) const;
0125
0126
0127 bool bound_check_reduced(int cell_index, int i, int j) const;
0128
0129
0130 int get_flat_index_reduced(int i, int j) const;
0131
0132
0133
0134 int m_phibins = 36;
0135 int m_rbins = 16;
0136 int m_zbins = 80;
0137
0138
0139
0140
0141
0142 static constexpr int m_ncoord = 3;
0143
0144
0145 using matrix_t = std::array<float, m_ncoord * m_ncoord>;
0146 using column_t = std::array<float, m_ncoord>;
0147
0148
0149 std::vector<matrix_t> m_lhs;
0150
0151
0152 std::vector<column_t> m_rhs;
0153
0154
0155
0156
0157
0158
0159 static constexpr int m_ncoord_reduced = 2;
0160
0161
0162 using reduced_matrix_t = std::array<float, m_ncoord_reduced * m_ncoord_reduced>;
0163 using reduced_column_t = std::array<float, m_ncoord_reduced>;
0164
0165
0166 std::vector<reduced_matrix_t> m_lhs_rphi;
0167
0168
0169 std::vector<reduced_column_t> m_rhs_rphi;
0170
0171
0172 std::vector<reduced_matrix_t> m_lhs_z;
0173
0174
0175 std::vector<reduced_column_t> m_rhs_z;
0176
0177
0178
0179 std::vector<int> m_entries;
0180
0181 ClassDefOverride(TpcSpaceChargeMatrixContainerv2, 1)
0182 };
0183
0184 #endif