Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-30 07:55:49

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 collection
0026   typename FactoryT::template PodioInput<InputT> m_input{this};
0027 
0028   // output collection
0029   typename FactoryT::template PodioOutput<edm4eic::ReconstructedParticle> m_output{this};
0030 
0031   // parameter bindings
0032   typename FactoryT::template ParameterRef<float> m_rJet{this, "rJet", FactoryT::config().rJet};
0033   typename FactoryT::template ParameterRef<float> m_pJet{this, "pJet", FactoryT::config().pJet};
0034   typename FactoryT::template ParameterRef<double> m_minCstPt{this, "minCstPt",
0035                                                               FactoryT::config().minCstPt};
0036   typename FactoryT::template ParameterRef<double> m_maxCstPt{this, "maxCstPt",
0037                                                               FactoryT::config().maxCstPt};
0038   typename FactoryT::template ParameterRef<double> m_minJetPt{this, "minJetPt",
0039                                                               FactoryT::config().minJetPt};
0040   typename FactoryT::template ParameterRef<double> m_ghostMaxRap{this, "ghostMaxRap",
0041                                                                  FactoryT::config().ghostMaxRap};
0042   typename FactoryT::template ParameterRef<double> m_ghostArea{this, "ghostArea",
0043                                                                FactoryT::config().ghostArea};
0044   typename FactoryT::template ParameterRef<int> m_numGhostRepeat{this, "numGhostRepeat",
0045                                                                  FactoryT::config().numGhostRepeat};
0046   typename FactoryT::template ParameterRef<std::string> m_jetAlgo{this, "jetAlgo",
0047                                                                   FactoryT::config().jetAlgo};
0048   typename FactoryT::template ParameterRef<std::string> m_recombScheme{
0049       this, "recombScheme", FactoryT::config().recombScheme};
0050   typename FactoryT::template ParameterRef<std::string> m_areaType{this, "areaType",
0051                                                                    FactoryT::config().areaType};
0052 
0053 public:
0054   void Configure() {
0055     m_algo = std::make_unique<Algo>(this->GetPrefix());
0056     m_algo->level(static_cast<algorithms::LogLevel>(this->logger()->level()));
0057     m_algo->applyConfig(FactoryT::config());
0058     m_algo->init();
0059   }
0060 
0061   void ChangeRun(int32_t /* run_number */) { /* nothing to do */
0062   }
0063 
0064   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0065     m_algo->process({m_input()}, {m_output().get()});
0066   }
0067 
0068 }; // end JetReconstruction_factory definition
0069 
0070 } // namespace eicrecon