EICrecon
JANA based reconstruction for the EPIC detector
Loading...
Searching...
No Matches
LGADHitClustering.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2// Copyright (C) 2025 Chun Yuen Tsang
3
4#pragma once
5#include <DD4hep/DetElement.h>
6#include <DD4hep/Detector.h>
7#include <DD4hep/Segmentations.h>
8#include <DDRec/CellIDPositionConverter.h>
9#include <DDSegmentation/BitFieldCoder.h>
10#include <DDSegmentation/CartesianGridXY.h>
11#include <algorithms/algorithm.h>
12#include <edm4eic/Measurement2DCollection.h>
13#include <edm4eic/TrackerHitCollection.h>
14#include <spdlog/logger.h>
15#include <memory>
16#include <string>
17#include <string_view>
18#include <unordered_map>
19#include <vector>
20
24
25namespace eicrecon {
26
28 algorithms::Algorithm<algorithms::Input<edm4eic::TrackerHitCollection>,
29 algorithms::Output<edm4eic::Measurement2DCollection>>;
30
32 public WithPodConfig<LGADHitClusteringConfig> {
33
34public:
35 LGADHitClustering(std::string_view name)
36 : LGADHitClusteringAlgorithm{name, {"TOFBarrelCalHit"}, {"TOFBarrelRecHit"}, ""} {};
37
38 void init() final;
39 void process(const Input&, const Output&) const final;
40
41private:
42 void _calcCluster(const Output& output, const std::vector<edm4eic::TrackerHit>& hits) const;
43
45 std::shared_ptr<spdlog::logger> m_log;
46
48 const dd4hep::rec::CellIDPositionConverter* m_converter = nullptr;
49
51 const dd4hep::DDSegmentation::BitFieldCoder* m_decoder = nullptr;
52
53 const dd4hep::Detector* m_detector = nullptr;
54
55 dd4hep::Segmentation m_seg;
56
57 std::shared_ptr<const ActsGeometryProvider> m_acts_context;
58
59 // neighbor finding algorithm copied from SiliconChargeSharing
60 const dd4hep::DDSegmentation::CartesianGridXY*
61 getLocalSegmentation(const dd4hep::rec::CellID& cellID) const;
62
63 mutable std::unordered_map<const dd4hep::DetElement*,
64 const dd4hep::DDSegmentation::CartesianGridXY*>
65 m_segmentation_map;
66
67 // union-find algorithm to group contiguous clusters
68 class UnionFind {
69 private:
70 std::vector<int> mParent, mRank;
71
72 public:
73 UnionFind(int n);
74 int find(int id);
75 void merge(int id1, int id2);
76 };
77};
78} // namespace eicrecon
Definition ActsGeometryProvider.h:39
Definition LGADHitClustering.h:32
LGADHitClustering(std::string_view name)
Definition LGADHitClustering.h:35
Definition WithPodConfig.h:22
Definition ActsGeometryProvider.h:28
-client
Definition CalorimeterClusterRecoCoG.cc:37
algorithms::Algorithm< algorithms::Input< edm4eic::TrackerHitCollection >, algorithms::Output< edm4eic::Measurement2DCollection > > LGADHitClusteringAlgorithm
Definition LGADHitClustering.h:29
Definition SimCalorimeterHitProcessor.cc:35