Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:13:05

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2024 - 2025 Dmitry Kalinkin, Derek Anderson, Wouter Deconinck
0003 
0004 #pragma once
0005 
0006 #include <memory>
0007 #include <utility>
0008 
0009 #include <algorithms/algorithm.h>
0010 #include <edm4eic/ReconstructedParticleCollection.h>
0011 #include <spdlog/logger.h>
0012 
0013 #include "algorithms/interfaces/WithPodConfig.h"
0014 
0015 namespace eicrecon {
0016 
0017 using ChargedReconstructedParticleSelectorAlgorithm =
0018     algorithms::Algorithm<algorithms::Input<edm4eic::ReconstructedParticleCollection>,
0019                           algorithms::Output<edm4eic::ReconstructedParticleCollection>>;
0020 
0021 class ChargedReconstructedParticleSelector : public ChargedReconstructedParticleSelectorAlgorithm,
0022                                              public WithPodConfig<NoConfig> {
0023 
0024 public:
0025   ChargedReconstructedParticleSelector(std::string_view name)
0026       : ChargedReconstructedParticleSelectorAlgorithm{
0027             name, {"inputParticles"}, {"outputParticles"}, "select charged particles"} {}
0028 
0029   // algorithm initialization
0030   void init() final {}
0031 
0032   // primary algorithm call
0033   void process(const Input& input, const Output& output) const final {
0034     const auto [rc_particles_in] = input;
0035     auto [rc_particles_out]      = output;
0036     rc_particles_out->setSubsetCollection();
0037 
0038     for (const auto& particle : *rc_particles_in) {
0039       if (particle.getCharge() != 0.) {
0040         rc_particles_out->push_back(particle);
0041       }
0042     }
0043   }
0044 };
0045 
0046 } // namespace eicrecon