File indexing completed on 2025-07-01 07:56:25
0001
0002
0003
0004 #include <DD4hep/Detector.h>
0005 #include <algorithms/algorithm.h>
0006 #include <algorithms/geo.h>
0007 #include <edm4eic/MCRecoParticleAssociationCollection.h>
0008 #include <edm4eic/ReconstructedParticleCollection.h>
0009 #include <edm4hep/ParticleIDCollection.h>
0010 #include <stdint.h>
0011 #include <gsl/pointers>
0012 #include <random>
0013 #include <string>
0014 #include <string_view>
0015
0016 #include "PIDLookupConfig.h"
0017 #include "algorithms/interfaces/ParticleSvc.h"
0018 #include "algorithms/interfaces/WithPodConfig.h"
0019 #include "services/pid_lut/PIDLookupTable.h"
0020
0021 namespace eicrecon {
0022
0023 using PIDLookupAlgorithm =
0024 algorithms::Algorithm<algorithms::Input<edm4eic::ReconstructedParticleCollection,
0025 edm4eic::MCRecoParticleAssociationCollection>,
0026 algorithms::Output<edm4eic::ReconstructedParticleCollection,
0027 edm4eic::MCRecoParticleAssociationCollection,
0028 edm4hep::ParticleIDCollection>>;
0029
0030 class PIDLookup : public PIDLookupAlgorithm, public WithPodConfig<PIDLookupConfig> {
0031
0032 public:
0033 PIDLookup(std::string_view name)
0034 : PIDLookupAlgorithm{name,
0035 {"inputParticlesCollection", "inputParticleAssociationsCollection"},
0036 {"outputParticlesCollection", "outputParticleAssociationsCollection",
0037 "outputParticleIDCollection"},
0038 ""} {}
0039
0040 void init() final;
0041 void process(const Input&, const Output&) const final;
0042
0043 private:
0044 mutable std::mt19937 m_gen{};
0045 mutable std::uniform_real_distribution<double> m_dist{0, 1};
0046 int32_t m_system;
0047 const algorithms::ParticleSvc& m_particleSvc = algorithms::ParticleSvc::instance();
0048 const dd4hep::Detector* m_detector{algorithms::GeoSvc::instance().detector()};
0049 const PIDLookupTable* m_lut;
0050 };
0051
0052 }