Skip to content
Open
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
c9d0fdf
Add skeletons of algorithm and factory
ruse-traveler Oct 8, 2024
7236ad9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 8, 2024
c052139
Merge branch 'main' into add-track-cluster-subtraction-pfa-one
ruse-traveler Feb 22, 2025
4728ac1
Propagate upstream changes from development fork
ruse-traveler Feb 22, 2025
cfe67de
Merge branch 'add-track-cluster-subtraction-pfa-one' of github.com:ei…
ruse-traveler Feb 22, 2025
fb5a202
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 22, 2025
d611fe6
Load particle plugin
ruse-traveler Feb 23, 2025
21186d6
Use track PDGs for masses
ruse-traveler Feb 23, 2025
703070e
Fix merge conflicts
ruse-traveler Feb 23, 2025
0a4203a
Allow for checking zero against resolutions
ruse-traveler Feb 23, 2025
df5646d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2025
dcaed63
Write out all relevant collections
ruse-traveler Feb 23, 2025
18176ea
Fix merge conflicts
ruse-traveler Feb 23, 2025
7bf428c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2025
c3a29ff
Merge branch 'main' into add-track-cluster-subtraction-pfa-one
ruse-traveler Mar 11, 2025
5fc4ac4
Add particle category to global reconstruction
ruse-traveler Mar 11, 2025
e7c9fd9
Merge branch 'add-track-cluster-subtraction-pfa-one' of github.com:ei…
ruse-traveler Mar 11, 2025
71d7bb6
Merge main
ruse-traveler Aug 26, 2025
87204cb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 26, 2025
10867a3
Implement Track-Cluster Subtraction (PFA1) (fix: iwyu) (#2051)
wdconinc Aug 26, 2025
3bbe27a
Remove PFTools
ruse-traveler Aug 26, 2025
0ec864d
Make sure cmake finds plugin
ruse-traveler Aug 26, 2025
fa3fcb0
Use track-cluster matches until merge/splitter is updated
ruse-traveler Aug 26, 2025
9c045ea
Make consistent with reco CMakeLists
ruse-traveler Aug 26, 2025
da828bb
Do light reformatting
ruse-traveler Aug 26, 2025
298815f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 26, 2025
88539e1
Fix merge conflicts
ruse-traveler Aug 28, 2025
7df36f3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 28, 2025
ea924e1
Merge branch 'main' into add-track-cluster-subtraction-pfa-one
ruse-traveler Sep 18, 2025
ff0a01b
Remove unused ChangeRun, make Process consistent with base class
ruse-traveler Sep 18, 2025
9cdd2dc
Add outputs to defaults
ruse-traveler Sep 18, 2025
b9f4300
Clean up, add header guards
ruse-traveler Sep 18, 2025
f0cc650
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 18, 2025
b1172a2
Implement Track-Cluster Subtraction (PFA1) (fix: iwyu) (#2087)
wdconinc Sep 18, 2025
1623c19
Merge branch 'main' into add-track-cluster-subtraction-pfa-one
ruse-traveler Sep 24, 2025
6412c91
Merge branch 'main' into add-track-cluster-subtraction-pfa-one
ruse-traveler Oct 8, 2025
7147e15
Add FHCal insert
ruse-traveler Oct 8, 2025
7e71e75
Make sure FHCal insert collections are in default output
ruse-traveler Oct 8, 2025
6b0429d
Rename factories after primary output
ruse-traveler Oct 8, 2025
429dd29
Remove WIP notes
ruse-traveler Oct 8, 2025
05251ce
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 8, 2025
e2c59e8
Add algorithm, factory, and generators
ruse-traveler Oct 9, 2025
a8040d9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 9, 2025
b467b31
Remove edm4eic 8.X guards
ruse-traveler Oct 13, 2025
a80c881
Merge main
ruse-traveler Oct 13, 2025
d9350e7
Merge PFA1(a) branch
ruse-traveler Oct 13, 2025
e2fa5d2
Remove edm4eic 8.X guards
ruse-traveler Oct 13, 2025
99325a7
Remove unnecessary comments
ruse-traveler Oct 13, 2025
8464990
Add missing factory
ruse-traveler Oct 13, 2025
dbb370a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 13, 2025
06a2536
Fix typo in docstring
ruse-traveler Oct 13, 2025
cb56a96
Fix typo in docstring
ruse-traveler Oct 13, 2025
0ba4a50
Merge branch 'add-track-cluster-subtraction-pfa-one' into add-charged…
ruse-traveler Oct 13, 2025
82451e7
Implement Track-Cluster Subtraction (PFA1a) (fix: iwyu) (#2133)
wdconinc Oct 13, 2025
ed2fae1
Implement Charged Candidate Maker (PFA1b) (fix: iwyu) (#2134)
wdconinc Oct 13, 2025
eb4e239
Remove misplaced factory
ruse-traveler Oct 23, 2025
4c8a98a
Temporarily add charged candidates to default output
ruse-traveler Oct 23, 2025
c027107
Merge branch 'main' into add-track-cluster-subtraction-pfa-one
ruse-traveler Oct 23, 2025
3ef200c
Merge branch 'main' into add-charged-candidate-maker-pfa-one
ruse-traveler Oct 23, 2025
c9a0aa7
Merge PFA1a branch into PFA1b
ruse-traveler Oct 23, 2025
f208a51
Use track-cluster matches as PFA1b input
ruse-traveler Oct 30, 2025
7deef73
Remove PFA1a code
ruse-traveler Oct 30, 2025
d517eb9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/algorithms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.16)
add_subdirectory(interfaces)
add_subdirectory(calorimetry)
add_subdirectory(tracking)
add_subdirectory(particle)
add_subdirectory(pid)
add_subdirectory(pid_lut)
add_subdirectory(digi)
Expand Down
18 changes: 18 additions & 0 deletions src/algorithms/particle/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.16)

set(PLUGIN_NAME "algorithms_particle")

# Function creates ${PLUGIN_NAME}_plugin and ${PLUGIN_NAME}_library targets
# Setting default includes, libraries and installation paths
plugin_add(${PLUGIN_NAME} WITH_SHARED_LIBRARY WITHOUT_PLUGIN)

# The macro grabs sources as *.cc *.cpp *.c and headers as *.h *.hh *.hpp Then
# correctly sets sources for ${_name}_plugin and ${_name}_library targets Adds
# headers to the correct installation directory
plugin_glob_all(${PLUGIN_NAME})

# Find dependencies
plugin_add_algorithms(${PLUGIN_NAME})
plugin_add_dd4hep(${PLUGIN_NAME})
plugin_add_event_model(${PLUGIN_NAME})
plugin_add_eigen3(${PLUGIN_NAME})
50 changes: 50 additions & 0 deletions src/algorithms/particle/ChargedCandidateMaker.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright (C) 2025 Derek Anderson

#include <edm4eic/Track.h>
#include <gsl/pointers>
#include <map>
#include <vector>

#include "ChargedCandidateMaker.h"

namespace eicrecon {

// ----------------------------------------------------------------------------
//! Process inputs
// ----------------------------------------------------------------------------
/*! Construct a candidate charged particle via the
* following algorithm.
* 1. Build map of tracks onto vectors of their
* matched tracks
* 2. For each track, create a Reconstructed
* Particle with track and cluster relations
* filled
*/
void ChargedCandidateMaker::process(const ChargedCandidateMaker::Input& input,
const ChargedCandidateMaker::Output& output) const {

// grab inputs/outputs
const auto [in_match] = input;
auto [out_particle] = output;

// exit if no matches in collection
if (in_match->size() == 0) {
debug("No track-cluster matches in collection");
return;
}

MapToVecClust mapTrkToClust;
for (const auto& match : *in_match) {
mapTrkToClust[match.getTrack()].push_back(match.getCluster());
}

for (const auto& [track, clusters] : mapTrkToClust) {
edm4eic::MutableReconstructedParticle particle = out_particle->create();
particle.addToTracks(track);
for (const edm4eic::Cluster& cluster : clusters) {
particle.addToClusters(cluster);
}
}
} // end 'process(Input&, Output&)'
} // namespace eicrecon
71 changes: 71 additions & 0 deletions src/algorithms/particle/ChargedCandidateMaker.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright (C) 2025 Derek Anderson

#pragma once

#include <algorithms/algorithm.h>
#include <edm4eic/ClusterCollection.h>
#include <edm4eic/ReconstructedParticleCollection.h>
#include <edm4eic/Track.h>
#include <edm4eic/TrackClusterMatchCollection.h>
#include <podio/ObjectID.h>
#include <map>
#include <string>
#include <string_view>
#include <vector>

#include "algorithms/interfaces/WithPodConfig.h"

namespace eicrecon {

// --------------------------------------------------------------------------
//! Algorithm input/output
// --------------------------------------------------------------------------
using ChargedCandidateMakerAlgorithm =
algorithms::Algorithm<algorithms::Input<edm4eic::TrackClusterMatchCollection>,
algorithms::Output<edm4eic::ReconstructedParticleCollection>>;

// ==========================================================================
//! Candidate Charged Particle Maker
// ==========================================================================
/*! An algorithm which takes a collection of clusters and their matched
* tracks, subtracts the sum of all tracks pointing to the cluster,
* and outputs the remnant clusters, expected clusters, and their matched
* tracks.
*/
class ChargedCandidateMaker : public ChargedCandidateMakerAlgorithm,
public WithPodConfig<NoConfig> {

public:
// ------------------------------------------------------------------------
//! Comparator struct for tracks
// ------------------------------------------------------------------------
/*! Organizes tracks by their ObjectIDs in decreasing collection
* ID first, and by decreasing index second.
*/
struct CompareTrack {
bool operator()(const edm4eic::Track& lhs, const edm4eic::Track& rhs) const {
if (lhs.getObjectID().collectionID == rhs.getObjectID().collectionID) {
return (lhs.getObjectID().index < rhs.getObjectID().index);
} else {
return (lhs.getObjectID().collectionID < rhs.getObjectID().collectionID);
}
}
};

///! Alias for a map from a track to matched clusters
using MapToVecClust = std::map<edm4eic::Track, std::vector<edm4eic::Cluster>, CompareTrack>;

///! Algorithm constructor
ChargedCandidateMaker(std::string_view name)
: ChargedCandidateMakerAlgorithm{name,
{"inputTrackClusterMatches"},
{"outputChargedCandidateParticles"},
"Forms candidate charged particles."} {}

// public method
void process(const Input&, const Output&) const final;

}; // end ChargedCandidateMaker

} // namespace eicrecon
42 changes: 42 additions & 0 deletions src/algorithms/particle/ChargedCandidateMaker_factory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright (C) 2025 Derek Anderson

#pragma once

#include <string>

#include "extensions/jana/JOmniFactory.h"
#include "algorithms/particle/ChargedCandidateMaker.h"

namespace eicrecon {

class ChargedCandidateMaker_factory : public JOmniFactory<ChargedCandidateMaker_factory> {

public:
///! alias for algorithm name
using AlgoT = eicrecon::ChargedCandidateMaker;

private:
// pointer to algorithm
std::unique_ptr<AlgoT> m_algo;

// input collection
PodioInput<edm4eic::TrackClusterMatch> m_track_cluster_match_input{this};

// output collection
PodioOutput<edm4eic::ReconstructedParticle> m_charged_candidate_output{this};

public:
///! Configures algorithm
void Configure() {
m_algo = std::make_unique<AlgoT>(GetPrefix());
m_algo->init();
}

///! Primary algorithm call
void Process(int32_t /*run_number*/, uint64_t /*event_number*/) {
m_algo->process({m_track_cluster_match_input()}, {m_charged_candidate_output().get()});
}
}; // end ChargedCandidateMaker_factory

} // namespace eicrecon
Loading