EICrecon
JANA based reconstruction for the EPIC detector
Loading...
Searching...
No Matches
MatchClusters.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2// Copyright (C) 2022, 2024 Sylvester Joosten, Dmitry Romanov, Wouter Deconinck
3
4// Takes a list of particles (presumed to be from tracking), and all available clusters.
5// 1. Match clusters to their tracks using the mcID field
6// 2. For unmatched clusters create neutrals and add to the particle list
7
8#pragma once
9
10#include <algorithms/algorithm.h>
11#include <edm4eic/ClusterCollection.h>
12#include <edm4eic/EDM4eicVersion.h>
13#include <edm4eic/MCRecoClusterParticleAssociationCollection.h>
14#include <edm4eic/MCRecoParticleAssociationCollection.h>
15#include <edm4eic/ReconstructedParticleCollection.h>
16#include <edm4hep/MCParticleCollection.h>
17#include <stdint.h>
18#include <map>
19#include <string>
20#include <string_view>
21
23
24#if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
25#include <edm4eic/MCRecoParticleLinkCollection.h>
26#endif
27
28namespace eicrecon {
29
30using MatchClustersAlgorithm = algorithms::Algorithm<
31 algorithms::Input<edm4hep::MCParticleCollection, edm4eic::ReconstructedParticleCollection,
32 edm4eic::MCRecoParticleAssociationCollection, edm4eic::ClusterCollection,
33 edm4eic::MCRecoClusterParticleAssociationCollection>,
34 algorithms::Output<edm4eic::ReconstructedParticleCollection,
35#if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
36 edm4eic::MCRecoParticleLinkCollection,
37#endif
38 edm4eic::MCRecoParticleAssociationCollection>>;
39
40class MatchClusters : public MatchClustersAlgorithm, public WithPodConfig<NoConfig> {
41
42public:
43 MatchClusters(std::string_view name)
45 {"MCParticles", "CentralTracks", "CentralTrackAssociations",
46 "EcalClusters", "EcalClusterAssociations"},
47 {"ReconstructedParticles",
48#if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
49 "ReconstructedParticleLinks",
50#endif
51 "ReconstructedParticleAssociations"},
52 "Match tracks with clusters, and assign associations."} {
53 }
54
55 void init() final {};
56 void process(const Input&, const Output&) const final;
57
58private:
59 // get a map of mcID --> cluster
60 // input: clusters --> all clusters
61 std::map<int, edm4eic::Cluster>
62 indexedClusters(const edm4eic::ClusterCollection* clusters,
63 const edm4eic::MCRecoClusterParticleAssociationCollection* associations) const;
64
65 // reconstruct a neutral cluster
66 // (for now assuming the vertex is at (0,0,0))
67 static edm4eic::MutableReconstructedParticle
68 reconstruct_neutral(const edm4eic::Cluster* cluster, const double mass, const int32_t pdg);
69};
70
71} // namespace eicrecon
Definition MatchClusters.h:40
MatchClusters(std::string_view name)
Definition MatchClusters.h:43
void init() final
Definition MatchClusters.h:55
Definition WithPodConfig.h:22
-client
Definition CalorimeterClusterRecoCoG.cc:37
algorithms::Algorithm< algorithms::Input< edm4hep::MCParticleCollection, edm4eic::ReconstructedParticleCollection, edm4eic::MCRecoParticleAssociationCollection, edm4eic::ClusterCollection, edm4eic::MCRecoClusterParticleAssociationCollection >, algorithms::Output< edm4eic::ReconstructedParticleCollection, edm4eic::MCRecoParticleLinkCollection, edm4eic::MCRecoParticleAssociationCollection > > MatchClustersAlgorithm
Definition MatchClusters.h:38