Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-07-01 07:05:50

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/WithPodConfig.h"
0014 #include "services/pid_lut/PIDLookupTable.h"
0015 
0016 namespace eicrecon {
0017 
0018 using PIDLookupAlgorithm =
0019     algorithms::Algorithm<algorithms::Input<edm4eic::ReconstructedParticleCollection,
0020                                             edm4eic::MCRecoParticleAssociationCollection>,
0021                           algorithms::Output<edm4eic::ReconstructedParticleCollection,
0022                                              edm4eic::MCRecoParticleAssociationCollection,
0023                                              edm4hep::ParticleIDCollection>>;
0024 
0025 class PIDLookup : public PIDLookupAlgorithm, public WithPodConfig<PIDLookupConfig> {
0026 
0027 public:
0028   PIDLookup(std::string_view name)
0029       : PIDLookupAlgorithm{name,
0030                            {"inputParticlesCollection", "inputParticleAssociationsCollection"},
0031                            {"outputParticlesCollection", "outputParticleAssociationsCollection",
0032                             "outputParticleIDCollection"},
0033                            ""} {}
0034 
0035   void init() final;
0036   void process(const Input&, const Output&) const final;
0037 
0038 private:
0039   mutable std::mt19937 m_gen{};
0040   mutable std::uniform_real_distribution<double> m_dist{0, 1};
0041   const PIDLookupTable* m_lut;
0042 };
0043 
0044 } // namespace eicrecon