Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-18 08:30:32

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2026 Minho Kim
0003 
0004 #pragma once
0005 #include "algorithms/calorimetry/EdepToNpeConversion.h"
0006 #include "services/algorithms_init/AlgorithmsInit_service.h"
0007 #include "extensions/jana/JOmniFactory.h"
0008 
0009 namespace eicrecon {
0010 
0011 class EdepToNpeConversion_factory
0012     : public JOmniFactory<EdepToNpeConversion_factory, EdepToNpeConversionConfig> {
0013 
0014 public:
0015   using AlgoT = eicrecon::EdepToNpeConversion;
0016 
0017 private:
0018   std::unique_ptr<AlgoT> m_algo;
0019 
0020   PodioInput<edm4hep::EventHeader> m_in_headers{this};
0021   PodioInput<edm4hep::SimCalorimeterHit> m_in_hits{this};
0022   PodioOutput<edm4hep::SimCalorimeterHit> m_out_hits{this};
0023 
0024   ParameterRef<std::string> m_readout{this, "readout", config().readout};
0025   ParameterRef<std::vector<std::string>> m_edep_to_npe_fields{this, "edepToNpeFields",
0026                                                               config().edep_to_npe_fields};
0027   ParameterRef<std::string> m_edep_to_npe_filename{this, "edepToNpeFilename",
0028                                                    config().edep_to_npe_filename};
0029   ParameterRef<double> m_edep_to_npe{this, "edepToNpe", config().edep_to_npe};
0030 
0031   Service<AlgorithmsInit_service> m_algorithmsInit{this};
0032 
0033 public:
0034   void Configure() {
0035     m_algo = std::make_unique<AlgoT>(GetPrefix());
0036     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0037     m_algo->applyConfig(config());
0038     m_algo->init();
0039   }
0040 
0041   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0042     m_algo->process({m_in_headers(), m_in_hits()}, {m_out_hits().get()});
0043   }
0044 };
0045 
0046 } // namespace eicrecon