Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-05 08:18:17

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/EDM4eicVersion.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 "services/particle/ParticleSvc.h"
0022 #include "algorithms/interfaces/WithPodConfig.h"
0023 #include "services/pid_lut/PIDLookupTable.h"
0024 
0025 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
0026 #include <edm4eic/MCRecoParticleLinkCollection.h>
0027 #endif
0028 
0029 namespace eicrecon {
0030 
0031 using PIDLookupAlgorithm = algorithms::Algorithm<
0032     algorithms::Input<edm4hep::EventHeaderCollection, edm4eic::ReconstructedParticleCollection,
0033                       edm4eic::MCRecoParticleAssociationCollection>,
0034     algorithms::Output<edm4eic::ReconstructedParticleCollection,
0035 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
0036                        edm4eic::MCRecoParticleLinkCollection,
0037 #endif
0038                        edm4eic::MCRecoParticleAssociationCollection,
0039                        edm4hep::ParticleIDCollection>>;
0040 
0041 class PIDLookup : public PIDLookupAlgorithm, public WithPodConfig<PIDLookupConfig> {
0042 
0043 public:
0044   PIDLookup(std::string_view name)
0045       : PIDLookupAlgorithm{
0046             name,
0047             {"eventHeader", "inputParticlesCollection", "inputParticleAssociationsCollection"},
0048             {"outputParticlesCollection",
0049 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
0050              "outputParticleLinks",
0051 #endif
0052              "outputParticleAssociationsCollection", "outputParticleIDCollection"},
0053             ""} {
0054   }
0055 
0056   void init() final;
0057   void process(const Input&, const Output&) const final;
0058 
0059 private:
0060   int32_t m_system;
0061   const algorithms::UniqueIDGenSvc& m_uid      = algorithms::UniqueIDGenSvc::instance();
0062   const algorithms::ParticleSvc& m_particleSvc = algorithms::ParticleSvc::instance();
0063   const dd4hep::Detector* m_detector{algorithms::GeoSvc::instance().detector()};
0064   const PIDLookupTable* m_lut;
0065 };
0066 
0067 } // namespace eicrecon