Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-07 08:28:08

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2026 Wouter Deconinck
0003 
0004 #pragma once
0005 
0006 #include <JANA/JEvent.h>
0007 #include <memory>
0008 #include <string>
0009 
0010 #include "algorithms/interfaces/WithPodConfig.h"
0011 #include "algorithms/meta/Cloner.h"
0012 #include "extensions/jana/JOmniFactory.h"
0013 
0014 namespace eicrecon {
0015 
0016 /**
0017  * Factory for cloning collection elements.
0018  *
0019  * Template parameter T is the PODIO object type (e.g., edm4eic::Cluster)
0020  *
0021  * Example usage in plugin:
0022  *   app->Add(new JOmniFactoryGeneratorT<Cloner_factory<edm4eic::Cluster>>(
0023  *       "MyClonedClusters",
0024  *       {"MySubsetClusters"},
0025  *       {"MyClonedClusters"},
0026  *       app
0027  *   ));
0028  */
0029 template <typename T> class Cloner_factory : public JOmniFactory<Cloner_factory<T>, NoConfig> {
0030 
0031 public:
0032   using FactoryT = JOmniFactory<Cloner_factory<T>, NoConfig>;
0033   using AlgoT    = Cloner<T>;
0034 
0035 private:
0036   std::unique_ptr<AlgoT> m_algo;
0037 
0038   typename FactoryT::template PodioInput<T> m_input{this};
0039   typename FactoryT::template PodioOutput<T> m_output{this};
0040 
0041 public:
0042   void Configure() {
0043     m_algo = std::make_unique<AlgoT>(this->GetPrefix());
0044     m_algo->level(static_cast<algorithms::LogLevel>(this->logger()->level()));
0045     m_algo->init();
0046   }
0047 
0048   void Process(int32_t /*run_number*/, uint64_t /*event_number*/) {
0049     m_algo->process({m_input()}, {m_output().get()});
0050   }
0051 };
0052 
0053 } // namespace eicrecon