File indexing completed on 2025-02-22 10:33:25
0001
0002
0003
0004 #pragma once
0005
0006 #include <memory>
0007 #include <utility>
0008
0009 #include <edm4hep/MCParticleCollection.h>
0010 #include <spdlog/logger.h>
0011
0012 #include "algorithms/interfaces/WithPodConfig.h"
0013
0014 namespace eicrecon {
0015
0016 class ChargedMCParticleSelector : public WithPodConfig<NoConfig> {
0017
0018 private:
0019
0020 std::shared_ptr<spdlog::logger> m_log;
0021
0022 public:
0023
0024
0025 void init(std::shared_ptr<spdlog::logger>& logger) {
0026 m_log = logger;
0027 }
0028
0029
0030 std::unique_ptr<edm4hep::MCParticleCollection> process(const edm4hep::MCParticleCollection* inputs) {
0031 auto outputs = std::make_unique<edm4hep::MCParticleCollection>();
0032 outputs->setSubsetCollection();
0033
0034 for (const auto &particle : *inputs) {
0035 if (particle.getCharge() != 0.) {
0036 outputs->push_back(particle);
0037 }
0038 }
0039
0040 return std::move(outputs);
0041 }
0042
0043 };
0044
0045 }