Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 08:29:02

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2024 - 2025 Simon Gardner
0003 
0004 #pragma once
0005 
0006 #include <algorithms/algorithm.h>
0007 #include <edm4eic/MCRecoParticleAssociationCollection.h>
0008 #include <edm4eic/MCRecoParticleLinkCollection.h>
0009 #include <edm4eic/MCRecoTrackParticleAssociationCollection.h>
0010 #include <edm4eic/ReconstructedParticleCollection.h>
0011 #include <edm4eic/TensorCollection.h>
0012 #include <edm4hep/MCParticleCollection.h>
0013 #include <mutex>
0014 #include <optional>
0015 #include <string>
0016 #include <string_view>
0017 
0018 #include "algorithms/fardetectors/FarDetectorTransportationPostMLConfig.h"
0019 #include "algorithms/interfaces/WithPodConfig.h"
0020 
0021 namespace eicrecon {
0022 
0023 using FarDetectorTransportationPostMLAlgorithm = algorithms::Algorithm<
0024     algorithms::Input<edm4eic::TensorCollection,
0025                       std::optional<edm4eic::MCRecoTrackParticleAssociationCollection>,
0026                       std::optional<edm4hep::MCParticleCollection>>,
0027     algorithms::Output<edm4eic::ReconstructedParticleCollection,
0028                        edm4eic::MCRecoParticleLinkCollection,
0029                        edm4eic::MCRecoParticleAssociationCollection>>;
0030 
0031 class FarDetectorTransportationPostML
0032     : public FarDetectorTransportationPostMLAlgorithm,
0033       public WithPodConfig<FarDetectorTransportationPostMLConfig> {
0034 
0035 public:
0036   FarDetectorTransportationPostML(std::string_view name)
0037       : FarDetectorTransportationPostMLAlgorithm{
0038             name,
0039             {"inputPredictionsTensor", "trackAssociations", "beamElectrons"},
0040             {"outputParticles", "outputLinks", "outputAssociations"},
0041             "Convert ML output tensor into reconstructed electron"} {}
0042 
0043   void init() final;
0044   void process(const Input&, const Output&) const final;
0045 
0046 private:
0047   double m_mass         = 0.000511; // Default to electron mass in GeV
0048   float m_charge        = -1.0;     // Default to electron charge
0049   mutable float m_beamE = 10.0;
0050   mutable std::once_flag m_initBeamE;
0051 };
0052 
0053 } // namespace eicrecon