Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-09-27 07:02:59

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2024, Nathan Brei, Dmitry Kalinkin
0003 
0004 #include <algorithms/algorithm.h>
0005 #include <edm4eic/MCRecoParticleAssociationCollection.h>
0006 #include <edm4eic/ReconstructedParticleCollection.h>
0007 #include <edm4hep/ParticleIDCollection.h>
0008 #include <random>
0009 #include <string>
0010 #include <string_view>
0011 
0012 #include "PIDLookupConfig.h"
0013 #include "algorithms/interfaces/ParticleSvc.h"
0014 #include "algorithms/interfaces/WithPodConfig.h"
0015 #include "services/pid_lut/PIDLookupTable.h"
0016 
0017 namespace eicrecon {
0018 
0019 using PIDLookupAlgorithm =
0020     algorithms::Algorithm<algorithms::Input<edm4eic::ReconstructedParticleCollection,
0021                                             edm4eic::MCRecoParticleAssociationCollection>,
0022                           algorithms::Output<edm4eic::ReconstructedParticleCollection,
0023                                              edm4eic::MCRecoParticleAssociationCollection,
0024                                              edm4hep::ParticleIDCollection>>;
0025 
0026 class PIDLookup : public PIDLookupAlgorithm, public WithPodConfig<PIDLookupConfig> {
0027 
0028 public:
0029   PIDLookup(std::string_view name)
0030       : PIDLookupAlgorithm{name,
0031                            {"inputParticlesCollection", "inputParticleAssociationsCollection"},
0032                            {"outputParticlesCollection", "outputParticleAssociationsCollection",
0033                             "outputParticleIDCollection"},
0034                            ""} {}
0035 
0036   void init() final;
0037   void process(const Input&, const Output&) const final;
0038 
0039 private:
0040   mutable std::mt19937 m_gen{};
0041   mutable std::uniform_real_distribution<double> m_dist{0, 1};
0042   const algorithms::ParticleSvc& m_particleSvc = algorithms::ParticleSvc::instance();
0043   const PIDLookupTable* m_lut;
0044 };
0045 
0046 } // namespace eicrecon