Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 09:06:33

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2022 Sylvester Joosten
0003 
0004 #pragma once
0005 
0006 #include <algorithms/algorithm.h>
0007 #include <edm4eic/ClusterCollection.h>
0008 #include <edm4eic/MCRecoClusterParticleAssociationCollection.h>
0009 #include <edm4eic/MCRecoClusterParticleLinkCollection.h>
0010 #include <string>
0011 #include <string_view>
0012 
0013 #include "EnergyPositionClusterMergerConfig.h"
0014 #include "algorithms/interfaces/WithPodConfig.h"
0015 
0016 namespace eicrecon {
0017 
0018 using EnergyPositionClusterMergerAlgorithm = algorithms::Algorithm<
0019     algorithms::Input<
0020         edm4eic::ClusterCollection, edm4eic::MCRecoClusterParticleAssociationCollection,
0021         edm4eic::ClusterCollection, edm4eic::MCRecoClusterParticleAssociationCollection>,
0022     algorithms::Output<edm4eic::ClusterCollection, edm4eic::MCRecoClusterParticleLinkCollection,
0023                        edm4eic::MCRecoClusterParticleAssociationCollection>>;
0024 
0025 /** Simple algorithm to merge the energy measurement from cluster1 with the position
0026   * measurement of cluster2 (in case matching clusters are found). If not, it will
0027   * propagate the raw cluster from cluster1 or cluster2
0028   *
0029   * Matching occurs based on the cluster phi, eta and E variables, with tolerances
0030   * defined in the options file. A negative tolerance effectively disables
0031   * a check. The energy tolerance is defined as a relative number (e.g. 0.1)
0032   *
0033   * In case of ambiguity the closest cluster is merged.
0034   *
0035   * \ingroup reco
0036   */
0037 class EnergyPositionClusterMerger : public EnergyPositionClusterMergerAlgorithm,
0038                                     public WithPodConfig<EnergyPositionClusterMergerConfig> {
0039 
0040 public:
0041   EnergyPositionClusterMerger(std::string_view name)
0042       : EnergyPositionClusterMergerAlgorithm{
0043             name,
0044             {"energyClusterCollection", "energyClusterAssociations", "positionClusterCollection",
0045              "positionClusterAssociations"},
0046             {"outputClusterCollection", "outputClusterLinks", "outputClusterAssociations"},
0047             "Merge energy and position clusters if matching."} {}
0048 
0049 public:
0050   void init() {}
0051 
0052   void process(const Input& input, const Output& output) const final;
0053 };
0054 
0055 } // namespace eicrecon