Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /EICrecon/src/factories/digi/PulseGeneration_factory.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2024-2025 Simon Gardner, Chun Yuen Tsang, Prithwish Tribedy
0003 //                         Minho Kim, Sylvester Joosten, Wouter Deconinck, Dmitry Kalinkin
0004 //
0005 
0006 #pragma once
0007 
0008 #include "algorithms/digi/PulseGeneration.h"
0009 #include "services/algorithms_init/AlgorithmsInit_service.h"
0010 #include "extensions/jana/JOmniFactory.h"
0011 
0012 namespace eicrecon {
0013 
0014 template <typename HitT>
0015 class PulseGeneration_factory
0016     : public JOmniFactory<PulseGeneration_factory<HitT>, PulseGenerationConfig> {
0017 public:
0018   using AlgoT    = eicrecon::PulseGeneration<HitT>;
0019   using FactoryT = JOmniFactory<PulseGeneration_factory<HitT>, PulseGenerationConfig>;
0020 
0021 private:
0022   std::unique_ptr<AlgoT> m_algo;
0023 
0024   typename FactoryT::template PodioInput<HitT> m_in_sim_hits{this};
0025 #if EDM4EIC_VERSION_MAJOR > 8 || (EDM4EIC_VERSION_MAJOR == 8 && EDM4EIC_VERSION_MINOR >= 1)
0026   typename FactoryT::template PodioOutput<edm4eic::SimPulse> m_out_pulses{this};
0027 #else
0028   typename FactoryT::template PodioOutput<edm4hep::TimeSeries> m_out_pulses{this};
0029 #endif
0030 
0031   typename FactoryT::template ParameterRef<std::string> m_pulse_shape_function{
0032       this, "pulseShapeFunction", this->config().pulse_shape_function};
0033   typename FactoryT::template ParameterRef<std::vector<double>> m_pulse_shape_params{
0034       this, "pulseShapeParams", this->config().pulse_shape_params};
0035   typename FactoryT::template ParameterRef<double> m_timestep{this, "timestep",
0036                                                               this->config().timestep};
0037   typename FactoryT::template ParameterRef<double> m_ignore_thres{this, "ignoreThreshold",
0038                                                                   this->config().ignore_thres};
0039   typename FactoryT::template ParameterRef<double> m_min_sampling_time{
0040       this, "minSamplingTime", this->config().min_sampling_time};
0041   typename FactoryT::template ParameterRef<uint32_t> m_max_time_bins{this, "maxTimeBins",
0042                                                                      this->config().max_time_bins};
0043 
0044   typename FactoryT::template Service<AlgorithmsInit_service> m_algorithmsInit{this};
0045 
0046 public:
0047   void Configure() {
0048     m_algo = std::make_unique<AlgoT>(this->GetPrefix());
0049     m_algo->level(static_cast<algorithms::LogLevel>(this->logger()->level()));
0050     m_algo->applyConfig(this->config());
0051     m_algo->init();
0052   }
0053 
0054   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0055     m_algo->process({m_in_sim_hits()}, {m_out_pulses().get()});
0056   }
0057 };
0058 
0059 } // namespace eicrecon