File indexing completed on 2025-08-06 08:10:33
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Clusterization/Clusterization.hpp"
0012 #include "Acts/Definitions/Algebra.hpp"
0013 #include "Acts/Definitions/TrackParametrization.hpp"
0014 #include "Acts/Utilities/BinUtility.hpp"
0015 #include "ActsExamples/Digitization/MeasurementCreation.hpp"
0016 #include "ActsExamples/EventData/Cluster.hpp"
0017 #include "ActsExamples/EventData/SimHit.hpp"
0018
0019 #include <algorithm>
0020 #include <cstddef>
0021 #include <set>
0022 #include <unordered_map>
0023 #include <utility>
0024 #include <variant>
0025 #include <vector>
0026
0027 namespace ActsExamples {
0028 struct DigitizedParameters;
0029
0030 struct ModuleValue {
0031 std::vector<Acts::BoundIndices> paramIndices = {};
0032 std::vector<Acts::ActsScalar> paramValues = {};
0033 std::vector<Acts::ActsScalar> paramVariances = {};
0034 std::variant<Cluster, Cluster::Cell> value;
0035 std::set<SimHitContainer::size_type> sources = {};
0036 Acts::Ccl::Label label = {Acts::Ccl::NO_LABEL};
0037 };
0038
0039 class ModuleClusters {
0040 public:
0041 using simhit_t = SimHitContainer::size_type;
0042
0043 ModuleClusters(Acts::BinUtility segmentation,
0044 std::vector<Acts::BoundIndices> geoIndices, bool merge,
0045 double nsigma, bool commonCorner)
0046 : m_segmentation(std::move(segmentation)),
0047 m_geoIndices(std::move(geoIndices)),
0048 m_merge(merge),
0049 m_nsigma(nsigma),
0050 m_commonCorner(commonCorner) {}
0051
0052 void add(DigitizedParameters params, simhit_t simhit);
0053 std::vector<std::pair<DigitizedParameters, std::set<simhit_t>>>
0054 digitizedParameters();
0055
0056 private:
0057 Acts::BinUtility m_segmentation;
0058 std::vector<Acts::BoundIndices> m_geoIndices;
0059 std::vector<ModuleValue> m_moduleValues;
0060 bool m_merge;
0061 double m_nsigma;
0062 bool m_commonCorner;
0063
0064 std::vector<ModuleValue> createCellCollection();
0065 void merge();
0066 ModuleValue squash(std::vector<ModuleValue>& values);
0067 std::vector<std::size_t> nonGeoEntries(
0068 std::vector<Acts::BoundIndices>& indices);
0069 std::vector<std::vector<ModuleValue>> mergeParameters(
0070 std::vector<ModuleValue> values);
0071 };
0072 }