Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-09-27 07:03:05

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