Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-30 08:34:29

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