File indexing completed on 2026-07-08 07:40:56
0001
0002
0003
0004 #pragma once
0005
0006 #include <algorithms/algorithm.h>
0007 #include <edm4eic/ClusterCollection.h>
0008 #include <edm4eic/EDM4eicVersion.h>
0009 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
0010 #include <edm4eic/TrackClusterLinkCollection.h>
0011 #endif
0012 #include <edm4eic/TrackClusterMatchCollection.h>
0013 #include <edm4eic/TrackSegmentCollection.h>
0014 #include <string>
0015 #include <string_view>
0016 #include <vector>
0017
0018 #include "TrackClusterSubtractorConfig.h"
0019 #include "algorithms/interfaces/WithPodConfig.h"
0020 #include "services/particle/ParticleSvc.h"
0021
0022 namespace eicrecon {
0023
0024 using TrackClusterSubtractorAlgorithm = algorithms::Algorithm<
0025 algorithms::Input<edm4eic::TrackClusterMatchCollection, edm4eic::ClusterCollection,
0026 edm4eic::TrackSegmentCollection>,
0027 algorithms::Output<edm4eic::ClusterCollection, edm4eic::ClusterCollection,
0028 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
0029 edm4eic::TrackClusterLinkCollection,
0030 #endif
0031 edm4eic::TrackClusterMatchCollection>>;
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 class TrackClusterSubtractor : public TrackClusterSubtractorAlgorithm,
0042 public WithPodConfig<TrackClusterSubtractorConfig> {
0043
0044 public:
0045
0046 TrackClusterSubtractor(std::string_view name)
0047 : TrackClusterSubtractorAlgorithm{
0048 name,
0049 {"inputTrackClusterMatches", "inputClusters", "inputTrackProjections"},
0050 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
0051 {"outputRemnantClusterCollection", "outputExpectedClusterCollection",
0052 "outputTrackExpectedClusterLinks", "outputTrackExpectedClusterMatches"},
0053 #else
0054 {"outputRemnantClusterCollection", "outputExpectedClusterCollection",
0055 "outputTrackExpectedClusterMatches"},
0056 #endif
0057 "Subtracts energy of tracks pointing to clusters."} {
0058 }
0059
0060 void process(const Input&, const Output&) const final;
0061
0062 private:
0063
0064 using segment_vector = std::vector<edm4eic::TrackSegment>;
0065
0066 double sum_track_energy(const segment_vector& projections) const;
0067 bool is_track_energy_greater_than_calo(const double difference) const;
0068
0069
0070 const algorithms::ParticleSvc& m_parSvc = algorithms::ParticleSvc::instance();
0071
0072 };
0073
0074 }