File indexing completed on 2026-08-30 08:14:27
0001 #ifndef TPCCALIB_STRIPECOMPARISON_H
0002 #define TPCCALIB_STRIPECOMPARISON_H
0003
0004 #include "GlobalFieldFitter.h"
0005 #include "StripeMatchingTypes.h"
0006
0007 #include <cstddef>
0008 #include <string>
0009 #include <array>
0010 #include <vector>
0011
0012 class TH2;
0013
0014
0015
0016
0017 inline constexpr int seed_measured_idx = 0;
0018 inline constexpr int seed_reference_idx = 1;
0019 inline constexpr int seed_phi = 2;
0020 inline constexpr int seed_r = 3;
0021 inline constexpr int seed_reference_phi = 4;
0022 inline constexpr int seed_reference_r = 5;
0023 inline constexpr int seed_delta_r = 6;
0024 inline constexpr int seed_delta_phi = 7;
0025 inline constexpr int seed_r_delta_phi = 8;
0026
0027 class StripeComparison {
0028 public:
0029 ~StripeComparison();
0030
0031
0032 bool initialize(const std::vector<std::array<double, 3>> &measured, const std::vector<std::array<double, 3>> &reference, int side, const std::vector<double> &controlRPositions);
0033
0034
0035 bool filter_isolated_inputs(const std::vector<std::array<double, 3>> &measured, const std::vector<std::array<double, 3>> &reference);
0036
0037
0038 bool build_global_pattern_matches();
0039
0040
0041 bool build_global_field_estimates();
0042
0043
0044 void write_output_maps();
0045
0046
0047 void write_corrected_measured_histogram(TH2 *measuredHistogram);
0048 void write_distorted_reference_histogram(TH2 *referenceHistogram);
0049
0050
0051 void clear();
0052
0053 private:
0054
0055 void fill_candidate_diagnostics(size_t diagnosticMeasuredIndex, size_t diagnosticReferenceIndex, double &referencePhi, double &referenceR, double &deltaR, double &deltaPhi, double &rDeltaPhi, double &cost, double &residualDeltaR, double &residualDeltaPhi, double &residualRDeltaPhi, int &withinGate);
0056
0057
0058 void write_shifted_histogram(TH2 *sourceHistogram, const std::string &name, const std::string &title, double shiftSign);
0059
0060
0061 std::string m_sideName;
0062
0063
0064 std::vector<double> m_controlRPositions;
0065
0066
0067 std::vector<std::array<double, 3>> m_measuredFiltered;
0068 std::vector<std::array<double, 3>> m_referenceFiltered;
0069
0070
0071 std::vector<std::array<double, 9>> m_seedMatches;
0072 std::vector<std::array<double, 6>> m_globalObservations;
0073
0074
0075 int m_selectedBranchShift = 0;
0076 std::vector<int> m_selectedReferenceRowByIndex;
0077 std::vector<int> m_selectedAllowedReferenceRowByMeasured;
0078
0079
0080 GlobalFieldFitter *m_globalFieldFitter = nullptr;
0081 };
0082
0083 #endif