File indexing completed on 2026-08-30 08:14:28
0001 #ifndef TPCCALIB_STRIPEDETECTOR_H
0002 #define TPCCALIB_STRIPEDETECTOR_H
0003
0004 #include "StripeMatchingTypes.h"
0005
0006 #include <cstddef>
0007 #include <array>
0008 #include <vector>
0009
0010 class TH2;
0011
0012
0013
0014 inline constexpr int component_bin_x = 0;
0015 inline constexpr int component_bin_y = 1;
0016 inline constexpr int component_phi = 2;
0017 inline constexpr int component_r = 3;
0018 inline constexpr int component_content = 4;
0019
0020 class StripeDetector {
0021 public:
0022
0023
0024 bool detect(TH2 *histogram, std::vector<std::array<double, 3>> &stripes);
0025
0026
0027 void clear();
0028
0029 private:
0030
0031 bool initialize(TH2 *histogram, std::vector<std::array<double, 3>> &stripes);
0032
0033
0034 bool create_working_histogram(TH2 *histogram);
0035
0036
0037 void collect_seed_bins(TH2 *histogram);
0038
0039
0040 void build_connected_components();
0041
0042
0043 void convert_components_to_raw_stripes(TH2 *histogram);
0044
0045
0046 static int wrapped_phi_bin(int bin, int nBinsX);
0047
0048
0049 static void normalize_phi_to_axis(TH2 *histogram, double &phi);
0050
0051
0052 TH2 *m_workingHist = nullptr;
0053
0054
0055 int m_nBinsX = 0;
0056 int m_nBinsY = 0;
0057
0058
0059 std::vector<std::vector<std::array<double, 5>>> m_seedBinsByPhi;
0060 std::vector<std::vector<std::array<double, 5>>> m_components;
0061
0062
0063 std::vector<std::array<double, 3>> m_rawStripes;
0064 size_t m_nSeedBins = 0;
0065 };
0066
0067 #endif