Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-05 08:02:24

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 "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 
0024   PodioOutput<edm4hep::TimeSeries> m_out_pulses{this};
0025 
0026   ParameterRef<std::string> m_pulse_shape_function{this, "pulseShapeFunction", config().pulse_shape_function};
0027   ParameterRef<std::vector<double>> m_pulse_shape_params{this, "pulseShapeParams", config().pulse_shape_params};
0028   ParameterRef<double> m_timestep{this, "timestep", config().timestep};
0029   ParameterRef<double> m_ignore_thres{this, "ignoreThreshold", config().ignore_thres};
0030   ParameterRef<double> m_min_sampling_time{this, "minSamplingTime", config().min_sampling_time};
0031   ParameterRef<int> m_max_time_bins{this, "maxTimeBins", config().max_time_bins};
0032 
0033   Service<AlgorithmsInit_service> m_algorithmsInit{this};
0034 
0035 public:
0036   void Configure() {
0037     m_algo = std::make_unique<eicrecon::SiliconPulseGeneration>(GetPrefix());
0038     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0039     m_algo->applyConfig(config());
0040     m_algo->init();
0041   }
0042 
0043   void ChangeRun(int64_t run_number) {}
0044 
0045   void Process(int64_t run_number, uint64_t event_number) {
0046     m_algo->process({m_in_sim_hits()}, {m_out_pulses().get()});
0047   }
0048 };
0049 
0050 } // namespace eicrecon