Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2024, Nathan Brei
0003 
0004 #pragma once
0005 
0006 #include <edm4eic/MCRecoParticleAssociationCollection.h>
0007 #include <edm4eic/ReconstructedParticleCollection.h>
0008 #include <edm4hep/MCParticleCollection.h>
0009 #include <edm4hep/ParticleIDCollection.h>
0010 
0011 #include "algorithms/pid_lut/PIDLookup.h"
0012 #include "extensions/jana/JOmniFactory.h"
0013 #include "services/algorithms_init/AlgorithmsInit_service.h"
0014 
0015 namespace eicrecon {
0016 
0017 class PIDLookup_factory : public JOmniFactory<PIDLookup_factory, PIDLookupConfig> {
0018 public:
0019   using AlgoT = eicrecon::PIDLookup;
0020 
0021 private:
0022   std::unique_ptr<AlgoT> m_algo;
0023 
0024   PodioInput<edm4hep::EventHeader> m_event_headers_input{this};
0025   PodioInput<edm4eic::ReconstructedParticle> m_recoparticles_input{this};
0026   PodioInput<edm4eic::MCRecoParticleAssociation> m_recoparticle_assocs_input{this};
0027   PodioOutput<edm4eic::ReconstructedParticle> m_recoparticles_output{this};
0028   PodioOutput<edm4eic::MCRecoParticleAssociation> m_recoparticle_assocs_output{this};
0029   PodioOutput<edm4hep::ParticleID> m_particleids_output{this};
0030 
0031   ParameterRef<std::string> m_filename{this, "filename", config().filename,
0032                                        "Relative to current working directory"};
0033   ParameterRef<std::string> m_system{this, "system", config().system, "For the ParticleID record"};
0034 
0035   Service<AlgorithmsInit_service> m_algorithmsInit{this};
0036 
0037 public:
0038   void Configure() {
0039     m_algo = std::make_unique<AlgoT>(this->GetPrefix());
0040     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0041     m_algo->applyConfig(config());
0042     m_algo->init();
0043   }
0044 
0045   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0046     m_algo->process(
0047         {m_event_headers_input(), m_recoparticles_input(), m_recoparticle_assocs_input()},
0048         {m_recoparticles_output().get(), m_recoparticle_assocs_output().get(),
0049          m_particleids_output().get()});
0050   }
0051 };
0052 
0053 } // namespace eicrecon