Warning, file /EICrecon/src/algorithms/calorimetry/ImagingTopoCluster.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #pragma once
0022
0023 #include <algorithms/algorithm.h>
0024
0025 #include <edm4eic/CalorimeterHitCollection.h>
0026 #include <edm4eic/ProtoClusterCollection.h>
0027 #include <array>
0028 #include <cstddef>
0029 #include <list>
0030 #include <set>
0031 #include <string>
0032 #include <string_view>
0033
0034 #include "ImagingTopoClusterConfig.h"
0035 #include "algorithms/interfaces/WithPodConfig.h"
0036
0037 namespace eicrecon {
0038
0039 using ImagingTopoClusterAlgorithm =
0040 algorithms::Algorithm<algorithms::Input<edm4eic::CalorimeterHitCollection>,
0041 algorithms::Output<edm4eic::ProtoClusterCollection>>;
0042
0043 class ImagingTopoCluster : public ImagingTopoClusterAlgorithm,
0044 public WithPodConfig<ImagingTopoClusterConfig> {
0045
0046 public:
0047 ImagingTopoCluster(std::string_view name)
0048 : ImagingTopoClusterAlgorithm{
0049 name,
0050 {"inputHitCollection"},
0051 {"outputProtoClusterCollection"},
0052 "Topological cell clustering algorithm for imaging calorimetry."} {}
0053
0054 private:
0055
0056 std::array<double, 2> sameLayerDistXY{0, 0};
0057 std::array<double, 2> diffLayerDistXY{0, 0};
0058 std::array<double, 3> sameLayerDistXYZ{0, 0, 0};
0059 std::array<double, 3> diffLayerDistXYZ{0, 0, 0};
0060 std::array<double, 2> sameLayerDistEtaPhi{0, 0};
0061 std::array<double, 2> diffLayerDistEtaPhi{0, 0};
0062 std::array<double, 2> sameLayerDistTZ{0, 0};
0063 std::array<double, 2> diffLayerDistTZ{0, 0};
0064 double sectorDist{0};
0065 double minClusterHitEdep{0};
0066 double minClusterCenterEdep{0};
0067 double minClusterEdep{0};
0068
0069 public:
0070 void init();
0071 void process(const Input& input, const Output& output) const final;
0072
0073 private:
0074
0075 bool is_neighbour(const edm4eic::CalorimeterHit& h1, const edm4eic::CalorimeterHit& h2) const;
0076
0077
0078
0079 template <typename Compare>
0080 void bfs_group(const edm4eic::CalorimeterHitCollection& hits,
0081 std::set<std::size_t, Compare>& indices, std::list<std::size_t>& group,
0082 const std::size_t idx) const {
0083
0084
0085 for (auto idx1 = group.begin(); idx1 != group.end(); ++idx1) {
0086
0087 for (auto idx2 = indices.begin(); idx2 != indices.end();
0088 indices.empty() ? idx2 = indices.end() : idx2) {
0089
0090
0091
0092 if (*idx2 == *idx1 || *idx2 == idx) {
0093 idx2++;
0094 continue;
0095 }
0096
0097
0098
0099
0100
0101
0102
0103 if (hits[*idx2].getEnergy() < m_cfg.minClusterHitEdep) {
0104 idx2 = indices.erase(idx2);
0105 continue;
0106 }
0107
0108 if (is_neighbour(hits[*idx1], hits[*idx2])) {
0109 group.push_back(*idx2);
0110 idx2 = indices.erase(idx2);
0111 } else {
0112 idx2++;
0113 }
0114 }
0115 }
0116 }
0117 };
0118
0119 }