Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:11:02

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/ReconstructedParticleCollection.h>
0011 #include <edm4hep/EventHeaderCollection.h>
0012 #include <edm4hep/ParticleIDCollection.h>
0013 #include <stdint.h>
0014 #include <gsl/pointers>
0015 #include <string>
0016 #include <string_view>
0017 
0018 #include "PIDLookupConfig.h"
0019 #include "algorithms/interfaces/UniqueIDGenSvc.h"
0020 #include "services/particle/ParticleSvc.h"
0021 #include "algorithms/interfaces/WithPodConfig.h"
0022 #include "services/pid_lut/PIDLookupTable.h"
0023 
0024 namespace eicrecon {
0025 
0026 using PIDLookupAlgorithm = algorithms::Algorithm<
0027     algorithms::Input<edm4hep::EventHeaderCollection, edm4eic::ReconstructedParticleCollection,
0028                       edm4eic::MCRecoParticleAssociationCollection>,
0029     algorithms::Output<edm4eic::ReconstructedParticleCollection,
0030                        edm4eic::MCRecoParticleAssociationCollection,
0031                        edm4hep::ParticleIDCollection>>;
0032 
0033 class PIDLookup : public PIDLookupAlgorithm, public WithPodConfig<PIDLookupConfig> {
0034 
0035 public:
0036   PIDLookup(std::string_view name)
0037       : PIDLookupAlgorithm{name,
0038                            {"inputParticlesCollection", "inputParticleAssociationsCollection"},
0039                            {"outputParticlesCollection", "outputParticleAssociationsCollection",
0040                             "outputParticleIDCollection"},
0041                            ""} {}
0042 
0043   void init() final;
0044   void process(const Input&, const Output&) const final;
0045 
0046 private:
0047   int32_t m_system;
0048   const algorithms::UniqueIDGenSvc& m_uid      = algorithms::UniqueIDGenSvc::instance();
0049   const algorithms::ParticleSvc& m_particleSvc = algorithms::ParticleSvc::instance();
0050   const dd4hep::Detector* m_detector{algorithms::GeoSvc::instance().detector()};
0051   const PIDLookupTable* m_lut;
0052 };
0053 
0054 } // namespace eicrecon