Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-03 08:28:43

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2024, Nathan Brei, Dmitry Kalinkin
0003 
0004 #pragma once
0005 
0006 #include <DD4hep/Detector.h>
0007 #include <algorithms/algorithm.h>
0008 #include <algorithms/geo.h>
0009 #include <edm4eic/MCRecoParticleAssociationCollection.h>
0010 #include <edm4eic/MCRecoParticleLinkCollection.h>
0011 #include <edm4eic/ReconstructedParticleCollection.h>
0012 #include <edm4hep/EventHeaderCollection.h>
0013 #include <edm4hep/ParticleIDCollection.h>
0014 #include <stdint.h>
0015 #include <gsl/pointers>
0016 #include <string>
0017 #include <string_view>
0018 
0019 #include "PIDLookupConfig.h"
0020 #include "algorithms/interfaces/UniqueIDGenSvc.h"
0021 #include "algorithms/interfaces/WithPodConfig.h"
0022 #include "services/particle/ParticleSvc.h"
0023 #include "services/pid_lut/PIDLookupTable.h"
0024 
0025 namespace eicrecon {
0026 
0027 using PIDLookupAlgorithm = algorithms::Algorithm<
0028     algorithms::Input<edm4hep::EventHeaderCollection, edm4eic::ReconstructedParticleCollection,
0029                       edm4eic::MCRecoParticleAssociationCollection>,
0030     algorithms::Output<
0031         edm4eic::ReconstructedParticleCollection, edm4eic::MCRecoParticleLinkCollection,
0032         edm4eic::MCRecoParticleAssociationCollection, edm4hep::ParticleIDCollection>>;
0033 
0034 class PIDLookup : public PIDLookupAlgorithm, public WithPodConfig<PIDLookupConfig> {
0035 
0036 public:
0037   PIDLookup(std::string_view name)
0038       : PIDLookupAlgorithm{
0039             name,
0040             {"eventHeader", "inputParticlesCollection", "inputParticleAssociationsCollection"},
0041             {"outputParticlesCollection", "outputParticleLinks",
0042              "outputParticleAssociationsCollection", "outputParticleIDCollection"},
0043             ""} {}
0044 
0045   void init() final;
0046   void process(const Input&, const Output&) const final;
0047 
0048 private:
0049   int32_t m_system;
0050   const algorithms::UniqueIDGenSvc& m_uid      = algorithms::UniqueIDGenSvc::instance();
0051   const algorithms::ParticleSvc& m_particleSvc = algorithms::ParticleSvc::instance();
0052   const dd4hep::Detector* m_detector{algorithms::GeoSvc::instance().detector()};
0053   const PIDLookupTable* m_lut;
0054 };
0055 
0056 } // namespace eicrecon