Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-06-26 07:05:41

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2023, Christopher Dilks
0003 
0004 // General algorithm to merge together particle ID datatypes
0005 
0006 #pragma once
0007 
0008 // data model
0009 #include <algorithms/algorithm.h>
0010 #include <edm4eic/CherenkovParticleIDCollection.h>
0011 #include <spdlog/logger.h>
0012 #include <memory>
0013 #include <vector>
0014 
0015 // EICrecon
0016 #include "MergeParticleIDConfig.h"
0017 #include "algorithms/interfaces/WithPodConfig.h"
0018 
0019 namespace eicrecon {
0020 
0021   using MergeParticleIDAlgorithm = algorithms::Algorithm<
0022     algorithms::Input<
0023       std::vector<const edm4eic::CherenkovParticleIDCollection>
0024     >,
0025     algorithms::Output<
0026       edm4eic::CherenkovParticleIDCollection
0027     >
0028   >;
0029 
0030   class MergeParticleID
0031   : public MergeParticleIDAlgorithm,
0032     public WithPodConfig<MergeParticleIDConfig> {
0033 
0034   public:
0035     MergeParticleID(std::string_view name)
0036       : MergeParticleIDAlgorithm{name,
0037                             {"inputTrackSegments"},
0038                             {"outputTrackSegments"},
0039                             "Effectively 'zip' the input particle IDs"} {}
0040 
0041     void init(std::shared_ptr<spdlog::logger>& logger);
0042 
0043     // - input: a list of particle ID collections, which we want to merge together
0044     // - output: the merged particle ID collection
0045     // - overload this function to support different collections from other PID subsystems, or to support
0046     //   merging PID results from overlapping subsystems
0047     void process(const Input&, const Output&) const final;
0048 
0049     private:
0050       std::shared_ptr<spdlog::logger> m_log;
0051   };
0052 }