File indexing completed on 2026-03-31 07:48:21
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #pragma once
0012
0013 #include <algorithms/algorithm.h>
0014 #include <edm4eic/CalorimeterHitCollection.h>
0015 #include <edm4eic/EDM4eicVersion.h>
0016 #include <edm4eic/ClusterCollection.h>
0017 #include <edm4eic/MCRecoCalorimeterHitAssociationCollection.h>
0018 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
0019 #include <edm4eic/MCRecoCalorimeterHitLinkCollection.h>
0020 #include <podio/LinkNavigator.h>
0021 #endif
0022 #include <edm4eic/MCRecoClusterParticleAssociationCollection.h>
0023 #include <edm4eic/ProtoClusterCollection.h>
0024 #include <edm4hep/CaloHitContribution.h>
0025
0026 #include <edm4hep/MCParticleCollection.h>
0027 #include <iterator>
0028 #include <string>
0029 #include <string_view>
0030 #include <utility>
0031 #include <vector>
0032
0033 #include "ImagingClusterRecoConfig.h"
0034 #include "algorithms/interfaces/WithPodConfig.h"
0035
0036 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
0037 #include <edm4eic/MCRecoClusterParticleLinkCollection.h>
0038 #endif
0039
0040 namespace eicrecon {
0041
0042 using ImagingClusterRecoAlgorithm =
0043 algorithms::Algorithm<algorithms::Input<edm4eic::ProtoClusterCollection,
0044 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
0045 edm4eic::MCRecoCalorimeterHitLinkCollection,
0046 #endif
0047 edm4eic::MCRecoCalorimeterHitAssociationCollection>,
0048 algorithms::Output<edm4eic::ClusterCollection,
0049 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
0050 edm4eic::MCRecoClusterParticleLinkCollection,
0051 #endif
0052 edm4eic::MCRecoClusterParticleAssociationCollection,
0053 edm4eic::ClusterCollection>>;
0054
0055
0056
0057
0058
0059
0060
0061
0062 class ImagingClusterReco : public ImagingClusterRecoAlgorithm,
0063 public WithPodConfig<ImagingClusterRecoConfig> {
0064
0065 public:
0066 ImagingClusterReco(std::string_view name)
0067 : ImagingClusterRecoAlgorithm{name,
0068 {"inputProtoClusterCollection",
0069 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
0070 "mcRawHitLinks",
0071 #endif
0072 "mcRawHitAssocations"},
0073 {"outputClusterCollection",
0074 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
0075 "outputClusterLinks",
0076 #endif
0077 "outputClusterAssociations", "outputLayerCollection"},
0078 "Reconstruct the cluster/layer info for imaging calorimeter."} {
0079 }
0080
0081 public:
0082 void init() {}
0083
0084 void process(const Input& input, const Output& output) const final;
0085
0086 private:
0087 std::vector<edm4eic::MutableCluster>
0088 reconstruct_cluster_layers(const edm4eic::ProtoCluster& pcl) const;
0089
0090 edm4eic::MutableCluster
0091 reconstruct_layer(const std::vector<std::pair<const edm4eic::CalorimeterHit, float>>& hits) const;
0092
0093 edm4eic::MutableCluster reconstruct_cluster(const edm4eic::ProtoCluster& pcl) const;
0094
0095 std::pair<double , double >
0096 fit_track(const std::vector<edm4eic::MutableCluster>& layers) const;
0097
0098 void associate_mc_particles(
0099 const edm4eic::Cluster& cl,
0100 const edm4eic::MCRecoCalorimeterHitAssociationCollection* mchitassociations,
0101 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
0102 const podio::LinkNavigator<edm4eic::MCRecoCalorimeterHitLinkCollection>& link_nav,
0103 edm4eic::MCRecoClusterParticleLinkCollection* links,
0104 #endif
0105 edm4eic::MCRecoClusterParticleAssociationCollection* assocs) const;
0106
0107 edm4hep::MCParticle get_primary(const edm4hep::CaloHitContribution& contrib) const;
0108 };
0109
0110 }