EICrecon
JANA based reconstruction for the EPIC detector
Loading...
Searching...
No Matches
TrackClusterMergeSplitter.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2// Copyright (C) 2026 Derek Anderson, Dmitry Kalinkin
3
4#pragma once
5
6#include <algorithms/algorithm.h>
7#include <edm4eic/CalorimeterHit.h>
8#include <edm4eic/ClusterCollection.h>
9#include <edm4eic/EDM4eicVersion.h>
10#include <edm4eic/ProtoClusterCollection.h>
11#include <edm4eic/TrackClusterMatchCollection.h>
12#if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
13#include <edm4eic/TrackProtoClusterLinkCollection.h>
14#elif EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 4, 0)
15#include <edm4eic/TrackProtoClusterMatchCollection.h>
16#endif
17#include <edm4eic/TrackSegmentCollection.h>
18#include <map>
19#include <optional>
20#include <string>
21#include <string_view>
22#include <vector>
23
27
28namespace eicrecon {
29
30using TrackClusterMergeSplitterAlgorithm = algorithms::Algorithm<
31 algorithms::Input<edm4eic::TrackClusterMatchCollection, edm4eic::ClusterCollection,
32 edm4eic::TrackSegmentCollection>,
33#if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
34 algorithms::Output<edm4eic::ProtoClusterCollection, edm4eic::TrackProtoClusterLinkCollection>>;
35#elif EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 4, 0)
36 algorithms::Output<edm4eic::ProtoClusterCollection, edm4eic::TrackProtoClusterMatchCollection>>;
37#else
38 algorithms::Output<edm4eic::ProtoClusterCollection>>;
39#endif
40
41// ==========================================================================
43// ==========================================================================
51 public WithPodConfig<TrackClusterMergeSplitterConfig> {
52
53public:
55 TrackClusterMergeSplitter(std::string_view name)
57 name,
58 {"InputTrackClusterMatches", "InputClusterCollection", "InputTrackProjections"},
59#if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
60 {"OutputProtoClusterCollection", "OutputTrackProtoClusterLinks"},
61#elif EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 4, 0)
62 {"OutputProtoClusterCollection", "OutputTrackProtoClusterMatches"},
63#else
64 {"OutputProtoClusterCollection"},
65#endif
66 "Merges or splits clusters based on tracks matched to them."} {
67 }
68
69 void process(const Input&, const Output&) const final;
70
71private:
73 using segment_vector = std::vector<edm4eic::TrackSegment>;
74
76 using protocluster_vector = std::vector<edm4eic::MutableProtoCluster>;
77
79 using cluster_vector = std::vector<edm4eic::Cluster>;
80
82 using hit_to_weight_map =
83 std::map<edm4eic::CalorimeterHit, double, CompareObjectID<edm4eic::CalorimeterHit>>;
84
85 void merge_and_split_clusters(const cluster_vector& to_merge, const segment_vector& to_split,
86 protocluster_vector& new_protos) const;
87 static void add_cluster_to_proto(const edm4eic::Cluster& clust,
88 edm4eic::MutableProtoCluster& proto,
89 std::optional<hit_to_weight_map> split_weights = std::nullopt);
90
91}; // end TrackClusterMergeSplitter
92} // namespace eicrecon
Track-Based Cluster Merger/Splitter.
Definition TrackClusterMergeSplitter.h:51
TrackClusterMergeSplitter(std::string_view name)
! Algorithm constructor
Definition TrackClusterMergeSplitter.h:55
Definition WithPodConfig.h:22
-client
Definition CalorimeterClusterRecoCoG.cc:37
algorithms::Algorithm< algorithms::Input< edm4eic::TrackClusterMatchCollection, edm4eic::ClusterCollection, edm4eic::TrackSegmentCollection >, algorithms::Output< edm4eic::ProtoClusterCollection, edm4eic::TrackProtoClusterLinkCollection > > TrackClusterMergeSplitterAlgorithm
Definition TrackClusterMergeSplitter.h:34