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