Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-09 08:25:58

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2024 Zhongling Ji, Derek Anderson
0003 
0004 #pragma once
0005 
0006 #include <string>
0007 #include "extensions/jana/JOmniFactory.h"
0008 #include "algorithms/reco/JetReconstruction.h"
0009 #include "algorithms/reco/JetReconstructionConfig.h"
0010 
0011 namespace eicrecon {
0012 
0013 template <typename InputT>
0014 class JetReconstruction_factory
0015     : public JOmniFactory<JetReconstruction_factory<InputT>, JetReconstructionConfig> {
0016 
0017 public:
0018   // algorithm to run
0019   using Algo     = eicrecon::JetReconstruction<InputT>;
0020   using FactoryT = JOmniFactory<JetReconstruction_factory<InputT>, JetReconstructionConfig>;
0021 
0022 private:
0023   std::unique_ptr<Algo> m_algo;
0024 
0025   // input collections
0026   typename FactoryT::template PodioInput<edm4hep::EventHeader> m_event_header_input{this};
0027   typename FactoryT::template PodioInput<InputT> m_input{this};
0028 
0029   // output collection
0030 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 9, 0)
0031   typename FactoryT::template PodioOutput<edm4eic::Jet> m_output{this};
0032 #else
0033   typename FactoryT::template PodioOutput<edm4eic::ReconstructedParticle> m_output{this};
0034 #endif
0035 
0036   // parameter bindings
0037   typename FactoryT::template ParameterRef<float> m_rJet{this, "rJet", FactoryT::config().rJet};
0038   typename FactoryT::template ParameterRef<float> m_pJet{this, "pJet", FactoryT::config().pJet};
0039   typename FactoryT::template ParameterRef<double> m_minCstPt{this, "minCstPt",
0040                                                               FactoryT::config().minCstPt};
0041   typename FactoryT::template ParameterRef<double> m_maxCstPt{this, "maxCstPt",
0042                                                               FactoryT::config().maxCstPt};
0043   typename FactoryT::template ParameterRef<double> m_minJetPt{this, "minJetPt",
0044                                                               FactoryT::config().minJetPt};
0045   typename FactoryT::template ParameterRef<double> m_ghostMaxRap{this, "ghostMaxRap",
0046                                                                  FactoryT::config().ghostMaxRap};
0047   typename FactoryT::template ParameterRef<double> m_ghostArea{this, "ghostArea",
0048                                                                FactoryT::config().ghostArea};
0049   typename FactoryT::template ParameterRef<int> m_numGhostRepeat{this, "numGhostRepeat",
0050                                                                  FactoryT::config().numGhostRepeat};
0051   typename FactoryT::template ParameterRef<std::string> m_jetAlgo{this, "jetAlgo",
0052                                                                   FactoryT::config().jetAlgo};
0053   typename FactoryT::template ParameterRef<std::string> m_recombScheme{
0054       this, "recombScheme", FactoryT::config().recombScheme};
0055   typename FactoryT::template ParameterRef<std::string> m_areaType{this, "areaType",
0056                                                                    FactoryT::config().areaType};
0057 
0058 public:
0059   void Configure() {
0060     m_algo = std::make_unique<Algo>(this->GetPrefix());
0061     m_algo->level(static_cast<algorithms::LogLevel>(this->logger()->level()));
0062     m_algo->applyConfig(FactoryT::config());
0063     m_algo->init();
0064   }
0065 
0066   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0067     m_algo->process({m_event_header_input(), m_input()}, {m_output().get()});
0068   }
0069 
0070 }; // end JetReconstruction_factory definition
0071 
0072 } // namespace eicrecon